summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx86
-rw-r--r--dbaccess/source/ui/app/AppController.hxx6
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx16
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx29
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx51
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx4
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx10
-rw-r--r--dbaccess/source/ui/app/AppIconControl.cxx4
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.cxx3
-rw-r--r--dbaccess/source/ui/app/AppView.cxx4
-rw-r--r--dbaccess/source/ui/app/ChildWindow.cxx2
-rw-r--r--dbaccess/source/ui/app/DocumentInfoPreview.cxx2
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx21
-rw-r--r--dbaccess/source/ui/app/templwin.cxx11
-rw-r--r--dbaccess/source/ui/browser/AsynchronousLink.cxx12
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx31
-rw-r--r--dbaccess/source/ui/browser/brwview.cxx5
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx12
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx6
-rw-r--r--dbaccess/source/ui/browser/dbloader.cxx11
-rw-r--r--dbaccess/source/ui/browser/dbtreemodel.hxx3
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx4
-rw-r--r--dbaccess/source/ui/browser/dsbrowserDnD.cxx12
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx7
-rw-r--r--dbaccess/source/ui/browser/formadapter.cxx12
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx118
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx51
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx173
-rw-r--r--dbaccess/source/ui/control/ColumnControlWindow.cxx3
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx53
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx11
-rw-r--r--dbaccess/source/ui/control/SqlNameEdit.cxx12
-rw-r--r--dbaccess/source/ui/control/TableGrantCtrl.cxx4
-rw-r--r--dbaccess/source/ui/control/charsetlistbox.cxx4
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx23
-rw-r--r--dbaccess/source/ui/control/opendoccontrols.cxx6
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx21
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx3
-rw-r--r--dbaccess/source/ui/dlg/CollectionView.cxx16
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx25
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx4
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx21
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.cxx10
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.hxx2
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx142
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx40
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx74
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.hxx4
-rw-r--r--dbaccess/source/ui/dlg/RelationDlg.cxx4
-rw-r--r--dbaccess/source/ui/dlg/TablesSingleDlg.cxx2
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.cxx38
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.hxx4
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.cxx161
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.hxx6
-rw-r--r--dbaccess/source/ui/dlg/UserAdminDlg.cxx6
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx11
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx11
-rw-r--r--dbaccess/source/ui/dlg/adodatalinks.cxx14
-rw-r--r--dbaccess/source/ui/dlg/adtabdlg.cxx7
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx8
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx2
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx284
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.cxx19
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.hxx9
-rw-r--r--dbaccess/source/ui/dlg/dbwiz.cxx9
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx71
-rw-r--r--dbaccess/source/ui/dlg/detailpages.cxx13
-rw-r--r--dbaccess/source/ui/dlg/detailpages.hxx10
-rw-r--r--dbaccess/source/ui/dlg/directsql.cxx52
-rw-r--r--dbaccess/source/ui/dlg/dlgattr.cxx6
-rw-r--r--dbaccess/source/ui/dlg/dlgsave.cxx260
-rw-r--r--dbaccess/source/ui/dlg/dlgsize.cxx2
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx8
-rw-r--r--dbaccess/source/ui/dlg/dsselect.hxx3
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx43
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx1
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx2
-rw-r--r--dbaccess/source/ui/dlg/indexfieldscontrol.cxx3
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.hxx2
-rw-r--r--dbaccess/source/ui/dlg/paramdialog.cxx14
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx15
-rw-r--r--dbaccess/source/ui/dlg/queryorder.cxx9
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx18
-rw-r--r--dbaccess/source/ui/dlg/tablespage.cxx11
-rw-r--r--dbaccess/source/ui/inc/AppElementType.hxx16
-rw-r--r--dbaccess/source/ui/inc/ChildWindow.hxx4
-rw-r--r--dbaccess/source/ui/inc/CollectionView.hxx2
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx2
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineAccess.hxx31
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineData.hxx2
-rw-r--r--dbaccess/source/ui/inc/DExport.hxx2
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx8
-rw-r--r--dbaccess/source/ui/inc/JAccess.hxx14
-rw-r--r--dbaccess/source/ui/inc/JoinExchange.hxx2
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx20
-rw-r--r--dbaccess/source/ui/inc/RelationController.hxx4
-rw-r--r--dbaccess/source/ui/inc/SqlNameEdit.hxx7
-rw-r--r--dbaccess/source/ui/inc/TableConnection.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableConnectionData.hxx4
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableCopyHelper.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableRowExchange.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableWindow.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableWindowAccess.hxx33
-rw-r--r--dbaccess/source/ui/inc/TableWindowData.hxx8
-rw-r--r--dbaccess/source/ui/inc/TableWindowListBox.hxx2
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx2
-rw-r--r--dbaccess/source/ui/inc/UITools.hxx2
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx2
-rw-r--r--dbaccess/source/ui/inc/WColumnSelect.hxx4
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx6
-rw-r--r--dbaccess/source/ui/inc/WTabPage.hxx2
-rw-r--r--dbaccess/source/ui/inc/WTypeSelect.hxx1
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx2
-rw-r--r--dbaccess/source/ui/inc/charsetlistbox.hxx6
-rw-r--r--dbaccess/source/ui/inc/charsets.hxx6
-rw-r--r--dbaccess/source/ui/inc/curledit.hxx2
-rw-r--r--dbaccess/source/ui/inc/databaseobjectview.hxx2
-rw-r--r--dbaccess/source/ui/inc/datasourceconnector.hxx2
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx10
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx2
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx1
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx4
-rw-r--r--dbaccess/source/ui/inc/defaultobjectnamecheck.hxx9
-rw-r--r--dbaccess/source/ui/inc/dlgattr.hxx2
-rw-r--r--dbaccess/source/ui/inc/dlgsave.hxx23
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx125
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx3
-rw-r--r--dbaccess/source/ui/inc/imageprovider.hxx14
-rw-r--r--dbaccess/source/ui/inc/indexcollection.hxx1
-rw-r--r--dbaccess/source/ui/inc/indexdialog.hxx2
-rw-r--r--dbaccess/source/ui/inc/linkeddocuments.hxx2
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx2
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hrc4
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx16
-rw-r--r--dbaccess/source/ui/inc/sbamultiplex.hxx3
-rw-r--r--dbaccess/source/ui/inc/singledoccontroller.hxx6
-rw-r--r--dbaccess/source/ui/inc/sqledit.hxx3
-rw-r--r--dbaccess/source/ui/inc/sqlmessage.hxx4
-rw-r--r--dbaccess/source/ui/inc/unoadmin.hxx3
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx7
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx15
-rw-r--r--dbaccess/source/ui/misc/HtmlReader.cxx4
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx4
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx43
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx223
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx204
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx5
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx23
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx48
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx8
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx22
-rw-r--r--dbaccess/source/ui/misc/asyncmodaldialog.cxx2
-rw-r--r--dbaccess/source/ui/misc/charsets.cxx11
-rw-r--r--dbaccess/source/ui/misc/controllerframe.cxx3
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx31
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx19
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx19
-rw-r--r--dbaccess/source/ui/misc/defaultobjectnamecheck.cxx44
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx22
-rw-r--r--dbaccess/source/ui/misc/imageprovider.cxx40
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx12
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx27
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx20
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx25
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineData.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/JAccess.cxx15
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/JoinDesignView.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/JoinExchange.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx52
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx59
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx18
-rw-r--r--dbaccess/source/ui/querydesign/QueryTextView.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx43
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/TableConnectionData.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx1
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldInfo.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldInfo.hxx1
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx21
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowAccess.cxx39
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowData.cxx13
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowListBox.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowTitle.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx23
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.hxx9
-rw-r--r--dbaccess/source/ui/querydesign/querycontainerwindow.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx79
-rw-r--r--dbaccess/source/ui/querydesign/querydlg.cxx12
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx19
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx11
-rw-r--r--dbaccess/source/ui/relationdesign/RelationDesignView.cxx6
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx9
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx39
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx44
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx41
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignControl.cxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignView.cxx4
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx10
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx4
-rw-r--r--dbaccess/source/ui/tabledesign/TableRow.cxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableRowExchange.cxx7
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.cxx7
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.hxx2
-rw-r--r--dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx1
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx5
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.hxx2
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.cxx2
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.cxx1
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx2
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.cxx1
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.cxx1
-rw-r--r--dbaccess/source/ui/uno/admindlg.cxx1
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.cxx15
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx171
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.cxx4
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.cxx4
-rw-r--r--dbaccess/source/ui/uno/unoadmin.cxx8
223 files changed, 2159 insertions, 2374 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 96e23f041d6d..fbe2c395633f 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -55,7 +55,7 @@
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include <osl/diagnose.h>
@@ -252,7 +252,7 @@ OApplicationController::OApplicationController(const Reference< XComponentContex
,m_aTableCopyHelper(this)
,m_nAsyncDrop(nullptr)
,m_aSelectContainerEvent( LINK( this, OApplicationController, OnSelectContainer ) )
- ,m_ePreviewMode(E_PREVIEWNONE)
+ ,m_ePreviewMode(PreviewMode::NONE)
,m_eCurrentType(E_NONE)
,m_bNeedToReconnect(false)
,m_bSuspended( false )
@@ -327,14 +327,20 @@ void SAL_CALL OApplicationController::disposing()
if ( m_xDataSource.is() )
{
+ // Should correspond to ODatabaseSource::createArrayHelper in dbaccess/source/core/dataaccess/datasource.cxx
m_xDataSource->removePropertyChangeListener(OUString(), this);
m_xDataSource->removePropertyChangeListener(PROPERTY_INFO, this);
- m_xDataSource->removePropertyChangeListener(PROPERTY_URL, this);
m_xDataSource->removePropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this);
+ m_xDataSource->removePropertyChangeListener(PROPERTY_ISREADONLY, this);
m_xDataSource->removePropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this);
+ m_xDataSource->removePropertyChangeListener(PROPERTY_NAME, this);
+ m_xDataSource->removePropertyChangeListener(PROPERTY_NUMBERFORMATSSUPPLIER, this);
+ m_xDataSource->removePropertyChangeListener(PROPERTY_PASSWORD, this);
+ m_xDataSource->removePropertyChangeListener(PROPERTY_SETTINGS, this);
m_xDataSource->removePropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this);
m_xDataSource->removePropertyChangeListener(PROPERTY_TABLEFILTER, this);
m_xDataSource->removePropertyChangeListener(PROPERTY_TABLETYPEFILTER, this);
+ m_xDataSource->removePropertyChangeListener(PROPERTY_URL, this);
m_xDataSource->removePropertyChangeListener(PROPERTY_USER, this);
m_xDataSource = nullptr;
}
@@ -348,8 +354,7 @@ void SAL_CALL OApplicationController::disposing()
OUString sUrl = m_xModel->getURL();
if ( !sUrl.isEmpty() )
{
- ::comphelper::NamedValueCollection aArgs( m_xModel->getArgs() );
- if ( aArgs.getOrDefault( "PickListEntry", true ) )
+ if ( ::comphelper::NamedValueCollection::getOrDefault( m_xModel->getArgs(), u"PickListEntry", true ) )
{
OUString aFilter;
INetURLObject aURL( m_xModel->getURL() );
@@ -357,12 +362,13 @@ void SAL_CALL OApplicationController::disposing()
if ( pFilter )
aFilter = pFilter->GetFilterName();
+ OUString sDatabaseName;
// add to svtool history options
SvtHistoryOptions::AppendItem( EHistoryType::PickList,
aURL.GetURLNoPass( INetURLObject::DecodeMechanism::NONE ),
aFilter,
- getStrippedDatabaseName(),
- std::nullopt);
+ ::dbaui::getStrippedDatabaseName(m_xDataSource, sDatabaseName),
+ std::nullopt, std::nullopt);
// add to recent document list
if ( aURL.GetProtocol() == INetProtocol::File )
@@ -499,7 +505,8 @@ sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend)
)
)
{
- switch (ExecuteQuerySaveDocument(getFrameWeld(), getStrippedDatabaseName()))
+ OUString sDatabaseName;
+ switch (ExecuteQuerySaveDocument(getFrameWeld(), ::dbaui::getStrippedDatabaseName(m_xDataSource, sDatabaseName)))
{
case RET_YES:
Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>());
@@ -793,18 +800,18 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
break;
case SID_DB_APP_DISABLE_PREVIEW:
aReturn.bEnabled = true;
- aReturn.bChecked = getContainer()->getPreviewMode() == E_PREVIEWNONE;
+ aReturn.bChecked = getContainer()->getPreviewMode() == PreviewMode::NONE;
break;
case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
{
ElementType eType = getContainer()->getElementType();
aReturn.bEnabled = (E_REPORT == eType || E_FORM == eType);
- aReturn.bChecked = getContainer()->getPreviewMode() == E_DOCUMENTINFO;
+ aReturn.bChecked = getContainer()->getPreviewMode() == PreviewMode::DocumentInfo;
}
break;
case SID_DB_APP_VIEW_DOC_PREVIEW:
aReturn.bEnabled = true;
- aReturn.bChecked = getContainer()->getPreviewMode() == E_DOCUMENT;
+ aReturn.bChecked = getContainer()->getPreviewMode() == PreviewMode::Document;
break;
case ID_BROWSER_UNDO:
aReturn.bEnabled = false;
@@ -907,8 +914,7 @@ namespace
bool bHandled = false;
// try handling the error with an interaction handler
- ::comphelper::NamedValueCollection aArgs( _rxDocument->getArgs() );
- Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
+ Reference< XInteractionHandler > xHandler = ::comphelper::NamedValueCollection::getOrDefault( _rxDocument->getArgs(), u"InteractionHandler", Reference< XInteractionHandler >() );
if ( xHandler.is() )
{
rtl::Reference pRequest( new ::comphelper::OInteractionRequest( _rException ) );
@@ -1027,7 +1033,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
{
if ( pIter->Name == "FormatStringId" )
{
- sal_uLong nTmp;
+ sal_uInt32 nTmp;
if ( pIter->Value >>= nTmp )
pasteFormat(static_cast<SotClipboardFormatId>(nTmp));
break;
@@ -1213,7 +1219,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource, aCreationArgs );
- onDocumentOpened( OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, nullptr );
+ onDocumentOpened( OUString(), E_QUERY, ElementOpenMode::Design, xComponent, nullptr );
}
}
break;
@@ -1237,17 +1243,17 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
case SID_DB_APP_QUERY_EDIT:
case SID_DB_APP_FORM_EDIT:
case SID_DB_APP_REPORT_EDIT:
- doAction( _nId, E_OPEN_DESIGN );
+ doAction( _nId, ElementOpenMode::Design );
break;
case SID_DB_APP_OPEN:
case SID_DB_APP_TABLE_OPEN:
case SID_DB_APP_QUERY_OPEN:
case SID_DB_APP_FORM_OPEN:
case SID_DB_APP_REPORT_OPEN:
- doAction( _nId, E_OPEN_NORMAL );
+ doAction( _nId, ElementOpenMode::Normal );
break;
case SID_DB_APP_CONVERTTOVIEW:
- doAction( _nId, E_OPEN_NORMAL );
+ doAction( _nId, ElementOpenMode::Normal );
break;
case SID_SELECTALL:
getContainer()->selectAll();
@@ -1256,7 +1262,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
case SID_DB_APP_DSRELDESIGN:
{
Reference< XComponent > xRelationDesigner;
- if ( !m_pSubComponentManager->activateSubFrame( OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xRelationDesigner ) )
+ if ( !m_pSubComponentManager->activateSubFrame( OUString(), SID_DB_APP_DSRELDESIGN, ElementOpenMode::Design, xRelationDesigner ) )
{
SharedConnection xConnection( ensureConnection() );
if ( xConnection.is() )
@@ -1265,7 +1271,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource );
- onDocumentOpened( OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, nullptr );
+ onDocumentOpened( OUString(), SID_DB_APP_DSRELDESIGN, ElementOpenMode::Design, xComponent, nullptr );
}
}
}
@@ -1319,15 +1325,15 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_REPORT ) );
break;
case SID_DB_APP_DISABLE_PREVIEW:
- m_ePreviewMode = E_PREVIEWNONE;
+ m_ePreviewMode = PreviewMode::NONE;
getContainer()->switchPreview(m_ePreviewMode);
break;
case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
- m_ePreviewMode = E_DOCUMENTINFO;
+ m_ePreviewMode = PreviewMode::DocumentInfo;
getContainer()->switchPreview(m_ePreviewMode);
break;
case SID_DB_APP_VIEW_DOC_PREVIEW:
- m_ePreviewMode = E_DOCUMENT;
+ m_ePreviewMode = PreviewMode::Document;
getContainer()->switchPreview(m_ePreviewMode);
break;
case SID_MAIL_SENDDOC:
@@ -1338,7 +1344,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
}
break;
case SID_DB_APP_SENDREPORTASMAIL:
- doAction( _nId, E_OPEN_FOR_MAIL );
+ doAction( _nId, ElementOpenMode::Mail );
break;
}
}
@@ -1703,7 +1709,7 @@ bool OApplicationController::onEntryDoubleClick(const weld::TreeView& rTreeView)
openElementWithArguments(
getContainer()->getQualifiedName(xHdlEntry.get()),
getContainer()->getElementType(),
- E_OPEN_NORMAL,
+ ElementOpenMode::Normal,
0,
::comphelper::NamedValueCollection() );
return true; // handled
@@ -1749,7 +1755,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
return nullptr;
Reference< XComponent > xRet;
- if ( _eOpenMode == E_OPEN_DESIGN )
+ if ( _eOpenMode == ElementOpenMode::Design )
{
// https://bz.apache.org/ooo/show_bug.cgi?id=30382
getContainer()->showPreview(nullptr);
@@ -1759,7 +1765,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
switch ( _eType )
{
case E_REPORT:
- if ( _eOpenMode != E_OPEN_DESIGN )
+ if ( _eOpenMode != ElementOpenMode::Design )
{
// reports which are opened in a mode other than design are no sub components of our application
// component, but standalone documents.
@@ -1796,7 +1802,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
::comphelper::NamedValueCollection aArguments( _rAdditionalArguments );
Any aDataSource;
- if ( _eOpenMode == E_OPEN_DESIGN )
+ if ( _eOpenMode == ElementOpenMode::Design )
{
bool bAddViewTypeArg = false;
@@ -1831,7 +1837,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
if ( !aArguments.has( PROPERTY_SHOWMENU ) )
- aArguments.put( PROPERTY_SHOWMENU, makeAny( true ) );
+ aArguments.put( PROPERTY_SHOWMENU, Any( true ) );
aDataSource <<= getDatabaseName();
}
@@ -1956,7 +1962,7 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType,
}
if ( xComponent.is() )
- onDocumentOpened( OUString(), _eType, E_OPEN_DESIGN, xComponent, o_rDocumentDefinition );
+ onDocumentOpened( OUString(), _eType, ElementOpenMode::Design, xComponent, o_rDocumentDefinition );
return xComponent;
}
@@ -2155,7 +2161,7 @@ void OApplicationController::onSelectionChanged()
void OApplicationController::showPreviewFor(const ElementType _eType,const OUString& _sName)
{
- if ( m_ePreviewMode == E_PREVIEWNONE )
+ if ( m_ePreviewMode == PreviewMode::NONE )
return;
OApplicationView* pView = getContainer();
@@ -2266,7 +2272,7 @@ Any OApplicationController::getCurrentSelection(weld::TreeView& rControl) const
{
Sequence< NamedDatabaseObject > aSelection;
getContainer()->describeCurrentSelectionForControl(rControl, aSelection);
- return makeAny( aSelection );
+ return Any( aSelection );
}
vcl::Window* OApplicationController::getMenuParent() const
@@ -2514,8 +2520,7 @@ void OApplicationController::OnFirstControllerConnected()
{
// If the migration just happened, but was not successful, the document is reloaded.
// In this case, we should not show the warning, again.
- ::comphelper::NamedValueCollection aModelArgs( m_xModel->getArgs() );
- if ( aModelArgs.getOrDefault( "SuppressMigrationWarning", false ) )
+ if ( ::comphelper::NamedValueCollection::getOrDefault( m_xModel->getArgs(), u"SuppressMigrationWarning", false ) )
return;
// also, if the document is read-only, then no migration is possible, and the
@@ -2523,13 +2528,10 @@ void OApplicationController::OnFirstControllerConnected()
if ( Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly() )
return;
- SQLWarning aWarning;
- aWarning.Message = DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS);
- SQLException aDetail;
- aDetail.Message = DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS_DETAIL);
- aWarning.NextException <<= aDetail;
+ SQLException aDetail(DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS_DETAIL), {}, {}, 0, {});
+ SQLWarning aWarning(DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS), {}, {}, 0, css::uno::Any(aDetail));
- Reference< XExecutableDialog > xDialog = ErrorMessageDialog::create( getORB(), "", nullptr, makeAny( aWarning ) );
+ Reference< XExecutableDialog > xDialog = ErrorMessageDialog::create( getORB(), "", nullptr, Any( aWarning ) );
xDialog->execute();
}
catch( const Exception& )
@@ -2568,7 +2570,7 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel >
const OUString aPropertyNames[] =
{
- OUString(PROPERTY_URL), OUString(PROPERTY_USER)
+ PROPERTY_URL, PROPERTY_USER
};
// disconnect from old model
@@ -2829,7 +2831,7 @@ Any SAL_CALL OApplicationController::getSelection( )
}
}
}
- return makeAny( aCurrentSelection );
+ return Any( aCurrentSelection );
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index b7579c0cf156..f50cdfb4daf7 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -137,12 +137,6 @@ namespace dbaui
*/
OUString getDatabaseName() const;
- /** returns the stripped database name.
- @return
- The stripped database name either the registered name or if it is a file url the last segment.
- */
- OUString getStrippedDatabaseName() const;
-
/** return the element type for given container
@param _xContainer The container where the element type has to be found
@return the element type corresponding to the given container
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index 4ba805904387..a46bfad409fd 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -52,7 +52,7 @@
#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
#include <svtools/querydelete.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <defaultobjectnamecheck.hxx>
#include <osl/mutex.hxx>
@@ -74,7 +74,6 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::util;
void OApplicationController::deleteTables(const std::vector< OUString>& _rList)
{
@@ -314,7 +313,8 @@ const SharedConnection& OApplicationController::ensureConnection( ::dbtools::SQL
SolarMutexGuard aSolarGuard;
OUString sConnectingContext(DBA_RES(STR_COULDNOTCONNECT_DATASOURCE));
- sConnectingContext = sConnectingContext.replaceFirst("$name$", getStrippedDatabaseName());
+ OUString sDatabaseName;
+ sConnectingContext = sConnectingContext.replaceFirst("$name$", ::dbaui::getStrippedDatabaseName(m_xDataSource, sDatabaseName));
// do the connection *without* holding getMutex() to avoid deadlock
// when we are not in the main thread and we need username/password
@@ -744,11 +744,11 @@ bool OApplicationController::paste( ElementType _eType, const svx::ODataAccessDe
::comphelper::copyProperties(xQuery,xNewQuery);
else
{
- xNewQuery->setPropertyValue(PROPERTY_COMMAND,makeAny(sCommand));
- xNewQuery->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,makeAny(bEscapeProcessing));
+ xNewQuery->setPropertyValue(PROPERTY_COMMAND,Any(sCommand));
+ xNewQuery->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,Any(bEscapeProcessing));
}
// insert
- xDestQueries->insertByName( sTargetName, makeAny(xNewQuery) );
+ xDestQueries->insertByName( sTargetName, Any(xNewQuery) );
xNewQuery.set(xDestQueries->getByName( sTargetName),UNO_QUERY);
if ( xQuery.is() && xNewQuery.is() )
{
@@ -852,10 +852,10 @@ IMPL_LINK_NOARG( OApplicationController, OnAsyncDrop, void*, void )
std::vector< OUString> aList;
sal_Int32 nIndex = 0;
OUString sName = xContent->getIdentifier()->getContentIdentifier();
- OUString sErase = sName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part
+ std::u16string_view sErase = o3tl::getToken(sName,0,'/',nIndex); // we don't want to have the "private:forms" part
if ( nIndex != -1 )
{
- aList.push_back(sName.copy(sErase.getLength() + 1));
+ aList.push_back(sName.copy(sErase.size() + 1));
deleteObjects( m_aAsyncDrop.nType, aList, false );
}
}
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 44e1a3b9666e..0f6eda11de7b 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -50,7 +50,7 @@
#include <sfx2/mailmodelapi.hxx>
#include <svx/dbaexchange.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/mnemonic.hxx>
#include <vcl/svapp.hxx>
@@ -110,7 +110,7 @@ void OApplicationController::convertToView(const OUString& _sName)
Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject);
if ( !xView.is() )
throw SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE),*this, "S1000",0,Any());
- getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView));
+ getContainer()->elementAdded(E_TABLE,sNewName,Any(xView));
}
}
catch(const SQLException& )
@@ -168,7 +168,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName )
// the parent window
pArgs[nArgPos++] <<= PropertyValue( "ParentWindow",
0,
- makeAny(xWindow),
+ Any(xWindow),
PropertyState_DIRECT_VALUE);
// the initial selection
@@ -179,7 +179,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName )
{
pArgs[ nArgPos++ ] <<= PropertyValue(
"InitialSelection", 0,
- makeAny( sInitialSelection ), PropertyState_DIRECT_VALUE );
+ Any( sInitialSelection ), PropertyState_DIRECT_VALUE );
}
SharedConnection xConnection( getConnection() );
@@ -321,7 +321,8 @@ void SAL_CALL OApplicationController::connect( )
// no particular error, but nonetheless could not connect -> throw a generic exception
OUString sConnectingContext( DBA_RES( STR_COULDNOTCONNECT_DATASOURCE ) );
- ::dbtools::throwGenericSQLException( sConnectingContext.replaceFirst( "$name$", getStrippedDatabaseName() ), *this );
+ OUString sDatabaseName;
+ ::dbtools::throwGenericSQLException( sConnectingContext.replaceFirst( "$name$", ::dbaui::getStrippedDatabaseName(m_xDataSource, sDatabaseName) ), *this );
}
}
@@ -433,7 +434,7 @@ Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArgume
Reference< XComponent > xComponent( openElementWithArguments(
ObjectName,
lcl_objectType2ElementType( ObjectType ),
- ForEditing ? E_OPEN_DESIGN : E_OPEN_NORMAL,
+ ForEditing ? ElementOpenMode::Design : ElementOpenMode::Normal,
ForEditing ? SID_DB_APP_EDIT : SID_DB_APP_OPEN,
::comphelper::NamedValueCollection( Arguments )
) );
@@ -487,7 +488,7 @@ void OApplicationController::previewChanged( sal_Int32 _nMode )
if ( nOldMode != _nMode )
{
aLayoutInfo.put( "Preview", _nMode );
- m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aLayoutInfo.getPropertyValues() ) );
+ m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, Any( aLayoutInfo.getPropertyValues() ) );
}
}
catch ( const Exception& )
@@ -550,12 +551,6 @@ OUString OApplicationController::getDatabaseName() const
return sDatabaseName;
}
-OUString OApplicationController::getStrippedDatabaseName() const
-{
- OUString sDatabaseName;
- return ::dbaui::getStrippedDatabaseName( m_xDataSource, sDatabaseName );
-}
-
void OApplicationController::onDocumentOpened( const OUString& _rName, const sal_Int32 _nType,
const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition )
{
@@ -639,7 +634,7 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa
if ( !_xLayoutManager.is() )
return;
- static constexpr OUStringLiteral s_sStatusbar = u"private:resource/statusbar/statusbar";
+ static constexpr OUString s_sStatusbar = u"private:resource/statusbar/statusbar"_ustr;
_xLayoutManager->createElement( s_sStatusbar );
_xLayoutManager->requestElement( s_sStatusbar );
@@ -667,10 +662,10 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO
ElementType eType = getContainer()->getElementType();
::comphelper::NamedValueCollection aArguments;
ElementOpenMode eOpenMode = _eOpenMode;
- if ( eType == E_REPORT && E_OPEN_FOR_MAIL == _eOpenMode )
+ if ( eType == E_REPORT && ElementOpenMode::Mail == _eOpenMode )
{
aArguments.put("Hidden",true);
- eOpenMode = E_OPEN_NORMAL;
+ eOpenMode = ElementOpenMode::Normal;
}
std::vector< std::pair< OUString ,Reference< XModel > > > aComponents;
@@ -686,7 +681,7 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO
}
// special handling for mail, if more than one document is selected attach them all
- if ( _eOpenMode != E_OPEN_FOR_MAIL )
+ if ( _eOpenMode != ElementOpenMode::Mail )
return;
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 4e9bb41cb63c..c4adb2f45935 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -18,7 +18,7 @@
*/
#include "AppDetailPageHelper.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tabletree.hxx>
#include <dbtreelistbox.hxx>
#include <com/sun/star/awt/PopupMenu.hpp>
@@ -43,6 +43,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include "AppView.hxx"
#include <helpids.h>
#include <strings.hxx>
@@ -79,11 +80,11 @@ namespace dbaui
namespace
{
- bool lcl_findEntry_impl(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter)
+ bool lcl_findEntry_impl(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter)
{
bool bReturn = false;
sal_Int32 nIndex = 0;
- OUString sName( rName.getToken(0,'/',nIndex) );
+ std::u16string_view sName( o3tl::getToken(rName,0,'/',nIndex) );
const weld::TreeView& rTreeView = rTree.GetWidget();
bool bEntry = true;
@@ -93,7 +94,7 @@ namespace
{
if ( nIndex != -1 )
{
- sName = rName.getToken(0,'/',nIndex);
+ sName = o3tl::getToken(rName,0,'/',nIndex);
bEntry = rTreeView.iter_children(rIter);
}
else
@@ -110,11 +111,11 @@ namespace
return bReturn;
}
- bool lcl_findEntry(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter)
+ bool lcl_findEntry(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter)
{
sal_Int32 nIndex = 0;
- OUString sErase = rName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part
- return nIndex != -1 && lcl_findEntry_impl(rTree, rName.copy(sErase.getLength() + 1), rIter);
+ std::u16string_view sErase = o3tl::getToken(rName,0,'/',nIndex); // we don't want to have the "private:forms" part
+ return nIndex != -1 && lcl_findEntry_impl(rTree, rName.substr(sErase.size() + 1), rIter);
}
}
@@ -552,7 +553,7 @@ void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameA
{
OSL_ENSURE(E_TABLE != _eType,"E_TABLE isn't allowed.");
- OString sHelpId;
+ OUString sHelpId;
switch( _eType )
{
case E_FORM:
@@ -669,7 +670,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
}
}
-std::unique_ptr<DBTreeViewBase> OAppDetailPageHelper::createSimpleTree(const OString& rHelpId, ElementType eType)
+std::unique_ptr<DBTreeViewBase> OAppDetailPageHelper::createSimpleTree(const OUString& rHelpId, ElementType eType)
{
const bool bSQLType = eType == E_TABLE || eType == E_QUERY;
std::unique_ptr<DBTreeViewBase> xTreeView(new DBTreeView(m_xBox.get(), bSQLType));
@@ -760,7 +761,7 @@ void OAppDetailPageHelper::elementReplaced(ElementType eType,
std::unique_ptr<weld::TreeIter> OAppDetailPageHelper::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
{
std::unique_ptr<weld::TreeIter> xRet;
- DBTreeViewBase* pTreeView = m_aLists[_eType].get();
+ DBTreeViewBase* pTreeView = _eType != E_NONE ? m_aLists[_eType].get() : nullptr;
if (!pTreeView)
return xRet;
weld::TreeView& rTreeView = pTreeView->GetWidget();
@@ -874,14 +875,14 @@ IMPL_LINK_NOARG( OAppDetailPageHelper, OnDeleteEntry, LinkParamNone*, void )
bool OAppDetailPageHelper::isPreviewEnabled() const
{
- return m_ePreviewMode != E_PREVIEWNONE;
+ return m_ePreviewMode != PreviewMode::NONE;
}
namespace
{
OUString stripTrailingDots(std::u16string_view rStr)
{
- return comphelper::string::stripEnd(rStr, '.');
+ return OUString(comphelper::string::stripEnd(rStr, '.'));
}
}
@@ -897,18 +898,18 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
OUString aCommand;
switch ( m_ePreviewMode )
{
- case E_PREVIEWNONE:
+ case PreviewMode::NONE:
aCommand = ".uno:DBDisablePreview";
break;
- case E_DOCUMENT:
+ case PreviewMode::Document:
aCommand = ".uno:DBShowDocPreview";
break;
- case E_DOCUMENTINFO:
+ case PreviewMode::DocumentInfo:
if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) )
aCommand = ".uno:DBShowDocInfoPreview";
else
{
- m_ePreviewMode = E_PREVIEWNONE;
+ m_ePreviewMode = PreviewMode::NONE;
aCommand = ".uno:DBDisablePreview";
}
break;
@@ -949,13 +950,13 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
if ( xContent.is() )
{
css::ucb::Command aCommand;
- if ( m_ePreviewMode == E_DOCUMENT )
+ if ( m_ePreviewMode == PreviewMode::Document )
aCommand.Name = "preview";
else
aCommand.Name = "getDocumentInfo";
Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >());
- if ( m_ePreviewMode == E_DOCUMENT )
+ if ( m_ePreviewMode == PreviewMode::Document )
{
m_xDocumentInfo->Hide();
m_xPreview->Show();
@@ -1044,7 +1045,7 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
aArgs.put( "AsTemplate", false );
aArgs.put( PROPERTY_SHOWMENU, false );
- Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
+ Reference< XController > xPreview( pDispatcher->openExisting( Any( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
bool bClearPreview = !xPreview.is();
// clear the preview when the query or table could not be loaded
@@ -1078,7 +1079,7 @@ namespace
if (!rEvent.IsEnabled)
{
const OUString &rURL = rEvent.FeatureURL.Complete;
- m_rMBPreview.remove_item(rURL.toUtf8());
+ m_rMBPreview.remove_item(rURL);
}
}
@@ -1104,9 +1105,9 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, weld::Toggleable&, voi
auto xFrame = getBorderWin().getView()->getAppController().getFrame();
css::uno::Sequence<css::uno::Any> aArgs {
- css::uno::makeAny(comphelper::makePropertyValue("InToolbar", true)),
- css::uno::makeAny(comphelper::makePropertyValue("ModuleIdentifier", OUString("com.sun.star.sdb.OfficeDatabaseDocument"))),
- css::uno::makeAny(comphelper::makePropertyValue("Frame", xFrame)) };
+ css::uno::Any(comphelper::makePropertyValue("InToolbar", true)),
+ css::uno::Any(comphelper::makePropertyValue("ModuleIdentifier", OUString("com.sun.star.sdb.OfficeDatabaseDocument"))),
+ css::uno::Any(comphelper::makePropertyValue("Frame", xFrame)) };
css::uno::Reference<css::frame::XPopupMenuController> xPopupController
(xPopupMenuFactory->createInstanceWithArgumentsAndContext(".uno:DBPreview", aArgs, xContext), css::uno::UNO_QUERY);
@@ -1151,13 +1152,13 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, weld::Toggleable&, voi
xComponent->dispose();
}
-IMPL_LINK(OAppDetailPageHelper, MenuSelectHdl, const OString&, rIdent, void)
+IMPL_LINK(OAppDetailPageHelper, MenuSelectHdl, const OUString&, rIdent, void)
{
if (rIdent.isEmpty())
return;
css::util::URL aURL;
- aURL.Complete = OUString::fromUtf8(rIdent);
+ aURL.Complete = rIdent;
Reference<XDispatchProvider> xProvider(getBorderWin().getView()->getAppController().getFrame(), UNO_QUERY);
Reference<XDispatch> xDisp = xProvider->queryDispatch(aURL, "_self", 0);
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 25cc3229a2d4..fb47cb70c558 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -144,7 +144,7 @@ namespace dbaui
@return
The new tree.
*/
- std::unique_ptr<DBTreeViewBase> createSimpleTree(const OString& rHelpId, ElementType eType);
+ std::unique_ptr<DBTreeViewBase> createSimpleTree(const OUString& rHelpId, ElementType eType);
DECL_LINK( OnEntryDoubleClick, weld::TreeView&, bool );
DECL_LINK( OnEntrySelChange, LinkParamNone*, void );
@@ -154,7 +154,7 @@ namespace dbaui
DECL_LINK( OnDeleteEntry, LinkParamNone*, void );
DECL_LINK(OnDropdownClickHdl, weld::Toggleable&, void);
- DECL_LINK(MenuSelectHdl, const OString&, void);
+ DECL_LINK(MenuSelectHdl, const OUString&, void);
OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 8491ea4a7ef1..9ea7dcd4e6da 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -40,8 +40,6 @@
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::graphic;
using namespace ::com::sun::star::ui;
@@ -63,7 +61,7 @@ void OTasksWindow::updateHelpText()
TranslateId pHelpTextId;
int nCurEntry = m_xTreeView->get_selected_index();
if (nCurEntry != -1)
- pHelpTextId = reinterpret_cast<TaskEntry*>(m_xTreeView->get_id(nCurEntry).toUInt64())->pHelpID;
+ pHelpTextId = weld::fromId<TaskEntry*>(m_xTreeView->get_id(nCurEntry))->pHelpID;
setHelpText(pHelpTextId);
}
@@ -73,7 +71,7 @@ IMPL_LINK(OTasksWindow, onSelected, weld::TreeView&, rTreeView, bool)
if (m_nCursorIndex != -1)
{
URL aCommand;
- aCommand.Complete = reinterpret_cast<TaskEntry*>(rTreeView.get_id(m_nCursorIndex).toUInt64())->sUNOCommand;
+ aCommand.Complete = weld::fromId<TaskEntry*>(rTreeView.get_id(m_nCursorIndex))->sUNOCommand;
getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
}
return true;
@@ -175,7 +173,7 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
size_t nIndex = 0;
for (auto const& task : _rList)
{
- OUString sId = OUString::number(reinterpret_cast<sal_uInt64>(new TaskEntry(task)));
+ OUString sId = weld::toId(new TaskEntry(task));
m_xTreeView->append(sId, task.sTitle);
m_xTreeView->set_image(nIndex++, *pImages++);
}
@@ -192,7 +190,7 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
void OTasksWindow::Clear()
{
m_xTreeView->all_foreach([this](weld::TreeIter& rEntry){
- TaskEntry* pUserData = reinterpret_cast<TaskEntry*>(m_xTreeView->get_id(rEntry).toUInt64());
+ TaskEntry* pUserData = weld::fromId<TaskEntry*>(m_xTreeView->get_id(rEntry));
delete pUserData;
return false;
});
diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx
index 1448c401584c..bd94d52c564b 100644
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ b/dbaccess/source/ui/app/AppIconControl.cxx
@@ -69,11 +69,11 @@ OApplicationIconControl::OApplicationIconControl(std::unique_ptr<weld::ScrolledW
void OApplicationIconControl::Fill()
{
- static const struct CategoryDescriptor
+ static constexpr struct CategoryDescriptor
{
TranslateId pLabelResId;
ElementType eType;
- rtl::OUStringConstExpr aImageResId;
+ OUString aImageResId;
} aCategories[] = { { RID_STR_TABLES_CONTAINER, E_TABLE, BMP_TABLEFOLDER_TREE_L },
{ RID_STR_QUERIES_CONTAINER, E_QUERY, BMP_QUERYFOLDER_TREE_L },
{ RID_STR_FORMS_CONTAINER, E_FORM, BMP_FORMFOLDER_TREE_L },
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index ea2066c729c1..ddef5a3a8ac0 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -28,9 +28,6 @@
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
OApplicationSwapWindow::OApplicationSwapWindow(weld::Container* pParent,
OAppBorderWindow& rBorderWindow)
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index b300df8dfe6c..e6536beecfb8 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -19,7 +19,7 @@
#include "AppView.hxx"
#include <strings.hrc>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/event.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
@@ -174,7 +174,7 @@ bool OApplicationView::PreNotify( NotifyEvent& rNEvt )
{
switch(rNEvt.GetType())
{
- case MouseNotifyEvent::KEYINPUT:
+ case NotifyEventType::KEYINPUT:
{
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
// give the pane the chance to intercept mnemonic accelerators
diff --git a/dbaccess/source/ui/app/ChildWindow.cxx b/dbaccess/source/ui/app/ChildWindow.cxx
index a8091c8637a5..2f27ccb30b46 100644
--- a/dbaccess/source/ui/app/ChildWindow.cxx
+++ b/dbaccess/source/ui/app/ChildWindow.cxx
@@ -13,7 +13,7 @@
namespace dbaui
{
OChildWindow::OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription,
- const OString& rID)
+ const OUString& rID)
: m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
, m_xContainer(m_xBuilder->weld_container(rID))
{
diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx
index 7220eb2bdb30..cfa79be20c1f 100644
--- a/dbaccess/source/ui/app/DocumentInfoPreview.cxx
+++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx
@@ -34,7 +34,7 @@
#include <vcl/svapp.hxx>
#include <svl/itemset.hxx>
#include <tools/datetime.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/localedatawrapper.hxx>
#include <templwin.hrc>
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index fc4cd1962a8a..712996e093be 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.cxx
@@ -31,8 +31,9 @@
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <dbaccess/dataview.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
@@ -47,7 +48,7 @@ namespace dbaui
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::makeAny;
+ using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::frame::XFrame;
using ::com::sun::star::frame::XController;
@@ -89,13 +90,13 @@ namespace dbaui
SubComponentDescriptor()
:nComponentType( -1 )
- ,eOpenMode( E_OPEN_NORMAL )
+ ,eOpenMode( ElementOpenMode::Normal )
{
}
- SubComponentDescriptor( const OUString& i_rName, const sal_Int32 i_nComponentType,
+ SubComponentDescriptor( OUString i_sName, const sal_Int32 i_nComponentType,
const ElementOpenMode i_eOpenMode, const Reference< XComponent >& i_rComponent )
- :sName( i_rName )
+ :sName(std::move( i_sName ))
,nComponentType( i_nComponentType )
,eOpenMode( i_eOpenMode )
{
@@ -168,9 +169,9 @@ namespace dbaui
struct SubComponentMatch
{
public:
- SubComponentMatch( const OUString& i_rName, const sal_Int32 i_nComponentType,
+ SubComponentMatch( OUString i_sName, const sal_Int32 i_nComponentType,
const ElementOpenMode i_eOpenMode )
- :m_sName( i_rName )
+ :m_sName(std::move( i_sName ))
,m_nComponentType( i_nComponentType )
,m_eOpenMode( i_eOpenMode )
{
@@ -192,9 +193,9 @@ namespace dbaui
// SubComponentManager_Data
struct SubComponentManager_Data
{
- SubComponentManager_Data( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex )
+ SubComponentManager_Data( OApplicationController& _rController, ::comphelper::SharedMutex _aMutex )
:m_rController( _rController )
- ,m_aMutex( _rMutex )
+ ,m_aMutex(std::move( _aMutex ))
{
}
@@ -315,7 +316,7 @@ namespace dbaui
xBroadcaster->notifyDocumentEvent(
OUString::createFromAscii( _pAsciiEventName ),
&_rData.m_rController,
- makeAny( _rComponent.xFrame )
+ Any( _rComponent.xFrame )
);
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/app/templwin.cxx b/dbaccess/source/ui/app/templwin.cxx
index e9940782d630..224d8be0aed9 100644
--- a/dbaccess/source/ui/app/templwin.cxx
+++ b/dbaccess/source/ui/app/templwin.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <algorithm>
#include <core_resource.hxx>
#include <templwin.hrc>
#include "templwin.hxx"
@@ -25,13 +26,9 @@ namespace SvtDocInfoTable_Impl
{
OUString GetString(int nId)
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(STRARY_SVT_DOCINFO); ++i)
- {
- if (STRARY_SVT_DOCINFO[i].second == nId)
- return DBA_RES(STRARY_SVT_DOCINFO[i].first);
- }
-
- return OUString();
+ auto const found = std::find_if(std::begin(STRARY_SVT_DOCINFO), std::end(STRARY_SVT_DOCINFO)
+ , [nId](auto const & docinfo){ return docinfo.second == nId; });
+ return (found != std::end(STRARY_SVT_DOCINFO)) ? DBA_RES(found->first) : OUString();
}
}
diff --git a/dbaccess/source/ui/browser/AsynchronousLink.cxx b/dbaccess/source/ui/browser/AsynchronousLink.cxx
index e4dcdb2f9eeb..538ea702c4ac 100644
--- a/dbaccess/source/ui/browser/AsynchronousLink.cxx
+++ b/dbaccess/source/ui/browser/AsynchronousLink.cxx
@@ -31,14 +31,14 @@ OAsynchronousLink::OAsynchronousLink(const Link<void*, void>& _rHandler)
OAsynchronousLink::~OAsynchronousLink()
{
{
- ::osl::MutexGuard aEventGuard(m_aEventSafety);
+ std::unique_lock aEventGuard(m_aEventSafety);
if (m_nEventId)
Application::RemoveUserEvent(m_nEventId);
m_nEventId = nullptr;
}
{
- ::osl::MutexGuard aDestructionGuard(m_aDestructionSafety);
+ std::unique_lock aDestructionGuard(m_aDestructionSafety);
// this is just for the case we're deleted while another thread just handled the event :
// if this other thread called our link while we were deleting the event here, the
// link handler blocked. With leaving the above block it continued, but now we are prevented
@@ -48,7 +48,7 @@ OAsynchronousLink::~OAsynchronousLink()
void OAsynchronousLink::Call(void* _pArgument)
{
- ::osl::MutexGuard aEventGuard(m_aEventSafety);
+ std::unique_lock aEventGuard(m_aEventSafety);
if (m_nEventId)
Application::RemoveUserEvent(m_nEventId);
m_nEventId = Application::PostUserEvent(LINK(this, OAsynchronousLink, OnAsyncCall), _pArgument);
@@ -56,7 +56,7 @@ void OAsynchronousLink::Call(void* _pArgument)
void OAsynchronousLink::CancelCall()
{
- ::osl::MutexGuard aEventGuard(m_aEventSafety);
+ std::unique_lock aEventGuard(m_aEventSafety);
if (m_nEventId)
Application::RemoveUserEvent(m_nEventId);
m_nEventId = nullptr;
@@ -65,9 +65,9 @@ void OAsynchronousLink::CancelCall()
IMPL_LINK(OAsynchronousLink, OnAsyncCall, void*, _pArg, void)
{
{
- ::osl::MutexGuard aDestructionGuard(m_aDestructionSafety);
+ std::unique_lock aDestructionGuard(m_aDestructionSafety);
{
- ::osl::MutexGuard aEventGuard(m_aEventSafety);
+ std::unique_lock aEventGuard(m_aEventSafety);
if (!m_nEventId)
// our destructor deleted the event just while we are waiting for m_aEventSafety
// -> get outta here
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 7b9a2ecf78e2..8a316b331d1e 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -68,7 +68,7 @@
#include <sal/log.hxx>
#include <svx/fmsearch.hxx>
#include <svx/svxdlg.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -712,14 +712,14 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
// we want to have a grid with a "flat" border
Reference< XPropertySet > xGridSet(m_xGridModel, UNO_QUERY);
if ( xGridSet.is() )
- xGridSet->setPropertyValue(PROPERTY_BORDER, makeAny(sal_Int16(2)));
+ xGridSet->setPropertyValue(PROPERTY_BORDER, Any(sal_Int16(2)));
// marry them
Reference< css::container::XNameContainer > xNameCont(m_xRowSet, UNO_QUERY);
{
OUString sText(DBA_RES(STR_DATASOURCE_GRIDCONTROL_NAME));
- xNameCont->insertByName(sText, makeAny(m_xGridModel));
+ xNameCont->insertByName(sText, Any(m_xGridModel));
}
// create the view
@@ -1257,7 +1257,6 @@ sal_Bool SbaXDataBrowserController::approveParameter(const css::form::DatabasePa
return true;
}
- Reference< css::container::XIndexAccess > xParameters = aEvent.Parameters;
SolarMutexGuard aSolarGuard;
// default handling: instantiate an interaction handler and let it handle the parameter request
@@ -1268,9 +1267,9 @@ sal_Bool SbaXDataBrowserController::approveParameter(const css::form::DatabasePa
rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
// the request
ParametersRequest aRequest;
- aRequest.Parameters = xParameters;
+ aRequest.Parameters = aEvent.Parameters;
aRequest.Connection = getConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY));
- rtl::Reference<OInteractionRequest> pParamRequest = new OInteractionRequest(makeAny(aRequest));
+ rtl::Reference<OInteractionRequest> pParamRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pParamRequest->addContinuation(pParamValues);
pParamRequest->addContinuation(pAbort);
@@ -1581,7 +1580,7 @@ void SbaXDataBrowserController::applyParserOrder(const OUString& _rOldOrder,cons
bool bSuccess = false;
try
{
- xFormSet->setPropertyValue(PROPERTY_ORDER, makeAny(_xParser->getOrder()));
+ xFormSet->setPropertyValue(PROPERTY_ORDER, Any(_xParser->getOrder()));
bSuccess = reloadForm(m_xLoadable);
}
catch(Exception&)
@@ -1590,7 +1589,7 @@ void SbaXDataBrowserController::applyParserOrder(const OUString& _rOldOrder,cons
if (!bSuccess)
{
- xFormSet->setPropertyValue(PROPERTY_ORDER, makeAny(_rOldOrder));
+ xFormSet->setPropertyValue(PROPERTY_ORDER, Any(_rOldOrder));
try
{
@@ -1623,8 +1622,8 @@ void SbaXDataBrowserController::applyParserFilter(const OUString& _rOldFilter, b
try
{
FormErrorHelper aError(this);
- xFormSet->setPropertyValue(PROPERTY_FILTER, makeAny(_xParser->getFilter()));
- xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE, makeAny(_xParser->getHavingClause()));
+ xFormSet->setPropertyValue(PROPERTY_FILTER, Any(_xParser->getFilter()));
+ xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE, Any(_xParser->getHavingClause()));
xFormSet->setPropertyValue(PROPERTY_APPLYFILTER, css::uno::Any(true));
bSuccess = reloadForm(m_xLoadable);
@@ -1635,8 +1634,8 @@ void SbaXDataBrowserController::applyParserFilter(const OUString& _rOldFilter, b
if (!bSuccess)
{
- xFormSet->setPropertyValue(PROPERTY_FILTER, makeAny(_rOldFilter));
- xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE, makeAny(_sOldHaving));
+ xFormSet->setPropertyValue(PROPERTY_FILTER, Any(_rOldFilter));
+ xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE, Any(_sOldHaving));
xFormSet->setPropertyValue(PROPERTY_APPLYFILTER, css::uno::Any(_bOldFilterApplied));
try
@@ -1789,7 +1788,7 @@ void SbaXDataBrowserController::ExecuteSearch()
OSL_ENSURE(xModelSet.is(), "SbaXDataBrowserController::ExecuteSearch : no model set ?!");
xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(false));
xModelSet->setPropertyValue("AlwaysShowCursor", css::uno::Any(true));
- xModelSet->setPropertyValue("CursorColor", makeAny(COL_LIGHTRED));
+ xModelSet->setPropertyValue("CursorColor", Any(COL_LIGHTRED));
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
VclPtr<AbstractFmSearchDialog> pDialog;
@@ -2079,9 +2078,9 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
Reference< XPropertySet > xSet(getRowSet(), UNO_QUERY);
if ( xSet.is() )
{
- xSet->setPropertyValue(PROPERTY_FILTER,makeAny(OUString()));
- xSet->setPropertyValue(PROPERTY_HAVING_CLAUSE,makeAny(OUString()));
- xSet->setPropertyValue(PROPERTY_ORDER,makeAny(OUString()));
+ xSet->setPropertyValue(PROPERTY_FILTER,Any(OUString()));
+ xSet->setPropertyValue(PROPERTY_HAVING_CLAUSE,Any(OUString()));
+ xSet->setPropertyValue(PROPERTY_ORDER,Any(OUString()));
}
try
{
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index b68819d6740a..19ec1ef44a5a 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -32,7 +32,6 @@
using namespace dbaui;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -251,7 +250,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const
Reference< css::awt::XWindowPeer > xPeer = m_xGrid->getPeer();
if ( xPeer.is() )
{
- SbaXGridPeer* pPeer = comphelper::getFromUnoTunnel<SbaXGridPeer>(xPeer);
+ SbaXGridPeer* pPeer = dynamic_cast<SbaXGridPeer*>(xPeer.get());
UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this);
if ( pPeer )
{
@@ -292,7 +291,7 @@ void UnoDataBrowserView::_disposing( const css::lang::EventObject& /*_rSource*/
bool UnoDataBrowserView::PreNotify( NotifyEvent& rNEvt )
{
bool bDone = false;
- if(rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
+ if(rNEvt.GetType() == NotifyEventType::KEYINPUT)
{
bool bGrabAllowed = isGrabVclControlFocusAllowed(this);
if ( bGrabAllowed )
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 74ceea688ba1..84716351d45a 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -23,16 +23,14 @@
#include <comphelper/namedvaluecollection.hxx>
#include <dbaccess/IController.hxx>
#include <svtools/acceleratorexecute.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/event.hxx>
#include <vcl/settings.hxx>
namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
ODataView::ODataView( vcl::Window* pParent,
@@ -98,7 +96,7 @@ namespace dbaui
bool bHandled = false;
switch ( _rNEvt.GetType() )
{
- case MouseNotifyEvent::KEYINPUT:
+ case NotifyEventType::KEYINPUT:
{
const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
const vcl::KeyCode& aKeyCode = pKeyEvent->GetKeyCode();
@@ -107,9 +105,9 @@ namespace dbaui
return true;
[[fallthrough]];
}
- case MouseNotifyEvent::KEYUP:
- case MouseNotifyEvent::MOUSEBUTTONDOWN:
- case MouseNotifyEvent::MOUSEBUTTONUP:
+ case NotifyEventType::KEYUP:
+ case NotifyEventType::MOUSEBUTTONDOWN:
+ case NotifyEventType::MOUSEBUTTONUP:
bHandled = m_xController->interceptUserInput( _rNEvt );
break;
default:
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index dc6398f48aea..dc318dc0f61c 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -140,14 +140,14 @@ namespace dbaui
osl_atomic_decrement( &m_refCount );
}
- bool ODataClipboard::WriteObject( ::tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
+ bool ODataClipboard::WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
{
if (nUserObjectId == FORMAT_OBJECT_ID_RTF || nUserObjectId == FORMAT_OBJECT_ID_HTML )
{
ODatabaseImportExport* pExport = static_cast<ODatabaseImportExport*>(pUserObject);
- if ( pExport && rxOStm.is() )
+ if ( pExport )
{
- pExport->setStream(rxOStm.get());
+ pExport->setStream(&rOStm);
return pExport->Write();
}
}
diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx
index 67645e92e611..0eeba92634a5 100644
--- a/dbaccess/source/ui/browser/dbloader.cxx
+++ b/dbaccess/source/ui/browser/dbloader.cxx
@@ -36,8 +36,9 @@
#include <comphelper/types.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
+#include <unotools/fcm.hxx>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -115,7 +116,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
static constexpr struct ServiceNameToImplName
{
- rtl::OUStringConstExpr sServiceName;
+ OUString sServiceName;
const char* pAsciiImplementationName;
} aImplementations[] = {
{ URL_COMPONENT_FORMGRIDVIEW, "org.openoffice.comp.dbu.OFormGridView" },
@@ -177,9 +178,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
if ( xReportModel.is() )
{
xController.set( ReportDesign::create( m_xContext ) );
- xController->attachModel( xReportModel );
- xReportModel->connectController( xController );
- xReportModel->setCurrentController( xController );
+ utl::ConnectModelController(xReportModel, xController);
}
}
@@ -216,7 +215,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
try
{
Reference<XInitialization > xIni(xController,UNO_QUERY);
- PropertyValue aFrame("Frame",0,makeAny(rFrame),PropertyState_DIRECT_VALUE);
+ PropertyValue aFrame("Frame",0,Any(rFrame),PropertyState_DIRECT_VALUE);
Sequence< Any > aInitArgs(m_aArgs.getLength()+1);
Any* pBegin = aInitArgs.getArray();
diff --git a/dbaccess/source/ui/browser/dbtreemodel.hxx b/dbaccess/source/ui/browser/dbtreemodel.hxx
index 2ea11b900975..53a34a8e4247 100644
--- a/dbaccess/source/ui/browser/dbtreemodel.hxx
+++ b/dbaccess/source/ui/browser/dbtreemodel.hxx
@@ -29,9 +29,6 @@
// tables holds the nameaccess for the tables
// table holds the table
-#define CONTAINER_QUERIES sal_uLong( 0 )
-#define CONTAINER_TABLES sal_uLong( 1 )
-
namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace dbaui
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index debc3fa51a67..475768d0f8b8 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -28,8 +28,6 @@
#include "dbtreemodel.hxx"
using namespace ::com::sun::star::frame;
-using namespace ::dbtools;
-using namespace ::svx;
namespace dbaui
{
@@ -56,7 +54,7 @@ OUString SbaTableQueryBrowser::GetEntryText(const weld::TreeIter& rEntry) const
SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType(const weld::TreeIter& rEntry) const
{
const weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rEntry).toUInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
return pEntryData ? pEntryData->eType : etUnknown;
}
diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
index 7d51a5abf8fb..774f43b4c7a4 100644
--- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx
+++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
@@ -31,7 +31,7 @@
#include <connectivity/dbtools.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <svx/dataaccessdescriptor.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/svapp.hxx>
@@ -43,16 +43,8 @@ namespace dbaui
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::form;
- using namespace ::com::sun::star::io;
- using namespace ::com::sun::star::i18n;
- using namespace ::com::sun::star::task;
using namespace ::com::sun::star::datatransfer;
using namespace ::dbtools;
using namespace ::svx;
@@ -232,7 +224,7 @@ namespace dbaui
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
rTreeView.all_foreach([this, &rTreeView](weld::TreeIter& rEntryLoop){
// clear the user data of the tree model
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rEntryLoop).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntryLoop));
if (pData)
{
rTreeView.set_id(rEntryLoop, OUString());
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index c7640e626d20..1beb1b5f2dd7 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -25,11 +25,10 @@
#include <formadapter.hxx>
#include <strings.hxx>
#include <o3tl/any.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
@@ -158,7 +157,7 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
// set its properties
if (xNewColProperties.is())
{
- for (const css::beans::PropertyValue& rControlProp : std::as_const(aControlProps))
+ for (const css::beans::PropertyValue& rControlProp : aControlProps)
{
try
{
@@ -181,7 +180,7 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
nControlPos = 0;
// append the column
- xColContainer->insertByIndex(nControlPos, makeAny(xNewCol));
+ xColContainer->insertByIndex(nControlPos, Any(xNewCol));
}
else if ( aURL.Complete == ".uno:FormSlots/ClearView" )
{
diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx
index bfa6923f9743..24791b44fff5 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -1273,6 +1273,8 @@ void SAL_CALL SbaXFormAdapter::dispose()
xComp->dispose();
}
m_aChildren.clear();
+ m_xMainForm.clear();
+ m_xParent.clear();
}
void SAL_CALL SbaXFormAdapter::addEventListener(const Reference< css::lang::XEventListener >& xListener)
@@ -1323,7 +1325,7 @@ Any SAL_CALL SbaXFormAdapter::getFastPropertyValue(sal_Int32 nHandle)
OSL_ENSURE(xSet.is(), "SAL_CALL SbaXFormAdapter::getFastPropertyValue : have no master form !");
if (m_nNamePropHandle == nHandle)
- return makeAny(m_sName);
+ return Any(m_sName);
return xSet->getFastPropertyValue(nHandle);
}
@@ -1336,7 +1338,7 @@ OUString SAL_CALL SbaXFormAdapter::getName()
void SAL_CALL SbaXFormAdapter::setName(const OUString& aName)
{
- setPropertyValue(PROPERTY_NAME, makeAny(aName));
+ setPropertyValue(PROPERTY_NAME, Any(aName));
}
// css::io::XPersistObject
@@ -1614,7 +1616,7 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU
try
{
if (pNewElName)
- xElementSet->setPropertyValue(PROPERTY_NAME, makeAny(*pNewElName));
+ xElementSet->setPropertyValue(PROPERTY_NAME, Any(*pNewElName));
xElementSet->getPropertyValue(PROPERTY_NAME) >>= sName;
}
@@ -1693,7 +1695,7 @@ Any SAL_CALL SbaXFormAdapter::getByName(const OUString& aName)
{
throw css::container::NoSuchElementException();
}
- return makeAny(m_aChildren[nPos]);
+ return Any(m_aChildren[nPos]);
}
Sequence< OUString > SAL_CALL SbaXFormAdapter::getElementNames()
@@ -1822,7 +1824,7 @@ Any SAL_CALL SbaXFormAdapter::getByIndex(sal_Int32 _rIndex)
throw css::lang::IndexOutOfBoundsException();
Reference< css::form::XFormComponent > xElement = *(m_aChildren.begin() + _rIndex);
- return makeAny(xElement);
+ return Any(xElement);
}
// css::container::XContainer
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 05aabe1855fa..8bde54b54549 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -23,7 +23,7 @@
#include <vcl/weld.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <dbaccess/dataview.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/stdtext.hxx>
#include <framework/titlehelper.hxx>
@@ -37,7 +37,6 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/ui/XSidebarProvider.hpp>
-#include <sfx2/userinputinterception.hxx>
#include <datasourceconnector.hxx>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -57,7 +56,6 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::frame::status;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::task;
@@ -73,32 +71,11 @@ typedef std::unordered_map< sal_Int16, sal_Int16 > CommandHashMap;
namespace dbaui
{
-namespace {
-
-// UserDefinedFeatures
-class UserDefinedFeatures
-{
-public:
- explicit UserDefinedFeatures( const Reference< XController >& _rxController );
-
- void execute( const URL& _rFeatureURL, const Sequence< PropertyValue>& _rArgs );
-
-private:
- css::uno::WeakReference< XController > m_aController;
-};
-
-}
-
-UserDefinedFeatures::UserDefinedFeatures( const Reference< XController >& _rxController )
- :m_aController( _rxController )
-{
-}
-
-void UserDefinedFeatures::execute( const URL& _rFeatureURL, const Sequence< PropertyValue>& _rArgs )
+void OGenericUnoController::executeUserDefinedFeatures( const URL& _rFeatureURL, const Sequence< PropertyValue>& _rArgs )
{
try
{
- Reference< XController > xController( Reference< XController >(m_aController), UNO_SET_THROW );
+ Reference< XController > xController( getXController(), UNO_SET_THROW );
Reference< XDispatchProvider > xDispatchProvider( xController->getFrame(), UNO_QUERY_THROW );
Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch(
_rFeatureURL,
@@ -121,22 +98,10 @@ void UserDefinedFeatures::execute( const URL& _rFeatureURL, const Sequence< Prop
}
}
-// OGenericUnoController_Data
-struct OGenericUnoController_Data
-{
- ::sfx2::UserInputInterception m_aUserInputInterception;
- UserDefinedFeatures m_aUserDefinedFeatures;
-
- OGenericUnoController_Data( OGenericUnoController& _rController, ::osl::Mutex& _rMutex )
- :m_aUserInputInterception( _rController, _rMutex )
- ,m_aUserDefinedFeatures( _rController.getXController() )
- {
- }
-};
-
// OGenericUnoController
OGenericUnoController::OGenericUnoController(const Reference< XComponentContext >& _rM)
:OGenericUnoController_Base( getMutex() )
+ ,m_aUserInputInterception(*this, getMutex())
,m_pView(nullptr)
#ifdef DBG_UTIL
,m_bDescribingSupportedFeatures( false )
@@ -150,12 +115,6 @@ OGenericUnoController::OGenericUnoController(const Reference< XComponentContext
,m_bCurrentlyModified(false)
,m_bExternalTitle(false)
{
- osl_atomic_increment( &m_refCount );
- {
- m_pData.reset( new OGenericUnoController_Data( *this, getMutex() ) );
- }
- osl_atomic_decrement( &m_refCount );
-
try
{
@@ -207,7 +166,7 @@ IMPL_LINK_NOARG(OGenericUnoController, OnAsyncInvalidateAll, void*, void)
InvalidateFeature_Impl();
}
-void OGenericUnoController::impl_initialize()
+void OGenericUnoController::impl_initialize(const ::comphelper::NamedValueCollection& /*rArguments*/)
{
}
@@ -246,7 +205,6 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
throw IllegalArgumentException("Parent window is null", *this, 1 );
}
- m_aInitParameters.assign( aArguments );
Construct( pParentWin );
ODataView* pView = getView();
@@ -256,7 +214,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
if ( m_bReadOnly || m_bPreview )
pView->EnableInput( false );
- impl_initialize();
+ impl_initialize(::comphelper::NamedValueCollection(aArguments));
}
catch(Exception&)
{
@@ -370,11 +328,11 @@ namespace
// #i68216# is the bug which requests to fix the code in Draw which relies on
// framework's implementation details
if ( !!_rFeatureState.sTitle )
- _out_rStates.push_back( makeAny( *_rFeatureState.sTitle ) );
- if ( !!_rFeatureState.bChecked )
- _out_rStates.push_back( makeAny( *_rFeatureState.bChecked ) );
- if ( !!_rFeatureState.bInvisible )
- _out_rStates.push_back( makeAny( Visibility( !*_rFeatureState.bInvisible ) ) );
+ _out_rStates.push_back( Any( *_rFeatureState.sTitle ) );
+ if ( _rFeatureState.bChecked.has_value() )
+ _out_rStates.push_back( Any( *_rFeatureState.bChecked ) );
+ if ( _rFeatureState.bInvisible.has_value() )
+ _out_rStates.push_back( Any( Visibility( !*_rFeatureState.bInvisible ) ) );
if ( _rFeatureState.aValue.hasValue() )
_out_rStates.push_back( _rFeatureState.aValue );
if ( _out_rStates.empty() )
@@ -429,7 +387,7 @@ void OGenericUnoController::ImplBroadcastFeatureState(const OUString& _rFeature,
// it is possible that listeners are registered or revoked while
// we are notifying them, so we must use a copy of m_arrStatusListener, not
// m_arrStatusListener itself
- Dispatch aNotifyLoop( m_arrStatusListener );
+ std::vector<DispatchTarget> aNotifyLoop( m_arrStatusListener );
for (auto const& elem : aNotifyLoop)
{
@@ -459,7 +417,7 @@ void OGenericUnoController::InvalidateFeature_Impl()
bool bEmpty = true;
FeatureListener aNextFeature;
{
- ::osl::MutexGuard aGuard( m_aFeatureMutex);
+ std::unique_lock aGuard( m_aFeatureMutex);
bEmpty = m_aFeaturesToInvalidate.empty();
if (!bEmpty)
aNextFeature = m_aFeaturesToInvalidate.front();
@@ -492,7 +450,7 @@ void OGenericUnoController::InvalidateFeature_Impl()
ImplBroadcastFeatureState( aFeaturePos->first, aNextFeature.xListener, aNextFeature.bForceBroadcast );
}
- ::osl::MutexGuard aGuard( m_aFeatureMutex);
+ std::unique_lock aGuard( m_aFeatureMutex);
m_aFeaturesToInvalidate.pop_front();
bEmpty = m_aFeaturesToInvalidate.empty();
if (!bEmpty)
@@ -521,7 +479,7 @@ void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Referen
bool bWasEmpty;
{
- ::osl::MutexGuard aGuard( m_aFeatureMutex );
+ std::unique_lock aGuard( m_aFeatureMutex );
bWasEmpty = m_aFeaturesToInvalidate.empty();
m_aFeaturesToInvalidate.push_back( aListener );
}
@@ -547,7 +505,7 @@ void OGenericUnoController::InvalidateAll_Impl()
ImplBroadcastFeatureState( supportedFeature.first, nullptr, true );
{
- ::osl::MutexGuard aGuard( m_aFeatureMutex);
+ std::unique_lock aGuard( m_aFeatureMutex);
OSL_ENSURE(m_aFeaturesToInvalidate.size(), "OGenericUnoController::InvalidateAll_Impl: to be called from within InvalidateFeature_Impl only!");
m_aFeaturesToInvalidate.pop_front();
if(!m_aFeaturesToInvalidate.empty())
@@ -653,14 +611,12 @@ void OGenericUnoController::removeStatusListener(const Reference< XStatusListene
{
if (_rURL.Complete.isEmpty())
{
- m_arrStatusListener.erase(std::remove_if(m_arrStatusListener.begin(), m_arrStatusListener.end(),
- [&aListener](const DispatchTarget& rCurrent) { return rCurrent.xListener == aListener; }),
- m_arrStatusListener.end());
+ std::erase_if(m_arrStatusListener, [&aListener](const DispatchTarget& rCurrent) { return rCurrent.xListener == aListener; });
}
else
{
// remove the listener only for the given URL
- Dispatch::iterator iterSearch = std::find_if(m_arrStatusListener.begin(), m_arrStatusListener.end(),
+ auto iterSearch = std::find_if(m_arrStatusListener.begin(), m_arrStatusListener.end(),
[&aListener, &_rURL](const DispatchTarget& rCurrent) {
return (rCurrent.xListener == aListener) && (rCurrent.aURL.Complete == _rURL.Complete); });
if (iterSearch != m_arrStatusListener.end())
@@ -674,18 +630,14 @@ void OGenericUnoController::removeStatusListener(const Reference< XStatusListene
SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find(_rURL.Complete);
if (aIter != m_aSupportedFeatures.end())
{ // clear the cache for that feature
- StateCache::const_iterator aCachePos = m_aStateCache.find( aIter->second.nFeatureId );
+ auto aCachePos = m_aStateCache.find( aIter->second.nFeatureId );
if ( aCachePos != m_aStateCache.end() )
m_aStateCache.erase( aCachePos );
}
// now remove the listener from the deque
- ::osl::MutexGuard aGuard( m_aFeatureMutex );
- m_aFeaturesToInvalidate.erase(
- std::remove_if( m_aFeaturesToInvalidate.begin(),
- m_aFeaturesToInvalidate.end(),
- FindFeatureListener(aListener))
- ,m_aFeaturesToInvalidate.end());
+ std::unique_lock aGuard( m_aFeatureMutex );
+ std::erase_if( m_aFeaturesToInvalidate, FindFeatureListener(aListener));
}
void OGenericUnoController::releaseNumberForComponent()
@@ -707,7 +659,7 @@ void OGenericUnoController::disposing()
{
EventObject aDisposeEvent;
aDisposeEvent.Source = static_cast<XWeak*>(this);
- Dispatch aStatusListener = m_arrStatusListener;
+ std::vector<DispatchTarget> aStatusListener = m_arrStatusListener;
for (auto const& statusListener : aStatusListener)
{
statusListener.xListener->disposing(aDisposeEvent);
@@ -717,7 +669,7 @@ void OGenericUnoController::disposing()
m_xDatabaseContext = nullptr;
{
- ::osl::MutexGuard aGuard( m_aFeatureMutex);
+ std::unique_lock aGuard( m_aFeatureMutex);
m_aAsyncInvalidateAll.CancelCall();
m_aFeaturesToInvalidate.clear();
}
@@ -733,7 +685,6 @@ void OGenericUnoController::disposing()
m_xSlaveDispatcher = nullptr;
m_xTitleHelper.clear();
m_xUrlTransformer.clear();
- m_aInitParameters.clear();
}
void SAL_CALL OGenericUnoController::addEventListener( const Reference< XEventListener >& xListener )
@@ -755,7 +706,7 @@ void OGenericUnoController::frameAction(const FrameActionEvent& aEvent)
m_aCurrentFrame.frameAction( aEvent.Action );
}
-void OGenericUnoController::implDescribeSupportedFeature( const char* _pAsciiCommandURL,
+void OGenericUnoController::implDescribeSupportedFeature( const OUString& _rCommandURL,
sal_uInt16 _nFeatureId, sal_Int16 _nCommandGroup )
{
#ifdef DBG_UTIL
@@ -765,7 +716,7 @@ void OGenericUnoController::implDescribeSupportedFeature( const char* _pAsciiCom
"OGenericUnoController::implDescribeSupportedFeature: invalid feature id!" );
ControllerFeature aFeature;
- aFeature.Command = OUString::createFromAscii( _pAsciiCommandURL );
+ aFeature.Command = _rCommandURL;
aFeature.nFeatureId = _nFeatureId;
aFeature.GroupId = _nCommandGroup;
@@ -815,7 +766,7 @@ void OGenericUnoController::Execute( sal_uInt16 _nId, const Sequence< PropertyVa
// user defined features can be handled by dispatch interceptors resp. protocol handlers only.
// So, we need to do a queryDispatch, and dispatch the URL
- m_pData->m_aUserDefinedFeatures.execute( getURLForId( _nId ), _rArgs );
+ executeUserDefinedFeatures( getURLForId( _nId ), _rArgs );
}
URL OGenericUnoController::getURLForId(sal_Int32 _nId) const
@@ -1102,23 +1053,23 @@ void SAL_CALL OGenericUnoController::removeTitleChangeListener(const Reference<
void SAL_CALL OGenericUnoController::addKeyHandler( const Reference< XKeyHandler >& _rxHandler )
{
if ( _rxHandler.is() )
- m_pData->m_aUserInputInterception.addKeyHandler( _rxHandler );
+ m_aUserInputInterception.addKeyHandler( _rxHandler );
}
void SAL_CALL OGenericUnoController::removeKeyHandler( const Reference< XKeyHandler >& _rxHandler )
{
- m_pData->m_aUserInputInterception.removeKeyHandler( _rxHandler );
+ m_aUserInputInterception.removeKeyHandler( _rxHandler );
}
void SAL_CALL OGenericUnoController::addMouseClickHandler( const Reference< XMouseClickHandler >& _rxHandler )
{
if ( _rxHandler.is() )
- m_pData->m_aUserInputInterception.addMouseClickHandler( _rxHandler );
+ m_aUserInputInterception.addMouseClickHandler( _rxHandler );
}
void SAL_CALL OGenericUnoController::removeMouseClickHandler( const Reference< XMouseClickHandler >& _rxHandler )
{
- m_pData->m_aUserInputInterception.removeMouseClickHandler( _rxHandler );
+ m_aUserInputInterception.removeMouseClickHandler( _rxHandler );
}
void OGenericUnoController::executeChecked(sal_uInt16 _nCommandId, const Sequence< PropertyValue >& aArgs)
@@ -1144,14 +1095,14 @@ Reference< XController > OGenericUnoController::getXController()
bool OGenericUnoController::interceptUserInput( const NotifyEvent& _rEvent )
{
- return m_pData->m_aUserInputInterception.handleNotifyEvent( _rEvent );
+ return m_aUserInputInterception.handleNotifyEvent( _rEvent );
}
bool OGenericUnoController::isCommandChecked(sal_uInt16 _nCommandId) const
{
FeatureState aState = GetState( _nCommandId );
- return aState.bChecked && *aState.bChecked;
+ return aState.bChecked.has_value() && *aState.bChecked;
}
bool OGenericUnoController::isCommandEnabled( const OUString& _rCompleteCommandURL ) const
@@ -1205,6 +1156,11 @@ void SAL_CALL OGenericUnoController::dispose()
{
SolarMutexGuard aSolarGuard;
OGenericUnoController_Base::dispose();
+ m_xUrlTransformer.clear();
+ m_xSlaveDispatcher.clear();
+ m_xMasterDispatcher.clear();
+ m_xDatabaseContext.clear();
+ m_xTitleHelper.clear();
}
weld::Window* OGenericUnoController::getFrameWeld() const
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index d1adbea01ed5..f433eaa3b47b 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/awt/XTextComponent.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <svl/numuno.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -59,12 +59,10 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::view;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::util;
@@ -127,9 +125,9 @@ rtl::Reference<FmXGridPeer> SbaXGridControl::imp_CreatePeer(vcl::Window* pParent
return pReturn;
}
-Any SAL_CALL SbaXGridControl::queryInterface(const Type& _rType)
+Any SAL_CALL SbaXGridControl::queryAggregation(const Type& _rType)
{
- Any aRet = FmXGridControl::queryInterface(_rType);
+ Any aRet = FmXGridControl::queryAggregation(_rType);
return aRet.hasValue() ? aRet : ::cppu::queryInterface(_rType,static_cast<css::frame::XDispatch*>(this));
}
@@ -237,7 +235,6 @@ void SAL_CALL SbaXGridControl::dispose()
// SbaXGridPeer
SbaXGridPeer::SbaXGridPeer(const Reference< XComponentContext >& _rM)
: FmXGridPeer(_rM)
-,m_aStatusListeners(m_aMutex)
{
}
@@ -247,10 +244,11 @@ SbaXGridPeer::~SbaXGridPeer()
void SAL_CALL SbaXGridPeer::dispose()
{
- EventObject aEvt(*this);
-
- m_aStatusListeners.disposeAndClear(aEvt);
-
+ {
+ std::unique_lock g(m_aMutex);
+ EventObject aEvt(*this);
+ m_aStatusListeners.disposeAndClear(g, aEvt);
+ }
FmXGridPeer::dispose();
}
@@ -275,12 +273,13 @@ void SbaXGridPeer::NotifyStatusChanged(const css::util::URL& _rUrl, const Refere
xControl->statusChanged(aEvt);
else
{
- ::comphelper::OInterfaceContainerHelper3<css::frame::XStatusListener> * pIter
- = m_aStatusListeners.getContainer(_rUrl);
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4<css::frame::XStatusListener> * pIter
+ = m_aStatusListeners.getContainer(g, _rUrl);
if (pIter)
{
- pIter->notifyEach( &XStatusListener::statusChanged, aEvt );
+ pIter->notifyEach( g, &XStatusListener::statusChanged, aEvt );
}
}
}
@@ -439,20 +438,24 @@ void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyVa
void SAL_CALL SbaXGridPeer::addStatusListener(const Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL)
{
- ::comphelper::OInterfaceContainerHelper3< css::frame::XStatusListener >* pCont
- = m_aStatusListeners.getContainer(aURL);
- if (!pCont)
- m_aStatusListeners.addInterface(aURL,xControl);
- else
- pCont->addInterface(xControl);
+ {
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4< css::frame::XStatusListener >* pCont
+ = m_aStatusListeners.getContainer(g, aURL);
+ if (!pCont)
+ m_aStatusListeners.addInterface(g, aURL,xControl);
+ else
+ pCont->addInterface(g, xControl);
+ }
NotifyStatusChanged(aURL, xControl);
}
void SAL_CALL SbaXGridPeer::removeStatusListener(const Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL)
{
- ::comphelper::OInterfaceContainerHelper3< css::frame::XStatusListener >* pCont = m_aStatusListeners.getContainer(aURL);
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4< css::frame::XStatusListener >* pCont = m_aStatusListeners.getContainer(g, aURL);
if ( pCont )
- pCont->removeInterface(xControl);
+ pCont->removeInterface(g, xControl);
}
Sequence< Type > SAL_CALL SbaXGridPeer::getTypes()
@@ -462,8 +465,6 @@ Sequence< Type > SAL_CALL SbaXGridPeer::getTypes()
Sequence { cppu::UnoType<css::frame::XDispatch>::get() });
}
-UNO3_GETIMPLEMENTATION2_IMPL(SbaXGridPeer, FmXGridPeer);
-
VclPtr<FmGridControl> SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
{
return VclPtr<SbaGridControl>::Create( m_xContext, pParent, this, nStyle);
@@ -590,7 +591,7 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& r
rMenu.insert_separator(nPos++, "separator2");
}
-void SbaGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OString& rExecutionResult)
+void SbaGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OUString& rExecutionResult)
{
if (rExecutionResult == "colwidth")
static_cast<SbaGridControl*>(GetParent())->SetColWidth(nColId);
@@ -787,7 +788,7 @@ void SbaGridControl::SetBrowserAttrs()
}
}
-void SbaGridControl::PostExecuteRowContextMenu(const OString& rExecutionResult)
+void SbaGridControl::PostExecuteRowContextMenu(const OUString& rExecutionResult)
{
if (rExecutionResult == "tableattr")
SetBrowserAttrs();
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index ee07b531f8b2..889c168247f0 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -82,12 +82,13 @@
#include <svx/dataaccessdescriptor.hxx>
#include <svx/databaseregistrationui.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <tools/multisel.hxx>
#include <tools/urlobj.hxx>
#include <unotools/confignode.hxx>
+#include <utility>
#include <vcl/split.hxx>
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
@@ -110,7 +111,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::form;
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::i18n;
using namespace ::com::sun::star::view;
using namespace ::com::sun::star::datatransfer;
@@ -192,9 +192,9 @@ Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType)
{
if ( _rType.equals( cppu::UnoType<XScriptInvocationContext>::get() ) )
{
- OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::queryInterface: did not initialize this, yet!" );
- if ( !!m_aDocScriptSupport && *m_aDocScriptSupport )
- return makeAny( Reference< XScriptInvocationContext >( this ) );
+ OSL_PRECOND( m_aDocScriptSupport.has_value(), "SbaTableQueryBrowser::queryInterface: did not initialize this, yet!" );
+ if ( m_aDocScriptSupport.has_value() && *m_aDocScriptSupport )
+ return Any( Reference< XScriptInvocationContext >( this ) );
return Any();
}
@@ -211,8 +211,8 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( )
SbaTableQueryBrowser_Base::getTypes()
) );
- OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::getTypes: did not initialize this, yet!" );
- if ( !m_aDocScriptSupport || !*m_aDocScriptSupport )
+ OSL_PRECOND( m_aDocScriptSupport.has_value(), "SbaTableQueryBrowser::getTypes: did not initialize this, yet!" );
+ if ( !m_aDocScriptSupport.has_value() || !*m_aDocScriptSupport )
{
auto [begin, end] = asNonConstRange(aTypes);
auto newEnd = std::remove_if( begin, end,
@@ -416,7 +416,7 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
if ( invalidColumn )
{
// reset the complete order statement at both the row set and the parser
- xRowSetProps->setPropertyValue( PROPERTY_ORDER, makeAny( OUString() ) );
+ xRowSetProps->setPropertyValue( PROPERTY_ORDER, Any( OUString() ) );
xComposer->setOrder( "" );
}
@@ -469,7 +469,7 @@ bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_f
try
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
ENSURE_OR_RETURN_FALSE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" );
ENSURE_OR_RETURN_FALSE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" );
@@ -479,10 +479,10 @@ bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_f
const OUString aTransferProperties[] =
{
- OUString(PROPERTY_APPLYFILTER),
- OUString(PROPERTY_FILTER),
- OUString(PROPERTY_HAVING_CLAUSE),
- OUString(PROPERTY_ORDER)
+ PROPERTY_APPLYFILTER,
+ PROPERTY_FILTER,
+ PROPERTY_HAVING_CLAUSE,
+ PROPERTY_ORDER
};
for (const auto & aTransferProperty : aTransferProperties)
{
@@ -523,9 +523,9 @@ void SbaTableQueryBrowser::initializePreviewMode()
Reference< XPropertySet > xDataSourceSet(getRowSet(), UNO_QUERY);
if ( xDataSourceSet.is() )
{
- xDataSourceSet->setPropertyValue("AllowInserts",makeAny(false));
- xDataSourceSet->setPropertyValue("AllowUpdates",makeAny(false));
- xDataSourceSet->setPropertyValue("AllowDeletes",makeAny(false));
+ xDataSourceSet->setPropertyValue("AllowInserts",Any(false));
+ xDataSourceSet->setPropertyValue("AllowUpdates",Any(false));
+ xDataSourceSet->setPropertyValue("AllowDeletes",Any(false));
}
}
@@ -546,10 +546,10 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
if (m_xCurrentlyDisplayed)
{
Sequence< OUString> aProperties(6 + ( m_bPreview ? 5 : 0 ));
- Sequence< Any> aValues(7 + ( m_bPreview ? 5 : 0 ));
+ Sequence< Any> aValues(6 + ( m_bPreview ? 5 : 0 ));
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
OSL_ENSURE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeGridModel: No table available!" );
if ( !pData->xObjectProperties.is() )
return;
@@ -641,14 +641,14 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
case DataType::BOOLEAN:
{
aCurrentModelType = "CheckBox";
- aInitialValues.emplace_back( "VisualEffect", makeAny( VisualEffect::FLAT ) );
+ aInitialValues.emplace_back( "VisualEffect", Any( VisualEffect::FLAT ) );
sDefaultProperty = PROPERTY_DEFAULTSTATE;
sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN;
OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= nNullable );
aInitialValues.emplace_back(
"TriState",
- makeAny( ColumnValue::NO_NULLS != nNullable )
+ Any( ColumnValue::NO_NULLS != nNullable )
);
if ( ColumnValue::NO_NULLS == nNullable )
aDefault <<= sal_Int16(TRISTATE_FALSE);
@@ -657,7 +657,7 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
case DataType::LONGVARCHAR:
case DataType::CLOB:
- aInitialValues.emplace_back( "MultiLine", makeAny( true ) );
+ aInitialValues.emplace_back( "MultiLine", Any( true ) );
[[fallthrough]];
case DataType::BINARY:
case DataType::VARBINARY:
@@ -675,19 +675,19 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
sDefaultProperty = PROPERTY_EFFECTIVEDEFAULT;
if ( xSupplier.is() )
- aInitialValues.emplace_back( "FormatsSupplier", makeAny( xSupplier ) );
- aInitialValues.emplace_back( "TreatAsNumber", makeAny( bFormattedIsNumeric ) );
+ aInitialValues.emplace_back( "FormatsSupplier", Any( xSupplier ) );
+ aInitialValues.emplace_back( "TreatAsNumber", Any( bFormattedIsNumeric ) );
aCopyProperties.emplace_back(PROPERTY_FORMATKEY );
break;
}
- aInitialValues.emplace_back( PROPERTY_CONTROLSOURCE, makeAny( rName ) );
+ aInitialValues.emplace_back( PROPERTY_CONTROLSOURCE, Any( rName ) );
OUString sLabel;
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
if ( !sLabel.isEmpty() )
- aInitialValues.emplace_back( PROPERTY_LABEL, makeAny( sLabel ) );
+ aInitialValues.emplace_back( PROPERTY_LABEL, Any( sLabel ) );
else
- aInitialValues.emplace_back( PROPERTY_LABEL, makeAny( rName ) );
+ aInitialValues.emplace_back( PROPERTY_LABEL, Any( rName ) );
Reference< XPropertySet > xGridCol( xColFactory->createColumn( aCurrentModelType ), UNO_SET_THROW );
Reference< XPropertySetInfo > xGridColPSI( xGridCol->getPropertySetInfo(), UNO_SET_THROW );
@@ -734,7 +734,7 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
// don't allow the mouse to scroll in the cells
if ( xGridColPSI->hasPropertyByName( PROPERTY_MOUSE_WHEEL_BEHAVIOR ) )
- aInitialValues.emplace_back( PROPERTY_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) );
+ aInitialValues.emplace_back( PROPERTY_MOUSE_WHEEL_BEHAVIOR, Any( MouseWheelBehavior::SCROLL_DISABLED ) );
// now set all those values
for (auto const& property : aInitialValues)
@@ -744,7 +744,7 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
for (auto const& copyPropertyName : aCopyProperties)
xGridCol->setPropertyValue( copyPropertyName, xColumn->getPropertyValue(copyPropertyName) );
- xColContainer->insertByName(rName, makeAny(xGridCol));
+ xColContainer->insertByName(rName, Any(xGridCol));
}
}
}
@@ -761,7 +761,7 @@ static Reference<XPropertySet> getColumnHelper(const weld::TreeView& rTreeView,
Reference<XPropertySet> xRet;
if (pCurrentlyDisplayed)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pCurrentlyDisplayed));
Reference<XColumnsSupplier> xColumnsSup(pData->xObjectProperties,UNO_QUERY);
Reference<XNameAccess> xNames = xColumnsSup->getColumns();
OUString aName;
@@ -777,7 +777,7 @@ void SbaTableQueryBrowser::transferChangedControlProperty(const OUString& _rProp
if (m_xCurrentlyDisplayed)
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
Reference< XPropertySet > xObjectProps = pData->xObjectProperties;
OSL_ENSURE(xObjectProps.is(),"SbaTableQueryBrowser::transferChangedControlProperty: no table/query object!");
if (xObjectProps.is())
@@ -805,7 +805,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
if(xProp.is())
{
if(!evt.NewValue.hasValue())
- xProp->setPropertyValue(PROPERTY_WIDTH,makeAny(sal_Int32(227)));
+ xProp->setPropertyValue(PROPERTY_WIDTH,Any(sal_Int32(227)));
else
xProp->setPropertyValue(PROPERTY_WIDTH,evt.NewValue);
}
@@ -831,12 +831,12 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
{
sal_Int16 nAlign = 0;
if(evt.NewValue >>= nAlign)
- xProp->setPropertyValue(PROPERTY_ALIGN,makeAny(sal_Int32(nAlign)));
+ xProp->setPropertyValue(PROPERTY_ALIGN,Any(sal_Int32(nAlign)));
else
xProp->setPropertyValue(PROPERTY_ALIGN,evt.NewValue);
}
else
- xProp->setPropertyValue(PROPERTY_ALIGN,makeAny(css::awt::TextAlign::LEFT));
+ xProp->setPropertyValue(PROPERTY_ALIGN,Any(css::awt::TextAlign::LEFT));
}
}
catch( const Exception& )
@@ -862,12 +862,12 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
{
if (m_xCurrentlyDisplayed)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
OSL_ENSURE( pData->xObjectProperties.is(), "No table available!" );
bool bDefault = !evt.NewValue.hasValue();
if (bDefault)
- pData->xObjectProperties->setPropertyValue(PROPERTY_ROW_HEIGHT,makeAny(sal_Int32(45)));
+ pData->xObjectProperties->setPropertyValue(PROPERTY_ROW_HEIGHT,Any(sal_Int32(45)));
else
pData->xObjectProperties->setPropertyValue(PROPERTY_ROW_HEIGHT,evt.NewValue);
}
@@ -1037,7 +1037,7 @@ namespace
struct FilterByEntryDataId : public IEntryFilter
{
OUString sId;
- explicit FilterByEntryDataId( const OUString& _rId ) : sId( _rId ) { }
+ explicit FilterByEntryDataId( OUString _aId ) : sId(std::move( _aId )) { }
virtual ~FilterByEntryDataId() {}
@@ -1054,7 +1054,7 @@ namespace
OUString SbaTableQueryBrowser::getDataSourceAccessor(const weld::TreeIter& rDataSourceEntry) const
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry));
OSL_ENSURE( pData, "SbaTableQueryBrowser::getDataSourceAccessor: invalid entry data!" );
OSL_ENSURE( pData->eType == etDatasource, "SbaTableQueryBrowser::getDataSourceAccessor: entry does not denote a data source!" );
return !pData->sAccessor.isEmpty() ? pData->sAccessor : GetEntryText(rDataSourceEntry);
@@ -1167,7 +1167,7 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getObjectEntry(const OUStr
{
if (ensureEntryObject(*xObject))
{
- DBTreeListUserData* pParentData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xObject).toUInt64());
+ DBTreeListUserData* pParentData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xObject));
Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY );
sal_Int32 nIndex2 = nIndex;
sPath = _rCommand.getToken( 0, '/', nIndex2 );
@@ -1239,13 +1239,13 @@ void SbaTableQueryBrowser::connectExternalDispatches()
ID_BROWSER_INSERTCONTENT
};
- for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i )
+ for ( size_t i=0; i < std::size( pURLs ); ++i )
{
URL aURL;
aURL.Complete = OUString::createFromAscii( pURLs[i] );
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aURL );
- m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( aURL );
+ m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( std::move(aURL) );
}
}
@@ -1345,7 +1345,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const css::lang::EventObject& _rS
{
do
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDSLoop).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSLoop));
if ( pData && pData->xConnection == xCon )
{
// we set the connection to null to avoid a second disposing of the connection
@@ -1645,7 +1645,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(xCurrentEntry.get());
DBTreeListUserData* pDSData
= xDataSourceEntry
- ? reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry).toUInt64())
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry))
: nullptr;
if ( nId == ID_TREE_CLOSE_CONN )
@@ -2034,7 +2034,7 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString&
pDSData->eType = etDatasource;
pDSData->sAccessor = sDataSourceId;
pDSData->xConnection = _rxConnection;
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pDSData)));
+ OUString sId(weld::toId(pDSData));
std::unique_ptr<weld::TreeIter> xDatasourceEntry(rTreeView.make_iterator());
rTreeView.insert(nullptr, -1, &sDSDisplayName, &sId, nullptr, nullptr, false, xDatasourceEntry.get());
@@ -2045,7 +2045,7 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString&
{
DBTreeListUserData* pQueriesData = new DBTreeListUserData;
pQueriesData->eType = etQueryContainer;
- sId = OUString::number(reinterpret_cast<sal_uInt64>(pQueriesData));
+ sId = weld::toId(pQueriesData);
std::unique_ptr<weld::TreeIter> xRet(rTreeView.make_iterator());
rTreeView.insert(xDatasourceEntry.get(), -1, &_rQueryName, &sId,
@@ -2058,7 +2058,7 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString&
{
DBTreeListUserData* pTablesData = new DBTreeListUserData;
pTablesData->eType = etTableContainer;
- sId = OUString::number(reinterpret_cast<sal_uInt64>(pTablesData));
+ sId = weld::toId(pTablesData);
std::unique_ptr<weld::TreeIter> xRet(rTreeView.make_iterator());
rTreeView.insert(xDatasourceEntry.get(), -1, &_rTableName, &sId,
@@ -2089,7 +2089,7 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
rTreeView.make_unsorted();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rParent).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
if (pData) // don't ask if the nameaccess is already set see OnExpandEntry views and tables
pData->xContainer = _xNameAccess;
@@ -2120,7 +2120,7 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
rTreeView.make_sorted();
}
-std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implAppendEntry(const weld::TreeIter* pParent, const OUString& rName, DBTreeListUserData* pUserData)
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implAppendEntry(const weld::TreeIter* pParent, const OUString& rName, const DBTreeListUserData* pUserData)
{
EntryType eEntryType = pUserData->eType;
@@ -2128,7 +2128,7 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implAppendEntry(const weld
OUString aImage = xImageProvider->getImageId(rName, getDatabaseObjectType(eEntryType));
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pUserData)));
+ OUString sId(weld::toId(pUserData));
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
std::unique_ptr<weld::TreeIter> xNewEntry(rTreeView.make_iterator());
rTreeView.insert(pParent, -1, &rName, &sId, nullptr, nullptr, eEntryType == etQueryContainer, xNewEntry.get());
@@ -2150,7 +2150,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, const weld::TreeIter&, rParent, b
std::unique_ptr<weld::TreeIter> xFirstParent = m_pTreeView->GetRootLevelParent(&rParent);
OSL_ENSURE(xFirstParent,"SbaTableQueryBrowser::OnExpandEntry: No rootlevelparent!");
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rParent).toInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
assert(pData && "SbaTableQueryBrowser::OnExpandEntry: No user data!");
if (etTableContainer == pData->eType)
@@ -2238,7 +2238,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, const weld::TreeIter&, rParent, b
// we have to expand the queries or bookmarks
if (ensureEntryObject(rParent))
{
- DBTreeListUserData* pParentData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rParent).toUInt64());
+ DBTreeListUserData* pParentData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY );
populateTree(xCollection, rParent, etQuery);
}
@@ -2252,7 +2252,7 @@ bool SbaTableQueryBrowser::ensureEntryObject(const weld::TreeIter& rEntry)
// the user data of the entry
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rEntry).toUInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
OSL_ENSURE(pEntryData,"ensureEntryObject: user data should already be set!");
std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(&rEntry);
@@ -2275,7 +2275,7 @@ bool SbaTableQueryBrowser::ensureEntryObject(const weld::TreeIter& rEntry)
if (rTreeView.iter_compare(*xParent, *xDataSourceEntry) != 0)
{
OUString aName(rTreeView.get_text(rEntry));
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xParent).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xParent));
try
{
Reference< XNameAccess > xNameAccess(pData->xContainer,UNO_QUERY);
@@ -2347,17 +2347,17 @@ bool SbaTableQueryBrowser::implLoadAnything(const OUString& _rDataSourceName, co
Reference<XPropertySet> xProp( getRowSet(), UNO_QUERY_THROW );
Reference< XLoadable > xLoadable( xProp, UNO_QUERY_THROW );
// the values allowing the RowSet to re-execute
- xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName));
+ xProp->setPropertyValue(PROPERTY_DATASOURCENAME, Any(_rDataSourceName));
if(_rxConnection.is())
- xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) );
+ xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( _rxConnection.getTyped() ) );
// set this _before_ setting the connection, else the rowset would rebuild it ...
- xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(nCommandType));
- xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand));
- xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, css::uno::makeAny(_bEscapeProcessing));
+ xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, Any(nCommandType));
+ xProp->setPropertyValue(PROPERTY_COMMAND, Any(_rCommand));
+ xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, css::uno::Any(_bEscapeProcessing));
if ( m_bPreview )
{
- xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD));
+ xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, Any(FetchDirection::FORWARD));
}
// the formatter depends on the data source we're working on, so rebuild it here ...
@@ -2482,11 +2482,11 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implGetConnectionEntry(con
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
std::unique_ptr<weld::TreeIter> xCurrentEntry(rTreeView.make_iterator(&rEntry));
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry).toInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry));
while (pEntryData->eType != etDatasource)
{
rTreeView.iter_parent(*xCurrentEntry);
- pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry).toInt64());
+ pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry));
}
return xCurrentEntry;
}
@@ -2497,7 +2497,7 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
return false;
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pEntry).toUInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pEntry));
switch (pEntryData->eType)
{
case etTableOrView:
@@ -2513,11 +2513,11 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
// get the entry for the tables or queries
std::unique_ptr<weld::TreeIter> xContainer = rTreeView.make_iterator(pEntry);
rTreeView.iter_parent(*xContainer);
- DBTreeListUserData* pContainerData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xContainer).toUInt64());
+ DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
// get the entry for the datasource
std::unique_ptr<weld::TreeIter> xConnection = implGetConnectionEntry(*xContainer);
- DBTreeListUserData* pConData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xConnection).toUInt64());
+ DBTreeListUserData* pConData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xConnection));
// reinitialize the rowset
// but first check if it is necessary
@@ -2540,8 +2540,7 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
{
while (rTreeView.iter_compare(*xNextTemp, *xConnection) != 0)
{
- sNameBuffer.insert(0,'/');
- sNameBuffer.insert(0, rTreeView.get_text(*xTemp));
+ sNameBuffer.insert(0, rTreeView.get_text(*xTemp) + "/");
rTreeView.copy_iterator(*xNextTemp, *xTemp);
if (!rTreeView.iter_parent(*xNextTemp))
break;
@@ -2624,7 +2623,7 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
bool bEscapeProcessing = true;
if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName))
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pEntry).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pEntry));
if ( !pData->xObjectProperties.is() )
{
Reference<XInterface> xObject;
@@ -2725,14 +2724,14 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getEntryFromContainer(cons
if (rTreeView.iter_children(*xContainer))
{
// 1st child is queries
- DBTreeListUserData* pQueriesData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xContainer).toUInt64());
+ DBTreeListUserData* pQueriesData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
if (pQueriesData && pQueriesData->xContainer == rxNameAccess)
break;
if (rTreeView.iter_next_sibling(*xContainer))
{
// 2nd child is tables
- DBTreeListUserData* pTablesData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xContainer).toUInt64());
+ DBTreeListUserData* pTablesData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
if (pTablesData && pTablesData->xContainer == rxNameAccess)
break;
}
@@ -2759,7 +2758,7 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted(const ContainerEvent& rEvent
rTreeView.make_unsorted();
// insert the new entry into the tree
- DBTreeListUserData* pContainerData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xEntry).toUInt64());
+ DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xEntry));
OSL_ENSURE(pContainerData, "elementInserted: There must be user data for this type!");
DBTreeListUserData* pNewData = new DBTreeListUserData;
@@ -2824,7 +2823,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// unload
unloadAndCleanup( false ); // don't dispose the connection
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xTemp).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xTemp));
rTreeView.set_id(*xTemp, OUString());
delete pData; // the data could be null because we have a table which isn't correct
rTreeView.remove(*xTemp);
@@ -2839,7 +2838,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
{
if (rTreeView.get_text(*xChild) == aName)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xChild).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xChild));
rTreeView.set_id(*xChild, OUString());
delete pData;
rTreeView.remove(*xChild);
@@ -2875,7 +2874,7 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
std::unique_ptr<weld::TreeIter> xTemp = rTreeView.make_iterator(m_xCurrentlyDisplayed.get());
unloadAndCleanup( false ); // don't dispose the connection
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xTemp).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xTemp));
if (pData)
{
if ( etTableOrView == pData->eType )
@@ -2900,7 +2899,7 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
{
if (rTreeView.get_text(*xChild) == aName)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xChild).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xChild));
if (pData)
{
if ( etTableOrView == pData->eType )
@@ -2968,7 +2967,7 @@ void SbaTableQueryBrowser::disposeConnection(const weld::TreeIter* pDSEntry)
if (pDSEntry)
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pTreeListData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pDSEntry).toUInt64());
+ DBTreeListUserData* pTreeListData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pDSEntry));
if (pTreeListData)
impl_releaseConnection(pTreeListData->xConnection);
}
@@ -3004,7 +3003,7 @@ void SbaTableQueryBrowser::closeConnection(const weld::TreeIter& rDSEntry, bool
{
std::unique_ptr<weld::TreeIter> xRemove(rTreeView.make_iterator(xElements.get()));
bElements = rTreeView.iter_next_sibling(*xElements);
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xRemove).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xRemove));
rTreeView.set_id(*xRemove, OUString());
delete pData;
rTreeView.remove(*xRemove);
@@ -3095,13 +3094,13 @@ namespace
}
}
-void SbaTableQueryBrowser::impl_initialize()
+void SbaTableQueryBrowser::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
SolarMutexGuard aGuard;
// doin' a lot of VCL stuff here -> lock the SolarMutex
// first initialize the parent
- SbaXDataBrowserController::impl_initialize();
+ SbaXDataBrowserController::impl_initialize(rArguments);
Reference<XConnection> xForeignConnection;
Reference< XFrame > xFrame;
@@ -3113,8 +3112,6 @@ void SbaTableQueryBrowser::impl_initialize()
OUString sInitialDataSourceName;
OUString sInitialCommand;
- const NamedValueCollection& rArguments( getInitParams() );
-
rArguments.get_ensureType( PROPERTY_DATASOURCENAME, sInitialDataSourceName );
rArguments.get_ensureType( PROPERTY_COMMAND_TYPE, nInitialDisplayCommandType );
rArguments.get_ensureType( PROPERTY_COMMAND, sInitialCommand );
@@ -3252,9 +3249,9 @@ void SbaTableQueryBrowser::impl_initialize()
try
{
Reference< XPropertySet > xRowSetProps(getRowSet(), UNO_QUERY);
- xRowSetProps->setPropertyValue(PROPERTY_UPDATE_CATALOGNAME,makeAny(aCatalogName));
- xRowSetProps->setPropertyValue(PROPERTY_UPDATE_SCHEMANAME,makeAny(aSchemaName));
- xRowSetProps->setPropertyValue(PROPERTY_UPDATE_TABLENAME,makeAny(aTableName));
+ xRowSetProps->setPropertyValue(PROPERTY_UPDATE_CATALOGNAME,Any(aCatalogName));
+ xRowSetProps->setPropertyValue(PROPERTY_UPDATE_SCHEMANAME,Any(aSchemaName));
+ xRowSetProps->setPropertyValue(PROPERTY_UPDATE_TABLENAME,Any(aTableName));
}
catch(const Exception&)
@@ -3306,7 +3303,7 @@ bool SbaTableQueryBrowser::ensureConnection(const weld::TreeIter* pAnyEntry, Sha
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData =
xDSEntry
- ? reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry).toUInt64())
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry))
: nullptr;
return ensureConnection(xDSEntry.get(), pDSData, rConnection);
@@ -3327,7 +3324,7 @@ bool SbaTableQueryBrowser::getExistentConnectionFor(const weld::TreeIter* pAnyEn
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData =
xDSEntry
- ? reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry).toUInt64())
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry))
: nullptr;
if (pDSData)
rConnection = pDSData->xConnection;
@@ -3523,7 +3520,7 @@ Any SbaTableQueryBrowser::getCurrentSelection(weld::TreeView& rControl) const
return Any();
NamedDatabaseObject aSelectedObject;
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xSelected).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xSelected));
aSelectedObject.Type = static_cast< sal_Int32 >( pData->eType );
switch ( aSelectedObject.Type )
@@ -3544,7 +3541,7 @@ Any SbaTableQueryBrowser::getCurrentSelection(weld::TreeView& rControl) const
break;
}
- return makeAny( aSelectedObject );
+ return Any( aSelectedObject );
}
vcl::Window* SbaTableQueryBrowser::getMenuParent() const
@@ -3781,14 +3778,14 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry(std::u16string_view rData
do
{
// delete any user data of the child entries of the to-be-removed entry
- const DBTreeListUserData* pData = reinterpret_cast<const DBTreeListUserData*>(rTreeView.get_id(*xChild).toUInt64());
+ const DBTreeListUserData* pData = weld::fromId<const DBTreeListUserData*>(rTreeView.get_id(*xChild));
rTreeView.set_id(*xChild, OUString());
delete pData;
} while (rTreeView.iter_next_sibling(*xChild));
}
// remove the entry
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry));
rTreeView.set_id(*xDataSourceEntry, OUString());
delete pData;
rTreeView.remove(*xDataSourceEntry);
diff --git a/dbaccess/source/ui/control/ColumnControlWindow.cxx b/dbaccess/source/ui/control/ColumnControlWindow.cxx
index 7a419a6cfb8c..f9f786f22ec3 100644
--- a/dbaccess/source/ui/control/ColumnControlWindow.cxx
+++ b/dbaccess/source/ui/control/ColumnControlWindow.cxx
@@ -21,6 +21,7 @@
#include <unotools/syslocale.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <connectivity/dbtools.hxx>
+#include <o3tl/safeint.hxx>
#include <UITools.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
@@ -121,7 +122,7 @@ Reference< XNumberFormatter > OColumnControlWindow::GetFormatter() const
TOTypeInfoSP OColumnControlWindow::getTypeInfo(sal_Int32 _nPos)
{
- return ( _nPos >= 0 && _nPos < static_cast<sal_Int32>(m_aDestTypeInfoIndex.size())) ? m_aDestTypeInfoIndex[_nPos]->second : TOTypeInfoSP();
+ return ( _nPos >= 0 && o3tl::make_unsigned(_nPos) < m_aDestTypeInfoIndex.size()) ? m_aDestTypeInfoIndex[_nPos]->second : TOTypeInfoSP();
}
const OTypeInfoMap* OColumnControlWindow::getTypeInfo() const
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index c11c6770b65e..f341482ea92f 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -20,7 +20,7 @@
#include <core_resource.hxx>
#include <FieldDescControl.hxx>
#include <FieldControls.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <TableDesignHelpBar.hxx>
#include <vcl/svapp.hxx>
#include <FieldDescriptions.hxx>
@@ -164,27 +164,28 @@ void OFieldDescControl::Init()
void OFieldDescControl::SetReadOnly( bool bReadOnly )
{
// Enable/disable Controls
- OWidgetBase* ppAggregates[] = { m_xRequired.get(), m_xNumType.get()
- , m_xAutoIncrement.get(), m_xDefault.get()
- , m_xTextLen.get(), m_xLength.get()
- , m_xScale.get(), m_xColumnName.get()
- , m_xType.get(), m_xAutoIncrementValue.get()
- };
- weld::Widget* ppAggregatesText[] = { m_xRequiredText.get(), m_xNumTypeText.get()
- , m_xAutoIncrementText.get(), m_xDefaultText.get()
- , m_xTextLenText.get(), m_xLengthText.get()
- , m_xScaleText.get(), m_xColumnNameText.get()
- , m_xTypeText.get(), m_xAutoIncrementValueText.get()
- };
-
- OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!");
-
- for (size_t i=0; i<SAL_N_ELEMENTS(ppAggregates); ++i)
+ struct final
{
- if ( ppAggregatesText[i] )
- ppAggregatesText[i]->set_sensitive( !bReadOnly );
- if ( ppAggregates[i] )
- ppAggregates[i]->set_sensitive( !bReadOnly );
+ OWidgetBase * aggregate;
+ weld::Widget * text;
+ } const aggregates[] = {
+ {m_xRequired.get(), m_xRequiredText.get()}
+ , {m_xNumType.get(), m_xNumTypeText.get()}
+ , {m_xAutoIncrement.get(), m_xAutoIncrementText.get()}
+ , {m_xDefault.get(), m_xDefaultText.get()}
+ , {m_xTextLen.get(), m_xTextLenText.get()}
+ , {m_xLength.get(), m_xLengthText.get()}
+ , {m_xScale.get(), m_xScaleText.get()}
+ , {m_xColumnName.get(), m_xColumnNameText.get()}
+ , {m_xType.get(), m_xTypeText.get()}
+ , {m_xAutoIncrementValue.get(), m_xAutoIncrementValueText.get()}};
+
+ for (auto const & aggregate: aggregates)
+ {
+ if (aggregate.text)
+ aggregate.text->set_sensitive(!bReadOnly);
+ if (aggregate.aggregate)
+ aggregate.aggregate->set_sensitive(!bReadOnly);
}
if (m_xFormat)
@@ -584,7 +585,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
}
}
-void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OString& _sHelpId,bool _bAddChangeHandler)
+void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OUString& _sHelpId,bool _bAddChangeHandler)
{
if ( _bAddChangeHandler )
_pControl->GetComboBox().connect_changed(LINK(this,OFieldDescControl,ChangeHdl));
@@ -592,7 +593,7 @@ void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OStr
InitializeControl(_pControl->GetWidget(), _sHelpId);
}
-void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString& _sHelpId)
+void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OUString& _sHelpId)
{
pControl->set_help_id(_sHelpId);
pControl->connect_focus_in(LINK(this, OFieldDescControl, OnControlFocusGot));
@@ -605,7 +606,7 @@ void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString&
}
}
-std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, TranslateId pHelpId, short _nProperty, const OString& _sHelpId)
+std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OUString& rId, TranslateId pHelpId, short _nProperty, const OUString& _sHelpId)
{
auto xControl = std::make_unique<OPropNumericEditCtrl>(
m_xBuilder->weld_spin_button(rId), pHelpId, _nProperty);
@@ -914,7 +915,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
else
m_xBoolDefault->set_active_text(sDef);
- pFieldDescr->SetControlDefault(makeAny(BoolStringPersistent(m_xBoolDefault->get_active_text())));
+ pFieldDescr->SetControlDefault(Any(BoolStringPersistent(m_xBoolDefault->get_active_text())));
}
else if (m_xBoolDefault->get_count() < 3)
{
@@ -1115,7 +1116,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
}
if ( !sDefault.isEmpty() )
- pFieldDescr->SetControlDefault(makeAny(sDefault));
+ pFieldDescr->SetControlDefault(Any(sDefault));
else
pFieldDescr->SetControlDefault(Any());
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index fc8bca178725..cedd116575b2 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -21,7 +21,7 @@
#include <svtools/editbrowsebox.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <TableConnectionData.hxx>
#include <TableConnection.hxx>
@@ -46,7 +46,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace svt;
@@ -184,9 +183,9 @@ namespace dbaui
bool ORelationControl::PreNotify(NotifyEvent& rNEvt)
{
- if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() && !ControlHasFocus())
+ if (rNEvt.GetType() == NotifyEventType::LOSEFOCUS && !HasChildPathFocus() && !ControlHasFocus())
PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate), nullptr, true);
- else if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ else if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
PostUserEvent(LINK(this, ORelationControl, AsynchActivate), nullptr, true);
return EditBrowseBox::PreNotify(rNEvt);
@@ -223,7 +222,7 @@ namespace dbaui
OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList();
if ( rLines.size() <= o3tl::make_unsigned(nRow) )
{
- rLines.push_back(new OConnectionLineData());
+ rLines.emplace_back(new OConnectionLineData());
nRow = rLines.size() - 1;
// add new past-rLines row
m_ops.emplace_back(INSERT, make_pair(nRow+1, nRow+2));
@@ -285,7 +284,7 @@ namespace dbaui
void ORelationControl::InitController( CellControllerRef& /*rController*/, sal_Int32 nRow, sal_uInt16 nColumnId )
{
- OString sHelpId( HID_RELATIONDIALOG_LEFTFIELDCELL );
+ OUString sHelpId( HID_RELATIONDIALOG_LEFTFIELDCELL );
Reference< XPropertySet> xDef;
switch ( getColumnIdent(nColumnId) )
diff --git a/dbaccess/source/ui/control/SqlNameEdit.cxx b/dbaccess/source/ui/control/SqlNameEdit.cxx
index 89c0afc0bda1..9ac58cfda851 100644
--- a/dbaccess/source/ui/control/SqlNameEdit.cxx
+++ b/dbaccess/source/ui/control/SqlNameEdit.cxx
@@ -21,33 +21,33 @@
namespace dbaui
{
- static bool isCharOk(sal_Unicode _cChar,bool _bFirstChar, const OUString& _sAllowedChars)
+ static bool isCharOk(sal_Unicode _cChar,bool _bFirstChar, std::u16string_view _sAllowedChars)
{
return (
(_cChar >= 'A' && _cChar <= 'Z') ||
_cChar == '_' ||
- _sAllowedChars.indexOf(_cChar) != -1 ||
+ _sAllowedChars.find(_cChar) != std::u16string_view::npos ||
(!_bFirstChar && (_cChar >= '0' && _cChar <= '9')) ||
(_cChar >= 'a' && _cChar <= 'z')
);
}
- bool OSQLNameChecker::checkString(const OUString& _sToCheck,
+ bool OSQLNameChecker::checkString(std::u16string_view _sToCheck,
OUString& _rsCorrected)
{
bool bCorrected = false;
if ( m_bCheck )
{
sal_Int32 nMatch = 0;
- for (sal_Int32 i = nMatch; i < _sToCheck.getLength(); ++i)
+ for (size_t i = nMatch; i < _sToCheck.size(); ++i)
{
if ( !isCharOk( _sToCheck[i], i == 0, m_sAllowedChars ) )
{
- _rsCorrected += _sToCheck.subView(nMatch, i - nMatch);
+ _rsCorrected += _sToCheck.substr(nMatch, i - nMatch);
bCorrected = true;
nMatch = i + 1;
}
}
- _rsCorrected += _sToCheck.subView( nMatch );
+ _rsCorrected += _sToCheck.substr( nMatch );
}
return bCorrected;
}
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index f4826e96d281..607c0199729a 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -151,14 +151,14 @@ void OTableGrantControl::Init()
bool OTableGrantControl::PreNotify(NotifyEvent& rNEvt)
{
- if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS)
+ if (rNEvt.GetType() == NotifyEventType::LOSEFOCUS)
if (!HasChildPathFocus())
{
if (m_nDeactivateEvent)
Application::RemoveUserEvent(m_nDeactivateEvent);
m_nDeactivateEvent = Application::PostUserEvent(LINK(this, OTableGrantControl, AsynchDeactivate), nullptr, true);
}
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
{
if (m_nDeactivateEvent)
Application::RemoveUserEvent(m_nDeactivateEvent);
diff --git a/dbaccess/source/ui/control/charsetlistbox.cxx b/dbaccess/source/ui/control/charsetlistbox.cxx
index 8915b65c9455..f9866905c3ea 100644
--- a/dbaccess/source/ui/control/charsetlistbox.cxx
+++ b/dbaccess/source/ui/control/charsetlistbox.cxx
@@ -34,7 +34,7 @@ namespace dbaui
}
}
- void CharSetListBox::SelectEntryByIanaName( const OUString& _rIanaName )
+ void CharSetListBox::SelectEntryByIanaName( std::u16string_view _rIanaName )
{
OCharsetDisplay::const_iterator aFind = m_aCharSets.findIanaName( _rIanaName );
if (aFind == m_aCharSets.end())
@@ -49,7 +49,7 @@ namespace dbaui
m_xControl->set_active_text((*aFind).getDisplayName());
}
- bool CharSetListBox::StoreSelectedCharSet( SfxItemSet& _rSet, const sal_uInt16 _nItemId )
+ bool CharSetListBox::StoreSelectedCharSet( SfxItemSet& _rSet, TypedWhichId<SfxStringItem> _nItemId )
{
bool bChangedSomething = false;
if (m_xControl->get_value_changed_from_saved())
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 55db602c5ea9..be900d650f63 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -36,6 +36,7 @@
#include <toolkit/awt/vclxmenu.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <svx/dbaobjectex.hxx>
+#include <utility>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
@@ -186,20 +187,28 @@ TreeListBox::~TreeListBox()
std::unique_ptr<weld::TreeIter> TreeListBox::GetEntryPosByName(std::u16string_view aName, const weld::TreeIter* pStart, const IEntryFilter* _pFilter) const
{
auto xEntry(m_xTreeView->make_iterator(pStart));
- if (!pStart && !m_xTreeView->get_iter_first(*xEntry))
- return nullptr;
+ if (pStart)
+ {
+ if (!m_xTreeView->iter_children(*xEntry))
+ return nullptr;
+ }
+ else
+ {
+ if (!m_xTreeView->get_iter_first(*xEntry))
+ return nullptr;
+ }
do
{
if (m_xTreeView->get_text(*xEntry) == aName)
{
- if (!_pFilter || _pFilter->includeEntry(reinterpret_cast<void*>(m_xTreeView->get_id(*xEntry).toUInt64())))
+ if (!_pFilter || _pFilter->includeEntry(weld::fromId<void*>(m_xTreeView->get_id(*xEntry))))
{
// found
return xEntry;
}
}
- } while (m_xTreeView->iter_next(*xEntry));
+ } while (m_xTreeView->iter_next_sibling(*xEntry));
return nullptr;
}
@@ -285,7 +294,7 @@ IMPL_LINK(TreeListBox, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
{
OUString sQuickHelpText;
if (m_pActionListener &&
- m_pActionListener->requestQuickHelp(reinterpret_cast<void*>(m_xTreeView->get_id(rIter).toUInt64()), sQuickHelpText))
+ m_pActionListener->requestQuickHelp(weld::fromId<void*>(m_xTreeView->get_id(rIter)), sQuickHelpText))
{
return sQuickHelpText;
}
@@ -300,8 +309,8 @@ namespace
class SelectionSupplier : public SelectionSupplier_Base
{
public:
- explicit SelectionSupplier( const Any& _rSelection )
- :m_aSelection( _rSelection )
+ explicit SelectionSupplier( Any _aSelection )
+ :m_aSelection(std::move( _aSelection ))
{
}
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index bf958d4a30b7..3847df5f54d0 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -143,9 +143,8 @@ namespace dbaui
OUString sURL = rHistoryItem.sURL;
OUString sFilter = rHistoryItem.sFilter;
OUString sTitle = rHistoryItem.sTitle;
- OUString sPassword = rHistoryItem.sPassword;
- // If the entry is an impress file then insert it into the
+ // If the entry is a Base file then insert it into the
// history list and the list box.
Sequence< PropertyValue > aProps;
xFilterFactory->getByName( sFilter ) >>= aProps;
@@ -158,9 +157,6 @@ namespace dbaui
// yes, it's a Base document
INetURLObject aURL;
aURL.SetSmartURL( sURL );
- // The password is set only when it is not empty.
- if ( !sPassword.isEmpty() )
- aURL.SetPass( sPassword );
if ( sTitle.isEmpty() )
sTitle = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::Unambiguous );
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index 5ebb87152684..4d00c32293d2 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -54,7 +54,7 @@ private:
virtual void SAL_CALL disposing(css::lang::EventObject const &) override
{
- osl::MutexGuard g(editor_.m_mutex);
+ std::unique_lock g(editor_.m_mutex);
editor_.m_notifier.clear();
}
@@ -86,7 +86,6 @@ void SQLEditView::DisableInternalUndo()
void SQLEditView::SetItemPoolFont(SfxItemPool* pItemPool)
{
- StyleSettings aStyleSettings = Application::GetSettings().GetStyleSettings();
OUString sFontName(officecfg::Office::Common::Font::SourceViewFont::FontName::get().value_or(OUString()));
if (sFontName.isEmpty())
{
@@ -97,21 +96,21 @@ void SQLEditView::SetItemPoolFont(SfxItemPool* pItemPool)
Size aFontSize(0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get());
vcl::Font aAppFont(sFontName, aFontSize);
- pItemPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
+ pItemPool->SetUserDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
"", PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
EE_CHAR_FONTINFO));
- pItemPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
+ pItemPool->SetUserDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
"", PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
EE_CHAR_FONTINFO_CJK));
- pItemPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
+ pItemPool->SetUserDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
"", PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
EE_CHAR_FONTINFO_CTL));
- pItemPool->SetPoolDefaultItem(
+ pItemPool->SetUserDefaultItem(
SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT));
- pItemPool->SetPoolDefaultItem(
+ pItemPool->SetUserDefaultItem(
SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT_CJK));
- pItemPool->SetPoolDefaultItem(
+ pItemPool->SetUserDefaultItem(
SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT_CTL));
}
@@ -146,7 +145,7 @@ void SQLEditView::SetDrawingArea(weld::DrawingArea* pDrawingArea)
officecfg::Office::Common::Font::SourceViewFont::get(),
css::uno::UNO_QUERY_THROW);
{
- osl::MutexGuard g(m_mutex);
+ std::unique_lock g(m_mutex);
m_notifier = n;
}
css::uno::Sequence< OUString > s { "FontHeight", "FontName" };
@@ -158,7 +157,7 @@ SQLEditView::~SQLEditView()
{
css::uno::Reference< css::beans::XMultiPropertySet > n;
{
- osl::MutexGuard g(m_mutex);
+ std::unique_lock g(m_mutex);
n = m_notifier;
}
if (n.is()) {
@@ -404,7 +403,7 @@ bool SQLEditView::Command(const CommandEvent& rCEvt)
xContextMenu->set_visible("undo", false);
xContextMenu->set_visible("specialchar", vcl::GetGetSpecialCharsFunction() != nullptr);
- OString sCommand = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ OUString sCommand = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sCommand == "cut")
pEditView->Cut();
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 2c3f0976fe60..e68132d4ea82 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <connectivity/dbmetadata.hxx>
@@ -39,7 +39,6 @@ namespace dbaui
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index 0ca6502ca93e..63f018f9e176 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -18,7 +18,7 @@
*/
#include <CollectionView.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include <comphelper/interaction.hxx>
@@ -26,6 +26,7 @@
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <UITools.hxx>
@@ -41,14 +42,13 @@
#include <ucbhelper/commandenvironment.hxx>
#include <ucbhelper/content.hxx>
#include <connectivity/dbexception.hxx>
+#include <utility>
namespace dbaui
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::sdbc;
@@ -57,10 +57,10 @@ using namespace comphelper;
OCollectionView::OCollectionView(weld::Window* pParent,
const Reference< XContent>& _xContent,
const OUString& _sDefaultName,
- const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
+ css::uno::Reference< css::uno::XComponentContext > _xContext)
: GenericDialogController(pParent, "dbaccess/ui/collectionviewdialog.ui", "CollectionView")
, m_xContent(_xContent)
- , m_xContext(_rxContext)
+ , m_xContext(std::move(_xContext))
, m_bCreateForm(true)
, m_xFTCurrentPath(m_xBuilder->weld_label("currentPathLabel"))
, m_xNewFolder(m_xBuilder->weld_button("newFolderButton"))
@@ -141,7 +141,7 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click, weld::Button&, void)
Reference<XInteractionHandler2> xHandler(
InteractionHandler::createWithParent(m_xContext, m_xDialog->GetXWindow()));
- rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aException));
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aException));
rtl::Reference<OInteractionApprove> pApprove = new OInteractionApprove;
pRequest->addContinuation(pApprove);
@@ -256,9 +256,9 @@ void OCollectionView::initCurrentPath()
static const char s_sReportsCID[] = "private:reports";
m_bCreateForm = s_sFormsCID == sCID;
OUString sPath("/");
- if ( m_bCreateForm && sCID.getLength() != static_cast<sal_Int32>(strlen(s_sFormsCID)))
+ if ( m_bCreateForm && o3tl::make_unsigned(sCID.getLength()) != strlen(s_sFormsCID))
sPath = sCID.copy(strlen(s_sFormsCID));
- else if ( !m_bCreateForm && sCID.getLength() != static_cast<sal_Int32>(strlen(s_sReportsCID)) )
+ else if ( !m_bCreateForm && o3tl::make_unsigned(sCID.getLength()) != strlen(s_sReportsCID) )
sPath = sCID.copy(strlen(s_sReportsCID) - 2);
m_xFTCurrentPath->set_label(sPath);
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index ae1968a738b9..66db8dc37ab3 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -46,7 +46,7 @@
#include <ucbhelper/content.hxx>
#include "finteraction.hxx"
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#if defined _WIN32
#include <rtl/process.h>
@@ -65,14 +65,10 @@ namespace dbaui
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
using namespace ::com::sun::star::mozilla;
- using namespace ::dbtools;
using namespace ::svt;
- OConnectionHelper::OConnectionHelper(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs)
+ OConnectionHelper::OConnectionHelper(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OUString& _rId, const SfxItemSet& _rCoreAttrs)
: OGenericAdministrationPage(pPage, pController, _rUIXMLDescription, _rId, _rCoreAttrs)
, m_bUserGrabFocus(false)
, m_pCollection(nullptr)
@@ -221,22 +217,11 @@ namespace dbaui
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
FileDialogFlags::NONE, GetFrameWeld());
- aFileDlg.AddFilter(sFilterName,"*.mdb;*.mde");
+ aFileDlg.AddFilter(sFilterName,"*.accdb;*.accde;*.mdb;*.mde");
aFileDlg.SetCurrentFilter(sFilterName);
askForFileName(aFileDlg);
}
break;
- case ::dbaccess::DST_MSACCESS_2007:
- {
- OUString sFilterName2(DBA_RES (STR_MSACCESS_2007_FILTERNAME));
- ::sfx2::FileDialogHelper aFileDlg(
- ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
- FileDialogFlags::NONE, GetFrameWeld());
- aFileDlg.AddFilter(sFilterName2,"*.accdb;*.accde");
- aFileDlg.SetCurrentFilter(sFilterName2);
- askForFileName(aFileDlg);
- }
- break;
case ::dbaccess::DST_MYSQL_ODBC:
case ::dbaccess::DST_ODBC:
{
@@ -570,7 +555,7 @@ namespace dbaui
commitURL();
}
- bool OConnectionHelper::createDirectoryDeep(const OUString& _rPathURL)
+ bool OConnectionHelper::createDirectoryDeep(std::u16string_view _rPathURL)
{
// get a URL object analyzing the URL for us ...
INetURLObject aParser;
@@ -663,7 +648,7 @@ namespace dbaui
const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
- if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
+ if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) )
{
if( pathExists(sURL, true) == PATH_NOT_EXIST )
{
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index 5b765dfa50b1..bbcf24783355 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -38,7 +38,7 @@ namespace dbaui
bool m_bUserGrabFocus;
public:
- OConnectionHelper(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs);
+ OConnectionHelper(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OUString& _rId, const SfxItemSet& _rCoreAttrs);
virtual ~OConnectionHelper() override;
OUString m_eType; // the type can't be changed in this class, so we hold it as member.
@@ -74,7 +74,7 @@ namespace dbaui
sal_Int32 checkPathExistence(const OUString& _rURL);
IS_PATH_EXIST pathExists(const OUString& _rURL, bool bIsFile) const;
- bool createDirectoryDeep(const OUString& _rPathNormalized);
+ bool createDirectoryDeep(std::u16string_view _rPathNormalized);
bool commitURL();
/** opens the FileOpen dialog and asks for a FileName
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 5b2fed5c26de..557045800658 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -35,18 +35,12 @@
#include <svl/filenotation.hxx>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <connectivity/CommonTools.hxx>
+#include <o3tl/string_view.hxx>
namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::ucb;
- using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::dbtools;
- using namespace ::svt;
std::unique_ptr<SfxTabPage> OConnectionTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet)
{
@@ -111,7 +105,6 @@ namespace dbaui
m_xFT_Connection->set_label(DBA_RES(STR_COMMONURL));
break;
case ::dbaccess::DST_MSACCESS:
- case ::dbaccess::DST_MSACCESS_2007:
m_xFT_Connection->set_label(DBA_RES(STR_MSACCESS_MDB_FILE));
m_xConnectionURL->set_help_id(HID_DSADMIN_MSACCESS_MDB_FILE);
break;
@@ -127,7 +120,7 @@ namespace dbaui
case ::dbaccess::DST_MYSQL_ODBC:
case ::dbaccess::DST_ODBC:
m_xFT_Connection->set_label(DBA_RES(STR_NAME_OF_ODBC_DATASOURCE));
- m_xConnectionURL->set_help_id( eType == ::dbaccess::DST_MYSQL_ODBC ? OString(HID_DSADMIN_MYSQL_ODBC_DATASOURCE) : OString(HID_DSADMIN_ODBC_DATASOURCE));
+ m_xConnectionURL->set_help_id( eType == ::dbaccess::DST_MYSQL_ODBC ? HID_DSADMIN_MYSQL_ODBC_DATASOURCE : HID_DSADMIN_ODBC_DATASOURCE);
break;
case ::dbaccess::DST_LDAP:
m_xFT_Connection->set_label(DBA_RES(STR_HOSTNAME));
@@ -203,7 +196,7 @@ namespace dbaui
m_xJavaDriverLabel->set_visible(bEnableJDBC);
m_xJavaDriver->set_visible(bEnableJDBC);
m_xTestJavaDriver->set_visible(bEnableJDBC);
- m_xTestJavaDriver->set_sensitive( !m_xJavaDriver->get_text().trim().isEmpty() );
+ m_xTestJavaDriver->set_sensitive( !o3tl::trim(m_xJavaDriver->get_text()).empty() );
m_xFL3->set_visible(bEnableJDBC);
checkTestConnection();
@@ -243,11 +236,11 @@ namespace dbaui
#if HAVE_FEATURE_JAVA
try
{
- if ( !m_xJavaDriver->get_text().trim().isEmpty() )
+ if ( !o3tl::trim(m_xJavaDriver->get_text()).empty() )
{
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
m_xJavaDriver->set_text(m_xJavaDriver->get_text().trim()); // fdo#68341
- bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_xJavaDriver->get_text().trim());
+ bSuccess = ::connectivity::existsJavaClassByName(xJVM, o3tl::trim(m_xJavaDriver->get_text()));
}
}
catch(Exception&)
@@ -265,14 +258,14 @@ namespace dbaui
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
bool bEnableTestConnection = !m_xConnectionURL->get_visible() || !m_xConnectionURL->GetTextNoPrefix().isEmpty();
if ( m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC )
- bEnableTestConnection = bEnableTestConnection && (!m_xJavaDriver->get_text().trim().isEmpty());
+ bEnableTestConnection = bEnableTestConnection && (!o3tl::trim(m_xJavaDriver->get_text()).empty());
m_xTestConnection->set_sensitive(bEnableTestConnection);
return true;
}
IMPL_LINK(OConnectionTabPage, OnEditModified, weld::Entry&, rEdit, void)
{
if (&rEdit == m_xJavaDriver.get())
- m_xTestJavaDriver->set_sensitive( !m_xJavaDriver->get_text().trim().isEmpty() );
+ m_xTestJavaDriver->set_sensitive( !o3tl::trim(m_xJavaDriver->get_text()).empty() );
checkTestConnection();
// tell the listener we were modified
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index 8f57c24f99eb..0282e46a1d7f 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -28,14 +28,6 @@
namespace dbaui
{
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::ucb;
- using namespace ::com::sun::star::ui::dialogs;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::svt;
-
std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet)
{
return std::make_unique<OConnectionTabPageSetup>( pPage, pController, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE );
@@ -61,7 +53,7 @@ namespace dbaui
return std::make_unique<OConnectionTabPageSetup>(pPage, pController, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, TranslateId(), TranslateId(), STR_COMMONURL);
}
- OConnectionTabPageSetup::OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, TranslateId pHelpTextResId, TranslateId pHeaderResId, TranslateId pUrlResId)
+ OConnectionTabPageSetup::OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OUString& _rId, const SfxItemSet& _rCoreAttrs, TranslateId pHelpTextResId, TranslateId pHeaderResId, TranslateId pUrlResId)
: OConnectionHelper(pPage, pController, _rUIXMLDescription, _rId, _rCoreAttrs)
, m_xHelpText(m_xBuilder->weld_label("helptext"))
, m_xHeaderText(m_xBuilder->weld_label("header"))
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
index 0039a7160a6e..27b8eab284ae 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
@@ -39,7 +39,7 @@ namespace dbaui
DECL_LINK(OnEditModified, weld::Entry&, void);
public:
- OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, TranslateId pHelpTextResId, TranslateId pHeaderResId, TranslateId pUrlResId);
+ OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OUString& _rId, const SfxItemSet& _rCoreAttrs, TranslateId pHelpTextResId, TranslateId pHeaderResId, TranslateId pUrlResId);
virtual ~OConnectionTabPageSetup() override;
static std::unique_ptr<OGenericAdministrationPage> CreateDbaseTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet);
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index ffbde972ff08..ad81680ba421 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -39,6 +39,9 @@
#include "TextConnectionHelper.hxx"
#include <osl/diagnose.h>
+#include <IItemSetHelper.hxx>
+#include <comphelper/string.hxx>
+
namespace dbaui
{
using namespace ::com::sun::star;
@@ -153,7 +156,7 @@ using namespace ::com::sun::star;
OSL_ENSURE(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
if (pCollection)
{
- OUString sUrl = pCollection->getPrefix( "sdbc:address:ldap:") + m_xETHostServer->get_text();
+ OUString sUrl = pCollection->getPrefix( u"sdbc:address:ldap:") + m_xETHostServer->get_text();
_rSet->Put(SfxStringItem(DSID_CONNECTURL, sUrl));
bChangedSomething = true;
}
@@ -236,9 +239,13 @@ using namespace ::com::sun::star;
if ( bHasMySQLNative )
m_xNATIVEDatabase->show();
- // if any of the options is checked, then there's nothing to do
+ // tdf#103068: if any of the options is checked, then just update the selected kind:
+ // it could happen that the selection and the wizard path are not in sync
if ( m_xODBCDatabase->get_active() || m_xJDBCDatabase->get_active() || m_xNATIVEDatabase->get_active() )
+ {
+ maClickHdl.Call(this);
return;
+ }
// prefer "native" or "JDBC"
if ( bHasMySQLNative )
@@ -448,7 +455,7 @@ using namespace ::com::sun::star;
OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
// to get the correct value when saveValue was called by base class
- if ( m_xETDriverClass->get_text().trim().isEmpty() )
+ if ( o3tl::trim(m_xETDriverClass->get_text()).empty() )
{
m_xETDriverClass->set_text(m_sDefaultJdbcDriverName);
m_xETDriverClass->save_value();
@@ -467,7 +474,7 @@ using namespace ::com::sun::star;
#if HAVE_FEATURE_JAVA
try
{
- if ( !m_xETDriverClass->get_text().trim().isEmpty() )
+ if ( !o3tl::trim(m_xETDriverClass->get_text()).empty() )
{
// TODO change jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
@@ -488,8 +495,8 @@ using namespace ::com::sun::star;
void OGeneralSpecialJDBCConnectionPageSetup::callModifiedHdl(weld::Widget* pControl)
{
if (pControl == m_xETDriverClass.get())
- m_xPBTestJavaDriver->set_sensitive( !m_xETDriverClass->get_text().trim().isEmpty() );
- bool bRoadmapState = ((!m_xETDatabasename->get_text().isEmpty() ) && ( !m_xETHostname->get_text().isEmpty() ) && (!m_xNFPortNumber->get_text().isEmpty() ) && ( !m_xETDriverClass->get_text().trim().isEmpty() ));
+ m_xPBTestJavaDriver->set_sensitive( !o3tl::trim(m_xETDriverClass->get_text()).empty() );
+ bool bRoadmapState = ((!m_xETDatabasename->get_text().isEmpty() ) && ( !m_xETHostname->get_text().isEmpty() ) && (!m_xNFPortNumber->get_text().isEmpty() ) && ( !o3tl::trim(m_xETDriverClass->get_text()).empty() ));
SetRoadmapStateValue(bRoadmapState);
OGenericAdministrationPage::callModifiedHdl();
}
@@ -499,6 +506,129 @@ using namespace ::com::sun::star;
return std::make_unique<OJDBCConnectionPageSetup>(pPage, pController, _rAttrSet);
}
+ // OPostgresConnectionPageSetup
+ OPostgresConnectionPageSetup::OPostgresConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs , sal_uInt16 _nPortId )
+ : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/postgrespage.ui", "SpecialPostgresPage", _rCoreAttrs)
+ , m_nPortId(_nPortId)
+ , m_xETDatabasename(m_xBuilder->weld_entry("dbNameEntry"))
+ , m_xETHostname(m_xBuilder->weld_entry("hostNameEntry"))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumEntry"))
+ , m_xConnectionURL(new OConnectionURLEdit(m_xBuilder->weld_entry("browseurl"), m_xBuilder->weld_label("browselabel")))
+ {
+ m_xETDatabasename->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
+ m_xETHostname->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
+ m_xNFPortNumber->connect_value_changed(LINK(this, OGenericAdministrationPage, OnControlSpinButtonModifyHdl));
+ const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rCoreAttrs.GetItem(DSID_TYPECOLLECTION) );
+ if (pCollectionItem)
+ m_pCollection = pCollectionItem->getCollection();
+ OSL_ENSURE(m_pCollection, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
+ m_xConnectionURL->SetTypeCollection(m_pCollection);
+
+ SetRoadmapStateValue(false);
+ }
+
+ OPostgresConnectionPageSetup::~OPostgresConnectionPageSetup()
+ {
+ }
+
+ std::unique_ptr<OGenericAdministrationPage> OPostgresConnectionPageSetup::CreatePostgresTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet )
+ {
+ return std::make_unique<OPostgresConnectionPageSetup>(pPage, pController,
+ _rAttrSet,
+ DSID_POSTGRES_PORTNUMBER);
+ }
+
+ void OPostgresConnectionPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
+ {
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETDatabasename.get()));
+ _rControlList.emplace_back( new OSaveValueWidgetWrapper<OConnectionURLEdit>( m_xConnectionURL.get() ) );
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETHostname.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get()));
+ }
+
+ bool OPostgresConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
+ {
+ bool bChangedSomething = false;
+ fillString(*_rSet,m_xConnectionURL.get(), DSID_CONNECTURL, bChangedSomething);
+ fillString(*_rSet,m_xETHostname.get(),DSID_CONN_HOSTNAME,bChangedSomething);
+ fillString(*_rSet,m_xETDatabasename.get(),DSID_DATABASENAME,bChangedSomething);
+ fillInt32(*_rSet,m_xNFPortNumber.get(),m_nPortId,bChangedSomething );
+ return bChangedSomething;
+ }
+
+ void OPostgresConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& /*_rControlList*/)
+ {
+ }
+
+ void OPostgresConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
+ {
+ // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
+ SetRoadmapStateValue(true);
+ bool bValid, bReadonly;
+ getFlags(_rSet, bValid, bReadonly);
+
+ m_xConnectionURL->show();
+ m_xConnectionURL->ShowPrefix( false);
+
+ const SfxStringItem* pDatabaseName = _rSet.GetItem<SfxStringItem>(DSID_DATABASENAME);
+ const SfxStringItem* pUrlItem = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
+ const SfxStringItem* pHostName = _rSet.GetItem<SfxStringItem>(DSID_CONN_HOSTNAME);
+ const SfxInt32Item* pPortNumber = _rSet.GetItem<SfxInt32Item>(m_nPortId);
+
+ if ( bValid )
+ {
+ m_xETDatabasename->set_text(pDatabaseName->GetValue());
+ m_xETDatabasename->save_value();
+
+ OUString sUrl = pUrlItem->GetValue();
+ setURL( sUrl );
+ m_xConnectionURL->save_value();
+
+ m_xETHostname->set_text(pHostName->GetValue());
+ m_xETHostname->save_value();
+
+ m_xNFPortNumber->set_value(pPortNumber->GetValue());
+ m_xNFPortNumber->save_value();
+ }
+
+ OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
+
+ callModifiedHdl();
+ }
+
+ bool OPostgresConnectionPageSetup::commitPage( ::vcl::WizardTypes::CommitPageReason /*_eReason*/ )
+ {
+ return commitURL();
+ }
+
+ bool OPostgresConnectionPageSetup::commitURL()
+ {
+ OUString sURL = m_xConnectionURL->GetTextNoPrefix();
+ setURLNoPrefix(sURL);
+ m_xConnectionURL->SaveValueNoPrefix();
+ return true;
+ }
+
+ void OPostgresConnectionPageSetup::impl_setURL( std::u16string_view _rURL, bool _bPrefix )
+ {
+ OUString sURL( comphelper::string::stripEnd(_rURL, '*') );
+ OSL_ENSURE( m_pCollection, "OConnectionHelper::impl_setURL: have no interpreter for the URLs!" );
+ if ( _bPrefix )
+ m_xConnectionURL->SetText( sURL );
+ else
+ m_xConnectionURL->SetTextNoPrefix( sURL );
+ }
+
+ void OPostgresConnectionPageSetup::setURLNoPrefix( std::u16string_view _rURL )
+ {
+ impl_setURL( _rURL,false);
+ }
+
+ void OPostgresConnectionPageSetup::setURL( std::u16string_view _rURL )
+ {
+ impl_setURL( _rURL, true);
+ }
+
// OMySQLJDBCConnectionPageSetup
OJDBCConnectionPageSetup::OJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
: OConnectionTabPageSetup(pPage, pController, "dbaccess/ui/jdbcconnectionpage.ui", "JDBCConnectionPage", rCoreAttrs,
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 8bc367602fd9..909cfede5806 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -25,6 +25,8 @@
#include "admincontrols.hxx"
#include "TextConnectionHelper.hxx"
+#include <curledit.hxx>
+
namespace dbaui
{
class ODbTypeWizDialogSetup;
@@ -141,7 +143,7 @@ namespace dbaui
DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
OUString m_sDefaultJdbcDriverName;
- sal_uInt16 m_nPortId;
+ TypedWhichId<SfxInt32Item> m_nPortId;
std::unique_ptr<weld::Label> m_xHeaderText;
std::unique_ptr<weld::Label> m_xFTHelpText;
@@ -214,6 +216,42 @@ namespace dbaui
DECL_LINK(OnSetupModeSelected, weld::Toggleable&, void);
};
+ // OPostgresPageSetup
+ class OPostgresConnectionPageSetup final : public OGenericAdministrationPage
+ {
+ public:
+ OPostgresConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController
+ , const SfxItemSet& _rCoreAttrs
+ , sal_uInt16 _nPortId );
+ virtual ~OPostgresConnectionPageSetup() override;
+ static std::unique_ptr<OGenericAdministrationPage> CreatePostgresTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
+ ::dbaccess::ODsnTypeCollection* m_pCollection;
+
+ private:
+ virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override;
+ virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
+ virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
+ virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
+ virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
+
+ TypedWhichId<SfxInt32Item> m_nPortId;
+
+ std::unique_ptr<weld::Entry> m_xETDatabasename;
+ std::unique_ptr<weld::Entry> m_xETHostname;
+ std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
+ std::unique_ptr<OConnectionURLEdit> m_xConnectionURL;
+
+ /** used for the connection URL
+ @param _rURL
+ The URL to check.
+ */
+ void impl_setURL( std::u16string_view _rURL, bool _bPrefix );
+ void setURLNoPrefix( std::u16string_view _rURL );
+ void setURL( std::u16string_view _rURL );
+ bool commitURL();
+ };
+
+
// OAuthentificationPageSetup
class OAuthentificationPageSetup final : public OGenericAdministrationPage
{
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 551f613fe5bb..3fa122bf6c69 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -50,7 +50,7 @@
#include <connectivity/DriversConfig.hxx>
#include <connectivity/dbexception.hxx>
#include <osl/file.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <typelib/typedescription.hxx>
@@ -62,6 +62,7 @@
#include <iterator>
#include <functional>
#include <o3tl/functional.hxx>
+#include <comphelper/string.hxx>
namespace dbaui
{
@@ -72,7 +73,6 @@ using namespace com::sun::star::ucb;
using namespace com::sun::star::task;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdb;
-using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::util;
using namespace com::sun::star::container;
@@ -88,7 +88,7 @@ namespace
OSL_ENSURE( pPool, "implCheckItemType: invalid item pool!" );
if ( pPool )
{
- const SfxPoolItem& rDefItem = pPool->GetDefaultItem( _nId );
+ const SfxPoolItem& rDefItem = pPool->GetUserOrPoolDefaultItem( _nId );
bCorrectType = isItemType(&rDefItem);
}
return bCorrectType;
@@ -210,7 +210,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal
const SfxStringItem* pUser = m_pItemSetHelper->getOutputSet()->GetItem<SfxStringItem>(DSID_USER);
if (pUser && pUser->GetValue().getLength())
aReturn.emplace_back( "user", 0,
- makeAny(pUser->GetValue()), PropertyState_DIRECT_VALUE);
+ Any(pUser->GetValue()), PropertyState_DIRECT_VALUE);
// check if the connection type requires a password
if (hasAuthentication(*m_pItemSetHelper->getOutputSet()))
@@ -260,7 +260,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal
aRequest.HasAccount = false;
// aRequest.Account
- rtl::Reference<comphelper::OInteractionRequest> pRequest = new comphelper::OInteractionRequest(makeAny(aRequest));
+ rtl::Reference<comphelper::OInteractionRequest> pRequest = new comphelper::OInteractionRequest(Any(aRequest));
// build an interaction request
// two continuations (Ok and Cancel)
@@ -294,7 +294,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal
if (!sPassword.isEmpty())
aReturn.emplace_back( "password", 0,
- makeAny(sPassword), PropertyState_DIRECT_VALUE);
+ Any(sPassword), PropertyState_DIRECT_VALUE);
}
if ( !aReturn.empty() )
@@ -320,7 +320,7 @@ void ODbDataSourceAdministrationHelper::successfullyConnected()
OUString sPassword = pPassword->GetValue();
Reference< XPropertySet > xCurrentDatasource = getCurrentDataSource();
- lcl_putProperty(xCurrentDatasource,m_aDirectPropTranslator[DSID_PASSWORD], makeAny(sPassword));
+ lcl_putProperty(xCurrentDatasource,m_aDirectPropTranslator[DSID_PASSWORD], Any(sPassword));
}
}
}
@@ -465,7 +465,6 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
case ::dbaccess::DST_WRITER:
break;
case ::dbaccess::DST_MSACCESS:
- case ::dbaccess::DST_MSACCESS_2007:
{
OUString sFileName = pCollection->cutPrefix(pUrlItem->GetValue());
OUString sNewFileName;
@@ -523,6 +522,39 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
sNewUrl = pCollection->cutPrefix(pUrlItem->GetValue()) + lcl_createHostWithPort(nullptr,pPortNumber);
}
break;
+ case ::dbaccess::DST_POSTGRES:
+ {
+ sNewUrl = pCollection->cutPrefix(pUrlItem->GetValue());
+ OUString rURL(comphelper::string::stripEnd(pUrlItem->GetValue(), '*'));
+ const SfxStringItem* pHostName = m_pItemSetHelper->getOutputSet()->GetItem<SfxStringItem>(DSID_CONN_HOSTNAME);
+ const SfxInt32Item* pPortNumber = m_pItemSetHelper->getOutputSet()->GetItem<SfxInt32Item>(DSID_POSTGRES_PORTNUMBER);
+ const SfxStringItem* pDatabaseName = m_pItemSetHelper->getOutputSet()->GetItem<SfxStringItem>(DSID_DATABASENAME);
+ if (pHostName && pHostName->GetValue().getLength())
+ {
+ OUString hostname( pHostName->GetValue() );
+ hostname = hostname.replaceAll( "\\", "\\\\");
+ hostname = hostname.replaceAll( "\'", "\\'");
+ hostname = "'" + hostname + "'";
+ rURL += " host=" + hostname;
+ }
+ // tdf#157260: if port is already in the URL, don't add another one
+ if (pPortNumber && pPortNumber->GetValue() && (rURL.indexOf("port=") == -1))
+ {
+ OUString port = "'" + OUString::number(pPortNumber->GetValue()) + "'";
+ rURL += " port=" + port;
+ }
+ if (pDatabaseName && pDatabaseName->GetValue().getLength())
+ {
+ OUString dbname( pDatabaseName->GetValue() );
+ dbname = dbname.replaceAll( "\\", "\\\\");
+ dbname = dbname.replaceAll( "\'", "\\'");
+ dbname = "'" + dbname + "'";
+ rURL += " dbname=" + dbname;
+ }
+ sNewUrl = rURL;
+ return sNewUrl;
+ }
+ break;
case ::dbaccess::DST_JDBC:
// run through
default:
@@ -530,7 +562,7 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
}
if ( !sNewUrl.isEmpty() )
sNewUrl = pCollection->getPrefix(eType) + sNewUrl;
- else
+ else if (pUrlItem)
sNewUrl = pUrlItem->GetValue();
return sNewUrl;
@@ -579,7 +611,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr
// collect the names of the additional settings
PropertyValueSet aInfos;
- for (const PropertyValue& rAdditionalInfo : std::as_const(aAdditionalInfo))
+ for (const PropertyValue& rAdditionalInfo : aAdditionalInfo)
{
if( rAdditionalInfo.Name == "JDBCDRV" )
{ // compatibility
@@ -631,7 +663,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r
try { xInfo = _rxDest->getPropertySetInfo(); }
catch(Exception&) { }
- static const OUStringLiteral sUrlProp(u"URL");
+ static constexpr OUStringLiteral sUrlProp(u"URL");
// transfer the direct properties
for (auto const& elem : m_aDirectPropTranslator)
{
@@ -648,7 +680,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r
{
if ( sUrlProp == elem.second )
{
- Any aValue(makeAny(getConnectionURL()));
+ Any aValue(getConnectionURL());
// aValue <<= OUString();
lcl_putProperty(_rxDest, elem.second,aValue);
}
@@ -671,7 +703,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r
// overwrite and extend them
fillDatasourceInfo(_rSource, aInfo);
// and propagate the (newly composed) sequence to the set
- lcl_putProperty(_rxDest,PROPERTY_INFO, makeAny(aInfo));
+ lcl_putProperty(_rxDest,PROPERTY_INFO, Any(aInfo));
}
void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rSource, Sequence< css::beans::PropertyValue >& _rInfo)
@@ -700,7 +732,7 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
OUString sCharSet;
implTranslateProperty(pCurrent) >>= sCharSet;
if ( !sCharSet.isEmpty() )
- aRelevantSettings.insert(PropertyValue(aTranslation->second, 0, makeAny(sCharSet), PropertyState_DIRECT_VALUE));
+ aRelevantSettings.insert(PropertyValue(aTranslation->second, 0, Any(sCharSet), PropertyState_DIRECT_VALUE));
}
else
aRelevantSettings.insert(PropertyValue(aTranslation->second, 0, implTranslateProperty(pCurrent), PropertyState_DIRECT_VALUE));
@@ -770,7 +802,7 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
// here we have a special entry for types from oracle
if ( aTypeSettings.hasElements() )
{
- aRelevantSettings.insert(PropertyValue("TypeInfoSettings", 0, makeAny(aTypeSettings), PropertyState_DIRECT_VALUE));
+ aRelevantSettings.insert(PropertyValue("TypeInfoSettings", 0, Any(aTypeSettings), PropertyState_DIRECT_VALUE));
}
// check which values are still left ('cause they were not present in the original sequence, but are to be set)
@@ -860,8 +892,7 @@ OString ODbDataSourceAdministrationHelper::translatePropertyId( sal_Int32 _nId )
aString = indirectPos->second;
}
- OString aReturn( aString.getStr(), aString.getLength(), RTL_TEXTENCODING_ASCII_US );
- return aReturn;
+ return OUStringToOString( aString, RTL_TEXTENCODING_ASCII_US );
}
template<class T> static bool checkItemType(const SfxPoolItem* pItem){ return dynamic_cast<const T*>(pItem) != nullptr;}
@@ -914,7 +945,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
{
sal_Int32 nValue = 0;
_rValue >>= nValue;
- _rSet.Put( SfxInt32Item( _nId, nValue ) );
+ _rSet.Put( SfxInt32Item( TypedWhichId<SfxInt32Item>(_nId), nValue ) );
}
else {
SAL_WARN( "dbaccess", "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value ("
@@ -981,7 +1012,7 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
OSL_ENSURE(pCollection, "ODbAdminDialog::getDatasourceType: invalid type collection!");
- sal_uInt16 nPortNumberId = 0;
+ TypedWhichId<SfxInt32Item> nPortNumberId(0);
sal_Int32 nPortNumber = -1;
OUString sNewHostName;
OUString sUrlPart;
@@ -1001,6 +1032,9 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
case ::dbaccess::DST_LDAP:
nPortNumberId = DSID_CONN_LDAP_PORTNUMBER;
break;
+ case ::dbaccess::DST_POSTGRES:
+ nPortNumberId = DSID_POSTGRES_PORTNUMBER;
+ break;
default:
break;
}
@@ -1021,7 +1055,7 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
if ( !sNewHostName.isEmpty() )
_rDest.Put(SfxStringItem(DSID_CONN_HOSTNAME, sNewHostName));
- if ( nPortNumber != -1 && nPortNumberId != 0 )
+ if ( nPortNumber != -1 && nPortNumberId != TypedWhichId<SfxInt32Item>(0) )
_rDest.Put(SfxInt32Item(nPortNumberId, nPortNumber));
}
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
index 22a61eceec80..dd4adcdc525b 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
@@ -40,8 +40,8 @@ namespace dbaui
{
void convert(const css::uno::Reference< css::uno::XComponentContext> & xContext,
const ::dbaccess::ODsnTypeCollection* _pCollection,
- const OUString& _sOldURLPrefix,
- const OUString& _sNewURLPrefix,
+ std::u16string_view _sOldURLPrefix,
+ std::u16string_view _sNewURLPrefix,
const css::uno::Reference< css::beans::XPropertySet >& _xDatasource);
};
class IItemSetHelper;
diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx
index cc449d9b7970..373f3c5242bd 100644
--- a/dbaccess/source/ui/dlg/RelationDlg.cxx
+++ b/dbaccess/source/ui/dlg/RelationDlg.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/sdbc/KeyRule.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <JoinDesignView.hxx>
#include <JoinController.hxx>
#include <connectivity/dbexception.hxx>
@@ -33,8 +33,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
using namespace ::dbaui;
using namespace ::dbtools;
diff --git a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
index bcf039c5e16d..872824c6e14c 100644
--- a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
+++ b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
@@ -25,9 +25,7 @@ namespace dbaui
{
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
-using namespace com::sun::star::container;
// OTableSubscriptionDialog
OTableSubscriptionDialog::OTableSubscriptionDialog(weld::Window* pParent
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index 432f8b6cc150..3148aad27924 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
@@ -28,18 +28,25 @@
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <vcl/mnemonic.hxx>
+#include <o3tl/string_view.hxx>
namespace
{
-OUString lcl_getListEntry(const OUString& rStr, sal_Int32& rIdx)
+OUString lcl_getListEntry(std::u16string_view rStr, sal_Int32& rIdx)
{
- const OUString sTkn {rStr.getToken( 0, '\t', rIdx )};
+ const OUString sTkn {o3tl::getToken(rStr, 0, '\t', rIdx )};
if (rIdx>=0)
{
- rIdx = rStr.indexOf('\t', rIdx);
- if (rIdx>=0 && ++rIdx>=rStr.getLength())
+ size_t nFnd = rStr.find('\t', rIdx);
+ if (nFnd == std::u16string_view::npos)
rIdx = -1;
+ else
+ {
+ rIdx = nFnd + 1;
+ if (rIdx >= static_cast<sal_Int32>(rStr.size()))
+ rIdx = -1;
+ }
}
return sTkn;
}
@@ -93,24 +100,23 @@ namespace dbaui
{
short nFlag;
weld::Widget* pFrame;
- } aSections[] = {
+ } const aSections[] = {
{ TC_EXTENSION, m_xExtensionHeader.get() },
{ TC_SEPARATORS, m_xFormatHeader.get() },
{ TC_HEADER, m_xRowHeader.get() },
- { TC_CHARSET, m_xCharSetHeader.get() },
- { 0, nullptr }
+ { TC_CHARSET, m_xCharSetHeader.get() }
};
- for ( size_t section=0; section < SAL_N_ELEMENTS( aSections ) - 1; ++section )
+ for (auto const & section: aSections)
{
- if ( ( m_nAvailableSections & aSections[section].nFlag ) != 0 )
+ if ( ( m_nAvailableSections & section.nFlag ) != 0 )
{
// the section is visible, no need to do anything here
continue;
}
// hide all elements from this section
- aSections[section].pFrame->hide();
+ section.pFrame->hide();
}
m_xContainer->show();
@@ -350,22 +356,22 @@ namespace dbaui
return sExtension;
}
- OUString OTextConnectionHelper::GetSeparator(const weld::ComboBox& rBox, const OUString& rList)
+ OUString OTextConnectionHelper::GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList)
{
sal_Unicode const nTok = '\t';
int nPos(rBox.find_text(rBox.get_active_text()));
if (nPos == -1)
- return rBox.get_active_text().copy(0);
+ return rBox.get_active_text();
if ( m_xTextSeparator.get() != &rBox || nPos != (rBox.get_count()-1) )
return OUString(
- static_cast< sal_Unicode >( rList.getToken((nPos*2)+1, nTok ).toInt32() ));
+ static_cast< sal_Unicode >( o3tl::toInt32(o3tl::getToken(rList, (nPos*2)+1, nTok )) ));
// somewhat strange ... translates for instance an "32" into " "
return OUString();
}
- void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, const OUString& rList, const OUString& rVal )
+ void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal )
{
if (rVal.getLength()==1)
{
@@ -373,9 +379,9 @@ namespace dbaui
for(sal_Int32 nIdx {0}; nIdx>=0;)
{
sal_Int32 nPrevIdx {nIdx};
- if (static_cast<sal_Unicode>(rList.getToken(1, '\t', nIdx).toInt32()) == nVal)
+ if (static_cast<sal_Unicode>(o3tl::toInt32(o3tl::getToken(rList, 1, '\t', nIdx))) == nVal)
{
- rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx));
+ rBox.set_entry_text(OUString(o3tl::getToken(rList,0, '\t', nPrevIdx)));
return;
}
}
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
index 41921f092f82..6755a422378e 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
@@ -71,8 +71,8 @@ namespace dbaui
DECL_LINK(OnSetExtensionHdl, weld::Toggleable&, void);
DECL_LINK(OnEditModified, weld::Entry&, void);
- OUString GetSeparator(const weld::ComboBox& rBox, const OUString& rList);
- void SetSeparator(weld::ComboBox& rBox, const OUString& rList, const OUString& rVal);
+ OUString GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList);
+ void SetSeparator(weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal);
void SetExtension(const OUString& _rVal);
public:
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 672830edd85b..40e33f41da78 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -45,10 +45,13 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::task;
using namespace dbaui;
-using namespace comphelper;
namespace {
+#define MNI_ACTION_ADD_USER "add"
+#define MNI_ACTION_DEL_USER "delete"
+#define MNI_ACTION_CHANGE_PASSWORD "password"
+
class OPasswordDialog : public weld::GenericDialogController
{
std::unique_ptr<weld::Frame> m_xUser;
@@ -111,20 +114,87 @@ IMPL_LINK(OPasswordDialog, ModifiedHdl, weld::Entry&, rEdit, void)
// OUserAdmin
OUserAdmin::OUserAdmin(weld::Container* pPage, weld::DialogController* pController,const SfxItemSet& _rAttrSet)
: OGenericAdministrationPage(pPage, pController, "dbaccess/ui/useradminpage.ui", "UserAdminPage", _rAttrSet)
+ , mxActionBar(m_xBuilder->weld_menu_button("action_menu"))
, m_xUSER(m_xBuilder->weld_combo_box("user"))
- , m_xNEWUSER(m_xBuilder->weld_button("add"))
- , m_xCHANGEPWD(m_xBuilder->weld_button("changepass"))
- , m_xDELETEUSER(m_xBuilder->weld_button("delete"))
, m_xTable(m_xBuilder->weld_container("table"))
, m_xTableCtrlParent(m_xTable->CreateChildFrame())
, m_xTableCtrl(VclPtr<OTableGrantControl>::Create(m_xTableCtrlParent))
{
+ mxActionBar->append_item(MNI_ACTION_ADD_USER, DBA_RES(STR_ADD_USER));
+ mxActionBar->append_item(MNI_ACTION_DEL_USER, DBA_RES(STR_DELETE_USER));
+ mxActionBar->append_item(MNI_ACTION_CHANGE_PASSWORD, DBA_RES(STR_CHANGE_PASSWORD));
+ mxActionBar->connect_selected(LINK(this,OUserAdmin,MenuSelectHdl));
+
m_xTableCtrl->Show();
m_xUSER->connect_changed(LINK(this, OUserAdmin, ListDblClickHdl));
- m_xNEWUSER->connect_clicked(LINK(this, OUserAdmin, UserHdl));
- m_xCHANGEPWD->connect_clicked(LINK(this, OUserAdmin, UserHdl));
- m_xDELETEUSER->connect_clicked(LINK(this, OUserAdmin, UserHdl));
+}
+
+IMPL_LINK(OUserAdmin, MenuSelectHdl, const OUString&, rIdent, void)
+{
+ try
+ {
+ if (rIdent == MNI_ACTION_ADD_USER) {
+ SfxPasswordDialog aPwdDlg(GetFrameWeld());
+ aPwdDlg.ShowExtras(SfxShowExtras::ALL);
+ if (aPwdDlg.run())
+ {
+ Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY);
+ Reference<XPropertySet> xNewUser = xUserFactory->createDataDescriptor();
+ if(xNewUser.is())
+ {
+ xNewUser->setPropertyValue(PROPERTY_NAME,Any(aPwdDlg.GetUser()));
+ xNewUser->setPropertyValue(PROPERTY_PASSWORD,Any(aPwdDlg.GetPassword()));
+ Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
+ if(xAppend.is())
+ xAppend->appendByDescriptor(xNewUser);
+ }
+ }
+ }
+ else if (rIdent == MNI_ACTION_DEL_USER) {
+ if (m_xUsers.is() && m_xUsers->hasByName(GetUser()))
+ {
+ Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
+ if(xDrop.is())
+ {
+ std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ DBA_RES(STR_QUERY_USERADMIN_DELETE_USER)));
+ if (xQry->run() == RET_YES)
+ xDrop->dropByName(GetUser());
+ }
+ }
+ }
+ else if (rIdent == MNI_ACTION_CHANGE_PASSWORD) {
+ OUString sName = GetUser();
+ if(m_xUsers->hasByName(sName))
+ {
+ Reference<XUser> xUser;
+ m_xUsers->getByName(sName) >>= xUser;
+ if(xUser.is())
+ {
+ OPasswordDialog aDlg(GetFrameWeld(), sName);
+ if (aDlg.run() == RET_OK)
+ {
+ OUString sNewPassword,sOldPassword;
+ sNewPassword = aDlg.GetNewPassword();
+ sOldPassword = aDlg.GetOldPassword();
+
+ if(!sNewPassword.isEmpty())
+ xUser->changePassword(sOldPassword,sNewPassword);
+ }
+ }
+ }
+ }
+ FillUserNames();
+ }
+ catch(const SQLException& e)
+ {
+ ::dbtools::showError(::dbtools::SQLExceptionInfo(e), GetDialogController()->getDialog()->GetXWindow(), m_xORB);
+ }
+ catch(Exception& )
+ {
+ }
}
OUserAdmin::~OUserAdmin()
@@ -173,11 +243,11 @@ void OUserAdmin::FillUserNames()
}
Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
- m_xNEWUSER->set_sensitive(xAppend.is());
+ mxActionBar->set_item_sensitive(MNI_ACTION_ADD_USER, xAppend.is());
Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
- m_xDELETEUSER->set_sensitive(xDrop.is());
+ mxActionBar->set_item_sensitive(MNI_ACTION_DEL_USER, xDrop.is());
+ mxActionBar->set_item_sensitive(MNI_ACTION_CHANGE_PASSWORD, m_xUsers.is());
- m_xCHANGEPWD->set_sensitive(m_xUsers.is());
m_xTableCtrl->Enable(m_xUsers.is());
}
@@ -186,77 +256,6 @@ std::unique_ptr<SfxTabPage> OUserAdmin::Create( weld::Container* pPage, weld::Di
return std::make_unique<OUserAdmin>( pPage, pController, *_rAttrSet );
}
-IMPL_LINK(OUserAdmin, UserHdl, weld::Button&, rButton, void)
-{
- try
- {
- if (&rButton == m_xNEWUSER.get())
- {
- SfxPasswordDialog aPwdDlg(GetFrameWeld());
- aPwdDlg.ShowExtras(SfxShowExtras::ALL);
- if (aPwdDlg.run())
- {
- Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY);
- Reference<XPropertySet> xNewUser = xUserFactory->createDataDescriptor();
- if(xNewUser.is())
- {
- xNewUser->setPropertyValue(PROPERTY_NAME,makeAny(aPwdDlg.GetUser()));
- xNewUser->setPropertyValue(PROPERTY_PASSWORD,makeAny(aPwdDlg.GetPassword()));
- Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
- if(xAppend.is())
- xAppend->appendByDescriptor(xNewUser);
- }
- }
- }
- else if (&rButton == m_xCHANGEPWD.get())
- {
- OUString sName = GetUser();
-
- if(m_xUsers->hasByName(sName))
- {
- Reference<XUser> xUser;
- m_xUsers->getByName(sName) >>= xUser;
- if(xUser.is())
- {
- OPasswordDialog aDlg(GetFrameWeld(), sName);
- if (aDlg.run() == RET_OK)
- {
- OUString sNewPassword,sOldPassword;
- sNewPassword = aDlg.GetNewPassword();
- sOldPassword = aDlg.GetOldPassword();
-
- if(!sNewPassword.isEmpty())
- xUser->changePassword(sOldPassword,sNewPassword);
- }
- }
- }
- }
- else
- {// delete user
- if(m_xUsers.is() && m_xUsers->hasByName(GetUser()))
- {
- Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
- if(xDrop.is())
- {
- std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- DBA_RES(STR_QUERY_USERADMIN_DELETE_USER)));
- if (xQry->run() == RET_YES)
- xDrop->dropByName(GetUser());
- }
- }
- }
- FillUserNames();
- }
- catch(const SQLException& e)
- {
- ::dbtools::showError(::dbtools::SQLExceptionInfo(e), GetDialogController()->getDialog()->GetXWindow(), m_xORB);
- }
- catch(Exception& )
- {
- }
-}
-
IMPL_LINK_NOARG(OUserAdmin, ListDblClickHdl, weld::ComboBox&, void)
{
m_xTableCtrl->setUserName(GetUser());
diff --git a/dbaccess/source/ui/dlg/UserAdmin.hxx b/dbaccess/source/ui/dlg/UserAdmin.hxx
index e9c2a13e7876..76460a8468e7 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.hxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.hxx
@@ -32,10 +32,8 @@ namespace dbaui
class OUserAdmin final : public OGenericAdministrationPage
{
+ std::unique_ptr<weld::MenuButton> mxActionBar;
std::unique_ptr<weld::ComboBox> m_xUSER;
- std::unique_ptr<weld::Button> m_xNEWUSER;
- std::unique_ptr<weld::Button> m_xCHANGEPWD;
- std::unique_ptr<weld::Button> m_xDELETEUSER;
std::unique_ptr<weld::Container> m_xTable;
css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent;
VclPtr<OTableGrantControl> m_xTableCtrl; // show the grant rights of one user
@@ -48,7 +46,7 @@ class OUserAdmin final : public OGenericAdministrationPage
// methods
DECL_LINK(ListDblClickHdl, weld::ComboBox&, void);
- DECL_LINK(UserHdl, weld::Button&, void);
+ DECL_LINK(MenuSelectHdl, const OUString&, void);
void FillUserNames();
diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
index ec44c33994b9..3e554e1f3f57 100644
--- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx
+++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
@@ -31,15 +31,13 @@
#include <connectivity/dbtools.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaui
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdbcx;
// OUserAdminDlg
OUserAdminDlg::OUserAdminDlg(weld::Window* pParent,
@@ -108,7 +106,7 @@ namespace dbaui
m_pImpl->saveChanges(*GetOutputItemSet());
return nRet;
}
- void OUserAdminDlg::PageCreated(const OString& rId, SfxTabPage& _rPage)
+ void OUserAdminDlg::PageCreated(const OUString& rId, SfxTabPage& _rPage)
{
// register ourself as modified listener
static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( m_pImpl->getORB() );
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index 5f0eedbb0496..c418728217b1 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -40,15 +40,12 @@ namespace dbaui
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::dbtools;
ISaveValueWrapper::~ISaveValueWrapper()
{
}
- OGenericAdministrationPage::OGenericAdministrationPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rId, const SfxItemSet& rAttrSet)
+ OGenericAdministrationPage::OGenericAdministrationPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rId, const SfxItemSet& rAttrSet)
: SfxTabPage(pPage, pController, rUIXMLDescription, rId, &rAttrSet)
, m_abEnableRoadmap(false)
, m_pAdminDialog(nullptr)
@@ -208,7 +205,7 @@ namespace dbaui
_bChangedSomething = true;
}
- void OGenericAdministrationPage::fillInt32(SfxItemSet& _rSet, const weld::SpinButton* pEdit, sal_uInt16 _nID, bool& _bChangedSomething)
+ void OGenericAdministrationPage::fillInt32(SfxItemSet& _rSet, const weld::SpinButton* pEdit, TypedWhichId<SfxInt32Item> _nID, bool& _bChangedSomething)
{
if (pEdit && pEdit->get_value_changed_from_saved())
{
@@ -216,7 +213,7 @@ namespace dbaui
_bChangedSomething = true;
}
}
- void OGenericAdministrationPage::fillString(SfxItemSet& _rSet, const weld::Entry* pEdit, sal_uInt16 _nID, bool& _bChangedSomething)
+ void OGenericAdministrationPage::fillString(SfxItemSet& _rSet, const weld::Entry* pEdit, TypedWhichId<SfxStringItem> _nID, bool& _bChangedSomething)
{
if (pEdit && pEdit->get_value_changed_from_saved())
{
@@ -224,7 +221,7 @@ namespace dbaui
_bChangedSomething = true;
}
}
- void OGenericAdministrationPage::fillString(SfxItemSet& _rSet, const dbaui::OConnectionURLEdit* pEdit, sal_uInt16 _nID, bool& _bChangedSomething)
+ void OGenericAdministrationPage::fillString(SfxItemSet& _rSet, const dbaui::OConnectionURLEdit* pEdit, TypedWhichId<SfxStringItem> _nID, bool& _bChangedSomething)
{
if (pEdit && pEdit->get_value_changed_from_saved())
{
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index de8265751992..7d13a3886e44 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -23,6 +23,9 @@
#include <vcl/wizardmachine.hxx>
#include <curledit.hxx>
+class SfxInt32Item;
+class SfxStringItem;
+
namespace dbaui
{
/// helper class to wrap the savevalue and disable call
@@ -94,7 +97,7 @@ namespace dbaui
css::uno::Reference< css::uno::XComponentContext >
m_xORB;
public:
- OGenericAdministrationPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rId, const SfxItemSet& rAttrSet);
+ OGenericAdministrationPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rId, const SfxItemSet& rAttrSet);
/// set a handler which gets called every time something on the page has been modified
void SetModifiedHandler(const Link<OGenericAdministrationPage const *, void>& _rHandler) { m_aModifiedHandler = _rHandler; }
@@ -203,7 +206,7 @@ namespace dbaui
@param _bChangedSomething
<TRUE/> if something changed otherwise <FALSE/>
*/
- static void fillInt32(SfxItemSet& _rSet,const weld::SpinButton* pEdit,sal_uInt16 _nID, bool& _bChangedSomething);
+ static void fillInt32(SfxItemSet& _rSet,const weld::SpinButton* pEdit,TypedWhichId<SfxInt32Item> _nID, bool& _bChangedSomething);
/** fills the String value into the item set when the value changed.
@param _rSet
@@ -215,8 +218,8 @@ namespace dbaui
@param _bChangedSomething
<TRUE/> if something changed otherwise <FALSE/>
*/
- static void fillString(SfxItemSet& _rSet,const weld::Entry* pEdit,sal_uInt16 _nID, bool& _bChangedSomething);
- static void fillString(SfxItemSet& _rSet,const dbaui::OConnectionURLEdit* pEdit,sal_uInt16 _nID, bool& _bChangedSomething);
+ static void fillString(SfxItemSet& _rSet,const weld::Entry* pEdit, TypedWhichId<SfxStringItem> _nID, bool& _bChangedSomething);
+ static void fillString(SfxItemSet& _rSet,const dbaui::OConnectionURLEdit* pEdit, TypedWhichId<SfxStringItem> _nID, bool& _bChangedSomething);
protected:
/** This link be used for controls where the tabpage does not need to take any special action when the control
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index be60cdb9b089..82af63688cc1 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -27,6 +27,7 @@
#include <comphelper/scopeguard.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <systools/win32/comtools.hxx>
+#include <systools/win32/oleauto.hxx>
#include <initguid.h>
#include <adoid.h>
@@ -57,12 +58,11 @@ OUString PromptNew(sal_IntPtr hWnd)
sal::systools::COMReference<ADOConnection> piTmpConnection(piDispatch,
sal::systools::COM_QUERY_THROW);
- BSTR _result = nullptr;
+ sal::systools::BStr _result;
sal::systools::ThrowIfFailed(piTmpConnection->get_ConnectionString(&_result),
"get_ConnectionString failed");
- // FIXME: Don't we need SysFreeString(_result)?
- return OUString(o3tl::toU(_result), SysStringLen(_result));
+ return OUString(_result);
}
catch (const sal::systools::ComError&)
{
@@ -80,9 +80,8 @@ OUString PromptEdit(sal_IntPtr hWnd, OUString const & connstr)
sal::systools::COMReference<ADOConnection> piTmpConnection;
piTmpConnection.CoCreateInstance(CLSID_CADOConnection, nullptr, CLSCTX_INPROC_SERVER);
- // FIXME: BSTR is not just cast from a random string
sal::systools::ThrowIfFailed(
- piTmpConnection->put_ConnectionString(const_cast<BSTR>(o3tl::toW(connstr.getStr()))),
+ piTmpConnection->put_ConnectionString(sal::systools::BStr(connstr)),
"put_ConnectionString failed");
// Instantiate DataLinks object.
@@ -111,12 +110,11 @@ OUString PromptEdit(sal_IntPtr hWnd, OUString const & connstr)
piTmpConnection.set(piDispatch, sal::systools::COM_QUERY_THROW);
}
- BSTR _result = nullptr;
+ sal::systools::BStr _result;
sal::systools::ThrowIfFailed(piTmpConnection->get_ConnectionString(&_result),
"get_ConnectionString failed");
- // FIXME: Don't we need SysFreeString(_result)?
- return OUString(o3tl::toU(_result), SysStringLen(_result));
+ return OUString(_result);
}
catch (const sal::systools::ComError&)
{
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 809b483cd19a..2d98688f5b6c 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -18,7 +18,7 @@
*/
#include <adtabdlg.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include <connectivity/dbtools.hxx>
@@ -196,10 +196,9 @@ void TableListFacade::updateTableObjectList( bool _bAllowViews )
const OUString* pViewEnd = pViewBegin + sViews.getLength();
::comphelper::UStringMixEqual aEqualFunctor;
for(;pViewBegin != pViewEnd;++pViewBegin)
- aTables.erase(std::remove_if(aTables.begin(),aTables.end(),
+ std::erase_if(aTables,
[&aEqualFunctor, pViewBegin](const OUString& lhs)
- { return aEqualFunctor(lhs, *pViewBegin); } )
- , aTables.end());
+ { return aEqualFunctor(lhs, *pViewBegin); } );
sTables = Sequence< OUString>(aTables.data(), aTables.size());
sViews = Sequence< OUString>();
}
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 40964305a9f3..935a5370de11 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -46,7 +46,7 @@ namespace dbaui
struct BooleanSettingDesc
{
std::unique_ptr<weld::CheckButton>& xControl; // the dialog's control which displays this setting
- OString sControlId; // the widget name of the control in the .ui
+ OUString sControlId; // the widget name of the control in the .ui
sal_uInt16 nItemId; // the ID of the item (in an SfxItemSet) which corresponds to this setting
bool bInvertedDisplay; // true if and only if the checkbox is checked when the item is sal_False, and vice versa
bool bOptionalBool; // type is OptionalBool
@@ -217,7 +217,7 @@ namespace dbaui
else
OSL_FAIL( "SpecialSettingsPage::implInitControls: unknown boolean item type!" );
- if ( !aValue )
+ if ( !aValue.has_value() )
{
booleanSetting.xControl->set_state(TRISTATE_INDET);
}
@@ -287,9 +287,7 @@ namespace dbaui
: OGenericAdministrationPage(pPage, pController, "dbaccess/ui/generatedvaluespage.ui", "GeneratedValuesPage", _rCoreAttrs)
, m_xAutoRetrievingEnabled(m_xBuilder->weld_check_button("autoretrieve"))
, m_xGrid(m_xBuilder->weld_widget("grid"))
- , m_xAutoIncrementLabel(m_xBuilder->weld_label("statementft"))
, m_xAutoIncrement(m_xBuilder->weld_entry("statement"))
- , m_xAutoRetrievingLabel(m_xBuilder->weld_label("queryft"))
, m_xAutoRetrieving(m_xBuilder->weld_entry("query"))
{
m_xAutoRetrievingEnabled->connect_toggled(LINK(this, GeneratedValuesPage, OnAutoToggleHdl));
@@ -412,7 +410,7 @@ namespace dbaui
return nRet;
}
- void AdvancedSettingsDialog::PageCreated(const OString& rId, SfxTabPage& _rPage)
+ void AdvancedSettingsDialog::PageCreated(const OUString& rId, SfxTabPage& _rPage)
{
// register ourself as modified listener
static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( getORB() );
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index 38f100612b43..9eaca4a41b48 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -88,9 +88,7 @@ namespace dbaui
{
std::unique_ptr<weld::CheckButton> m_xAutoRetrievingEnabled;
std::unique_ptr<weld::Widget> m_xGrid;
- std::unique_ptr<weld::Label> m_xAutoIncrementLabel;
std::unique_ptr<weld::Entry> m_xAutoIncrement;
- std::unique_ptr<weld::Label> m_xAutoRetrievingLabel;
std::unique_ptr<weld::Entry> m_xAutoRetrieving;
public:
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 3b528ba0b070..2705d56362de 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -38,10 +38,7 @@ namespace dbaui
{
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::util;
using namespace com::sun::star::beans;
-using namespace com::sun::star::container;
// ODbAdminDialog
ODbAdminDialog::ODbAdminDialog(weld::Window* pParent,
@@ -71,7 +68,7 @@ short ODbAdminDialog::Ok()
// TODO : AR_ERROR is not handled correctly, we always close the dialog here
}
-void ODbAdminDialog::PageCreated(const OString& rId, SfxTabPage& _rPage)
+void ODbAdminDialog::PageCreated(const OUString& rId, SfxTabPage& _rPage)
{
// register ourself as modified listener
static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( getORB() );
@@ -80,7 +77,7 @@ void ODbAdminDialog::PageCreated(const OString& rId, SfxTabPage& _rPage)
SfxTabDialogController::PageCreated(rId, _rPage);
}
-void ODbAdminDialog::addDetailPage(const OString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc)
+void ODbAdminDialog::addDetailPage(const OUString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc)
{
AddTabPage(rPageId, DBA_RES(pTextId), pCreateFunc);
}
@@ -91,8 +88,9 @@ void ODbAdminDialog::impl_selectDataSource(const css::uno::Any& _aDataSourceName
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
impl_resetPages( xDatasource );
- const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*getOutputSet()->GetItem(DSID_TYPECOLLECTION));
- ::dbaccess::ODsnTypeCollection* pCollection = rCollectionItem.getCollection();
+ const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+ assert(pCollectionItem && "must exist");
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
// and insert the new ones
@@ -141,7 +139,7 @@ void ODbAdminDialog::impl_selectDataSource(const css::uno::Any& _aDataSourceName
case ::dbaccess::DST_USERDEFINE10:
{
OUString aTitle(DBA_RES(STR_PAGETITLE_ADVANCED));
- AddTabPage("user" + OString::number(eType - dbaccess::DST_USERDEFINE1 + 1), aTitle, ODriversSettings::CreateUser);
+ AddTabPage("user" + OUString::number(eType - dbaccess::DST_USERDEFINE1 + 1), aTitle, ODriversSettings::CreateUser);
}
break;
default:
@@ -177,11 +175,12 @@ void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasou
// special case: MySQL Native does not have the generic "advanced" page
- const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*getOutputSet()->GetItem(DSID_TYPECOLLECTION));
- ::dbaccess::ODsnTypeCollection* pCollection = rCollectionItem.getCollection();
+ const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+ assert(pCollectionItem && "must exist");
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
if ( pCollection->determineType(getDatasourceType( *m_xExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
{
- OString sMySqlNative("mysqlnative");
+ OUString sMySqlNative("mysqlnative");
AddTabPage(sMySqlNative, DBA_RES(STR_PAGETITLE_CONNECTION), ODriversSettings::CreateMySQLNATIVE);
RemoveTabPage("advanced");
m_sMainPageID = sMySqlNative;
@@ -262,168 +261,135 @@ void ODbAdminDialog::clearPassword()
m_pImpl->clearPassword();
}
-void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
+static ItemInfoPackage& getItemInfoPackageAdminDlg()
{
- // just to be sure...
- _rpSet = nullptr;
- _rpPool = nullptr;
- _rpDefaults = nullptr;
-
- const OUString sFilterAll( "%" );
- // create and initialize the defaults
- _rpDefaults = new std::vector<SfxPoolItem*>(DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1);
- SfxPoolItem** pCounter = _rpDefaults->data(); // want to modify this without affecting the out param _rppDefaults
- *pCounter++ = new SfxStringItem(DSID_NAME, OUString());
- *pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, OUString());
- *pCounter++ = new SfxStringItem(DSID_CONNECTURL, OUString());
- *pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< OUString >(&sFilterAll, 1));
- *pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
- *pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, false);
- *pCounter++ = new SfxBoolItem(DSID_READONLY, false);
- *pCounter++ = new SfxStringItem(DSID_USER, OUString());
- *pCounter++ = new SfxStringItem(DSID_PASSWORD, OUString());
- *pCounter++ = new SfxStringItem(DSID_ADDITIONALOPTIONS, OUString());
- *pCounter++ = new SfxStringItem(DSID_CHARSET, OUString());
- *pCounter++ = new SfxBoolItem(DSID_PASSWORDREQUIRED, false);
- *pCounter++ = new SfxBoolItem(DSID_SHOWDELETEDROWS, false);
- *pCounter++ = new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, false);
- *pCounter++ = new SfxStringItem(DSID_JDBCDRIVERCLASS, OUString());
- *pCounter++ = new SfxStringItem(DSID_FIELDDELIMITER, OUString(','));
- *pCounter++ = new SfxStringItem(DSID_TEXTDELIMITER, OUString('"'));
- *pCounter++ = new SfxStringItem(DSID_DECIMALDELIMITER, OUString('.'));
- *pCounter++ = new SfxStringItem(DSID_THOUSANDSDELIMITER, OUString());
- *pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, "txt");
- *pCounter++ = new SfxBoolItem(DSID_TEXTFILEHEADER, true);
- *pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, false);
- *pCounter++ = new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100);
- *pCounter++ = new SfxBoolItem(DSID_SUPPRESSVERSIONCL, false);
- *pCounter++ = new SfxBoolItem(DSID_CONN_SHUTSERVICE, false);
- *pCounter++ = new SfxInt32Item(DSID_CONN_DATAINC, 20);
- *pCounter++ = new SfxInt32Item(DSID_CONN_CACHESIZE, 20);
- *pCounter++ = new SfxStringItem(DSID_CONN_CTRLUSER, OUString());
- *pCounter++ = new SfxStringItem(DSID_CONN_CTRLPWD, OUString());
- *pCounter++ = new SfxBoolItem(DSID_USECATALOG, false);
- *pCounter++ = new SfxStringItem(DSID_CONN_HOSTNAME, OUString());
- *pCounter++ = new SfxStringItem(DSID_CONN_LDAP_BASEDN, OUString());
- *pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389);
- *pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100);
- *pCounter++ = new SfxBoolItem(DSID_SQL92CHECK, false);
- *pCounter++ = new SfxStringItem(DSID_AUTOINCREMENTVALUE, OUString());
- *pCounter++ = new SfxStringItem(DSID_AUTORETRIEVEVALUE, OUString());
- *pCounter++ = new SfxBoolItem(DSID_AUTORETRIEVEENABLED, false);
- *pCounter++ = new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, false);
- *pCounter++ = new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306);
- *pCounter++ = new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, true);
- *pCounter++ = new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0);
- *pCounter++ = new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521);
- *pCounter++ = new SfxBoolItem(DSID_ENABLEOUTERJOIN, true);
- *pCounter++ = new SfxBoolItem(DSID_CATALOG, true);
- *pCounter++ = new SfxBoolItem(DSID_SCHEMA, true);
- *pCounter++ = new SfxBoolItem(DSID_INDEXAPPENDIX, true);
- *pCounter++ = new SfxBoolItem(DSID_CONN_LDAP_USESSL, false);
- *pCounter++ = new SfxStringItem(DSID_DOCUMENT_URL, OUString());
- *pCounter++ = new SfxBoolItem(DSID_DOSLINEENDS, false);
- *pCounter++ = new SfxStringItem(DSID_DATABASENAME, OUString());
- *pCounter++ = new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, false);
- *pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, true);
- *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, false);
- *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, OUString());
- *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, true);
- *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, OUString());
- *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT );
- *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100);
- *pCounter++ = new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,false );
-
- // create the pool
- static SfxItemInfo const aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] =
+ class ItemInfoPackageAdminDlg : public ItemInfoPackage
{
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
- {0,false},
+ typedef std::array<ItemInfoStatic, DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1> ItemInfoArrayAdminDlg;
+ ItemInfoArrayAdminDlg maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { DSID_NAME, new SfxStringItem(DSID_NAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_ORIGINALNAME, new SfxStringItem(DSID_ORIGINALNAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONNECTURL, new SfxStringItem(DSID_CONNECTURL, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+
+ // gets added in constructor below once for LO runtime as static default
+ { DSID_TABLEFILTER, nullptr, 0, SFX_ITEMINFOFLAG_NONE },
+
+ // gets added by callback for each new Pool as dynamic default
+ { DSID_TYPECOLLECTION, nullptr, 0, SFX_ITEMINFOFLAG_NONE },
+
+ { DSID_INVALID_SELECTION, new SfxBoolItem(DSID_INVALID_SELECTION, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_READONLY, new SfxBoolItem(DSID_READONLY, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_USER, new SfxStringItem(DSID_USER, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_PASSWORD, new SfxStringItem(DSID_PASSWORD, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_ADDITIONALOPTIONS, new SfxStringItem(DSID_ADDITIONALOPTIONS, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CHARSET, new SfxStringItem(DSID_CHARSET, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_PASSWORDREQUIRED, new SfxBoolItem(DSID_PASSWORDREQUIRED, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_SHOWDELETEDROWS, new SfxBoolItem(DSID_SHOWDELETEDROWS, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_ALLOWLONGTABLENAMES, new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_JDBCDRIVERCLASS, new SfxStringItem(DSID_JDBCDRIVERCLASS, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_FIELDDELIMITER, new SfxStringItem(DSID_FIELDDELIMITER, OUString(',')), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_TEXTDELIMITER, new SfxStringItem(DSID_TEXTDELIMITER, OUString('"')), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_DECIMALDELIMITER, new SfxStringItem(DSID_DECIMALDELIMITER, OUString('.')), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_THOUSANDSDELIMITER, new SfxStringItem(DSID_THOUSANDSDELIMITER, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_TEXTFILEEXTENSION, new SfxStringItem(DSID_TEXTFILEEXTENSION, "txt"), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_TEXTFILEHEADER, new SfxBoolItem(DSID_TEXTFILEHEADER, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_PARAMETERNAMESUBST, new SfxBoolItem(DSID_PARAMETERNAMESUBST, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_PORTNUMBER, new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_SUPPRESSVERSIONCL, new SfxBoolItem(DSID_SUPPRESSVERSIONCL, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_SHUTSERVICE, new SfxBoolItem(DSID_CONN_SHUTSERVICE, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_DATAINC, new SfxInt32Item(DSID_CONN_DATAINC, 20), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_CACHESIZE, new SfxInt32Item(DSID_CONN_CACHESIZE, 20), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_CTRLUSER, new SfxStringItem(DSID_CONN_CTRLUSER, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_CTRLPWD, new SfxStringItem(DSID_CONN_CTRLPWD, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_USECATALOG, new SfxBoolItem(DSID_USECATALOG, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_HOSTNAME, new SfxStringItem(DSID_CONN_HOSTNAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_LDAP_BASEDN, new SfxStringItem(DSID_CONN_LDAP_BASEDN, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_LDAP_PORTNUMBER, new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_LDAP_ROWCOUNT, new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_SQL92CHECK, new SfxBoolItem(DSID_SQL92CHECK, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_AUTOINCREMENTVALUE, new SfxStringItem(DSID_AUTOINCREMENTVALUE, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_AUTORETRIEVEVALUE, new SfxStringItem(DSID_AUTORETRIEVEVALUE, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_AUTORETRIEVEENABLED, new SfxBoolItem(DSID_AUTORETRIEVEENABLED, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_APPEND_TABLE_ALIAS, new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_MYSQL_PORTNUMBER, new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_IGNOREDRIVER_PRIV, new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_BOOLEANCOMPARISON, new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_ORACLE_PORTNUMBER, new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_ENABLEOUTERJOIN, new SfxBoolItem(DSID_ENABLEOUTERJOIN, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CATALOG, new SfxBoolItem(DSID_CATALOG, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_SCHEMA, new SfxBoolItem(DSID_SCHEMA, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_INDEXAPPENDIX, new SfxBoolItem(DSID_INDEXAPPENDIX, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_LDAP_USESSL, new SfxBoolItem(DSID_CONN_LDAP_USESSL, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_DOCUMENT_URL, new SfxStringItem(DSID_DOCUMENT_URL, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_DOSLINEENDS, new SfxBoolItem(DSID_DOSLINEENDS, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_DATABASENAME, new SfxStringItem(DSID_DATABASENAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_AS_BEFORE_CORRNAME, new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CHECK_REQUIRED_FIELDS, new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_IGNORECURRENCY, new SfxBoolItem(DSID_IGNORECURRENCY, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_CONN_SOCKET, new SfxStringItem(DSID_CONN_SOCKET, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_ESCAPE_DATETIME, new SfxBoolItem(DSID_ESCAPE_DATETIME, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_NAMED_PIPE, new SfxStringItem(DSID_NAMED_PIPE, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_PRIMARY_KEY_SUPPORT, new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_MAX_ROW_SCAN, new SfxInt32Item(DSID_MAX_ROW_SCAN, 100), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_RESPECTRESULTSETTYPE, new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,false ), 0, SFX_ITEMINFOFLAG_NONE },
+ { DSID_POSTGRES_PORTNUMBER, new SfxInt32Item(DSID_POSTGRES_PORTNUMBER, 5432), 0, SFX_ITEMINFOFLAG_NONE }
+ }};
+
+ virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
+
+ public:
+ ItemInfoPackageAdminDlg()
+ {
+ static constexpr OUString sFilterAll( u"%"_ustr );
+ setItemAtItemInfoStatic(
+ new OStringListItem(DSID_TABLEFILTER, Sequence< OUString >{sFilterAll}),
+ maItemInfos[DSID_TABLEFILTER - DSID_FIRST_ITEM_ID]);
+ }
+
+ virtual size_t size() const override { return maItemInfos.size(); }
+ virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
};
- OSL_ENSURE(SAL_N_ELEMENTS(aItemInfos) == DSID_LAST_ITEM_ID,"Invalid Ids!");
- _rpPool = new SfxItemPool("DSAItemPool", DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID,
- aItemInfos, _rpDefaults);
- _rpPool->FreezeIdRanges();
+ static std::unique_ptr<ItemInfoPackageAdminDlg> g_aItemInfoPackageAdminDlg;
+ if (!g_aItemInfoPackageAdminDlg)
+ g_aItemInfoPackageAdminDlg.reset(new ItemInfoPackageAdminDlg);
+ return *g_aItemInfoPackageAdminDlg;
+}
+
+void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
+{
+ // just to be sure...
+ _rpSet = nullptr;
+ _rpPool = nullptr;
+ _rpPool = new SfxItemPool("DSAItemPool");
+
+ // here we have to use the callback to create all needed default entries since
+ // the DSID_TYPECOLLECTION needs the local given _pTypeCollection. Thus this will
+ // be a ItemInfoDynamic created by SfxItemPool::registerItemInfoPackage. That
+ // (and the contained Item) will be owned by the Pool and cleaned up when it goes
+ // down (see SfxItemPool::cleanupItemInfos())
+ _rpPool->registerItemInfoPackage(
+ getItemInfoPackageAdminDlg(),
+ [&_pTypeCollection](sal_uInt16 nWhich)
+ {
+ SfxPoolItem* pRetval(nullptr);
+ if (DSID_TYPECOLLECTION == nWhich)
+ pRetval = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
+ return pRetval;
+ });
// and, finally, the set
_rpSet.reset(new SfxItemSet(*_rpPool));
}
-void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
+void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool)
{
// _first_ delete the set (referring the pool)
_rpSet.reset();
// delete the pool
- if (_rpPool)
- {
- _rpPool->ReleaseDefaults(true);
- // the "true" means delete the items, too
- _rpPool = nullptr;
- }
-
- // reset the defaults ptr
- _rpDefaults = nullptr;
- // no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
+ _rpPool = nullptr;
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx
index d12688d2cbd8..35db6e446ee4 100644
--- a/dbaccess/source/ui/dlg/dbfindex.cxx
+++ b/dbaccess/source/ui/dlg/dbfindex.cxx
@@ -29,6 +29,7 @@
#include <ucbhelper/content.hxx>
#include <svl/filenotation.hxx>
#include <rtl/strbuf.hxx>
+#include <utility>
namespace dbaui
{
@@ -36,12 +37,12 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using namespace ::svt;
-constexpr OStringLiteral aGroupIdent("dBase III");
+constexpr OString aGroupIdent("dBase III"_ostr);
-ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, const OUString& aDataSrcName)
+ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, OUString aDataSrcName)
: GenericDialogController(pParent, "dbaccess/ui/dbaseindexdialog.ui", "DBaseIndexDialog")
- , m_aDSN(aDataSrcName)
+ , m_aDSN(std::move(aDataSrcName))
, m_xPB_OK(m_xBuilder->weld_button("ok"))
, m_xCB_Tables(m_xBuilder->weld_combo_box("table"))
, m_xIndexes(m_xBuilder->weld_widget("frame"))
@@ -253,9 +254,6 @@ void ODbaseIndexDialog::Init()
// first assume for all indexes they're free
- OUString const aIndexExt("ndx");
- OUString const aTableExt("dbf");
-
std::vector< OUString > aUsedIndexes;
aURL.SetSmartProtocol(INetProtocol::File);
@@ -266,11 +264,11 @@ void ODbaseIndexDialog::Init()
osl::FileBase::getSystemPathFromFileURL(rURL,aName);
aURL.SetSmartURL(aName);
OUString aExt = aURL.getExtension();
- if (aExt == aIndexExt)
+ if (aExt == "ndx")
{
m_aFreeIndexList.emplace_back(aURL.getName() );
}
- else if (aExt == aTableExt)
+ else if (aExt == "dbf")
{
m_aTableInfoList.emplace_back(aURL.getName() );
OTableInfo& rTabInfo = m_aTableInfoList.back();
@@ -370,7 +368,6 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const
aInfFile.SetGroup( aGroupIdent );
// first, delete all table indices
- OString aNDX;
sal_uInt16 nKeyCnt = aInfFile.GetKeyCount();
sal_uInt16 nKey = 0;
@@ -378,7 +375,7 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const
{
// Does the key point to an index file?...
OString aKeyName = aInfFile.GetKeyName( nKey );
- aNDX = aKeyName.copy(0,3);
+ OString aNDX = aKeyName.copy(0,3);
//...if yes, delete index file, nKey is at subsequent key
if (aNDX == "NDX")
@@ -414,7 +411,7 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const
try
{
::ucbhelper::Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- aContent.executeCommand( "delete", makeAny( true ) );
+ aContent.executeCommand( "delete", Any( true ) );
}
catch (const Exception& )
{
diff --git a/dbaccess/source/ui/dlg/dbfindex.hxx b/dbaccess/source/ui/dlg/dbfindex.hxx
index 53b75640e6f4..938339314ecc 100644
--- a/dbaccess/source/ui/dlg/dbfindex.hxx
+++ b/dbaccess/source/ui/dlg/dbfindex.hxx
@@ -19,6 +19,7 @@
#pragma once
+#include <utility>
#include <vcl/weld.hxx>
#include <deque>
@@ -34,7 +35,7 @@ private:
public:
OTableIndex() { }
- explicit OTableIndex( const OUString& rFileName ) : aIndexFileName( rFileName ) { }
+ explicit OTableIndex( OUString aFileName ) : aIndexFileName(std::move( aFileName )) { }
const OUString& GetIndexFileName() const { return aIndexFileName; }
};
@@ -53,7 +54,7 @@ private:
TableIndexList aIndexList;
public:
- explicit OTableInfo( const OUString& rName ) : aTableName(rName) { }
+ explicit OTableInfo( OUString aName ) : aTableName(std::move(aName)) { }
void WriteInfFile( const OUString& rDSN ) const;
};
@@ -63,7 +64,6 @@ typedef std::deque< OTableInfo > TableInfoList;
// IndexDialog
class ODbaseIndexDialog : public weld::GenericDialogController
{
-protected:
OUString m_aDSN;
TableInfoList m_aTableInfoList;
TableIndexList m_aFreeIndexList;
@@ -87,6 +87,7 @@ protected:
DECL_LINK( OKClickHdl, weld::Button&, void );
DECL_LINK( OnListEntrySelected, weld::TreeView&, void );
+protected:
void Init();
void SetCtrls();
@@ -101,7 +102,7 @@ protected:
void checkButtons();
public:
- ODbaseIndexDialog(weld::Window * pParent, const OUString& rDataSrcName);
+ ODbaseIndexDialog(weld::Window * pParent, OUString aDataSrcName);
virtual ~ODbaseIndexDialog() override;
};
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index 6f90f3e499d6..f34e58c1717e 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -35,7 +35,6 @@ namespace dbaui
{
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::lang;
using namespace com::sun::star::util;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
@@ -77,8 +76,9 @@ ODbTypeWizDialog::ODbTypeWizDialog(weld::Window* _pParent, SfxItemSet const * _p
m_xFinish->set_help_id(HID_DBWIZ_FINISH);
// no local resources needed anymore
- const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*_pItems->GetItem(DSID_TYPECOLLECTION));
- m_pCollection = rCollectionItem.getCollection();
+ const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(_pItems->GetItem(DSID_TYPECOLLECTION));
+ assert(pCollectionItem && "must exist");
+ m_pCollection = pCollectionItem->getCollection();
ActivatePage();
setTitleBase(DBA_RES(STR_DATABASE_TYPE_CHANGE));
@@ -137,7 +137,6 @@ WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) c
case ::dbaccess::DST_KAB:
case ::dbaccess::DST_MACAB:
case ::dbaccess::DST_MSACCESS:
- case ::dbaccess::DST_MSACCESS_2007:
case ::dbaccess::DST_JDBC:
case ::dbaccess::DST_CALC:
case ::dbaccess::DST_WRITER:
@@ -217,7 +216,7 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialog::createPage(WizardState _nState)
TranslateId pStringId = STR_PAGETITLE_ADVANCED;
std::unique_ptr<BuilderPage> xPage;
- OString sIdent(OString::number(_nState));
+ OUString sIdent(OUString::number(_nState));
weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
switch(_nState)
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index f3582e41dbed..8fb43e3d2fc2 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -60,9 +60,10 @@
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <connectivity/DriversConfig.hxx>
+#include <utility>
namespace dbaui
{
@@ -71,7 +72,6 @@ using namespace vcl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
using namespace com::sun::star::task;
using namespace com::sun::star::lang;
using namespace com::sun::star::io;
@@ -105,6 +105,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
, m_sRM_JDBCText( DBA_RES( STR_PAGETITLE_JDBC ) )
, m_sRM_MySQLNativePageTitle( DBA_RES( STR_PAGETITLE_MYSQL_NATIVE ) )
, m_sRM_OracleText( DBA_RES( STR_PAGETITLE_ORACLE ) )
+ , m_sRM_PostgresText( DBA_RES( STR_PAGETITLE_POSTGRES ) )
, m_sRM_MySQLText( DBA_RES( STR_PAGETITLE_MYSQL ) )
, m_sRM_ODBCText( DBA_RES( STR_PAGETITLE_ODBC ) )
, m_sRM_DocumentOrSpreadSheetText( DBA_RES( STR_PAGETITLE_DOCUMENT_OR_SPREADSHEET ) )
@@ -114,15 +115,14 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
, m_pGeneralPage( nullptr )
, m_pMySQLIntroPage( nullptr )
, m_pFinalPage( nullptr )
- , m_pCollection( nullptr )
{
// no local resources needed anymore
// extract the datasource type collection from the item set
- const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _pItems->GetItem(DSID_TYPECOLLECTION) );
- if (pCollectionItem)
- m_pCollection = pCollectionItem->getCollection();
+ const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(_pItems->GetItem(DSID_TYPECOLLECTION));
+ assert(pCollectionItem && "must exist");
+ m_pCollection = pCollectionItem->getCollection();
- OSL_ENSURE(m_pCollection, "ODbTypeWizDialogSetup::ODbTypeWizDialogSetup : really need a DSN type collection !");
+ assert(m_pCollection && "ODbTypeWizDialogSetup::ODbTypeWizDialogSetup : really need a DSN type collection !");
m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB, m_xAssistant.get(), _pParent, this));
m_pImpl->setDataSourceOrName(_aDataSourceName);
@@ -153,10 +153,14 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
declarePath( static_cast<PathId>(m_pCollection->size()+1), aPath);
+ // Set general help ID for the roadmap
+ SetRoadmapHelpId(HID_DBWIZ_ROADMAP);
+
m_xPrevPage->set_help_id(HID_DBWIZ_PREVIOUS);
m_xNextPage->set_help_id(HID_DBWIZ_NEXT);
m_xCancel->set_help_id(HID_DBWIZ_CANCEL);
m_xFinish->set_help_id(HID_DBWIZ_FINISH);
+ m_xHelp->set_help_id(HID_DBWIZ_HELP);
ActivatePage();
setTitleBase(DBA_RES(STR_DBWIZARDTITLE));
m_xAssistant->set_current_page(0);
@@ -209,6 +213,9 @@ OUString ODbTypeWizDialogSetup::getStateDisplayName(WizardState _nState) const
case PAGE_DBSETUPWIZARD_ORACLE:
sRoadmapItem = m_sRM_OracleText;
break;
+ case PAGE_DBSETUPWIZARD_POSTGRES:
+ sRoadmapItem = m_sRM_PostgresText;
+ break;
case PAGE_DBSETUPWIZARD_MYSQL_INTRO:
sRoadmapItem = m_sRM_MySQLText;
break;
@@ -266,7 +273,7 @@ static void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,con
}
}
-void DataSourceInfoConverter::convert(const Reference<XComponentContext> & xContext, const ::dbaccess::ODsnTypeCollection* _pCollection,const OUString& _sOldURLPrefix,const OUString& _sNewURLPrefix,const css::uno::Reference< css::beans::XPropertySet >& _xDatasource)
+void DataSourceInfoConverter::convert(const Reference<XComponentContext> & xContext, const ::dbaccess::ODsnTypeCollection* _pCollection, std::u16string_view _sOldURLPrefix, std::u16string_view _sNewURLPrefix,const css::uno::Reference< css::beans::XPropertySet >& _xDatasource)
{
if ( _pCollection->getPrefix(_sOldURLPrefix) == _pCollection->getPrefix(_sNewURLPrefix) )
return ;
@@ -281,7 +288,7 @@ void DataSourceInfoConverter::convert(const Reference<XComponentContext> & xCont
lcl_removeUnused(aOldProperties,aNewProperties,aDS);
aDS >>= aInfo;
- _xDatasource->setPropertyValue(PROPERTY_INFO,uno::makeAny(aInfo));
+ _xDatasource->setPropertyValue(PROPERTY_INFO,uno::Any(aInfo));
}
void ODbTypeWizDialogSetup::activateDatabasePath()
@@ -304,6 +311,9 @@ void ODbTypeWizDialogSetup::activateDatabasePath()
{
OUString sOld = m_sURL;
m_sURL = m_pGeneralPage->GetSelectedType();
+ if (m_sURL.startsWith("sdbc:mysql:") && sOld.startsWith("sdbc:mysql:"))
+ m_sURL = sOld; // The type of MySQL connection was already set elsewhere; just use it,
+ // instead of the hardcoded one from the selector
DataSourceInfoConverter::convert(getORB(), m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource());
::dbaccess::DATASOURCE_TYPE eType = VerifyDataSourceType(m_pCollection->determineType(m_sURL));
if (eType == ::dbaccess::DST_UNKNOWN)
@@ -456,7 +466,7 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nSta
{
std::unique_ptr<OGenericAdministrationPage> xPage;
- OString sIdent(OString::number(_nState));
+ OUString sIdent(OUString::number(_nState));
weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
switch(_nState)
@@ -486,16 +496,16 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nSta
break;
case PAGE_DBSETUPWIZARD_MYSQL_ODBC:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix("sdbc:mysql:odbc:")));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(u"sdbc:mysql:odbc:")));
xPage = OConnectionTabPageSetup::CreateODBCTabPage(pPageContainer, this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MYSQL_JDBC:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix("sdbc:mysql:jdbc:")));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(u"sdbc:mysql:jdbc:")));
xPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage(pPageContainer, this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MYSQL_NATIVE:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix("sdbc:mysql:mysqlc:")));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(u"sdbc:mysql:mysqlc:")));
xPage = MySQLNativeSetupPage::Create(pPageContainer, this, *m_pOutSet);
break;
@@ -503,6 +513,10 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nSta
xPage = OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage(pPageContainer, this, *m_pOutSet);
break;
+ case PAGE_DBSETUPWIZARD_POSTGRES:
+ xPage = OPostgresConnectionPageSetup::CreatePostgresTabPage(pPageContainer, this, *m_pOutSet);
+ break;
+
case PAGE_DBSETUPWIZARD_LDAP:
xPage = OLDAPConnectionPageSetup::CreateLDAPTabPage(pPageContainer, this, *m_pOutSet);
break;
@@ -690,16 +704,13 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
{
if ( !lcl_handle( xHandler, aError ) )
{
- InteractiveIOException aRequest;
- aRequest.Classification = InteractionClassification_ERROR;
- if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) )
- // assume saving the document failed
- aRequest.Code = IOErrorCode_CANT_WRITE;
- else
- aRequest.Code = IOErrorCode_GENERAL;
- aRequest.Message = e.Message;
- aRequest.Context = e.Context;
- lcl_handle( xHandler, makeAny( aRequest ) );
+ css::ucb::IOErrorCode code
+ = aError.isExtractableTo(::cppu::UnoType<IOException>::get())
+ ? IOErrorCode_CANT_WRITE // assume saving the document failed
+ : IOErrorCode_GENERAL;
+ InteractiveIOException aRequest(e.Message, e.Context,
+ InteractionClassification_ERROR, code);
+ lcl_handle( xHandler, Any( aRequest ) );
}
}
}
@@ -738,7 +749,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
OSL_ENSURE(xDatasource.is(),"DataSource is null!");
if ( xDatasource.is() )
- xDatasource->setPropertyValue( PROPERTY_INFO, makeAny( m_pCollection->getDefaultDBSettings( eType ) ) );
+ xDatasource->setPropertyValue( PROPERTY_INFO, Any( m_pCollection->getDefaultDBSettings( eType ) ) );
m_pImpl->translateProperties(xDatasource,*m_pOutSet);
}
else if ( m_pCollection->isFileSystemBased(eType) )
@@ -755,7 +766,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
m_pImpl->saveChanges(*m_pOutSet);
}
- void ODbTypeWizDialogSetup::RegisterDataSourceByLocation(const OUString& _sPath)
+ void ODbTypeWizDialogSetup::RegisterDataSourceByLocation(std::u16string_view _sPath)
{
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(getORB()) );
@@ -814,7 +825,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
if (bFolderExists)
{
i++;
- pURL->setName(OUStringConcatenation(sLastSegmentName + OUString::number(i)));
+ pURL->setName(Concat2View(sLastSegmentName + OUString::number(i)));
}
}
}
@@ -832,7 +843,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
bElementExists = xSimpleFileAccess->exists( aExistenceCheck.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if ( bElementExists )
{
- aExistenceCheck.setBase( OUStringConcatenation(BaseName + OUString::number( i ) ));
+ aExistenceCheck.setBase( Concat2View(BaseName + OUString::number( i ) ));
++i;
}
}
@@ -859,7 +870,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
OAsynchronousLink m_aAsyncCaller;
public:
- AsyncLoader( const Reference< XComponentContext >& _rxORB, const OUString& _rURL );
+ AsyncLoader( const Reference< XComponentContext >& _xORB, OUString _aURL );
void doLoadAsync();
@@ -873,8 +884,8 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
DECL_LINK( OnOpenDocument, void*, void );
};
- AsyncLoader::AsyncLoader( const Reference< XComponentContext >& _rxORB, const OUString& _rURL )
- :m_sURL( _rURL )
+ AsyncLoader::AsyncLoader( const Reference< XComponentContext >& _rxORB, OUString _aURL )
+ :m_sURL(std::move( _aURL ))
,m_aAsyncCaller( LINK( this, AsyncLoader, OnOpenDocument ) )
{
try
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 8a06d7de1c18..ed3d60692f34 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -45,14 +45,9 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::dbtools;
OCommonBehaviourTabPage::OCommonBehaviourTabPage(weld::Container* pPage, weld::DialogController* pController,
- const OUString& rUIXMLDescription, const OString& rId, const SfxItemSet& rCoreAttrs,
+ const OUString& rUIXMLDescription, const OUString& rId, const SfxItemSet& rCoreAttrs,
OCommonBehaviourTabPageFlags nControlFlags)
: OGenericAdministrationPage(pPage, pController, rUIXMLDescription, rId, rCoreAttrs)
, m_nControlFlags(nControlFlags)
@@ -442,7 +437,7 @@ namespace dbaui
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
// to get the correct value when saveValue was called by base class
- if ( m_bUseClass && m_xEDDriverClass->get_text().trim().isEmpty() )
+ if ( m_bUseClass && o3tl::trim(m_xEDDriverClass->get_text()).empty() )
{
m_xEDDriverClass->set_text(m_sDefaultJdbcDriverName);
m_xEDDriverClass->save_value();
@@ -457,7 +452,7 @@ namespace dbaui
#if HAVE_FEATURE_JAVA
try
{
- if (!m_xEDDriverClass->get_text().trim().isEmpty())
+ if (!o3tl::trim(m_xEDDriverClass->get_text()).empty())
{
// TODO change jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
@@ -478,7 +473,7 @@ namespace dbaui
void OGeneralSpecialJDBCDetailsPage::callModifiedHdl(weld::Widget* pControl)
{
if (m_bUseClass && pControl == m_xEDDriverClass.get())
- m_xTestJavaDriver->set_sensitive(!m_xEDDriverClass->get_text().trim().isEmpty());
+ m_xTestJavaDriver->set_sensitive(!o3tl::trim(m_xEDDriverClass->get_text()).empty());
// tell the listener we were modified
OGenericAdministrationPage::callModifiedHdl();
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index 2952f42e6155..aa01c12f930e 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -54,16 +54,10 @@ namespace dbaui
std::unique_ptr<weld::Label> m_xCharsetLabel;
std::unique_ptr<CharSetListBox> m_xCharset;
- std::unique_ptr<weld::CheckButton> m_xAutoRetrievingEnabled;
- std::unique_ptr<weld::Label> m_xAutoIncrementLabel;
- std::unique_ptr<weld::Entry> m_xAutoIncrement;
- std::unique_ptr<weld::Label> m_xAutoRetrievingLabel;
- std::unique_ptr<weld::Entry> m_xAutoRetrieving;
-
public:
virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) override;
- OCommonBehaviourTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rId, const SfxItemSet& _rCoreAttrs, OCommonBehaviourTabPageFlags nControlFlags);
+ OCommonBehaviourTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rId, const SfxItemSet& _rCoreAttrs, OCommonBehaviourTabPageFlags nControlFlags);
protected:
virtual ~OCommonBehaviourTabPage() override;
@@ -171,7 +165,7 @@ namespace dbaui
DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
OUString m_sDefaultJdbcDriverName;
- sal_uInt16 m_nPortId;
+ TypedWhichId<SfxInt32Item> m_nPortId;
bool m_bUseClass;
std::unique_ptr<weld::Entry> m_xEDHostname;
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index bcf8923abfaa..eab893e4e4b1 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -25,13 +25,16 @@
#include <comphelper/types.hxx>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XMultipleResults.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
namespace dbaui
{
@@ -213,7 +216,7 @@ namespace dbaui
Reference< com::sun::star::beans::XPropertySet > xStatementProps(xStatement, UNO_QUERY_THROW);
try
{
- xStatementProps->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny(false));
+ xStatementProps->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, Any(false));
}
catch( const Exception& )
{
@@ -235,7 +238,7 @@ namespace dbaui
}
else
addOutputText(
- OUStringConcatenation(OUString::number(xMR->getUpdateCount()) + " rows updated\n"));
+ Concat2View(OUString::number(xMR->getUpdateCount()) + " rows updated\n"));
for (;;)
{
hasRS = xMR->getMoreResults();
@@ -255,17 +258,17 @@ namespace dbaui
if (upperStatement.startsWith("UPDATE"))
{
sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
- addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows updated\n"));
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows updated\n"));
}
else if (upperStatement.startsWith("INSERT"))
{
sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
- addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows inserted\n"));
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows inserted\n"));
}
else if (upperStatement.startsWith("DELETE"))
{
sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
- addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows deleted\n"));
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows deleted\n"));
}
else if (upperStatement.startsWith("CREATE"))
{
@@ -281,7 +284,7 @@ namespace dbaui
else
{
sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
- addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows updated\n"));
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows updated\n"));
}
}
// successful
@@ -305,6 +308,10 @@ namespace dbaui
void DirectSQLDialog::display(const css::uno::Reference< css::sdbc::XResultSet >& xRS)
{
+
+ const Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRS,UNO_QUERY_THROW)->getMetaData();
+ const sal_Int32 nColumnsCount = xResultSetMetaData->getColumnCount();
+
// get a handle for the rows
css::uno::Reference< css::sdbc::XRow > xRow( xRS, css::uno::UNO_QUERY );
// work through each of the rows
@@ -315,12 +322,31 @@ namespace dbaui
// work along the columns until that are none left
try
{
- int i = 1;
- for (;;)
+ for (sal_Int32 i = 1; i <= nColumnsCount; ++i)
{
- // be dumb, treat everything as a string
- out.append(xRow->getString(i) + ",");
- i++;
+ switch (xResultSetMetaData->getColumnType(i))
+ {
+ // tdf#153317, at least "Bit" type in Mysql/MariaDB gives: "\000" or "\001"
+ // so retrieve Sequence from getBytes, test if it has a length of 1 (so we avoid BLOB/CLOB or other complex types)
+ // and test if the value of first byte is one of those.
+ // In this case, there's a good chance it's a "Bit" field
+ case css::sdbc::DataType::BIT:
+ {
+ auto seq = xRow->getBytes(i);
+ if ((seq.getLength() == 1) && (seq[0] >= 0) && (seq[0] <= 1))
+ {
+ out.append(OUString::number(static_cast<int>(seq[0])) + ",");
+ }
+ else
+ {
+ out.append(xRow->getString(i) + ",");
+ }
+ break;
+ }
+ // for the rest, be dumb, treat everything as a string
+ default:
+ out.append(xRow->getString(i) + ",");
+ }
}
}
// trap for when we fall off the end of the row
@@ -328,7 +354,7 @@ namespace dbaui
{
}
// report the output
- addOutputText(out.makeStringAndClear());
+ addOutputText(out);
}
}
diff --git a/dbaccess/source/ui/dlg/dlgattr.cxx b/dbaccess/source/ui/dlg/dlgattr.cxx
index 47457be595ca..24a1c4e81c2d 100644
--- a/dbaccess/source/ui/dlg/dlgattr.cxx
+++ b/dbaccess/source/ui/dlg/dlgattr.cxx
@@ -34,7 +34,7 @@ SbaSbAttrDlg::SbaSbAttrDlg(weld::Widget* pParent, const SfxItemSet* pCellAttrs,
SvNumberFormatter* pFormatter, bool bHasFormat)
: SfxTabDialogController(pParent, "dbaccess/ui/fielddialog.ui", "FieldDialog", pCellAttrs)
{
- pNumberInfoItem.reset( new SvxNumberInfoItem( pFormatter, 0 ) );
+ pNumberInfoItem.reset( new SvxNumberInfoItem( pFormatter, SID_ATTR_NUMBERFORMAT_INFO ) );
if (bHasFormat)
AddTabPage("format", RID_SVXPAGE_NUMBERFORMAT);
@@ -47,12 +47,12 @@ SbaSbAttrDlg::~SbaSbAttrDlg()
{
}
-void SbaSbAttrDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
+void SbaSbAttrDlg::PageCreated(const OUString& rPageId, SfxTabPage& rTabPage)
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
if (rPageId == "format")
{
- aSet.Put (SvxNumberInfoItem( pNumberInfoItem->GetNumberFormatter(), static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)));
+ aSet.Put (SvxNumberInfoItem( pNumberInfoItem->GetNumberFormatter(), SID_ATTR_NUMBERFORMAT_INFO));
rTabPage.PageCreated(aSet);
}
}
diff --git a/dbaccess/source/ui/dlg/dlgsave.cxx b/dbaccess/source/ui/dlg/dlgsave.cxx
index ce5d16881f1d..44c98cd49e63 100644
--- a/dbaccess/source/ui/dlg/dlgsave.cxx
+++ b/dbaccess/source/ui/dlg/dlgsave.cxx
@@ -24,58 +24,18 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <connectivity/dbtools.hxx>
#include <UITools.hxx>
-#include <SqlNameEdit.hxx>
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <objectnamecheck.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace dbaui;
using namespace dbtools;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
-namespace dbaui
-{
-class OSaveAsDlgImpl
-{
-public:
- OUString m_aQryLabel;
- OUString m_sTblLabel;
- OUString m_aName;
- const IObjectNameCheck& m_rObjectNameCheck;
- css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xMetaData;
- sal_Int32 m_nType;
- SADFlags m_nFlags;
-
- OSQLNameChecker m_aChecker;
-
- std::unique_ptr<weld::Label> m_xDescription;
- std::unique_ptr<weld::Label> m_xCatalogLbl;
- std::unique_ptr<weld::ComboBox> m_xCatalog;
- std::unique_ptr<weld::Label> m_xSchemaLbl;
- std::unique_ptr<weld::ComboBox> m_xSchema;
- std::unique_ptr<weld::Label> m_xLabel;
- std::unique_ptr<weld::Entry> m_xTitle;
- std::unique_ptr<weld::Button> m_xPB_OK;
-
- DECL_LINK(TextFilterHdl, OUString&, bool);
-
- OSaveAsDlgImpl( weld::Builder* pParent, sal_Int32 _rType,
- const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
- const OUString& rDefault,
- const IObjectNameCheck& _rObjectNameCheck,
- SADFlags _nFlags);
- OSaveAsDlgImpl( weld::Builder* pParent,
- const OUString& rDefault,
- const IObjectNameCheck& _rObjectNameCheck,
- SADFlags _nFlags);
-};
-
-} // dbaui
-
-IMPL_LINK(OSaveAsDlgImpl, TextFilterHdl, OUString&, rTest, bool)
+
+IMPL_LINK(OSaveAsDlg, TextFilterHdl, OUString&, rTest, bool)
{
OUString sCorrected;
if (m_aChecker.checkString(rTest, sCorrected))
@@ -83,69 +43,6 @@ IMPL_LINK(OSaveAsDlgImpl, TextFilterHdl, OUString&, rTest, bool)
return true;
}
-OSaveAsDlgImpl::OSaveAsDlgImpl(weld::Builder* pBuilder,
- sal_Int32 _rType,
- const Reference< XConnection>& _xConnection,
- const OUString& rDefault,
- const IObjectNameCheck& _rObjectNameCheck,
- SADFlags _nFlags)
- : m_aQryLabel(DBA_RES(STR_QRY_LABEL))
- , m_sTblLabel(DBA_RES(STR_TBL_LABEL))
- , m_aName(rDefault)
- , m_rObjectNameCheck( _rObjectNameCheck )
- , m_nType(_rType)
- , m_nFlags(_nFlags)
- , m_aChecker(OUString())
- , m_xDescription(pBuilder->weld_label("descriptionft"))
- , m_xCatalogLbl(pBuilder->weld_label("catalogft"))
- , m_xCatalog(pBuilder->weld_combo_box("catalog"))
- , m_xSchemaLbl(pBuilder->weld_label("schemaft"))
- , m_xSchema(pBuilder->weld_combo_box("schema"))
- , m_xLabel(pBuilder->weld_label("titleft"))
- , m_xTitle(pBuilder->weld_entry("title"))
- , m_xPB_OK(pBuilder->weld_button("ok"))
-{
- if ( _xConnection.is() )
- m_xMetaData = _xConnection->getMetaData();
-
- if (m_xMetaData.is())
- {
- OUString sExtraNameChars(m_xMetaData->getExtraNameCharacters());
- m_aChecker.setAllowedChars(sExtraNameChars);
- }
-
- m_xTitle->connect_insert_text(LINK(this, OSaveAsDlgImpl, TextFilterHdl));
- m_xSchema->connect_entry_insert_text(LINK(this, OSaveAsDlgImpl, TextFilterHdl));
- m_xCatalog->connect_entry_insert_text(LINK(this, OSaveAsDlgImpl, TextFilterHdl));
-}
-
-OSaveAsDlgImpl::OSaveAsDlgImpl(weld::Builder* pBuilder,
- const OUString& rDefault,
- const IObjectNameCheck& _rObjectNameCheck,
- SADFlags _nFlags)
- : m_aQryLabel(DBA_RES(STR_QRY_LABEL))
- , m_sTblLabel(DBA_RES(STR_TBL_LABEL))
- , m_aName(rDefault)
- , m_rObjectNameCheck( _rObjectNameCheck )
- , m_nType(CommandType::COMMAND)
- , m_nFlags(_nFlags)
- , m_aChecker(OUString())
- , m_xDescription(pBuilder->weld_label("descriptionft"))
- , m_xCatalogLbl(pBuilder->weld_label("catalogft"))
- , m_xCatalog(pBuilder->weld_combo_box("catalog"))
- , m_xSchemaLbl(pBuilder->weld_label("schemaft"))
- , m_xSchema(pBuilder->weld_combo_box("schema"))
- , m_xLabel(pBuilder->weld_label("titleft"))
- , m_xTitle(pBuilder->weld_entry("title"))
- , m_xPB_OK(pBuilder->weld_button("ok"))
-{
- m_xTitle->connect_insert_text(LINK(this, OSaveAsDlgImpl, TextFilterHdl));
- m_xSchema->connect_entry_insert_text(LINK(this, OSaveAsDlgImpl, TextFilterHdl));
- m_xCatalog->connect_entry_insert_text(LINK(this, OSaveAsDlgImpl, TextFilterHdl));
-}
-
-using namespace ::com::sun::star::lang;
-
namespace
{
typedef Reference< XResultSet > (SAL_CALL XDatabaseMetaData::*FGetMetaStrings)();
@@ -185,69 +82,93 @@ OSaveAsDlg::OSaveAsDlg( weld::Window * pParent,
SADFlags _nFlags)
: GenericDialogController(pParent, "dbaccess/ui/savedialog.ui", "SaveDialog")
, m_xContext( _rxContext )
+ , m_aName(rDefault)
+ , m_rObjectNameCheck( _rObjectNameCheck )
+ , m_nType(_rType)
+ , m_nFlags(_nFlags)
+ , m_aChecker(OUString())
+ , m_xDescription(m_xBuilder->weld_label("descriptionft"))
+ , m_xCatalogLbl(m_xBuilder->weld_label("catalogft"))
+ , m_xCatalog(m_xBuilder->weld_combo_box("catalog"))
+ , m_xSchemaLbl(m_xBuilder->weld_label("schemaft"))
+ , m_xSchema(m_xBuilder->weld_combo_box("schema"))
+ , m_xLabel(m_xBuilder->weld_label("titleft"))
+ , m_xTitle(m_xBuilder->weld_entry("title"))
+ , m_xPB_OK(m_xBuilder->weld_button("ok"))
{
- m_pImpl.reset( new OSaveAsDlgImpl(m_xBuilder.get(),_rType,_xConnection,rDefault,_rObjectNameCheck,_nFlags) );
+ if ( _xConnection.is() )
+ m_xMetaData = _xConnection->getMetaData();
+
+ if (m_xMetaData.is())
+ {
+ OUString sExtraNameChars(m_xMetaData->getExtraNameCharacters());
+ m_aChecker.setAllowedChars(sExtraNameChars);
+ }
+
+ m_xTitle->connect_insert_text(LINK(this, OSaveAsDlg, TextFilterHdl));
+ m_xSchema->connect_entry_insert_text(LINK(this, OSaveAsDlg, TextFilterHdl));
+ m_xCatalog->connect_entry_insert_text(LINK(this, OSaveAsDlg, TextFilterHdl));
switch (_rType) {
case CommandType::QUERY:
- implInitOnlyTitle(m_pImpl->m_aQryLabel);
+ implInitOnlyTitle(DBA_RES(STR_QRY_LABEL));
break;
case CommandType::TABLE:
- OSL_ENSURE( m_pImpl->m_xMetaData.is(), "OSaveAsDlg::OSaveAsDlg: no meta data for entering table names: this will crash!" );
+ OSL_ENSURE( m_xMetaData.is(), "OSaveAsDlg::OSaveAsDlg: no meta data for entering table names: this will crash!" );
{
- m_pImpl->m_xLabel->set_label(m_pImpl->m_sTblLabel);
- if(m_pImpl->m_xMetaData.is() && !m_pImpl->m_xMetaData->supportsCatalogsInTableDefinitions()) {
- m_pImpl->m_xCatalogLbl->hide();
- m_pImpl->m_xCatalog->hide();
+ m_xLabel->set_label(DBA_RES(STR_TBL_LABEL));
+ if(m_xMetaData.is() && !m_xMetaData->supportsCatalogsInTableDefinitions()) {
+ m_xCatalogLbl->hide();
+ m_xCatalog->hide();
} else {
// now fill the catalogs
- lcl_fillComboList( *m_pImpl->m_xCatalog, _xConnection,
+ lcl_fillComboList( *m_xCatalog, _xConnection,
&XDatabaseMetaData::getCatalogs, _xConnection->getCatalog() );
}
- if ( !m_pImpl->m_xMetaData->supportsSchemasInTableDefinitions()) {
- m_pImpl->m_xSchemaLbl->hide();
- m_pImpl->m_xSchema->hide();
+ if ( !m_xMetaData->supportsSchemasInTableDefinitions()) {
+ m_xSchemaLbl->hide();
+ m_xSchema->hide();
} else {
- lcl_fillComboList( *m_pImpl->m_xSchema, _xConnection,
- &XDatabaseMetaData::getSchemas, m_pImpl->m_xMetaData->getUserName() );
+ lcl_fillComboList( *m_xSchema, _xConnection,
+ &XDatabaseMetaData::getSchemas, m_xMetaData->getUserName() );
}
- OSL_ENSURE(m_pImpl->m_xMetaData.is(),"The metadata can not be null!");
- if(m_pImpl->m_aName.indexOf('.') != -1) {
+ OSL_ENSURE(m_xMetaData.is(),"The metadata can not be null!");
+ if(m_aName.indexOf('.') != -1) {
OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_pImpl->m_xMetaData,
- m_pImpl->m_aName,
+ ::dbtools::qualifiedNameComponents(m_xMetaData,
+ m_aName,
sCatalog,
sSchema,
sTable,
::dbtools::EComposeRule::InDataManipulation);
- int nPos = m_pImpl->m_xCatalog->find_text(sCatalog);
+ int nPos = m_xCatalog->find_text(sCatalog);
if (nPos != -1)
- m_pImpl->m_xCatalog->set_active(nPos);
+ m_xCatalog->set_active(nPos);
if ( !sSchema.isEmpty() ) {
- nPos = m_pImpl->m_xSchema->find_text(sSchema);
+ nPos = m_xSchema->find_text(sSchema);
if (nPos != -1)
- m_pImpl->m_xSchema->set_active(nPos);
+ m_xSchema->set_active(nPos);
}
- m_pImpl->m_xTitle->set_text(sTable);
+ m_xTitle->set_text(sTable);
} else
- m_pImpl->m_xTitle->set_text(m_pImpl->m_aName);
- m_pImpl->m_xTitle->select_region(0, -1);
+ m_xTitle->set_text(m_aName);
+ m_xTitle->select_region(0, -1);
- sal_Int32 nLength = m_pImpl->m_xMetaData.is() ? m_pImpl->m_xMetaData->getMaxTableNameLength() : 0;
+ sal_Int32 nLength = m_xMetaData.is() ? m_xMetaData->getMaxTableNameLength() : 0;
if (nLength)
{
- m_pImpl->m_xTitle->set_max_length(nLength);
- m_pImpl->m_xSchema->set_entry_max_length(nLength);
- m_pImpl->m_xCatalog->set_entry_max_length(nLength);
+ m_xTitle->set_max_length(nLength);
+ m_xSchema->set_entry_max_length(nLength);
+ m_xCatalog->set_entry_max_length(nLength);
}
bool bCheck = _xConnection.is() && isSQL92CheckEnabled(_xConnection);
- m_pImpl->m_aChecker.setCheck(bCheck); // enable non valid sql chars as well
+ m_aChecker.setCheck(bCheck); // enable non valid sql chars as well
}
break;
@@ -266,8 +187,23 @@ OSaveAsDlg::OSaveAsDlg(weld::Window * pParent,
SADFlags _nFlags)
: GenericDialogController(pParent, "dbaccess/ui/savedialog.ui", "SaveDialog")
, m_xContext( _rxContext )
+ , m_aName(rDefault)
+ , m_rObjectNameCheck( _rObjectNameCheck )
+ , m_nType(CommandType::COMMAND)
+ , m_nFlags(_nFlags)
+ , m_aChecker(OUString())
+ , m_xDescription(m_xBuilder->weld_label("descriptionft"))
+ , m_xCatalogLbl(m_xBuilder->weld_label("catalogft"))
+ , m_xCatalog(m_xBuilder->weld_combo_box("catalog"))
+ , m_xSchemaLbl(m_xBuilder->weld_label("schemaft"))
+ , m_xSchema(m_xBuilder->weld_combo_box("schema"))
+ , m_xLabel(m_xBuilder->weld_label("titleft"))
+ , m_xTitle(m_xBuilder->weld_entry("title"))
+ , m_xPB_OK(m_xBuilder->weld_button("ok"))
{
- m_pImpl.reset( new OSaveAsDlgImpl(m_xBuilder.get(),rDefault,_rObjectNameCheck,_nFlags) );
+ m_xTitle->connect_insert_text(LINK(this, OSaveAsDlg, TextFilterHdl));
+ m_xSchema->connect_entry_insert_text(LINK(this, OSaveAsDlg, TextFilterHdl));
+ m_xCatalog->connect_entry_insert_text(LINK(this, OSaveAsDlg, TextFilterHdl));
implInitOnlyTitle(_sLabel);
implInit();
}
@@ -278,13 +214,13 @@ OSaveAsDlg::~OSaveAsDlg()
IMPL_LINK_NOARG(OSaveAsDlg, ButtonClickHdl, weld::Button&, void)
{
- m_pImpl->m_aName = m_pImpl->m_xTitle->get_text();
+ m_aName = m_xTitle->get_text();
- OUString sNameToCheck( m_pImpl->m_aName );
+ OUString sNameToCheck( m_aName );
- if ( m_pImpl->m_nType == CommandType::TABLE ) {
+ if ( m_nType == CommandType::TABLE ) {
sNameToCheck = ::dbtools::composeTableName(
- m_pImpl->m_xMetaData,
+ m_xMetaData,
getCatalog(),
getSchema(),
sNameToCheck,
@@ -294,58 +230,58 @@ IMPL_LINK_NOARG(OSaveAsDlg, ButtonClickHdl, weld::Button&, void)
}
SQLExceptionInfo aNameError;
- if ( m_pImpl->m_rObjectNameCheck.isNameValid( sNameToCheck, aNameError ) )
+ if ( m_rObjectNameCheck.isNameValid( sNameToCheck, aNameError ) )
m_xDialog->response(RET_OK);
showError(aNameError, m_xDialog->GetXWindow(), m_xContext);
- m_pImpl->m_xTitle->grab_focus();
+ m_xTitle->grab_focus();
}
IMPL_LINK_NOARG(OSaveAsDlg, EditModifyHdl, weld::Entry&, void)
{
- m_pImpl->m_xPB_OK->set_sensitive(!m_pImpl->m_xTitle->get_text().isEmpty());
+ m_xPB_OK->set_sensitive(!m_xTitle->get_text().isEmpty());
}
void OSaveAsDlg::implInitOnlyTitle(const OUString& _rLabel)
{
- m_pImpl->m_xLabel->set_label(_rLabel);
- m_pImpl->m_xCatalogLbl->hide();
- m_pImpl->m_xCatalog->hide();
- m_pImpl->m_xSchemaLbl->hide();
- m_pImpl->m_xSchema->hide();
-
- m_pImpl->m_xTitle->set_text(m_pImpl->m_aName);
- m_pImpl->m_aChecker.setCheck(false); // enable non valid sql chars as well
+ m_xLabel->set_label(_rLabel);
+ m_xCatalogLbl->hide();
+ m_xCatalog->hide();
+ m_xSchemaLbl->hide();
+ m_xSchema->hide();
+
+ m_xTitle->set_text(m_aName);
+ m_aChecker.setCheck(false); // enable non valid sql chars as well
}
void OSaveAsDlg::implInit()
{
- if ( !( m_pImpl->m_nFlags & SADFlags::AdditionalDescription ) ) {
+ if ( !( m_nFlags & SADFlags::AdditionalDescription ) ) {
// hide the description window
- m_pImpl->m_xDescription->hide();
+ m_xDescription->hide();
}
- if ( SADFlags::TitlePasteAs == ( m_pImpl->m_nFlags & SADFlags::TitlePasteAs ) )
+ if ( SADFlags::TitlePasteAs == ( m_nFlags & SADFlags::TitlePasteAs ) )
m_xDialog->set_title( DBA_RES( STR_TITLE_PASTE_AS ) );
- else if ( SADFlags::TitleRename == ( m_pImpl->m_nFlags & SADFlags::TitleRename ) )
+ else if ( SADFlags::TitleRename == ( m_nFlags & SADFlags::TitleRename ) )
m_xDialog->set_title( DBA_RES( STR_TITLE_RENAME ) );
- m_pImpl->m_xPB_OK->connect_clicked(LINK(this,OSaveAsDlg,ButtonClickHdl));
- m_pImpl->m_xTitle->connect_changed(LINK(this,OSaveAsDlg,EditModifyHdl));
- m_pImpl->m_xTitle->grab_focus();
+ m_xPB_OK->connect_clicked(LINK(this,OSaveAsDlg,ButtonClickHdl));
+ m_xTitle->connect_changed(LINK(this,OSaveAsDlg,EditModifyHdl));
+ m_xTitle->grab_focus();
}
const OUString& OSaveAsDlg::getName() const
{
- return m_pImpl->m_aName;
+ return m_aName;
}
OUString OSaveAsDlg::getCatalog() const
{
- return m_pImpl->m_xCatalog->get_visible() ? m_pImpl->m_xCatalog->get_active_text() : OUString();
+ return m_xCatalog->get_visible() ? m_xCatalog->get_active_text() : OUString();
}
OUString OSaveAsDlg::getSchema() const
{
- return m_pImpl->m_xSchema->get_visible() ? m_pImpl->m_xSchema->get_active_text() : OUString();
+ return m_xSchema->get_visible() ? m_xSchema->get_active_text() : OUString();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/dlgsize.cxx b/dbaccess/source/ui/dlg/dlgsize.cxx
index 544d9577fdd9..be9e96612a83 100644
--- a/dbaccess/source/ui/dlg/dlgsize.cxx
+++ b/dbaccess/source/ui/dlg/dlgsize.cxx
@@ -27,7 +27,7 @@ namespace dbaui
DlgSize::DlgSize(weld::Window* pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard )
: GenericDialogController(pParent, bRow ? OUString("dbaccess/ui/rowheightdialog.ui") : OUString("dbaccess/ui/colwidthdialog.ui"),
- bRow ? OString("RowHeightDialog") : OString("ColWidthDialog"))
+ bRow ? OUString("RowHeightDialog") : OUString("ColWidthDialog"))
, m_nPrevValue(nVal)
, m_xMF_VALUE(m_xBuilder->weld_metric_spin_button("value", FieldUnit::CM))
, m_xCB_STANDARD(m_xBuilder->weld_check_button("automatic"))
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index 4c0b9a836382..34be198cb44c 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -24,17 +24,9 @@
namespace dbaui
{
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::ui::dialogs;
-
ODatasourceSelectDialog::ODatasourceSelectDialog(weld::Window* _pParent, const std::set<OUString>& _rDatasources)
: GenericDialogController(_pParent, "dbaccess/ui/choosedatasourcedialog.ui", "ChooseDataSourceDialog")
, m_xDatasource(m_xBuilder->weld_tree_view("treeview"))
- , m_xOk(m_xBuilder->weld_button("ok"))
- , m_xCancel(m_xBuilder->weld_button("cancel"))
- , m_xManageDatasources(m_xBuilder->weld_button("organize"))
{
m_xDatasource->set_size_request(-1, m_xDatasource->get_height_rows(6));
diff --git a/dbaccess/source/ui/dlg/dsselect.hxx b/dbaccess/source/ui/dlg/dsselect.hxx
index 87cdef17c7aa..bfd068898093 100644
--- a/dbaccess/source/ui/dlg/dsselect.hxx
+++ b/dbaccess/source/ui/dlg/dsselect.hxx
@@ -32,9 +32,6 @@ namespace dbaui
class ODatasourceSelectDialog final : public weld::GenericDialogController
{
std::unique_ptr<weld::TreeView> m_xDatasource;
- std::unique_ptr<weld::Button> m_xOk;
- std::unique_ptr<weld::Button> m_xCancel;
- std::unique_ptr<weld::Button> m_xManageDatasources;
#ifdef HAVE_ODBC_ADMINISTRATION
std::unique_ptr<OOdbcManagement> m_xODBCManagement;
#endif
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index e3bacdefbc73..bb308845528e 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include <core_resource.hxx>
#include "dsnItem.hxx"
#include "generalpage.hxx"
@@ -25,6 +26,7 @@
#include <dsitems.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/docfilt.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <svl/stritem.hxx>
@@ -76,7 +78,7 @@ namespace dbaui
OUString eType;
OUString sDisplayName;
- DisplayedType( const OUString& _eType, const OUString& _rDisplayName ) : eType( _eType ), sDisplayName( _rDisplayName ) { }
+ DisplayedType( OUString _eType, OUString _sDisplayName ) : eType(std::move( _eType )), sDisplayName(std::move( _sDisplayName )) { }
};
typedef std::vector< DisplayedType > DisplayedTypes;
@@ -154,9 +156,11 @@ namespace dbaui
if (m_xEmbeddedDBType->find_text(sDisplayName) == -1 &&
dbaccess::ODsnTypeCollection::isEmbeddedDatabase(sURLPrefix))
{
+#if !HAVE_FEATURE_MACOSX_SANDBOX
if( !officecfg::Office::Common::Misc::ExperimentalMode::get()
&& sURLPrefix.startsWith("sdbc:embedded:firebird") )
continue;
+#endif
aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
m_bIsDisplayedTypesEmpty = false;
}
@@ -222,31 +226,29 @@ namespace dbaui
OUString OGeneralPageWizard::getEmbeddedDBName( const SfxItemSet& _rSet )
{
+ if (!m_pCollection)
+ return {};
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
bool bValid, bReadonly;
getFlags( _rSet, bValid, bReadonly );
-
- // if the selection is invalid, disable everything
-
- implSetCurrentType( OUString() );
+ if (!bValid)
+ return {};
// compare the DSN prefix with the registered ones
- OUString sDisplayName;
-
- if (m_pCollection && bValid)
- {
- implSetCurrentType( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() );
- sDisplayName = m_pCollection->getTypeDisplayName( m_eCurrentSelection );
- onTypeSelected(m_eCurrentSelection);
- }
-
- // select the correct datasource type
- if ( dbaccess::ODsnTypeCollection::isEmbeddedDatabase( m_eCurrentSelection )
- && m_xEmbeddedDBType->find_text(sDisplayName) == -1 )
+ OUString sDBURL;
+ if (const SfxStringItem* pUrlItem = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL))
+ if (dbaccess::ODsnTypeCollection::isEmbeddedDatabase(pUrlItem->GetValue()))
+ sDBURL = pUrlItem->GetValue();
+ if (sDBURL.isEmpty())
+ sDBURL = dbaccess::ODsnTypeCollection::getEmbeddedDatabase();
+ OUString sDisplayName = m_pCollection->getTypeDisplayName(sDBURL);
+
+ // ensure presence of the correct datasource type
+ if (!sDisplayName.isEmpty() && m_xEmbeddedDBType->find_text(sDisplayName) == -1)
{ // 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;
- insertEmbeddedDBTypeEntryData( m_eCurrentSelection, sDisplayName );
+ insertEmbeddedDBTypeEntryData(sDBURL, sDisplayName);
}
return sDisplayName;
@@ -450,7 +452,6 @@ namespace dbaui
, m_xFT_EmbeddedDBLabel(m_xBuilder->weld_label("embeddeddbLabel"))
, m_xEmbeddedDBType(m_xBuilder->weld_combo_box("embeddeddbList"))
, m_xFT_DocListLabel(m_xBuilder->weld_label("docListLabel"))
- , m_xFT_HelpText(m_xBuilder->weld_label("helpText"))
, 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_xFT_NoEmbeddedDBLabel(m_xBuilder->weld_label("noembeddeddbLabel"))
@@ -564,7 +565,7 @@ namespace dbaui
case ::dbaccess::DST_MYSQL_JDBC:
case ::dbaccess::DST_MYSQL_ODBC:
case ::dbaccess::DST_MYSQL_NATIVE:
- _inout_rDisplayName = "MySQL";
+ _inout_rDisplayName = "MySQL/MariaDB";
break;
default:
break;
@@ -677,7 +678,7 @@ namespace dbaui
// 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) )
+ if (pFilter && !pFilter->GetWildcard().Matches(sPath))
{
OUString sMessage(DBA_RES(STR_ERR_USE_CONNECT_TO));
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 1abda980ec54..57ea5f5a4937 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -135,7 +135,6 @@ namespace dbaui
std::unique_ptr<weld::ComboBox> m_xEmbeddedDBType;
std::unique_ptr<weld::Label> m_xFT_DocListLabel;
- std::unique_ptr<weld::Label> m_xFT_HelpText;
std::unique_ptr<OpenDocumentListBox> m_xLB_DocumentList;
std::unique_ptr<OpenDocumentButton> m_xPB_OpenDatabase;
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 4c93128482d5..d12602ce2eec 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -409,7 +409,7 @@ namespace dbaui
updateToolbox();
}
- IMPL_LINK(DbaIndexDialog, OnIndexAction, const OString&, rClicked, void)
+ IMPL_LINK(DbaIndexDialog, OnIndexAction, const OUString&, rClicked, void)
{
if (rClicked == "ID_INDEX_NEW")
OnNewIndex();
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index 3770fb737e1a..35b0e3f02a27 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -20,6 +20,7 @@
#include <core_resource.hxx>
#include <indexfieldscontrol.hxx>
#include <strings.hrc>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <helpids.h>
#include <toolkit/helper/vclunohelper.hxx>
@@ -266,7 +267,7 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
bool IndexFieldsControl::implGetFieldDesc(sal_Int32 _nRow, IndexFields::const_iterator& _rPos)
{
_rPos = m_aFields.end();
- if ((_nRow < 0) || (_nRow >= static_cast<sal_Int32>(m_aFields.size())))
+ if ((_nRow < 0) || (o3tl::make_unsigned(_nRow) >= m_aFields.size()))
return false;
_rPos = m_aFields.begin() + _nRow;
return true;
diff --git a/dbaccess/source/ui/dlg/optionalboolitem.hxx b/dbaccess/source/ui/dlg/optionalboolitem.hxx
index c500dfa2ac60..1c1d039e2650 100644
--- a/dbaccess/source/ui/dlg/optionalboolitem.hxx
+++ b/dbaccess/source/ui/dlg/optionalboolitem.hxx
@@ -37,7 +37,7 @@ namespace dbaui
virtual bool operator==( const SfxPoolItem& _rItem ) const override;
virtual OptionalBoolItem* Clone( SfxItemPool* _pPool = nullptr ) const override;
- bool HasValue() const { return !!m_aValue; }
+ bool HasValue() const { return m_aValue.has_value(); }
void ClearValue() { m_aValue.reset(); }
bool GetValue() const { return *m_aValue; }
void SetValue(bool _bValue) { m_aValue = _bValue; }
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index 12f96d186f78..fddb77f4bd8c 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -27,18 +27,16 @@
#include <vcl/weld.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::util;
- using namespace ::connectivity;
// OParameterDialog
@@ -124,15 +122,10 @@ namespace dbaui
OnEntrySelected();
if (m_xAllParams->n_children() == 1)
- {
m_xTravelNext->set_sensitive(false);
- }
if (m_xAllParams->n_children() > 1)
- {
- m_xOKBtn->set_has_default(false);
- m_xTravelNext->set_has_default(true);
- }
+ m_xDialog->change_default_widget(m_xOKBtn.get(), m_xTravelNext.get());
}
m_xParam->grab_focus();
@@ -322,8 +315,7 @@ namespace dbaui
if (!bVisited)
{
// yes, there isn't another one -> change the "default button"
- m_xTravelNext->set_has_default(false);
- m_xOKBtn->set_has_default(true);
+ m_xDialog->change_default_widget(m_xTravelNext.get(), m_xOKBtn.get());
}
}
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 2735acee5de4..84f2c774c6e2 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -25,18 +25,15 @@
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <comphelper/string.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <connectivity/dbtools.hxx>
#include <strings.hxx>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
using namespace dbaui;
-using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
@@ -295,16 +292,16 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo
{
// properly quote all parts of the table name, so
// e.g. <schema>.<table> becomes "<schema>"."<table>"
- OUString aCatlog,aSchema,aTable;
- ::dbtools::qualifiedNameComponents( m_xMetaData, sTableName, aCatlog, aSchema, aTable, ::dbtools::EComposeRule::InDataManipulation );
- sTableName = ::dbtools::composeTableName( m_xMetaData, aCatlog, aSchema, aTable, true, ::dbtools::EComposeRule::InDataManipulation );
+ OUString aCatalog,aSchema,aTable;
+ ::dbtools::qualifiedNameComponents( m_xMetaData, sTableName, aCatalog, aSchema, aTable, ::dbtools::EComposeRule::InDataManipulation );
+ sTableName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, true, ::dbtools::EComposeRule::InDataManipulation );
}
}
xColumn->getPropertyValue(PROPERTY_REALNAME) >>= _rFilter.Name;
- static constexpr OUStringLiteral sAgg = u"AggregateFunction";
+ static constexpr OUString sAgg = u"AggregateFunction"_ustr;
if ( xInfo->hasPropertyByName(sAgg) )
xColumn->getPropertyValue(sAgg) >>= bHaving;
- static constexpr OUStringLiteral sFunction = u"Function";
+ static constexpr OUString sFunction = u"Function"_ustr;
if ( xInfo->hasPropertyByName(sFunction) )
xColumn->getPropertyValue(sFunction) >>= bFunction;
}
diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx
index 40b25cdd3d54..5799fff7d68c 100644
--- a/dbaccess/source/ui/dlg/queryorder.cxx
+++ b/dbaccess/source/ui/dlg/queryorder.cxx
@@ -27,16 +27,13 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <connectivity/dbtools.hxx>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace dbaui;
-using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
@@ -126,8 +123,8 @@ void DlgOrderCrit::impl_initializeOrderList_nothrow()
{
try
{
- static const OUStringLiteral sNameProperty = u"Name";
- static const OUStringLiteral sAscendingProperty = u"IsAscending";
+ static constexpr OUStringLiteral sNameProperty = u"Name";
+ static constexpr OUStringLiteral sAscendingProperty = u"IsAscending";
Reference< XIndexAccess > xOrderColumns( m_xQueryComposer->getOrderColumns(), UNO_SET_THROW );
sal_Int32 nColumns = xOrderColumns->getCount();
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index eacc5908328d..e5cd612c282c 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -22,6 +22,7 @@
#include <strings.hrc>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
+#include <utility>
#include <vcl/stdtext.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -50,8 +51,8 @@ namespace
OUString m_defaultImageID;
public:
- explicit ImageProvider(const OUString& defaultImageID)
- : m_defaultImageID(defaultImageID)
+ explicit ImageProvider(OUString defaultImageID)
+ : m_defaultImageID(std::move(defaultImageID))
{
}
@@ -481,7 +482,7 @@ void OSQLMessageBox::impl_createStandardButtons( MessBoxStyle _nStyle )
else
aTmp = m_sHelpURL;
- m_xDialog->set_help_id(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8));
+ m_xDialog->set_help_id(aTmp);
}
void OSQLMessageBox::impl_addDetailsButton()
@@ -555,20 +556,19 @@ void OSQLMessageBox::Construct(weld::Window* pParent, MessBoxStyle _nStyle, Mess
impl_addDetailsButton();
}
-OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const SQLExceptionInfo& rException, MessBoxStyle nStyle, const OUString& rHelpURL)
+OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const SQLExceptionInfo& rException, MessBoxStyle nStyle, OUString sHelpURL)
: m_pImpl(new SQLMessageBox_Impl(rException))
- , m_sHelpURL(rHelpURL)
+ , m_sHelpURL(std::move(sHelpURL))
{
Construct(pParent, nStyle, AUTO);
}
OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage, MessBoxStyle nStyle, MessageType eType, const ::dbtools::SQLExceptionInfo* pAdditionalErrorInfo )
{
- SQLContext aError;
- aError.Message = rTitle;
- aError.Details = rMessage;
+ css::uno::Any next;
if (pAdditionalErrorInfo)
- aError.NextException = pAdditionalErrorInfo->get();
+ next = pAdditionalErrorInfo->get();
+ SQLContext aError(rTitle, {}, {}, 0, next, rMessage);
m_pImpl.reset(new SQLMessageBox_Impl(SQLExceptionInfo(aError)));
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index d8ff8f863923..5b956558d15f 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -32,7 +32,7 @@
#include <UITools.hxx>
#include <osl/diagnose.h>
#include <TablesSingleDlg.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/exc_hlp.hxx>
namespace dbaui
@@ -40,11 +40,8 @@ namespace dbaui
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::dbtools;
using namespace ::comphelper;
@@ -205,9 +202,9 @@ namespace dbaui
bool bModified = ( xModi.is() && xModi->isModified() );
Sequence< OUString > aNewTableFilter { "%" };
- xProp->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(aNewTableFilter));
+ xProp->setPropertyValue(PROPERTY_TABLEFILTER,Any(aNewTableFilter));
- xProp->setPropertyValue( PROPERTY_TABLETYPEFILTER, makeAny( Sequence< OUString >() ) );
+ xProp->setPropertyValue( PROPERTY_TABLETYPEFILTER, Any( Sequence< OUString >() ) );
Reference< css::lang::XEventListener> xEvt;
aErrorInfo = ::dbaui::createConnection(xProp, m_xORB, xEvt, m_xCurrentConnection);
@@ -335,7 +332,7 @@ namespace dbaui
Sequence< OUString > OTableSubscriptionPage::collectDetailedSelection() const
{
Sequence< OUString > aTableFilter;
- constexpr OUStringLiteral sWildcard = u"%";
+ constexpr OUString sWildcard = u"%"_ustr;
std::unique_ptr<weld::TreeIter> xAllObjectsEntry(m_xTablesList->getAllObjectsEntry());
if (!xAllObjectsEntry)
diff --git a/dbaccess/source/ui/inc/AppElementType.hxx b/dbaccess/source/ui/inc/AppElementType.hxx
index 59105cf225f7..b7265e5af663 100644
--- a/dbaccess/source/ui/inc/AppElementType.hxx
+++ b/dbaccess/source/ui/inc/AppElementType.hxx
@@ -34,18 +34,18 @@ namespace dbaui
E_ELEMENT_TYPE_COUNT = E_NONE
};
- enum PreviewMode
+ enum class PreviewMode
{
- E_PREVIEWNONE = 0,
- E_DOCUMENT = 1,
- E_DOCUMENTINFO = 2
+ NONE = 0,
+ Document = 1,
+ DocumentInfo = 2
};
- enum ElementOpenMode
+ enum class ElementOpenMode
{
- E_OPEN_NORMAL,
- E_OPEN_DESIGN,
- E_OPEN_FOR_MAIL
+ Normal,
+ Design,
+ Mail
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/ChildWindow.hxx b/dbaccess/source/ui/inc/ChildWindow.hxx
index 8da6c8570dea..c2f68ac46f78 100644
--- a/dbaccess/source/ui/inc/ChildWindow.hxx
+++ b/dbaccess/source/ui/inc/ChildWindow.hxx
@@ -16,7 +16,7 @@ namespace dbaui
class OChildWindow
{
protected:
- OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID);
+ OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription, const OUString& rID);
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
@@ -29,7 +29,7 @@ public:
void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
- void SetHelpId(const OString& rHelpId) { m_xContainer->set_help_id(rHelpId); }
+ void SetHelpId(const OUString& rHelpId) { m_xContainer->set_help_id(rHelpId); }
void Show() { m_xContainer->show(); }
};
diff --git a/dbaccess/source/ui/inc/CollectionView.hxx b/dbaccess/source/ui/inc/CollectionView.hxx
index c80e98f5e858..c49a5fd4fc14 100644
--- a/dbaccess/source/ui/inc/CollectionView.hxx
+++ b/dbaccess/source/ui/inc/CollectionView.hxx
@@ -55,7 +55,7 @@ namespace dbaui
OCollectionView(weld::Window * pParent,
const css::uno::Reference< css::ucb::XContent>& _xContent,
const OUString& _sDefaultName,
- const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ css::uno::Reference< css::uno::XComponentContext > _xContext);
virtual ~OCollectionView() override;
const css::uno::Reference< css::ucb::XContent>& getSelectedFolder() const { return m_xContent;}
OUString getName() const;
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
index 954c7e02d3a3..360395f94b6e 100644
--- a/dbaccess/source/ui/inc/ConnectionLine.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -45,7 +45,7 @@ namespace dbaui
Point m_aSourceDescrLinePos,
m_aDestDescrLinePos;
public:
- OConnectionLine( OTableConnection* pConn, OConnectionLineDataRef const & pLineData );
+ OConnectionLine( OTableConnection* pConn, OConnectionLineDataRef pLineData );
OConnectionLine( const OConnectionLine& rLine );
~OConnectionLine();
diff --git a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
index 1652b8b0b53c..5e14186b0765 100644
--- a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
@@ -20,21 +20,20 @@
#include "TableConnection.hxx"
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <vcl/vclptr.hxx>
namespace dbaui
{
- typedef ::cppu::ImplHelper2< css::accessibility::XAccessibleRelationSet,
- css::accessibility::XAccessible
- > OConnectionLineAccess_BASE;
class OTableConnection;
/** the class OConnectionLineAccess represents the accessible object for the connection between two table windows
like they are used in the QueryDesign and the RelationDesign
*/
- class OConnectionLineAccess : public VCLXAccessibleComponent
- , public OConnectionLineAccess_BASE
+ class OConnectionLineAccess : public cppu::ImplInheritanceHelper<
+ VCLXAccessibleComponent,
+ css::accessibility::XAccessibleRelationSet,
+ css::accessibility::XAccessible>
{
VclPtr<const OTableConnection> m_pLine; // the window which I should give accessibility to
protected:
@@ -45,20 +44,6 @@ namespace dbaui
public:
OConnectionLineAccess(OTableConnection* _pLine);
- // XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
- virtual void SAL_CALL acquire( ) noexcept override
- { // here inline is allowed because we do not use this class outside this dll
- VCLXAccessibleComponent::acquire( );
- }
- virtual void SAL_CALL release( ) noexcept override
- { // here inline is allowed because we do not use this class outside this dll
- VCLXAccessibleComponent::release( );
- }
-
- // XTypeProvider
- virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
-
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
@@ -66,9 +51,9 @@ namespace dbaui
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
// XAccessibleContext
- virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
- virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
diff --git a/dbaccess/source/ui/inc/ConnectionLineData.hxx b/dbaccess/source/ui/inc/ConnectionLineData.hxx
index 10ad0bfddfd9..2a41c93d9aab 100644
--- a/dbaccess/source/ui/inc/ConnectionLineData.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineData.hxx
@@ -48,7 +48,7 @@ namespace dbaui
virtual ~OConnectionLineData() override;
public:
OConnectionLineData();
- OConnectionLineData( const OUString& rSourceFieldName, const OUString& rDestFieldName );
+ OConnectionLineData( OUString sSourceFieldName, OUString sDestFieldName );
OConnectionLineData( const OConnectionLineData& rConnLineData );
// provide a copy of own instance (this is somehow more acceptable for me compared to a virtual assignment operator
void CopyFrom(const OConnectionLineData& rSource);
diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx
index ab7c85811778..a79999647077 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -153,7 +153,7 @@ namespace dbaui
void enableCheckOnly() { m_bCheckOnly = true; }
bool isCheckEnabled() const { return m_bCheckOnly; }
- static css::uno::Reference< css::sdbc::XPreparedStatement > createPreparedStatment( const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData
+ static css::uno::Reference< css::sdbc::XPreparedStatement > createPreparedStatement( const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData
,const css::uno::Reference< css::beans::XPropertySet>& _xDestTable
,const TPositions& _rvColumnPositions);
};
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index 478a41070f73..410e086116fe 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -117,9 +117,9 @@ namespace dbaui
void UpdateFormatSample(OFieldDescription const * pFieldDescr);
bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
- std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OString& rId, TranslateId pHelpId, short _nProperty, const OString& _sHelpId);
- void InitializeControl(weld::Widget* _pControl,const OString& _sHelpId);
- void InitializeControl(OPropListBoxCtrl* _pControl,const OString& _sHelpId,bool _bAddChangeHandler);
+ std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OUString& rId, TranslateId pHelpId, short _nProperty, const OUString& _sHelpId);
+ void InitializeControl(weld::Widget* _pControl,const OUString& _sHelpId);
+ void InitializeControl(OPropListBoxCtrl* _pControl,const OUString& _sHelpId,bool _bAddChangeHandler);
bool IsFocusInEditableWidget() const;
@@ -165,7 +165,7 @@ namespace dbaui
void SetReadOnly( bool bReadOnly );
void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
- void SetHelpId(const OString& rId) { m_xContainer->set_help_id(rId); }
+ void SetHelpId(const OUString& rId) { m_xContainer->set_help_id(rId); }
virtual bool isCutAllowed() override;
virtual bool isCopyAllowed() override;
diff --git a/dbaccess/source/ui/inc/JAccess.hxx b/dbaccess/source/ui/inc/JAccess.hxx
index 3a630faa2bca..6d0d52ec0233 100644
--- a/dbaccess/source/ui/inc/JAccess.hxx
+++ b/dbaccess/source/ui/inc/JAccess.hxx
@@ -20,18 +20,16 @@
#include "JoinTableView.hxx"
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase.hxx>
#include <vcl/vclptr.hxx>
namespace dbaui
{
class OJoinTableView;
- typedef ::cppu::ImplHelper1< css::accessibility::XAccessible
- > OJoinDesignViewAccess_BASE;
/** the class OJoinDesignViewAccess represents the accessible object for join views
like the QueryDesign and the RelationDesign
*/
- class OJoinDesignViewAccess : public VCLXAccessibleComponent, public OJoinDesignViewAccess_BASE
+ class OJoinDesignViewAccess : public cppu::ImplInheritanceHelper<VCLXAccessibleComponent, css::accessibility::XAccessible>
{
VclPtr<OJoinTableView> m_pTableView; // the window which I should give accessibility to
@@ -40,18 +38,14 @@ namespace dbaui
*/
OJoinDesignViewAccess( OJoinTableView* _pTableView);
- // XInterface
- DECLARE_XINTERFACE( )
- DECLARE_XTYPEPROVIDER( )
-
virtual OUString SAL_CALL getImplementationName() override;
// XAccessible
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
// XAccessibleContext
- virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
- virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
void notifyAccessibleEvent(
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
index 73f9ea884540..7401ec886e44 100644
--- a/dbaccess/source/ui/inc/JoinExchange.hxx
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
@@ -47,7 +47,7 @@ namespace dbaui
virtual void SAL_CALL release( ) noexcept override;
// XUnoTunnel
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
static OJoinExchangeData GetSourceDescription(const css::uno::Reference< css::datatransfer::XTransferable >& _rxObject);
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index 80de958ea627..9e2e2bf57e25 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -18,10 +18,10 @@
*/
#pragma once
+#include <svtools/scrolladaptor.hxx>
#include <vcl/window.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
-#include <vcl/scrbar.hxx>
#include <vcl/vclptr.hxx>
#include <vcl/transfer.hxx>
@@ -50,9 +50,8 @@ namespace dbaui
class OJoinTableView;
class OScrollWindowHelper : public vcl::Window
{
- VclPtr<ScrollBar> m_aHScrollBar;
- VclPtr<ScrollBar> m_aVScrollBar;
- VclPtr<vcl::Window> m_pCornerWindow;
+ VclPtr<ScrollAdaptor> m_aHScrollBar;
+ VclPtr<ScrollAdaptor> m_aVScrollBar;
VclPtr<OJoinTableView> m_pTableView;
protected:
@@ -68,8 +67,8 @@ namespace dbaui
void resetRange(const Point& _aSize);
// own methods
- ScrollBar& GetHScrollBar() { return *m_aHScrollBar; }
- ScrollBar& GetVScrollBar() { return *m_aVScrollBar; }
+ ScrollAdaptor& GetHScrollBar() { return *m_aHScrollBar; }
+ ScrollAdaptor& GetVScrollBar() { return *m_aVScrollBar; }
};
@@ -121,9 +120,10 @@ namespace dbaui
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
// own methods
- ScrollBar& GetHScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetHScrollBar(); }
- ScrollBar& GetVScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); }
- DECL_LINK( ScrollHdl, ScrollBar*, void );
+ ScrollAdaptor& GetHScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetHScrollBar(); }
+ ScrollAdaptor& GetVScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); }
+ DECL_LINK(VertScrollHdl, weld::Scrollbar&, void);
+ DECL_LINK(HorzScrollHdl, weld::Scrollbar&, void);
void DrawConnections(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
void InvalidateConnections();
@@ -163,7 +163,7 @@ namespace dbaui
void addConnection(OTableConnection* _pConnection,bool _bAddData = true);
bool ScrollPane( tools::Long nDelta, bool bHoriz, bool bPaintScrollBars );
- sal_uLong GetTabWinCount() const;
+ sal_Int64 GetTabWinCount() const;
const Point& GetScrollOffset() const { return m_aScrollOffset; }
OJoinDesignView* getDesignView() const { return m_pView; }
diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx
index a457f38b8057..d4aa52faf080 100644
--- a/dbaccess/source/ui/inc/RelationController.hxx
+++ b/dbaccess/source/ui/inc/RelationController.hxx
@@ -34,7 +34,7 @@ namespace dbaui
{
css::uno::Reference< css::container::XNameAccess > m_xTables;
std::unique_ptr<weld::WaitObject> m_xWaitObject;
- sal_uLong m_nThreadEvent;
+ sal_Int32 m_nThreadEvent;
bool m_bRelationsPossible;
protected:
// all the features which should be handled by this class
@@ -70,7 +70,7 @@ namespace dbaui
// ask the user if the design should be saved when it is modified
virtual short saveModified() override;
virtual void reset() override;
- virtual void impl_initialize() override;
+ virtual void impl_initialize(const ::comphelper::NamedValueCollection& rArguments) override;
virtual OUString getPrivateTitle( ) const override;
DECL_LINK( OnThreadFinished, void*, void );
};
diff --git a/dbaccess/source/ui/inc/SqlNameEdit.hxx b/dbaccess/source/ui/inc/SqlNameEdit.hxx
index 257b18ebbfdb..14d845b4b17c 100644
--- a/dbaccess/source/ui/inc/SqlNameEdit.hxx
+++ b/dbaccess/source/ui/inc/SqlNameEdit.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <svtools/editbrowsebox.hxx>
+#include <utility>
#include <vcl/weld.hxx>
namespace dbaui
@@ -28,8 +29,8 @@ namespace dbaui
OUString m_sAllowedChars;
bool m_bCheck; // true when we should check for invalid chars
public:
- OSQLNameChecker(const OUString& _rAllowedChars)
- :m_sAllowedChars(_rAllowedChars)
+ OSQLNameChecker(OUString _sAllowedChars)
+ :m_sAllowedChars(std::move(_sAllowedChars))
,m_bCheck(true)
{
}
@@ -42,7 +43,7 @@ namespace dbaui
{
m_bCheck = _bCheck;
}
- bool checkString(const OUString& _sToCheck,OUString& _rsCorrected);
+ bool checkString(std::u16string_view _sToCheck,OUString& _rsCorrected);
};
class OSQLNameEditControl : public svt::EditControl
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
index 3c6ce0fdf76c..a38aa1fe030b 100644
--- a/dbaccess/source/ui/inc/TableConnection.hxx
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -47,7 +47,7 @@ namespace dbaui
void clearLineData();
public:
- OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
+ OTableConnection( OJoinTableView* pContainer, TTableConnectionData::value_type aTabConnData );
OTableConnection( const OTableConnection& rConn );
/** destructor
diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx
index 38de2289458f..096a6de70ad3 100644
--- a/dbaccess/source/ui/inc/TableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/TableConnectionData.hxx
@@ -47,8 +47,8 @@ namespace dbaui
OTableConnectionData& operator=( const OTableConnectionData& rConnData );
public:
OTableConnectionData();
- OTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
- const TTableWindowData::value_type& _pReferencedTable );
+ OTableConnectionData( TTableWindowData::value_type _aReferencingTable,
+ TTableWindowData::value_type _aReferencedTable );
OTableConnectionData( const OTableConnectionData& rConnData );
virtual ~OTableConnectionData();
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index ce2017b586d1..13af9cf51c48 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -121,7 +121,7 @@ namespace dbaui
private:
void startTableListening();
void stopTableListening();
- virtual void impl_initialize() override;
+ virtual void impl_initialize(const ::comphelper::NamedValueCollection& rArguments) override;
};
}
diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx
index b543dade80bb..636ca85c7752 100644
--- a/dbaccess/source/ui/inc/TableCopyHelper.hxx
+++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx
@@ -72,7 +72,7 @@ namespace dbaui
OUString sDefaultTableName;
OUString aUrl;
- tools::SvRef<SotTempStream> aHtmlRtfStorage;
+ std::unique_ptr<SvStream> aHtmlRtfStorage;
ElementType nType;
std::unique_ptr<weld::TreeIter> xDroppedAt;
sal_Int8 nAction;
diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx
index 36e249795137..9450ab2ff827 100644
--- a/dbaccess/source/ui/inc/TableRowExchange.hxx
+++ b/dbaccess/source/ui/inc/TableRowExchange.hxx
@@ -32,7 +32,7 @@ namespace dbaui
protected:
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
- virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
virtual void ObjectReleased() override;
};
}
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index c3bed06c75b8..2ccf236d0c98 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -112,7 +112,7 @@ namespace dbaui
*/
void impl_updateImage();
- OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData );
+ OTableWindow( vcl::Window* pParent, TTableWindowData::value_type aTabWinData );
public:
virtual ~OTableWindow() override;
diff --git a/dbaccess/source/ui/inc/TableWindowAccess.hxx b/dbaccess/source/ui/inc/TableWindowAccess.hxx
index b51e4c80f4b8..09aa268f1e6c 100644
--- a/dbaccess/source/ui/inc/TableWindowAccess.hxx
+++ b/dbaccess/source/ui/inc/TableWindowAccess.hxx
@@ -20,25 +20,24 @@
#include "TableWindow.hxx"
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <vcl/vclptr.hxx>
namespace dbaui
{
- typedef ::cppu::ImplHelper2< css::accessibility::XAccessibleRelationSet,
- css::accessibility::XAccessible
- > OTableWindowAccess_BASE;
class OTableWindow;
/** the class OTableWindowAccess represents the accessible object for table windows
like they are used in the QueryDesign and the RelationDesign
*/
- class OTableWindowAccess : public VCLXAccessibleComponent
- , public OTableWindowAccess_BASE
+ class OTableWindowAccess : public cppu::ImplInheritanceHelper<
+ VCLXAccessibleComponent,
+ css::accessibility::XAccessibleRelationSet,
+ css::accessibility::XAccessible>
{
VclPtr<OTableWindow> m_pTable; // the window which I should give accessibility to
- css::uno::Reference< css::accessibility::XAccessible > getParentChild(sal_Int32 _nIndex);
+ css::uno::Reference< css::accessibility::XAccessible > getParentChild(sal_Int64 _nIndex);
protected:
/** this function is called upon disposing the component
*/
@@ -48,20 +47,6 @@ namespace dbaui
public:
OTableWindowAccess( OTableWindow* _pTable);
- // XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
- virtual void SAL_CALL acquire( ) noexcept override
- { // here inline is allowed because we do not use this class outside this dll
- VCLXAccessibleComponent::acquire( );
- }
- virtual void SAL_CALL release( ) noexcept override
- { // here inline is allowed because we do not use this class outside this dll
- VCLXAccessibleComponent::release( );
- }
-
- // XTypeProvider
- virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
-
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
@@ -70,9 +55,9 @@ namespace dbaui
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
// XAccessibleContext
- virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
- virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
diff --git a/dbaccess/source/ui/inc/TableWindowData.hxx b/dbaccess/source/ui/inc/TableWindowData.hxx
index f7aea00b9713..0160ea723316 100644
--- a/dbaccess/source/ui/inc/TableWindowData.hxx
+++ b/dbaccess/source/ui/inc/TableWindowData.hxx
@@ -34,7 +34,7 @@ namespace dbaui
mutable ::osl::Mutex m_aMutex;
void listen();
- protected:
+
// the columns of the table
css::uno::Reference< css::beans::XPropertySet > m_xTable; // can either be a table or a query
css::uno::Reference< css::container::XIndexAccess> m_xKeys;
@@ -51,9 +51,9 @@ namespace dbaui
public:
explicit OTableWindowData( const css::uno::Reference< css::beans::XPropertySet>& _xTable
- ,const OUString& _rComposedName
- ,const OUString& strTableName
- ,const OUString& rWinName );
+ ,OUString _sComposedName
+ ,OUString strTableName
+ ,OUString sWinName );
virtual ~OTableWindowData() override;
/** late constructor
diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx
index 0d3890cf26c7..cdad4947ca8d 100644
--- a/dbaccess/source/ui/inc/TableWindowListBox.hxx
+++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx
@@ -90,7 +90,7 @@ namespace dbaui
virtual void Command(const CommandEvent& rEvt) override;
OTableWindow* GetTabWin(){ return m_pTabWin; }
- int GetEntryFromText( const OUString& rEntryText );
+ int GetEntryFromText( std::u16string_view rEntryText );
};
class TableWindowListBoxHelper final : public DropTargetHelper
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index 82e36240fc29..b82bd71a5feb 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -83,7 +83,7 @@ namespace dbaui
const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF);
// import data
- ODatabaseImportExport( const SharedConnection& _rxConnection,
+ ODatabaseImportExport( SharedConnection _xConnection,
const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rM);
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
index 34249933f9b6..c622c73f65c5 100644
--- a/dbaccess/source/ui/inc/UITools.hxx
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -115,7 +115,7 @@ namespace dbaui
@param _rTypeInfoIters the vector filled with map iterators
*/
void fillTypeInfo( const css::uno::Reference< css::sdbc::XConnection>& _rxConnection,
- const OUString& _rsTypeNames,
+ std::u16string_view _rsTypeNames,
OTypeInfoMap& _rTypeInfoMap,
std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters);
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
index 941eab5faed3..95edbe5f5527 100644
--- a/dbaccess/source/ui/inc/UserAdminDlg.hxx
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -47,7 +47,7 @@ namespace dbaui
css::uno::Reference< css::sdbc::XConnection> m_xConnection;
bool m_bOwnConnection;
protected:
- virtual void PageCreated(const OString& rId, SfxTabPage& _rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
public:
OUserAdminDlg(weld::Window* pParent, SfxItemSet* pItems,
const css::uno::Reference< css::uno::XComponentContext >& rxORB,
diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx
index 706ccfd0371c..38b1317fd507 100644
--- a/dbaccess/source/ui/inc/WColumnSelect.hxx
+++ b/dbaccess/source/ui/inc/WColumnSelect.hxx
@@ -49,7 +49,7 @@ namespace dbaui
OFieldDescription const * _pSrcField,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase);
@@ -57,7 +57,7 @@ namespace dbaui
weld::TreeView const * _pLeft,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase);
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 936acfc80c96..d3c0672f8e0b 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -183,7 +183,7 @@ namespace dbaui
public:
NamedTableCopySource(
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
- const OUString& _rTableName
+ OUString _sTableName
);
// ICopyTableSourceObject overridables
@@ -309,7 +309,7 @@ namespace dbaui
// used for importing rtf/html sources
OCopyTableWizard(
weld::Window* pParent,
- const OUString& _rDefaultName,
+ OUString _sDefaultName,
sal_Int16 _nOperation,
ODatabaseExport::TColumns&& _rDestColumns,
const ODatabaseExport::TColumnVector& _rSourceColVec,
@@ -395,7 +395,7 @@ namespace dbaui
OUString convertColumnName( const TColumnFindFunctor& _rCmpFunctor,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen);
TOTypeInfoSP convertType(const TOTypeInfoSP&_pType, bool& _bNotConvert);
diff --git a/dbaccess/source/ui/inc/WTabPage.hxx b/dbaccess/source/ui/inc/WTabPage.hxx
index cc7564cbae59..ef3d7f23b20c 100644
--- a/dbaccess/source/ui/inc/WTabPage.hxx
+++ b/dbaccess/source/ui/inc/WTabPage.hxx
@@ -31,7 +31,7 @@ namespace dbaui
OCopyTableWizard* m_pParent;
bool m_bFirstTime; // Page is called the first time; should be set in the reset method
- OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID);
+ OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID);
public:
virtual ~OWizardPage() override;
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
index 8a953302a978..56af0e355d1a 100644
--- a/dbaccess/source/ui/inc/WTypeSelect.hxx
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -103,7 +103,6 @@ namespace dbaui
DECL_LINK( ButtonClickHdl, weld::Button&, void );
protected:
std::unique_ptr<OWizTypeSelectList> m_xColumnNames;
- std::unique_ptr<weld::Label> m_xColumns;
std::unique_ptr<weld::Container> m_xControlContainer;
std::unique_ptr<OWizTypeSelectControl> m_xTypeControl;
std::unique_ptr<weld::Label> m_xAutoType;
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
index b28fe5ce3857..7c38562145a5 100644
--- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
@@ -37,7 +37,7 @@ namespace dbaui
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
protected:
- virtual void PageCreated(const OString& rId, SfxTabPage& _rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
virtual short Ok() override;
public:
diff --git a/dbaccess/source/ui/inc/charsetlistbox.hxx b/dbaccess/source/ui/inc/charsetlistbox.hxx
index aedfb6ec50a4..a12b425cd9c1 100644
--- a/dbaccess/source/ui/inc/charsetlistbox.hxx
+++ b/dbaccess/source/ui/inc/charsetlistbox.hxx
@@ -19,10 +19,12 @@
#pragma once
+#include <svl/typedwhich.hxx>
#include <vcl/weld.hxx>
#include "charsets.hxx"
class SfxItemSet;
+class SfxStringItem;
namespace dbaui
{
@@ -32,8 +34,8 @@ namespace dbaui
public:
CharSetListBox(std::unique_ptr<weld::ComboBox> xControl);
- void SelectEntryByIanaName( const OUString& _rIanaName );
- bool StoreSelectedCharSet( SfxItemSet& _rSet, const sal_uInt16 _nItemId );
+ void SelectEntryByIanaName( std::u16string_view _rIanaName );
+ bool StoreSelectedCharSet( SfxItemSet& _rSet, TypedWhichId<SfxStringItem> _nItemId );
weld::ComboBox* get_widget() { return m_xControl.get(); }
void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
diff --git a/dbaccess/source/ui/inc/charsets.hxx b/dbaccess/source/ui/inc/charsets.hxx
index ed1f88d7beab..49977bd56262 100644
--- a/dbaccess/source/ui/inc/charsets.hxx
+++ b/dbaccess/source/ui/inc/charsets.hxx
@@ -43,7 +43,7 @@ namespace dbaui
// various find operations
const_iterator findEncoding(const rtl_TextEncoding _eEncoding) const;
- const_iterator findIanaName(const OUString& _rIanaName) const;
+ const_iterator findIanaName(std::u16string_view _rIanaName) const;
const_iterator findDisplayName(const OUString& _rDisplayName) const;
/// get access to the first element of the charset collection
@@ -72,7 +72,7 @@ namespace dbaui
const OUString& getDisplayName() const { return m_sDisplayName; }
private:
- CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, const OUString& _rDisplayName);
+ CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, OUString _sDisplayName);
};
//- OCharsetDisplay::ExtendedCharsetIterator
@@ -97,7 +97,7 @@ namespace dbaui
const ExtendedCharsetIterator& operator++();
protected:
- ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, const base_iterator& _rPosition );
+ ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, base_iterator _aPosition );
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
index a99c2c3affe3..6042f761ce2f 100644
--- a/dbaccess/source/ui/inc/curledit.hxx
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -43,7 +43,7 @@ public:
public:
bool get_visible() const { return m_xEntry->get_visible(); }
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_xEntry->connect_changed(rLink); }
- void set_help_id(const OString& rName) { m_xEntry->set_help_id(rName); }
+ void set_help_id(const OUString& rName) { m_xEntry->set_help_id(rName); }
void hide()
{
m_xEntry->hide();
diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx
index d6b23878a8f0..46df99181627 100644
--- a/dbaccess/source/ui/inc/databaseobjectview.hxx
+++ b/dbaccess/source/ui/inc/databaseobjectview.hxx
@@ -91,7 +91,7 @@ namespace dbaui
const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
- const OUString& _rComponentURL
+ OUString _sComponentURL
);
virtual ~DatabaseObjectView(){}
diff --git a/dbaccess/source/ui/inc/datasourceconnector.hxx b/dbaccess/source/ui/inc/datasourceconnector.hxx
index 541c49607c90..56f7bf2f067b 100644
--- a/dbaccess/source/ui/inc/datasourceconnector.hxx
+++ b/dbaccess/source/ui/inc/datasourceconnector.hxx
@@ -48,7 +48,7 @@ namespace dbaui
ODatasourceConnector(
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
weld::Window* _pMessageParent,
- const OUString& _rContextInformation
+ OUString _sContextInformation
);
/// returns <TRUE/> if the object is able to create data source connections
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index 8caf3c129102..ac56418ab71c 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -49,7 +49,7 @@ class ODbAdminDialog final : public SfxTabDialogController, public IItemSetHelpe
private:
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
- OString m_sMainPageID;
+ OUString m_sMainPageID;
public:
/** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
@@ -63,10 +63,10 @@ public:
@param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case
the pool will not contain a typecollection default.
*/
- static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
+ static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
/** destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method>
*/
- static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
+ static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool);
/** selects the DataSource
@param _rName
@@ -89,9 +89,9 @@ public:
private:
// adds a new detail page and remove all the old ones
- void addDetailPage(const OString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc);
+ void addDetailPage(const OUString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc);
- virtual void PageCreated(const OString& rId, SfxTabPage& _rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
virtual short Ok() override;
/// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
index 7fb0c6ee0b96..050f5bd3b849 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -75,7 +75,7 @@ namespace dbaui
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual void ObjectReleased() override;
- virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
};
}
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index 0c51ab1a9cfb..744c308a6822 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -37,7 +37,6 @@ namespace com::sun::star {
}
using vcl::WizardTypes::WizardState;
-using vcl::WizardTypes::CommitPageReason;
namespace dbaccess
{
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 424a34534c60..50f463fac42a 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -38,7 +38,6 @@ namespace com::sun::star {
}
using vcl::WizardTypes::WizardState;
-using vcl::WizardTypes::CommitPageReason;
using vcl::RoadmapWizardTypes::PathId;
namespace dbaui
@@ -72,6 +71,7 @@ private:
OUString m_sRM_JDBCText;
OUString m_sRM_MySQLNativePageTitle;
OUString m_sRM_OracleText;
+ OUString m_sRM_PostgresText;
OUString m_sRM_MySQLText;
OUString m_sRM_ODBCText;
OUString m_sRM_DocumentOrSpreadSheetText;
@@ -147,7 +147,7 @@ private:
*/
void declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const vcl::RoadmapWizardTypes::WizardPath& _rPaths);
- void RegisterDataSourceByLocation(const OUString& sPath);
+ void RegisterDataSourceByLocation(std::u16string_view sPath);
bool SaveDatabaseDocument();
void activateDatabasePath();
OUString createUniqueFileName(const INetURLObject& rURL);
diff --git a/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx b/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
index 59705fe61260..c75528940e15 100644
--- a/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
+++ b/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/tools/XConnectionTools.hpp>
#include <memory>
@@ -30,14 +31,14 @@ namespace dbaui
{
// HierarchicalNameCheck
- struct HierarchicalNameCheck_Impl;
/** class implementing the IObjectNameCheck interface, and checking given object names
against a hierarchical name container
*/
class HierarchicalNameCheck :public IObjectNameCheck
{
private:
- std::unique_ptr< HierarchicalNameCheck_Impl > m_pImpl;
+ css::uno::Reference< css::container::XHierarchicalNameAccess > mxHierarchicalNames;
+ OUString msRelativeRoot;
public:
/** constructs a HierarchicalNameCheck instance
@@ -67,7 +68,6 @@ namespace dbaui
};
// DynamicTableOrQueryNameCheck
- struct DynamicTableOrQueryNameCheck_Impl;
/** class implementing the IObjectNameCheck interface, and checking a given name
for being valid as either a query or a table name.
@@ -84,7 +84,8 @@ namespace dbaui
class DynamicTableOrQueryNameCheck :public IObjectNameCheck
{
private:
- std::unique_ptr< DynamicTableOrQueryNameCheck_Impl > m_pImpl;
+ sal_Int32 mnCommandType;
+ css::uno::Reference< css::sdb::tools::XObjectNames > mxObjectNames;
public:
/** constructs a DynamicTableOrQueryNameCheck instance
diff --git a/dbaccess/source/ui/inc/dlgattr.hxx b/dbaccess/source/ui/inc/dlgattr.hxx
index 6c3a00f95472..83fe0466e4f8 100644
--- a/dbaccess/source/ui/inc/dlgattr.hxx
+++ b/dbaccess/source/ui/inc/dlgattr.hxx
@@ -34,7 +34,7 @@ namespace dbaui
SbaSbAttrDlg(weld::Widget* pParent, const SfxItemSet*, SvNumberFormatter*, bool bHasFormat);
virtual ~SbaSbAttrDlg() override;
- virtual void PageCreated(const OString& rPageId, SfxTabPage& rTabPage) override;
+ virtual void PageCreated(const OUString& rPageId, SfxTabPage& rTabPage) override;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/dlgsave.hxx b/dbaccess/source/ui/inc/dlgsave.hxx
index d56fc6ade293..f3b33a278500 100644
--- a/dbaccess/source/ui/inc/dlgsave.hxx
+++ b/dbaccess/source/ui/inc/dlgsave.hxx
@@ -19,6 +19,8 @@
#pragma once
+#include "SqlNameEdit.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <o3tl/typed_flags_set.hxx>
#include <vcl/weld.hxx>
@@ -42,13 +44,30 @@ namespace o3tl {
namespace dbaui
{
- class OSaveAsDlgImpl;
class IObjectNameCheck;
class OSaveAsDlg : public weld::GenericDialogController
{
private:
- std::unique_ptr<OSaveAsDlgImpl> m_pImpl;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ OUString m_aName;
+ const IObjectNameCheck& m_rObjectNameCheck;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xMetaData;
+ sal_Int32 m_nType;
+ SADFlags m_nFlags;
+
+ OSQLNameChecker m_aChecker;
+
+ std::unique_ptr<weld::Label> m_xDescription;
+ std::unique_ptr<weld::Label> m_xCatalogLbl;
+ std::unique_ptr<weld::ComboBox> m_xCatalog;
+ std::unique_ptr<weld::Label> m_xSchemaLbl;
+ std::unique_ptr<weld::ComboBox> m_xSchema;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Entry> m_xTitle;
+ std::unique_ptr<weld::Button> m_xPB_OK;
+
+ DECL_LINK(TextFilterHdl, OUString&, bool);
+
public:
OSaveAsDlg( weld::Window * pParent, sal_Int32 _rType,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
index 09410d31b83f..9d2d3544325c 100644
--- a/dbaccess/source/ui/inc/dsitems.hxx
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -20,76 +20,83 @@
#pragma once
#include <sal/types.h>
+#include <svl/typedwhich.hxx>
+
+class OptionalBoolItem;
+class SfxBoolItem;
+class SfxInt32Item;
+class SfxStringItem;
typedef sal_Int32 ItemID;
// item ids for the data source administration dialog
-#define DSID_NAME 1 // name of a data source, SfxStringItem
-#define DSID_ORIGINALNAME 2 // original name, internal, SfxStringItem
-#define DSID_CONNECTURL 3 // connection URL, SfxStringItem
+#define DSID_NAME TypedWhichId<SfxStringItem>(1) // name of a data source, SfxStringItem
+#define DSID_ORIGINALNAME TypedWhichId<SfxStringItem>(2) // original name, internal, SfxStringItem
+#define DSID_CONNECTURL TypedWhichId<SfxStringItem>(3) // connection URL, SfxStringItem
#define DSID_TABLEFILTER 4 // table filter, OStringListItem
#define DSID_TYPECOLLECTION 5 // collection of data source types, ODsnTypeCollection
-#define DSID_INVALID_SELECTION 6 // is the selection (thus the set data) invalid?, SfxBoolItem
-#define DSID_READONLY 7 // is the selection (thus the set data) readonly?, SfxBoolItem
-#define DSID_USER 8 // the user name used for logon, SfxStringItem
-#define DSID_PASSWORD 9 // the password used for logon, SfxStringItem
-#define DSID_ADDITIONALOPTIONS 10 // additional options used for connecting, SfxStringItem
-#define DSID_CHARSET 11 // character set to use, SfxStringItem by now
-#define DSID_PASSWORDREQUIRED 12 // is the password required to connect?, SfxBoolItem
-#define DSID_SHOWDELETEDROWS 13 // show deleted rows?, SfxBoolItem
-#define DSID_ALLOWLONGTABLENAMES 14 // allow tables names longer than 8.3?, SfxBoolItem
-#define DSID_JDBCDRIVERCLASS 15 // JDBC driver class, SfxStringItem
-#define DSID_FIELDDELIMITER 16 // field delimiter, SfxUInt16Item
-#define DSID_TEXTDELIMITER 17 // text delimiter, SfxUInt16Item
-#define DSID_DECIMALDELIMITER 18 // decimal delimiter, SfxUInt16Item
-#define DSID_THOUSANDSDELIMITER 19 // thousands delimiter, SfxUInt16Item
-#define DSID_TEXTFILEEXTENSION 20 // extension for text files, SfxStringItem
-#define DSID_TEXTFILEHEADER 21 // the text file contains a header?, SfxBoolItem
-#define DSID_PARAMETERNAMESUBST 22
-#define DSID_CONN_PORTNUMBER 23
-#define DSID_SUPPRESSVERSIONCL 24 // meta data: sal_True if the data source described by the set is to-be-deleted
-#define DSID_CONN_SHUTSERVICE 25
-#define DSID_CONN_DATAINC 26
-#define DSID_CONN_CACHESIZE 27
-#define DSID_CONN_CTRLUSER 28
-#define DSID_CONN_CTRLPWD 29
-#define DSID_USECATALOG 30 // should the driver use the catalog name when the database is filebased
-#define DSID_CONN_HOSTNAME 31
-#define DSID_CONN_LDAP_BASEDN 32
-#define DSID_CONN_LDAP_PORTNUMBER 33
-#define DSID_CONN_LDAP_ROWCOUNT 34
-#define DSID_SQL92CHECK 35
-#define DSID_AUTOINCREMENTVALUE 36
-#define DSID_AUTORETRIEVEVALUE 37
-#define DSID_AUTORETRIEVEENABLED 38
-#define DSID_APPEND_TABLE_ALIAS 39
-#define DSID_MYSQL_PORTNUMBER 40
-#define DSID_IGNOREDRIVER_PRIV 41
-#define DSID_BOOLEANCOMPARISON 42
-#define DSID_ORACLE_PORTNUMBER 43
-#define DSID_ENABLEOUTERJOIN 44
-#define DSID_CATALOG 45
-#define DSID_SCHEMA 46
-#define DSID_INDEXAPPENDIX 47
-#define DSID_CONN_LDAP_USESSL 48
-#define DSID_DOCUMENT_URL 49
-#define DSID_DOSLINEENDS 50
-#define DSID_DATABASENAME 51
-#define DSID_AS_BEFORE_CORRNAME 52
-#define DSID_CHECK_REQUIRED_FIELDS 53
-#define DSID_IGNORECURRENCY 54
-#define DSID_CONN_SOCKET 55
-#define DSID_ESCAPE_DATETIME 56
-#define DSID_NAMED_PIPE 57
-#define DSID_PRIMARY_KEY_SUPPORT 58
-#define DSID_MAX_ROW_SCAN 59
-#define DSID_RESPECTRESULTSETTYPE 60
+#define DSID_INVALID_SELECTION TypedWhichId<SfxBoolItem>(6) // is the selection (thus the set data) invalid?, SfxBoolItem
+#define DSID_READONLY TypedWhichId<SfxBoolItem>(7) // is the selection (thus the set data) readonly?, SfxBoolItem
+#define DSID_USER TypedWhichId<SfxStringItem>(8) // the user name used for logon, SfxStringItem
+#define DSID_PASSWORD TypedWhichId<SfxStringItem>(9) // the password used for logon, SfxStringItem
+#define DSID_ADDITIONALOPTIONS TypedWhichId<SfxStringItem>(10) // additional options used for connecting, SfxStringItem
+#define DSID_CHARSET TypedWhichId<SfxStringItem>(11) // character set to use, SfxStringItem by now
+#define DSID_PASSWORDREQUIRED TypedWhichId<SfxBoolItem>(12) // is the password required to connect?, SfxBoolItem
+#define DSID_SHOWDELETEDROWS TypedWhichId<SfxBoolItem>(13) // show deleted rows?, SfxBoolItem
+#define DSID_ALLOWLONGTABLENAMES TypedWhichId<SfxBoolItem>(14) // allow tables names longer than 8.3?, SfxBoolItem
+#define DSID_JDBCDRIVERCLASS TypedWhichId<SfxStringItem>(15) // JDBC driver class, SfxStringItem
+#define DSID_FIELDDELIMITER TypedWhichId<SfxStringItem>(16) // field delimiter, SfxUInt16Item
+#define DSID_TEXTDELIMITER TypedWhichId<SfxStringItem>(17) // text delimiter, SfxUInt16Item
+#define DSID_DECIMALDELIMITER TypedWhichId<SfxStringItem>(18) // decimal delimiter, SfxUInt16Item
+#define DSID_THOUSANDSDELIMITER TypedWhichId<SfxStringItem>(19) // thousands delimiter, SfxUInt16Item
+#define DSID_TEXTFILEEXTENSION TypedWhichId<SfxStringItem>(20) // extension for text files, SfxStringItem
+#define DSID_TEXTFILEHEADER TypedWhichId<SfxBoolItem>(21) // the text file contains a header?, SfxBoolItem
+#define DSID_PARAMETERNAMESUBST TypedWhichId<SfxBoolItem>(22)
+#define DSID_CONN_PORTNUMBER TypedWhichId<SfxInt32Item>(23)
+#define DSID_SUPPRESSVERSIONCL TypedWhichId<SfxBoolItem>(24) // meta data: sal_True if the data source described by the set is to-be-deleted
+#define DSID_CONN_SHUTSERVICE TypedWhichId<SfxBoolItem>(25)
+#define DSID_CONN_DATAINC TypedWhichId<SfxInt32Item>(26)
+#define DSID_CONN_CACHESIZE TypedWhichId<SfxInt32Item>(27)
+#define DSID_CONN_CTRLUSER TypedWhichId<SfxStringItem>(28)
+#define DSID_CONN_CTRLPWD TypedWhichId<SfxStringItem>(29)
+#define DSID_USECATALOG TypedWhichId<SfxBoolItem>(30) // should the driver use the catalog name when the database is filebased
+#define DSID_CONN_HOSTNAME TypedWhichId<SfxStringItem>(31)
+#define DSID_CONN_LDAP_BASEDN TypedWhichId<SfxStringItem>(32)
+#define DSID_CONN_LDAP_PORTNUMBER TypedWhichId<SfxInt32Item>(33)
+#define DSID_CONN_LDAP_ROWCOUNT TypedWhichId<SfxInt32Item>(34)
+#define DSID_SQL92CHECK TypedWhichId<SfxBoolItem>(35)
+#define DSID_AUTOINCREMENTVALUE TypedWhichId<SfxStringItem>(36)
+#define DSID_AUTORETRIEVEVALUE TypedWhichId<SfxStringItem>(37)
+#define DSID_AUTORETRIEVEENABLED TypedWhichId<SfxBoolItem>(38)
+#define DSID_APPEND_TABLE_ALIAS TypedWhichId<SfxBoolItem>(39)
+#define DSID_MYSQL_PORTNUMBER TypedWhichId<SfxInt32Item>(40)
+#define DSID_IGNOREDRIVER_PRIV TypedWhichId<SfxBoolItem>(41)
+#define DSID_BOOLEANCOMPARISON TypedWhichId<SfxInt32Item>(42)
+#define DSID_ORACLE_PORTNUMBER TypedWhichId<SfxInt32Item>(43)
+#define DSID_ENABLEOUTERJOIN TypedWhichId<SfxBoolItem>(44)
+#define DSID_CATALOG TypedWhichId<SfxBoolItem>(45)
+#define DSID_SCHEMA TypedWhichId<SfxBoolItem>(46)
+#define DSID_INDEXAPPENDIX TypedWhichId<SfxBoolItem>(47)
+#define DSID_CONN_LDAP_USESSL TypedWhichId<SfxBoolItem>(48)
+#define DSID_DOCUMENT_URL TypedWhichId<SfxStringItem>(49)
+#define DSID_DOSLINEENDS TypedWhichId<SfxBoolItem>(50)
+#define DSID_DATABASENAME TypedWhichId<SfxStringItem>(51)
+#define DSID_AS_BEFORE_CORRNAME TypedWhichId<SfxBoolItem>(52)
+#define DSID_CHECK_REQUIRED_FIELDS TypedWhichId<SfxBoolItem>(53)
+#define DSID_IGNORECURRENCY TypedWhichId<SfxBoolItem>(54)
+#define DSID_CONN_SOCKET TypedWhichId<SfxStringItem>(55)
+#define DSID_ESCAPE_DATETIME TypedWhichId<SfxBoolItem>(56)
+#define DSID_NAMED_PIPE TypedWhichId<SfxStringItem>(57)
+#define DSID_PRIMARY_KEY_SUPPORT TypedWhichId<OptionalBoolItem>(58)
+#define DSID_MAX_ROW_SCAN TypedWhichId<SfxInt32Item>(59)
+#define DSID_RESPECTRESULTSETTYPE TypedWhichId<SfxBoolItem>(60)
+#define DSID_POSTGRES_PORTNUMBER TypedWhichId<SfxInt32Item>(61)
// don't forget to adjust DSID_LAST_ITEM_ID below!
// item range. Adjust this if you introduce new items above
#define DSID_FIRST_ITEM_ID DSID_NAME
-#define DSID_LAST_ITEM_ID DSID_RESPECTRESULTSETTYPE
+#define DSID_LAST_ITEM_ID DSID_POSTGRES_PORTNUMBER
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 69b13ebb7965..0c8646a53cbd 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -42,7 +42,6 @@ namespace dbaui
// DataSourceMetaData
class FeatureSet;
- class DataSourceMetaData_Impl;
/** encapsulates meta data for a data source
On the long run, this class should a) encapsulate *all* meta data which
@@ -65,7 +64,7 @@ namespace dbaui
static AuthenticationMode getAuthentication( const OUString& _sURL );
private:
- std::shared_ptr< DataSourceMetaData_Impl > m_pImpl;
+ OUString m_sURL;
};
// FeatureSet
diff --git a/dbaccess/source/ui/inc/imageprovider.hxx b/dbaccess/source/ui/inc/imageprovider.hxx
index a8d24f4288b9..28784e6dbfa1 100644
--- a/dbaccess/source/ui/inc/imageprovider.hxx
+++ b/dbaccess/source/ui/inc/imageprovider.hxx
@@ -22,12 +22,10 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
-#include <memory>
+namespace com::sun::star::sdb::application { class XTableUIProvider; }
namespace dbaui
{
- // ImageProvider
- struct ImageProvider_Data;
/** provides images for database objects such as tables, queries, forms, reports ...
At the moment, this class cares for small icons only, that is, icons which can be used
@@ -36,9 +34,6 @@ namespace dbaui
*/
class ImageProvider
{
- private:
- std::shared_ptr< ImageProvider_Data > m_pData;
-
public:
/** creates a semi-functional ImageProvider instance
@@ -98,6 +93,13 @@ namespace dbaui
the image to be used for folders of this type
*/
static OUString getDatabaseImage();
+ private:
+ /// the connection we work with
+ css::uno::Reference< css::sdbc::XConnection > mxConnection;
+ /// the views of the connection, if the DB supports views
+ css::uno::Reference< css::container::XNameAccess > mxViews;
+ /// interface for providing table's UI
+ css::uno::Reference< css::sdb::application::XTableUIProvider > mxTableUI;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/indexcollection.hxx b/dbaccess/source/ui/inc/indexcollection.hxx
index d677eed06c5f..3d227b0b3869 100644
--- a/dbaccess/source/ui/inc/indexcollection.hxx
+++ b/dbaccess/source/ui/inc/indexcollection.hxx
@@ -29,7 +29,6 @@ namespace dbaui
// OIndexCollection
class OIndexCollection
{
- protected:
css::uno::Reference< css::container::XNameAccess >
m_xIndexes;
diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx
index f03b04f6f0b8..b3ba37936e79 100644
--- a/dbaccess/source/ui/inc/indexdialog.hxx
+++ b/dbaccess/source/ui/inc/indexdialog.hxx
@@ -74,7 +74,7 @@ namespace dbaui
void IndexSelected();
DECL_LINK( OnIndexSelected, weld::TreeView&, void );
- DECL_LINK( OnIndexAction, const OString&, void );
+ DECL_LINK( OnIndexAction, const OUString&, void );
DECL_LINK( OnEntryEditing, const weld::TreeIter&, bool );
DECL_LINK( OnEntryEdited, const IterString&, bool );
DECL_LINK( OnModifiedClick, weld::Toggleable&, void );
diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx
index 961b2ea4cddf..c20f3a87ae51 100644
--- a/dbaccess/source/ui/inc/linkeddocuments.hxx
+++ b/dbaccess/source/ui/inc/linkeddocuments.hxx
@@ -53,7 +53,7 @@ namespace dbaui
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const css::uno::Reference< css::container::XNameAccess >& _rxContainer,
const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
- const OUString& _sDataSourceName
+ OUString _sDataSourceName
);
~OLinkedDocumentsAccess();
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index 94bb5d8f4ffa..a2e334871692 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -187,7 +187,7 @@ namespace dbaui
// ask the user if the design should be saved when it is modified
virtual short saveModified() override;
virtual void reset() override;
- virtual void impl_initialize() override;
+ virtual void impl_initialize(const ::comphelper::NamedValueCollection& rArguments) override;
void impl_reset( const bool i_bIgnoreQuerySettings = false );
/// tells the user that we needed to switch to SQL view automatically
diff --git a/dbaccess/source/ui/inc/sbagrid.hrc b/dbaccess/source/ui/inc/sbagrid.hrc
index c84dbccead66..921faa6a9bd2 100644
--- a/dbaccess/source/ui/inc/sbagrid.hrc
+++ b/dbaccess/source/ui/inc/sbagrid.hrc
@@ -26,8 +26,8 @@
// Columns
// Formatting
-#define SBA_DEF_RANGEFORMAT (SBA_WHICHID_START+143) // RangeItem
-#define SBA_DEF_FMTVALUE (SBA_WHICHID_START+144) // SfxULONG, Format
+#define SBA_DEF_RANGEFORMAT TypedWhichId<SfxRangeItem>(SBA_WHICHID_START+143) // RangeItem
+#define SBA_DEF_FMTVALUE TypedWhichId<SfxUInt32Item>(SBA_WHICHID_START+144) // SfxULONG, Format
// Justification
#define SBA_ATTR_ALIGN_HOR_JUSTIFY (SBA_WHICHID_START + 145) // SvxHorJustifyItem
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 0d22f6dceec1..ae96bb291bbb 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -25,7 +25,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/util/URL.hpp>
-#include <comphelper/multiinterfacecontainer3.hxx>
+#include <comphelper/multiinterfacecontainer4.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/uno3.hxx>
#include "sbamultiplex.hxx"
@@ -62,8 +62,8 @@ namespace dbaui
virtual ~SbaXGridControl() override;
// UNO
- DECLARE_UNO3_DEFAULTS(SbaXGridControl, FmXGridControl)
- virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+ DECLARE_UNO3_AGG_DEFAULTS(SbaXGridControl, FmXGridControl)
+ virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type& _rType) override;
// XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -93,8 +93,8 @@ namespace dbaui
:public FmXGridPeer
,public css::frame::XDispatch
{
- comphelper::OMultiTypeInterfaceContainerHelperVar3< css::frame::XStatusListener,
- css::util::URL, SbaURLCompare> m_aStatusListeners;
+ comphelper::OMultiTypeInterfaceContainerHelperVar4< css::util::URL, css::frame::XStatusListener,
+ SbaURLCompare> m_aStatusListeners;
public:
SbaXGridPeer(const css::uno::Reference< css::uno::XComponentContext >&);
@@ -107,8 +107,6 @@ namespace dbaui
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
- UNO3_GETIMPLEMENTATION_DECL(SbaXGridPeer)
-
// css::frame::XDispatch
virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override;
@@ -165,7 +163,7 @@ namespace dbaui
virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rMenu,
weld::Menu& rInsertMenu, weld::Menu& rChangeMenu,
weld::Menu& rShowMenu) override;
- virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OString& rExecutionResult) override;
+ virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OUString& rExecutionResult) override;
private:
// DragSourceHelper overridables
@@ -256,7 +254,7 @@ namespace dbaui
// DbGridControl overridables
virtual void PreExecuteRowContextMenu(weld::Menu& rMenu) override;
- virtual void PostExecuteRowContextMenu(const OString& rExecutionResult) override;
+ virtual void PostExecuteRowContextMenu(const OUString& rExecutionResult) override;
// DbGridControl overridables
virtual void onRowChange() override;
diff --git a/dbaccess/source/ui/inc/sbamultiplex.hxx b/dbaccess/source/ui/inc/sbamultiplex.hxx
index d48e3299e9b6..47fd753d4af6 100644
--- a/dbaccess/source/ui/inc/sbamultiplex.hxx
+++ b/dbaccess/source/ui/inc/sbamultiplex.hxx
@@ -276,9 +276,6 @@ namespace dbaui
sal_Int32 getOverallLen() const;
- ::comphelper::OInterfaceContainerHelper3<css::beans::XVetoableChangeListener>* getContainer(const OUString& rName)
- { return m_aListeners.getContainer(rName); }
-
private:
void Notify(::comphelper::OInterfaceContainerHelper3<css::beans::XVetoableChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e);
};
diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx
index e5e11ba7a2f0..6b535882bc80 100644
--- a/dbaccess/source/ui/inc/singledoccontroller.hxx
+++ b/dbaccess/source/ui/inc/singledoccontroller.hxx
@@ -31,9 +31,8 @@ class SfxUndoManager;
namespace dbaui
{
+class UndoManager;
- // OSingleDocumentController
- struct OSingleDocumentController_Data;
typedef ::cppu::ImplInheritanceHelper< DBSubComponentController
, css::document::XUndoManagerSupplier
> OSingleDocumentController_Base;
@@ -70,7 +69,8 @@ namespace dbaui
using OSingleDocumentController_Base::disposing;
private:
- std::unique_ptr< OSingleDocumentController_Data > m_pData;
+ // no Reference! see UndoManager::acquire
+ std::unique_ptr<UndoManager> m_pUndoManager;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx
index 0f2ecc8b60eb..d0f8672cc698 100644
--- a/dbaccess/source/ui/inc/sqledit.hxx
+++ b/dbaccess/source/ui/inc/sqledit.hxx
@@ -25,6 +25,7 @@
#include <svtools/colorcfg.hxx>
#include <svx/weldeditview.hxx>
#include <vcl/timer.hxx>
+#include <mutex>
namespace com::sun::star::beans { class XMultiPropertySet; }
@@ -45,7 +46,7 @@ namespace dbaui
rtl::Reference<SfxItemPool> m_pItemPool;
rtl::Reference<ChangesListener> m_listener;
- osl::Mutex m_mutex;
+ std::mutex m_mutex;
css::uno::Reference<css::beans::XMultiPropertySet> m_notifier;
bool m_bInUpdate;
diff --git a/dbaccess/source/ui/inc/sqlmessage.hxx b/dbaccess/source/ui/inc/sqlmessage.hxx
index a2541dc0fe38..481732985d12 100644
--- a/dbaccess/source/ui/inc/sqlmessage.hxx
+++ b/dbaccess/source/ui/inc/sqlmessage.hxx
@@ -89,7 +89,7 @@ public:
weld::Window* pParent,
const dbtools::SQLExceptionInfo& _rException,
MessBoxStyle _nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
- const OUString& _rHelpURL = OUString()
+ OUString _sHelpURL = OUString()
);
/** display a database related error message
@@ -106,7 +106,7 @@ public:
const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
- void add_button(const OUString& rText, int nResponse, const OString& rHelpId = OString()) { m_xDialog->add_button(rText, nResponse, rHelpId); }
+ void add_button(const OUString& rText, int nResponse, const OUString& rHelpId = {}) { m_xDialog->add_button(rText, nResponse, rHelpId); }
void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
virtual ~OSQLMessageBox() override;
diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx
index 944dccf87ae6..a1d6de4e8a0f 100644
--- a/dbaccess/source/ui/inc/unoadmin.hxx
+++ b/dbaccess/source/ui/inc/unoadmin.hxx
@@ -25,7 +25,6 @@
class SfxItemSet;
class SfxItemPool;
-class SfxPoolItem;
namespace dbaui
{
@@ -38,8 +37,6 @@ class ODatabaseAdministrationDialog
protected:
std::unique_ptr<SfxItemSet> m_pDatasourceItems; // item set for the dialog
rtl::Reference<SfxItemPool> m_pItemPool; // item pool for the item set for the dialog
- std::vector<SfxPoolItem*>*
- m_pItemPoolDefaults; // pool defaults
std::unique_ptr<::dbaccess::ODsnTypeCollection>
m_pCollection; // datasource type collection
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index efe4ae51b27c..61905563f940 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -34,6 +34,7 @@
#include <comphelper/interfacecontainer2.hxx>
#include <cppuhelper/implbase5.hxx>
#include "callbacks.hxx"
+#include <utility>
#include <vcl/transfer.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include "TableCopyHelper.hxx"
@@ -74,7 +75,7 @@ namespace dbaui
bool bEnabled;
ExternalFeature() : bEnabled( false ) { }
- ExternalFeature( const css::util::URL& _rURL ) : aURL( _rURL ), bEnabled( false ) { }
+ ExternalFeature( css::util::URL _aURL ) : aURL(std::move( _aURL )), bEnabled( false ) { }
};
typedef std::map< sal_uInt16, ExternalFeature > ExternalFeaturesMap;
@@ -221,7 +222,7 @@ namespace dbaui
virtual vcl::Window* getMenuParent() const override;
virtual void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const override;
- virtual void impl_initialize() override;
+ virtual void impl_initialize(const ::comphelper::NamedValueCollection& rArguments) override;
// SbaGridListener overridables
virtual void RowChanged() override;
@@ -356,7 +357,7 @@ namespace dbaui
std::unique_ptr<weld::TreeIter> implAppendEntry(
const weld::TreeIter* pParent,
const OUString& rName,
- DBTreeListUserData* pUserData);
+ const DBTreeListUserData* pUserData);
/// loads the grid control with the data object specified (which may be a table, a query or a command)
bool implLoadAnything(const OUString& _rDataSourceName, const OUString& _rCommand,
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 72838e83cabf..a1e02b8745be 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -40,7 +40,7 @@
#include <TypeInfo.hxx>
#include <FieldDescriptions.hxx>
#include <UITools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <WCopyTable.hxx>
#include <unotools/syslocale.hxx>
@@ -655,16 +655,16 @@ void ODatabaseExport::CreateDefaultColumn(const OUString& _rColumnName)
void ODatabaseExport::createRowSet()
{
- m_pUpdateHelper = std::make_shared<OParameterUpdateHelper>(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumnPositions));
+ m_pUpdateHelper = std::make_shared<OParameterUpdateHelper>(createPreparedStatement(m_xConnection->getMetaData(),m_xTable,m_vColumnPositions));
}
bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTextColor, const FontDescriptor& _rFont)
{
bool bHaveDefaultTable = !m_sDefaultTableName.isEmpty();
- OUString sTableName( bHaveDefaultTable ? m_sDefaultTableName : _rTableName );
+ const OUString& rTableName(bHaveDefaultTable ? m_sDefaultTableName : _rTableName);
OCopyTableWizard aWizard(
nullptr,
- sTableName,
+ rTableName,
bHaveDefaultTable ? CopyTableOperation::AppendData : CopyTableOperation::CopyDefinitionAndData,
ODatabaseExport::TColumns(m_aDestColumns),
m_vDestVector,
@@ -689,7 +689,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
bError = !m_xTable.is();
if(m_xTable.is())
{
- m_xTable->setPropertyValue(PROPERTY_FONT,makeAny(_rFont));
+ m_xTable->setPropertyValue(PROPERTY_FONT,Any(_rFont));
if(_aTextColor.hasValue())
m_xTable->setPropertyValue(PROPERTY_TEXTCOLOR,_aTextColor);
}
@@ -778,7 +778,7 @@ void ODatabaseExport::ensureFormatter()
}
}
-Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const Reference<XDatabaseMetaData>& _xMetaData
+Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const Reference<XDatabaseMetaData>& _xMetaData
,const Reference<XPropertySet>& _xDestTable
,const TPositions& _rvColumns)
{
@@ -823,8 +823,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
{
if ( !elem.isEmpty() )
{
- aSql.append(elem);
- aSql.append(",");
+ aSql.append(elem + ",");
aValues.append("?,");
}
}
diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx
index 56eade49356d..c2917a6300e0 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -312,7 +312,7 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont, Color &_rTextColor)
while( nPos != -1 )
{
// list of fonts, VCL: semicolon as separator, HTML: comma
- OUString aFName = rFace.getToken( 0, ',', nPos );
+ std::u16string_view aFName = o3tl::getToken(rFace, 0, ',', nPos );
aFName = comphelper::string::strip(aFName, ' ');
if( !aFontName.isEmpty() )
aFontName.append(";");
@@ -465,7 +465,7 @@ bool OHTMLReader::CreateTable(HtmlTokenId nToken)
if ( isCheckEnabled() )
return true;
- return !executeWizard(aTableName,makeAny(nTextColor),aFont) && m_xTable.is();
+ return !executeWizard(aTableName,Any(nTextColor),aFont) && m_xTable.is();
}
void OHTMLReader::setTextEncoding()
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 065fee9ce9c0..6fced2dfc16f 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -33,11 +33,7 @@
using namespace dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::lang;
// export data
ORowSetImportExport::ORowSetImportExport(weld::Window* pParent,
diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index a51e1a124f51..5d22c90468c8 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -35,7 +35,7 @@
#include <svx/dbaexchange.hxx>
#include <unotools/ucbhelper.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/tempfile.hxx>
@@ -48,12 +48,10 @@ using namespace ::svx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::ucb;
OTableCopyHelper::OTableCopyHelper(OGenericUnoController* _pController)
@@ -89,15 +87,15 @@ void OTableCopyHelper::insertTable( std::u16string_view i_rSourceDataSource, con
Reference< XDataAccessDescriptorFactory > xFactory( DataAccessDescriptorFactory::get( aContext ) );
Reference< XPropertySet > xSource( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
- xSource->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( i_nCommandType ) );
- xSource->setPropertyValue( PROPERTY_COMMAND, makeAny( i_rCommand ) );
- xSource->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xSrcConnection ) );
- xSource->setPropertyValue( PROPERTY_RESULT_SET, makeAny( i_rSourceRows ) );
- xSource->setPropertyValue( PROPERTY_SELECTION, makeAny( i_rSelection ) );
- xSource->setPropertyValue( PROPERTY_BOOKMARK_SELECTION, makeAny( i_bBookmarkSelection ) );
+ xSource->setPropertyValue( PROPERTY_COMMAND_TYPE, Any( i_nCommandType ) );
+ xSource->setPropertyValue( PROPERTY_COMMAND, Any( i_rCommand ) );
+ xSource->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( xSrcConnection ) );
+ xSource->setPropertyValue( PROPERTY_RESULT_SET, Any( i_rSourceRows ) );
+ xSource->setPropertyValue( PROPERTY_SELECTION, Any( i_rSelection ) );
+ xSource->setPropertyValue( PROPERTY_BOOKMARK_SELECTION, Any( i_bBookmarkSelection ) );
Reference< XPropertySet > xDest( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
- xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( i_rDestConnection ) );
+ xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( i_rDestConnection ) );
auto xInteractionHandler = InteractionHandler::createWithParent(aContext, VCLUnoHelper::GetInterface(m_pController->getView()));
@@ -182,16 +180,15 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
try
{
DropDescriptor aTrans;
- bool bOk;
if ( _nFormatId != SotClipboardFormatId::RTF )
- bOk = _rTransData.GetSotStorageStream(SotClipboardFormatId::HTML ,aTrans.aHtmlRtfStorage);
+ aTrans.aHtmlRtfStorage = _rTransData.GetSotStorageStream(SotClipboardFormatId::HTML);
else
- bOk = _rTransData.GetSotStorageStream(SotClipboardFormatId::RTF,aTrans.aHtmlRtfStorage);
+ aTrans.aHtmlRtfStorage = _rTransData.GetSotStorageStream(SotClipboardFormatId::RTF);
aTrans.nType = E_TABLE;
aTrans.bHtml = SotClipboardFormatId::HTML == _nFormatId;
aTrans.sDefaultTableName = GetTableNameForAppend();
- if ( !bOk || !copyTagTable(aTrans,false,_xConnection) )
+ if ( !aTrans.aHtmlRtfStorage || !copyTagTable(aTrans,false,_xConnection) )
m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
}
catch(const SQLException&)
@@ -256,25 +253,21 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData
bool bHtml = _aDroppedData.HasFormat(SotClipboardFormatId::HTML);
if ( bHtml || _aDroppedData.HasFormat(SotClipboardFormatId::RTF) )
{
- bool bOk;
- if ( bHtml )
- bOk = _aDroppedData.GetSotStorageStream(SotClipboardFormatId::HTML ,_rAsyncDrop.aHtmlRtfStorage);
- else
- bOk = _aDroppedData.GetSotStorageStream(SotClipboardFormatId::RTF,_rAsyncDrop.aHtmlRtfStorage);
+ _rAsyncDrop.aHtmlRtfStorage = _aDroppedData.GetSotStorageStream(bHtml ? SotClipboardFormatId::HTML : SotClipboardFormatId::RTF);
_rAsyncDrop.bHtml = bHtml;
_rAsyncDrop.bError = !copyTagTable(_rAsyncDrop,true,_xConnection);
- bRet = ( !_rAsyncDrop.bError && bOk && _rAsyncDrop.aHtmlRtfStorage.is() );
+ bRet = ( !_rAsyncDrop.bError && _rAsyncDrop.aHtmlRtfStorage );
if ( bRet )
{
// now we need to copy the stream
- ::utl::TempFile aTmp;
+ ::utl::TempFileNamed aTmp;
_rAsyncDrop.aUrl = aTmp.GetURL();
- ::tools::SvRef<SotTempStream> aNew = new SotTempStream( aTmp.GetFileName() );
+ std::unique_ptr<SvStream> aNew = SotTempStream::Create( aTmp.GetFileName() );
_rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN);
- _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew.get() );
- _rAsyncDrop.aHtmlRtfStorage = aNew;
+ aNew->WriteStream(*_rAsyncDrop.aHtmlRtfStorage);
+ _rAsyncDrop.aHtmlRtfStorage = std::move(aNew);
}
else
_rAsyncDrop.aHtmlRtfStorage = nullptr;
@@ -286,7 +279,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
,std::u16string_view i_rDestDataSource
,const SharedConnection& _xConnection)
{
- if ( _rDesc.aHtmlRtfStorage.is() )
+ if ( _rDesc.aHtmlRtfStorage )
{
copyTagTable(_rDesc,false,_xConnection);
_rDesc.aHtmlRtfStorage = nullptr;
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 7b2ff6d8f6f7..fd2f098db4d0 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -18,7 +18,7 @@
*/
#include <TokenWriter.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/stream.hxx>
#include <osl/diagnose.h>
#include <rtl/tencinfo.h>
@@ -48,6 +48,7 @@
#include <svtools/htmlout.hxx>
#include <sfx2/frmhtmlw.hxx>
#include <svl/numuno.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <UITools.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -55,6 +56,7 @@
#include <vcl/settings.hxx>
#include <svtools/rtfout.hxx>
#include <svtools/htmlcfg.hxx>
+#include <o3tl/string_view.hxx>
#include <connectivity/formattedcolumnvalue.hxx>
#include <memory>
@@ -94,11 +96,11 @@ ODatabaseImportExport::ODatabaseImportExport(const svx::ODataAccessDescriptor& _
}
// import data
-ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& _rxConnection,
+ODatabaseImportExport::ODatabaseImportExport( ::dbtools::SharedConnection _xConnection,
const Reference< XNumberFormatter >& _rxNumberF, const Reference< XComponentContext >& _rM )
:m_bBookmarkSelection( false )
,m_pStream(nullptr)
- ,m_xConnection(_rxConnection)
+ ,m_xConnection(std::move(_xConnection))
,m_xFormatter(_rxNumberF)
,m_xContext(_rM)
,m_nCommandType(css::sdb::CommandType::TABLE)
@@ -134,6 +136,7 @@ void ODatabaseImportExport::dispose()
m_xRow.clear();
m_xRowLocate.clear();
m_xFormatter.clear();
+ m_xRowSetColumns.clear();
}
void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source )
@@ -259,9 +262,9 @@ void ODatabaseImportExport::initialize()
{
m_xResultSet.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", m_xContext), UNO_QUERY );
Reference< XPropertySet > xProp( m_xResultSet, UNO_QUERY_THROW );
- xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( m_xConnection.getTyped() ) );
- xProp->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( m_nCommandType ) );
- xProp->setPropertyValue( PROPERTY_COMMAND, makeAny( m_sName ) );
+ xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( m_xConnection.getTyped() ) );
+ xProp->setPropertyValue( PROPERTY_COMMAND_TYPE, Any( m_nCommandType ) );
+ xProp->setPropertyValue( PROPERTY_COMMAND, Any( m_sName ) );
Reference< XRowSet > xRowSet( xProp, UNO_QUERY );
xRowSet->execute();
}
@@ -318,13 +321,13 @@ bool ODatabaseImportExport::Read()
bool ORTFImportExport::Write()
{
ODatabaseImportExport::Write();
- m_pStream->WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RTF );
- m_pStream->WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI);
+ m_pStream->WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_RTF );
+ m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSI);
if (sal_uInt32 nCpg = rtl_getWindowsCodePageFromTextEncoding(m_eDestEnc); nCpg && nCpg != 65001)
{
- m_pStream->WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteUInt32AsString(nCpg);
+ m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteNumberAsString(nCpg);
}
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING);
+ m_pStream->WriteOString(SAL_NEWLINE_STRING);
bool bBold = ( css::awt::FontWeight::BOLD == m_aFont.Weight );
bool bItalic = ( css::awt::FontSlant_ITALIC == m_aFont.Slant );
@@ -342,37 +345,37 @@ bool ORTFImportExport::Write()
aFonts = OUStringToOString(aName, RTL_TEXTENCODING_MS_1252);
}
- m_pStream->WriteCharPtr( "{\\fonttbl" );
+ m_pStream->WriteOString( "{\\fonttbl" );
if (!aFonts.isEmpty())
{
sal_Int32 nIdx{0};
sal_Int32 nTok{-1}; // to compensate pre-increment
do {
- m_pStream->WriteCharPtr( "\\f" );
- m_pStream->WriteInt32AsString(++nTok);
- m_pStream->WriteCharPtr( "\\fcharset0\\fnil " );
- m_pStream->WriteOString( aFonts.getToken(0, ';', nIdx) );
+ m_pStream->WriteOString( "\\f" );
+ m_pStream->WriteNumberAsString(++nTok);
+ m_pStream->WriteOString( "\\fcharset0\\fnil " );
+ m_pStream->WriteOString( o3tl::getToken(aFonts, 0, ';', nIdx) );
m_pStream->WriteChar( ';' );
} while (nIdx>=0);
}
m_pStream->WriteChar( '}' ) ;
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
// write the rtf color table
- m_pStream->WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_COLORTBL ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RED );
- m_pStream->WriteUInt32AsString(aColor.GetRed());
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_GREEN );
- m_pStream->WriteUInt32AsString(aColor.GetGreen());
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_BLUE );
- m_pStream->WriteUInt32AsString(aColor.GetBlue());
+ m_pStream->WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_COLORTBL ).WriteOString( OOO_STRING_SVTOOLS_RTF_RED );
+ m_pStream->WriteNumberAsString(aColor.GetRed());
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_GREEN );
+ m_pStream->WriteNumberAsString(aColor.GetGreen());
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_BLUE );
+ m_pStream->WriteNumberAsString(aColor.GetBlue());
- m_pStream->WriteCharPtr( ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" )
- .WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" )
+ .WriteOString( SAL_NEWLINE_STRING );
static char const aCell1[] = "\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx";
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH );
- m_pStream->WriteInt32AsString(40);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( OOO_STRING_SVTOOLS_RTF_TRGAPH );
+ m_pStream->WriteOString("40");
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
if(m_xObject.is())
{
@@ -391,14 +394,14 @@ bool ORTFImportExport::Write()
for( sal_Int32 i=1; i<=nCount; ++i )
{
- m_pStream->WriteCharPtr( aCell1 );
- m_pStream->WriteInt32AsString(i*CELL_X);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( aCell1 );
+ m_pStream->WriteNumberAsString(i*CELL_X);
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
}
// column description
- m_pStream->WriteChar( '{' ).WriteCharPtr( SAL_NEWLINE_STRING );
- m_pStream->WriteCharPtr( "\\trrh-270\\pard\\intbl" );
+ m_pStream->WriteChar( '{' ).WriteOString( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( "\\trrh-270\\pard\\intbl" );
std::unique_ptr<OString[]> pHorzChar(new OString[nCount]);
@@ -428,28 +431,28 @@ bool ORTFImportExport::Write()
pHorzChar[i-1] = pChar; // to avoid to always rummage in the ITEMSET later on
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteChar( '{' );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_QC ); // column header always centered
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_QC ); // column header always centered
- if ( bBold ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_B );
- if ( bItalic ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_I );
- if ( bUnderline ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_UL );
- if ( bStrikeout ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_STRIKE );
+ if ( bBold ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_B );
+ if ( bItalic ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_I );
+ if ( bUnderline ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_UL );
+ if ( bStrikeout ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_STRIKE );
- m_pStream->WriteCharPtr( "\\fs20\\f0\\cf0\\cb2" );
+ m_pStream->WriteOString( "\\fs20\\f0\\cf0\\cb2" );
m_pStream->WriteChar( ' ' );
RTFOutFuncs::Out_String(*m_pStream, sColumnName, m_eDestEnc);
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_CELL );
m_pStream->WriteChar( '}' );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PARD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_INTBL );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_PARD ).WriteOString( OOO_STRING_SVTOOLS_RTF_INTBL );
}
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ROW );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ).WriteChar( '}' );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_ROW );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING ).WriteChar( '}' );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
sal_Int32 k=1;
sal_Int32 kk=0;
@@ -486,7 +489,7 @@ bool ORTFImportExport::Write()
}
}
- m_pStream->WriteChar( '}' ).WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteUChar( 0 );
return ((*m_pStream).GetError() == ERRCODE_NONE);
}
@@ -494,17 +497,17 @@ bool ORTFImportExport::Write()
void ORTFImportExport::appendRow(OString const * pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk)
{
++kk;
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH );
- m_pStream->WriteInt32AsString(40);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( OOO_STRING_SVTOOLS_RTF_TRGAPH );
+ m_pStream->WriteOString("40");
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
static char const aCell2[] = "\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx";
for ( sal_Int32 i=1; i<=_nColumnCount; ++i )
{
- m_pStream->WriteCharPtr( aCell2 );
- m_pStream->WriteInt32AsString(i*CELL_X);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( aCell2 );
+ m_pStream->WriteNumberAsString(i*CELL_X);
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
}
const bool bBold = ( css::awt::FontWeight::BOLD == m_aFont.Weight );
@@ -514,19 +517,19 @@ void ORTFImportExport::appendRow(OString const * pHorzChar,sal_Int32 _nColumnCou
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
m_pStream->WriteChar( '{' );
- m_pStream->WriteCharPtr( "\\trrh-270\\pard\\intbl" );
+ m_pStream->WriteOString( "\\trrh-270\\pard\\intbl" );
for ( sal_Int32 i=1; i <= _nColumnCount; ++i )
{
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteChar( '{' );
m_pStream->WriteOString( pHorzChar[i-1] );
- if ( bBold ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_B );
- if ( bItalic ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_I );
- if ( bUnderline ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_UL );
- if ( bStrikeout ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_STRIKE );
+ if ( bBold ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_B );
+ if ( bItalic ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_I );
+ if ( bUnderline ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_UL );
+ if ( bStrikeout ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_STRIKE );
- m_pStream->WriteCharPtr( "\\fs20\\f1\\cf0\\cb1 " );
+ m_pStream->WriteOString( "\\fs20\\f1\\cf0\\cb1 " );
try
{
@@ -541,12 +544,12 @@ void ORTFImportExport::appendRow(OString const * pHorzChar,sal_Int32 _nColumnCou
SAL_WARN("dbaccess.ui","RTF WRITE!");
}
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_CELL );
m_pStream->WriteChar( '}' );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PARD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_INTBL );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_PARD ).WriteOString( OOO_STRING_SVTOOLS_RTF_INTBL );
}
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ROW ).WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_ROW ).WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteChar( '}' );
++k;
}
@@ -579,7 +582,7 @@ OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDes
#endif
{
// set HTML configuration
- m_eDestEnc = SvxHtmlOptions::GetTextEncoding();
+ m_eDestEnc = RTL_TEXTENCODING_UTF8;
strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource)));
sIndent[0] = 0;
}
@@ -589,13 +592,13 @@ bool OHTMLImportExport::Write()
ODatabaseImportExport::Write();
if(m_xObject.is())
{
- m_pStream->WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_doctype ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_doctype5 ).WriteChar( '>' ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( SAL_NEWLINE_STRING );
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteChar( '<' ).WriteOString( OOO_STRING_SVTOOLS_HTML_doctype ).WriteChar( ' ' ).WriteOString( OOO_STRING_SVTOOLS_HTML_doctype5 ).WriteChar( '>' ).WriteOString( SAL_NEWLINE_STRING ).WriteOString( SAL_NEWLINE_STRING );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteHeader();
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteBody();
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
return ((*m_pStream).GetError() == ERRCODE_NONE);
}
@@ -627,52 +630,52 @@ void OHTMLImportExport::WriteHeader()
}
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
SfxFrameHTMLWriter::Out_DocInfo( (*m_pStream), OUString(),
- xDocProps, sIndent, osl_getThreadTextEncoding() );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ xDocProps, sIndent );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(-1);
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteBody()
{
IncIndent(1);
- m_pStream->WriteCharPtr( "<" ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_style ).WriteCharPtr( " " ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_type ).WriteCharPtr( "=\"text/css\">" );
+ m_pStream->WriteOString( "<" ).WriteOString( OOO_STRING_SVTOOLS_HTML_style ).WriteOString( " " ).WriteOString( OOO_STRING_SVTOOLS_HTML_O_type ).WriteOString( "=\"text/css\">" );
- m_pStream->WriteCharPtr( "<!-- " );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteCharPtr( " { " ).WriteCharPtr( "font-family: " ).WriteChar( '"' ).WriteOString( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()) ).WriteChar( '\"' );
+ m_pStream->WriteOString( "<!-- " );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_HTML_body ).WriteOString( " { " ).WriteOString( "font-family: " ).WriteChar( '"' ).WriteOString( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()) ).WriteChar( '\"' );
// TODO : think about the encoding of the font name
- m_pStream->WriteCharPtr( "; " ).WriteCharPtr( "font-size: " );
- m_pStream->WriteInt32AsString(m_aFont.Height);
+ m_pStream->WriteOString( "; " ).WriteOString( "font-size: " );
+ m_pStream->WriteNumberAsString(m_aFont.Height);
m_pStream->WriteChar( '}' );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- m_pStream->WriteCharPtr( " -->" );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString( " -->" );
IncIndent(-1);
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_style, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_style, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// default Textcolour black
- m_pStream->WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_text ).WriteChar( '=' );
+ m_pStream->WriteChar( '<' ).WriteOString( OOO_STRING_SVTOOLS_HTML_body ).WriteChar( ' ' ).WriteOString( OOO_STRING_SVTOOLS_HTML_O_text ).WriteChar( '=' );
::Color aColor;
if(m_xObject.is())
m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
- m_pStream->WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" );
+ m_pStream->WriteOString( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" );
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
m_pStream->WriteChar( '>' );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteTables();
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_body, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_body, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteTables()
@@ -681,7 +684,7 @@ void OHTMLImportExport::WriteTables()
" "
OOO_STRING_SVTOOLS_HTML_frame
"="
- OOO_STRING_SVTOOLS_HTML_TF_void;
+ OOO_STRING_SVTOOLS_HTML_TF_void ""_ostr;
Sequence< OUString> aNames;
Reference<XNameAccess> xColumns;
@@ -719,7 +722,7 @@ void OHTMLImportExport::WriteTables()
"=1";
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut.getStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut);
FontOn();
@@ -732,14 +735,14 @@ void OHTMLImportExport::WriteTables()
HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_caption, false);
FontOff();
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// </FONT>
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
if(m_xObject.is())
{
@@ -783,22 +786,20 @@ void OHTMLImportExport::WriteTables()
}
IncIndent(-1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// 2. and now the data
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
- sal_Int32 kk=0;
m_xResultSet->beforeFirst(); // set back before the first row
while(m_xResultSet->next())
{
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
- ++kk;
for(sal_Int32 i=1;i<=aNames.getLength();++i)
{
if(i == aNames.getLength())
@@ -821,24 +822,24 @@ void OHTMLImportExport::WriteTables()
}
WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
}
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
}
else
{
IncIndent(-1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
IncIndent(-1);
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(-1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_table, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_table, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal_Int32 nHeightPixel, const char* pChar,
@@ -883,7 +884,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
}
}
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD.getStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD);
FontOn();
@@ -900,7 +901,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
if ( rValue.isEmpty() )
HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_linebreak); // no completely empty cell
else
- HTMLOutFuncs::Out_String( (*m_pStream), rValue ,m_eDestEnc);
+ HTMLOutFuncs::Out_String( (*m_pStream), rValue );
if ( bStrikeout ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_strike, false);
if ( bUnderline ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_underline, false);
@@ -909,7 +910,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
FontOff();
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, pHtmlTag, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, pHtmlTag, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::FontOn()
@@ -938,7 +939,7 @@ void OHTMLImportExport::FontOn()
m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
- m_pStream->WriteCharPtr( ">" );
+ m_pStream->WriteOString( ">" );
}
inline void OHTMLImportExport::FontOff()
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index fca7026cf9e2..b8efb2fb60c0 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -83,7 +83,7 @@
#include <dlgsize.hxx>
#include <svtools/editbrowsebox.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <svl/numuno.hxx>
#include <svl/filenotation.hxx>
#include <connectivity/FValue.hxx>
@@ -106,7 +106,6 @@ using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ui::dialogs;
using namespace ::svt;
using ::com::sun::star::ucb::InteractiveIOException;
using ::com::sun::star::ucb::IOErrorCode_NO_FILE;
@@ -395,7 +394,7 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
}
void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
- const OUString& _rsTypeNames,
+ std::u16string_view _rsTypeNames,
OTypeInfoMap& _rTypeInfoMap,
std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters)
{
@@ -489,108 +488,108 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
if( pInfo->nNumPrecRadix <= 1)
pInfo->nNumPrecRadix = 10;
- OUString aName;
+ std::u16string_view aName;
switch(pInfo->nType)
{
case DataType::CHAR:
- aName = _rsTypeNames.getToken(TYPE_CHAR, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_CHAR, ';');
break;
case DataType::VARCHAR:
- aName = _rsTypeNames.getToken(TYPE_TEXT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_TEXT, ';');
break;
case DataType::DECIMAL:
- aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DECIMAL, ';');
break;
case DataType::NUMERIC:
- aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_NUMERIC, ';');
break;
case DataType::BIGINT:
- aName = _rsTypeNames.getToken(TYPE_BIGINT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BIGINT, ';');
break;
case DataType::FLOAT:
- aName = _rsTypeNames.getToken(TYPE_FLOAT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_FLOAT, ';');
break;
case DataType::DOUBLE:
- aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DOUBLE, ';');
break;
case DataType::LONGVARCHAR:
- aName = _rsTypeNames.getToken(TYPE_MEMO, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_MEMO, ';');
break;
case DataType::LONGVARBINARY:
- aName = _rsTypeNames.getToken(TYPE_IMAGE, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_IMAGE, ';');
break;
case DataType::DATE:
- aName = _rsTypeNames.getToken(TYPE_DATE, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DATE, ';');
break;
case DataType::TIME:
- aName = _rsTypeNames.getToken(TYPE_TIME, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_TIME, ';');
break;
case DataType::TIMESTAMP:
- aName = _rsTypeNames.getToken(TYPE_DATETIME, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DATETIME, ';');
break;
case DataType::BIT:
if ( !pInfo->aCreateParams.isEmpty() )
{
- aName = _rsTypeNames.getToken(TYPE_BIT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BIT, ';');
break;
}
[[fallthrough]];
case DataType::BOOLEAN:
- aName = _rsTypeNames.getToken(TYPE_BOOL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BOOL, ';');
break;
case DataType::TINYINT:
- aName = _rsTypeNames.getToken(TYPE_TINYINT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_TINYINT, ';');
break;
case DataType::SMALLINT:
- aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_SMALLINT, ';');
break;
case DataType::INTEGER:
- aName = _rsTypeNames.getToken(TYPE_INTEGER, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_INTEGER, ';');
break;
case DataType::REAL:
- aName = _rsTypeNames.getToken(TYPE_REAL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_REAL, ';');
break;
case DataType::BINARY:
- aName = _rsTypeNames.getToken(TYPE_BINARY, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BINARY, ';');
break;
case DataType::VARBINARY:
- aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_VARBINARY, ';');
break;
case DataType::SQLNULL:
- aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_SQLNULL, ';');
break;
case DataType::OBJECT:
- aName = _rsTypeNames.getToken(TYPE_OBJECT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_OBJECT, ';');
break;
case DataType::DISTINCT:
- aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DISTINCT, ';');
break;
case DataType::STRUCT:
- aName = _rsTypeNames.getToken(TYPE_STRUCT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_STRUCT, ';');
break;
case DataType::ARRAY:
- aName = _rsTypeNames.getToken(TYPE_ARRAY, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_ARRAY, ';');
break;
case DataType::BLOB:
- aName = _rsTypeNames.getToken(TYPE_BLOB, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BLOB, ';');
break;
case DataType::CLOB:
- aName = _rsTypeNames.getToken(TYPE_CLOB, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_CLOB, ';');
break;
case DataType::REF:
- aName = _rsTypeNames.getToken(TYPE_REF, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_REF, ';');
break;
case DataType::OTHER:
- aName = _rsTypeNames.getToken(TYPE_OTHER, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_OTHER, ';');
break;
}
- if ( !aName.isEmpty() )
+ if ( !aName.empty() )
{
pInfo->aUIName = aName;
pInfo->aUIName += " [ ";
}
pInfo->aUIName += pInfo->aTypeName;
- if ( !aName.isEmpty() )
+ if ( !aName.empty() )
pInfo->aUIName += " ]";
// Now that we have the type info, save it in the multimap
_rTypeInfoMap.emplace(pInfo->nType,pInfo);
@@ -610,20 +609,20 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDescription* _pFieldDesc)
{
- _rxColumn->setPropertyValue(PROPERTY_NAME,makeAny(_pFieldDesc->GetName()));
- _rxColumn->setPropertyValue(PROPERTY_TYPENAME,makeAny(_pFieldDesc->getTypeInfo()->aTypeName));
- _rxColumn->setPropertyValue(PROPERTY_TYPE,makeAny(_pFieldDesc->GetType()));
- _rxColumn->setPropertyValue(PROPERTY_PRECISION,makeAny(_pFieldDesc->GetPrecision()));
- _rxColumn->setPropertyValue(PROPERTY_SCALE,makeAny(_pFieldDesc->GetScale()));
- _rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, makeAny(_pFieldDesc->GetIsNullable()));
- _rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT, css::uno::makeAny(_pFieldDesc->IsAutoIncrement()));
- _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,makeAny(_pFieldDesc->GetDescription()));
+ _rxColumn->setPropertyValue(PROPERTY_NAME,Any(_pFieldDesc->GetName()));
+ _rxColumn->setPropertyValue(PROPERTY_TYPENAME,Any(_pFieldDesc->getTypeInfo()->aTypeName));
+ _rxColumn->setPropertyValue(PROPERTY_TYPE,Any(_pFieldDesc->GetType()));
+ _rxColumn->setPropertyValue(PROPERTY_PRECISION,Any(_pFieldDesc->GetPrecision()));
+ _rxColumn->setPropertyValue(PROPERTY_SCALE,Any(_pFieldDesc->GetScale()));
+ _rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, Any(_pFieldDesc->GetIsNullable()));
+ _rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT, css::uno::Any(_pFieldDesc->IsAutoIncrement()));
+ _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,Any(_pFieldDesc->GetDescription()));
if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISCURRENCY) && _pFieldDesc->IsCurrency() )
- _rxColumn->setPropertyValue(PROPERTY_ISCURRENCY, css::uno::makeAny(_pFieldDesc->IsCurrency()));
+ _rxColumn->setPropertyValue(PROPERTY_ISCURRENCY, css::uno::Any(_pFieldDesc->IsCurrency()));
// set autoincrement value when available
// and only set when the entry is not empty, that lets the value in the column untouched
if ( _pFieldDesc->IsAutoIncrement() && !_pFieldDesc->GetAutoIncrementValue().isEmpty() && _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
- _rxColumn->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,makeAny(_pFieldDesc->GetAutoIncrementValue()));
+ _rxColumn->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,Any(_pFieldDesc->GetAutoIncrementValue()));
}
OUString createDefaultName(const Reference< XDatabaseMetaData>& _xMetaData,const Reference<XNameAccess>& _xTables,const OUString& _sName)
@@ -739,9 +738,9 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
if(callColumnFormatDialog(_pParent,_pFormatter,nDataType,nFormatKey,eJustify,bHasFormat))
{
- xAffectedCol->setPropertyValue(PROPERTY_ALIGN, makeAny(static_cast<sal_Int16>(dbaui::mapTextAlign(eJustify))));
+ xAffectedCol->setPropertyValue(PROPERTY_ALIGN, Any(static_cast<sal_Int16>(dbaui::mapTextAlign(eJustify))));
if (bHasFormat)
- xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, makeAny(nFormatKey));
+ xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, Any(nFormatKey));
}
}
@@ -751,6 +750,31 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
}
}
+static ItemInfoPackage& getItemInfoPackageColumnFormatDialog()
+{
+ class ItemInfoPackageColumnFormatDialog : public ItemInfoPackage
+ {
+ typedef std::array<ItemInfoStatic, SBA_ATTR_ALIGN_HOR_JUSTIFY - SBA_DEF_RANGEFORMAT + 1> ItemInfoArrayColumnFormatDialog;
+ ItemInfoArrayColumnFormatDialog maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { SBA_DEF_RANGEFORMAT, new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY), 0, SFX_ITEMINFOFLAG_NONE },
+ { SBA_DEF_FMTVALUE, new SfxUInt32Item(SBA_DEF_FMTVALUE), SID_ATTR_NUMBERFORMAT_VALUE, SFX_ITEMINFOFLAG_NONE },
+ { SBA_ATTR_ALIGN_HOR_JUSTIFY, new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY), SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE },
+ }};
+
+ virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
+
+ public:
+ virtual size_t size() const override { return maItemInfos.size(); }
+ virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
+ };
+
+ static std::unique_ptr<ItemInfoPackageColumnFormatDialog> g_aItemInfoPackageColumnFormatDialog;
+ if (!g_aItemInfoPackageColumnFormatDialog)
+ g_aItemInfoPackageColumnFormatDialog.reset(new ItemInfoPackageColumnFormatDialog);
+ return *g_aItemInfoPackageColumnFormatDialog;
+}
+
bool callColumnFormatDialog(weld::Widget* _pParent,
SvNumberFormatter* _pFormatter,
sal_Int32 _nDataType,
@@ -761,32 +785,15 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
bool bRet = false;
// UNO->ItemSet
- static SfxItemInfo aItemInfos[] =
- {
- { 0, false },
- { SID_ATTR_NUMBERFORMAT_VALUE, true },
- { SID_ATTR_ALIGN_HOR_JUSTIFY, true },
- { SID_ATTR_NUMBERFORMAT_INFO, true },
- { SID_ATTR_NUMBERFORMAT_ONE_AREA, true }
- };
static const auto aAttrMap = svl::Items<
SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY,
SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA
>;
- std::vector<SfxPoolItem*> pDefaults
- {
- new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY),
- new SfxUInt32Item(SBA_DEF_FMTVALUE),
- new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY),
- new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO),
- new SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false)
- };
-
- rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults));
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties"));
+ pPool->registerItemInfoPackage(getItemInfoPackageColumnFormatDialog());
pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap));
// fill it
@@ -852,8 +859,6 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
pFormatDescriptor.reset();
pPool.clear();
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
return bRet;
}
@@ -881,7 +886,7 @@ bool appendToFilter(const Reference<XConnection>& _xConnection,
xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= aFilter;
// first check if we have something like SCHEMA.%
bool bHasToInsert = true;
- for (const OUString& rItem : std::as_const(aFilter))
+ for (const OUString& rItem : aFilter)
{
if(rItem.indexOf('%') != -1)
{
@@ -907,7 +912,7 @@ bool appendToFilter(const Reference<XConnection>& _xConnection,
{
aFilter.realloc(aFilter.getLength()+1);
aFilter.getArray()[aFilter.getLength()-1] = _sName;
- xProp->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(aFilter));
+ xProp->setPropertyValue(PROPERTY_TABLEFILTER,Any(aFilter));
}
}
}
@@ -928,7 +933,7 @@ void notifySystemWindow(vcl::Window const * _pWindow, vcl::Window* _pToRegister,
void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId )
{
sal_Int32 nColSize = -1;
- sal_uInt32 nDefaultWidth = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
+ ::tools::Long nDefaultWidth = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
if ( nDefaultWidth != _pBox->GetColumnWidth( _nColId ) )
{
Size aSizeMM = _pBox->PixelToLogic( Size( _pBox->GetColumnWidth( _nColId ), 0 ), MapMode( MapUnit::MapMM ) );
@@ -1046,29 +1051,40 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons
}
}
+static bool TypeIsGreater(const TOTypeInfoSP& lhs, const TOTypeInfoSP& rhs)
+{
+ assert(lhs);
+ if (!rhs)
+ return true;
+ if (lhs->nNumPrecRadix == rhs->nNumPrecRadix)
+ return lhs->nPrecision > rhs->nPrecision;
+ if (lhs->nPrecision == rhs->nPrecision)
+ return lhs->nNumPrecRadix > rhs->nNumPrecRadix;
+ if ((lhs->nNumPrecRadix > rhs->nNumPrecRadix) == (lhs->nPrecision > rhs->nPrecision))
+ return lhs->nPrecision > rhs->nPrecision;
+ return std::pow(lhs->nNumPrecRadix, lhs->nPrecision)
+ > std::pow(rhs->nNumPrecRadix, rhs->nPrecision);
+}
+
TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo)
{
- TOTypeInfoSP pTypeInfo;
- // first we search for a type which supports autoIncrement
+ TOTypeInfoSP pTypeInfo, pFallback;
+ // first we search for a largest type which supports autoIncrement
for (auto const& elem : _rTypeInfo)
{
- // OJ: we don't want to set an autoincrement column to be key
- // because we don't have the possibility to know how to create
- // such auto increment column later on
- // so until we know how to do it, we create a column without autoincrement
- // therefore we have searched
- if ( elem.second->nType == DataType::INTEGER )
- {
- pTypeInfo = elem.second; // alternative
- break;
- }
- else if ( !pTypeInfo && elem.second->nType == DataType::DOUBLE )
- pTypeInfo = elem.second; // alternative
- else if ( !pTypeInfo && elem.second->nType == DataType::REAL )
- pTypeInfo = elem.second; // alternative
+ if (elem.second->bAutoIncrement && TypeIsGreater(elem.second, pTypeInfo))
+ pTypeInfo = elem.second;
+ if (pTypeInfo)
+ continue;
+ if (elem.second->nType == DataType::INTEGER)
+ pFallback = elem.second; // default alternative
+ else if (!pFallback && elem.second->nType == DataType::DOUBLE)
+ pFallback = elem.second; // alternative
+ else if (!pFallback && elem.second->nType == DataType::REAL)
+ pFallback = elem.second; // alternative
}
if ( !pTypeInfo ) // just a fallback
- pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo);
+ pTypeInfo = pFallback ? pFallback : queryTypeInfoByType(DataType::VARCHAR, _rTypeInfo);
OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!");
return pTypeInfo;
@@ -1203,11 +1219,11 @@ Reference< XPropertySet > createView( const OUString& _rName, const Reference< X
sTable,
::dbtools::EComposeRule::InDataManipulation);
- xView->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xView->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xView->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
+ xView->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xView->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xView->setPropertyValue(PROPERTY_NAME,Any(sTable));
- xView->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) );
+ xView->setPropertyValue( PROPERTY_COMMAND, Any( _rCommand ) );
Reference<XAppend> xAppend(xViews,UNO_QUERY);
if(xAppend.is())
@@ -1323,11 +1339,11 @@ bool insertHierarchyElement(weld::Window* pParent, const Reference< XComponentCo
{"Parent", uno::Any(xNameAccess)},
{PROPERTY_EMBEDDEDOBJECT, uno::Any(_xContent)},
}));
- OUString sServiceName(_bCollection ? (_bForm ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION)) : OUString(SERVICE_SDB_DOCUMENTDEFINITION));
+ OUString sServiceName(_bCollection ? (_bForm ? SERVICE_NAME_FORM_COLLECTION : SERVICE_NAME_REPORT_COLLECTION) : SERVICE_SDB_DOCUMENTDEFINITION);
Reference<XContent > xNew( xORB->createInstanceWithArguments( sServiceName, aArguments ), UNO_QUERY_THROW );
Reference< XNameContainer > xNameContainer( xNameAccess, UNO_QUERY_THROW );
- xNameContainer->insertByName( sNewName, makeAny( xNew ) );
+ xNameContainer->insertByName( sNewName, Any( xNew ) );
}
catch( const IllegalArgumentException& e )
{
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 738c85124708..6176c19700ef 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -34,7 +34,6 @@ using namespace ::dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
@@ -106,8 +105,8 @@ IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Toggleable&, rButton, void)
SetAppendDataRadio();
return;
}
- m_pParent->EnableNextButton(m_xRB_View->get_active());
- bool bKey = m_bPKeyAllowed && m_xRB_View->get_active();
+ m_pParent->EnableNextButton(!m_xRB_View->get_active());
+ bool bKey = m_bPKeyAllowed && !m_xRB_View->get_active();
m_xFT_KeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active());
m_xEdKeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active());
m_xCB_PrimaryColumn->set_sensitive(bKey);
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 544b79d03267..28f4d50e4a81 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -26,17 +26,14 @@
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace dbaui;
namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation;
OUString OWizColumnSelect::GetTitle() const { return DBA_RES(STR_WIZ_COLUMN_SELECT_TITLE); }
-OWizardPage::OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID)
+OWizardPage::OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID)
: ::vcl::OWizardPage(pPage, pWizard, rUIXMLDescription, rID)
, m_pParent(pWizard)
, m_bFirstTime(true)
@@ -73,7 +70,7 @@ OWizColumnSelect::~OWizColumnSelect()
{
while (m_xNewColumnNames->n_children())
{
- delete reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(0).toInt64());
+ delete weld::fromId<OFieldDescription*>(m_xNewColumnNames->get_id(0));
m_xNewColumnNames->remove(0);
}
}
@@ -90,7 +87,7 @@ void OWizColumnSelect::Reset()
for (auto const& column : rSrcColumns)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ OUString sId(weld::toId(column->second));
m_xOrgColumnNames->append(sId, column->first);
}
@@ -121,7 +118,7 @@ void OWizColumnSelect::Activate( )
{
if (rSrcColumns.find(column->first) != rSrcColumns.end())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new OFieldDescription(*(column->second)))));
+ OUString sId(weld::toId(new OFieldDescription(*(column->second))));
m_xNewColumnNames->append(sId, column->first);
int nRemove = m_xOrgColumnNames->find_text(column->first);
if (nRemove != -1)
@@ -140,7 +137,7 @@ bool OWizColumnSelect::LeavePage()
for(sal_Int32 i=0 ; i< m_xNewColumnNames->n_children();++i)
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(i).toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xNewColumnNames->get_id(i));
OSL_ENSURE(pField,"The field information can not be null!");
m_pParent->insertColumn(i,pField);
}
@@ -275,7 +272,7 @@ void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
OFieldDescription const * _pSrcField,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase)
{
@@ -290,7 +287,7 @@ void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
if ( !m_pParent->supportsPrimaryKey() )
pNewField->SetPrimaryKey(false);
- _pListbox->append(OUString::number(reinterpret_cast<sal_Int64>(pNewField)), sConvertedName);
+ _pListbox->append(weld::toId(pNewField), sConvertedName);
_rRightColumns.push_back(sConvertedName);
if ( !bNotConvert )
@@ -301,14 +298,14 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
weld::TreeView const * _pLeft,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase)
{
if(_pRight == m_xNewColumnNames.get())
{
// we copy the column into the new format for the dest
- OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)).toInt64());
+ OFieldDescription* pSrcField = weld::fromId<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)));
createNewColumn(_pRight,pSrcField,_rRightColumns,_sColumnName,_sExtraChars,_nMaxNameLen,_aCase);
}
else
@@ -332,7 +329,7 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
OSL_ENSURE( aPos != rSrcVector.end(),"Invalid position for the iterator here!");
ODatabaseExport::TColumnVector::size_type nPos = (aPos - rSrcVector.begin()) - adjustColumnPosition(_pLeft, _sColumnName, (aPos - rSrcVector.begin()), _aCase);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aSrcIter->second)));
+ OUString sId(weld::toId(aSrcIter->second));
const OUString& rStr = (*aIter).first;
_pRight->insert(nullptr, nPos, &rStr, &sId, nullptr, nullptr, false, nullptr);
_rRightColumns.push_back(rStr);
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 03458111fc73..a2737543c705 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -53,9 +53,10 @@
#include <o3tl/safeint.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
+#include <utility>
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
@@ -133,7 +134,7 @@ bool ObjectCopySource::isView() const
void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObject ) const
{
const OUString aCopyProperties[] = {
- OUString(PROPERTY_FONT), OUString(PROPERTY_ROW_HEIGHT), OUString(PROPERTY_TEXTCOLOR),OUString(PROPERTY_TEXTLINECOLOR),OUString(PROPERTY_TEXTEMPHASIS),OUString(PROPERTY_TEXTRELIEF)
+ PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF
};
for (const auto & aCopyProperty : aCopyProperties)
{
@@ -167,7 +168,7 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _
{
sStatement.append(aProperty.second);
sFilter = sFilter.replaceFirst(sSourceName,sTargetNameTemp);
- _rxObject->setPropertyValue( aProperty.first, makeAny(sFilter) );
+ _rxObject->setPropertyValue( aProperty.first, Any(sFilter) );
sStatement.append(sFilter);
}
}
@@ -212,8 +213,7 @@ OUString ObjectCopySource::getSelectStatement() const
}
else
{ // table
- OUStringBuffer aSQL;
- aSQL.append( "SELECT " );
+ OUStringBuffer aSQL( "SELECT " );
// we need to create the sql stmt with column names
// otherwise it is possible that names don't match
@@ -250,10 +250,10 @@ OUString ObjectCopySource::getSelectStatement() const
}
// NamedTableCopySource
-NamedTableCopySource::NamedTableCopySource( const Reference< XConnection >& _rxConnection, const OUString& _rTableName )
+NamedTableCopySource::NamedTableCopySource( const Reference< XConnection >& _rxConnection, OUString _sTableName )
:m_xConnection( _rxConnection, UNO_SET_THROW )
,m_xMetaData( _rxConnection->getMetaData(), UNO_SET_THROW )
- ,m_sTableName( _rTableName )
+ ,m_sTableName(std::move( _sTableName ))
{
::dbtools::qualifiedNameComponents( m_xMetaData, m_sTableName, m_sTableCatalog, m_sTableSchema, m_sTableBareName, ::dbtools::EComposeRule::Complete );
impl_ensureColumnInfo_throw();
@@ -269,7 +269,7 @@ bool NamedTableCopySource::isView() const
OUString sTableType;
try
{
- Reference< XResultSet > xTableDesc( m_xMetaData->getTables( makeAny( m_sTableCatalog ), m_sTableSchema, m_sTableBareName,
+ Reference< XResultSet > xTableDesc( m_xMetaData->getTables( Any( m_sTableCatalog ), m_sTableSchema, m_sTableBareName,
Sequence< OUString >() ) );
Reference< XRow > xTableDescRow( xTableDesc, UNO_QUERY_THROW );
OSL_VERIFY( xTableDesc->next() );
@@ -341,7 +341,7 @@ Sequence< OUString > NamedTableCopySource::getPrimaryKeyColumnNames() const
try
{
- Reference< XResultSet > xPKDesc( m_xMetaData->getPrimaryKeys( makeAny( m_sTableCatalog ), m_sTableSchema, m_sTableBareName ) );
+ Reference< XResultSet > xPKDesc( m_xMetaData->getPrimaryKeys( Any( m_sTableCatalog ), m_sTableSchema, m_sTableBareName ) );
Reference< XRow > xPKDescRow( xPKDesc, UNO_QUERY_THROW );
while ( xPKDesc->next() )
{
@@ -578,12 +578,12 @@ OCopyTableWizard::OCopyTableWizard(weld::Window* pParent, const OUString& _rDefa
weld::Container* OCopyTableWizard::CreatePageContainer()
{
- OString sIdent(OString::number(m_nPageCount));
+ OUString sIdent(OUString::number(m_nPageCount));
weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
return pPageContainer;
}
-OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, const OUString& _rDefaultName, sal_Int16 _nOperation,
+OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, OUString _sDefaultName, sal_Int16 _nOperation,
ODatabaseExport::TColumns&& _rSourceColumns, const ODatabaseExport::TColumnVector& _rSourceColVec,
const Reference< XConnection >& _xConnection, const Reference< XNumberFormatter >& _xFormatter,
TypeSelectionPageFactory _pTypeSelectionPageFactory, SvStream& _rTypeSelectionPageArg, const Reference< XComponentContext >& _rxContext )
@@ -598,7 +598,7 @@ OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, const OUString& _rDef
, m_nPageCount(0)
, m_bDeleteSourceColumns(false)
, m_bInterConnectionCopy( false )
- , m_sName(_rDefaultName)
+ , m_sName(std::move(_sDefaultName))
, m_nOperation( _nOperation )
, m_ePressed( WIZARD_NONE )
, m_bCreatePrimaryKeyColumn(false)
@@ -651,9 +651,9 @@ void OCopyTableWizard::construct()
if (!m_vDestColumns.empty())
// source is a html or rtf table
- m_xNextPage->set_has_default(true);
+ m_xAssistant->change_default_widget(nullptr, m_xNextPage.get());
else
- m_xFinish->set_has_default(true);
+ m_xAssistant->change_default_widget(nullptr, m_xFinish.get());
m_pTypeInfo = std::make_shared<OTypeInfo>();
m_pTypeInfo->aUIName = m_sTypeNames.getToken(TYPE_OTHER, ';');
@@ -737,6 +737,7 @@ bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
OFieldDescription* pField = new OFieldDescription();
pField->SetName(m_aKeyName);
pField->FillFromTypeInfo(pTypeInfo,true,true);
+ pField->SetAutoIncrement(pTypeInfo->bAutoIncrement);
pField->SetPrimaryKey(true);
m_bAddPKFirstTime = false;
insertColumn(0,pField);
@@ -842,9 +843,8 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, weld::Button&, void)
{
OUString sMsg(DBA_RES(STR_TABLEDESIGN_NO_PRIM_KEY));
- SQLContext aError;
- aError.Message = sMsg;
- ::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
+ SQLContext aError(sMsg, {}, {}, 0, {}, {});
+ ::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( Any( aError ) ) );
::rtl::Reference xYes = new ::comphelper::OInteractionApprove;
xRequest->addContinuation( xYes );
xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
@@ -992,7 +992,7 @@ void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject,
_rColumns.clear();
OFieldDescription* pActFieldDescr = nullptr;
- OUString const sCreateParam("x");
+ static constexpr OUStringLiteral sCreateParam(u"x");
// ReadOnly-Flag
// On drop no line must be editable.
// On add only empty lines must be editable.
@@ -1075,7 +1075,7 @@ void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier> const & _rxCol
if(!_bKeyColumns)
dbaui::setColumnProperties(xColumn,pField);
else
- xColumn->setPropertyValue(PROPERTY_NAME,makeAny(pField->GetName()));
+ xColumn->setPropertyValue(PROPERTY_NAME,Any(pField->GetName()));
xAppend->appendByDescriptor(xColumn);
xColumn = nullptr;
@@ -1110,7 +1110,7 @@ void OCopyTableWizard::appendKey( Reference<XKeysSupplier> const & _rxSup, const
Reference<XPropertySet> xKey = xKeyFactory->createDataDescriptor();
OSL_ENSURE(xKey.is(),"Key is null!");
- xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::PRIMARY));
+ xKey->setPropertyValue(PROPERTY_TYPE,Any(KeyType::PRIMARY));
Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
if(xColSup.is())
@@ -1202,9 +1202,9 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
}
}
- xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xTable->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xTable->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
+ xTable->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xTable->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xTable->setPropertyValue(PROPERTY_NAME,Any(sTable));
Reference< XColumnsSupplier > xSuppDestinationColumns( xTable, UNO_QUERY );
// now append the columns
@@ -1359,7 +1359,7 @@ void OCopyTableWizard::setOperation( const sal_Int16 _nOperation )
OUString OCopyTableWizard::convertColumnName(const TColumnFindFunctor& _rCmpFunctor,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen)
{
OUString sAlias = _sColumnName;
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 75ff6e3372f1..a6bb59da8eea 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -119,7 +119,7 @@ bool OWizNameMatching::LeavePage()
bool bRightEntry = m_xCTRL_RIGHT->get_iter_first(*xRightEntry);
while (bLeftEntry && bRightEntry)
{
- OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry).toInt64());
+ OFieldDescription* pSrcField = weld::fromId<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry));
OSL_ENSURE(pSrcField,"OWizNameMatching: OColumn can not be null!");
sal_Int32 nPos = 0;
@@ -132,7 +132,7 @@ bool OWizNameMatching::LeavePage()
if (m_xCTRL_LEFT->get_toggle(*xLeftEntry) == TRISTATE_TRUE)
{
- OFieldDescription* pDestField = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry).toInt64());
+ OFieldDescription* pDestField = weld::fromId<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry));
OSL_ENSURE(pDestField,"OWizNameMatching: OColumn can not be null!");
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
sal_Int32 nPosDest = 1;
@@ -268,7 +268,7 @@ IMPL_LINK_NOARG( OWizNameMatching, TableListRightSelectHdl, weld::TreeView&, voi
if (nPos == -1)
return;
- OFieldDescription* pColumn = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos).toInt64());
+ OFieldDescription* pColumn = weld::fromId<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos));
if (pColumn->IsAutoIncrement())
{
m_xCTRL_RIGHT->unselect(nPos);
@@ -319,7 +319,7 @@ void OWizNameMatching::FillListBox(weld::TreeView& rTreeView, const ODatabaseExp
rTreeView.set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
}
rTreeView.set_text(nRow, elem->first, 0);
- rTreeView.set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(elem->second)));
+ rTreeView.set_id(nRow, weld::toId(elem->second));
++nRow;
}
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 6f3fbd79d22c..f27dcc921168 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -19,7 +19,7 @@
#include <WTypeSelect.hxx>
#include <bitmaps.hlst>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <FieldDescriptions.hxx>
#include <WCopyTable.hxx>
@@ -33,7 +33,6 @@
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdbc;
@@ -86,7 +85,7 @@ void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
OFieldDescription* pCurFieldDescr = getCurrentFieldDescData();
const sal_Int32 nPos = pListBox->find_text(pCurFieldDescr->GetName());
- pCurFieldDescr = reinterpret_cast< OFieldDescription* >( pListBox->get_id(nPos).toInt64() );
+ pCurFieldDescr = weld::fromId<OFieldDescription*>(pListBox->get_id(nPos));
OSL_ENSURE( pCurFieldDescr, "OWizTypeSelectControl::CellModified: Columnname/type not found in the listbox!" );
if ( !pCurFieldDescr )
return;
@@ -153,7 +152,7 @@ void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
pListBox->remove(nPos);
pListBox->insert_text(nPos, pCurFieldDescr->GetName());
- pListBox->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pCurFieldDescr)));
+ pListBox->set_id(nPos, weld::toId(pCurFieldDescr));
pWiz->replaceColumn(nPos,pCurFieldDescr,sOldName);
}
@@ -205,7 +204,6 @@ OUString OWizTypeSelectControl::getAutoIncrementValue() const
OWizTypeSelect::OWizTypeSelect(weld::Container* pPage, OCopyTableWizard* pWizard, SvStream* pStream)
: OWizardPage(pPage, pWizard, "dbaccess/ui/typeselectpage.ui", "TypeSelect")
, m_xColumnNames(new OWizTypeSelectList(m_xBuilder->weld_tree_view("columnnames")))
- , m_xColumns(m_xBuilder->weld_label("columns"))
, m_xControlContainer(m_xBuilder->weld_container("control_container"))
, m_xTypeControl(new OWizTypeSelectControl(m_xControlContainer.get(), this))
, m_xAutoType(m_xBuilder->weld_label("autotype"))
@@ -248,7 +246,7 @@ OUString OWizTypeSelect::GetTitle() const
IMPL_LINK_NOARG(OWizTypeSelect, ColumnSelectHdl, weld::TreeView&, void)
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
if (pField)
m_xTypeControl->DisplayData(pField);
@@ -265,7 +263,7 @@ void OWizTypeSelect::Reset()
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
for (auto const& column : rDestColumns)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ OUString sId(weld::toId(column->second));
m_xColumnNames->append(sId, column->first);
if (column->second->IsPrimaryKey())
m_xColumnNames->set_image(nCount, BMP_PRIMARY_KEY);
@@ -288,7 +286,7 @@ void OWizTypeSelect::Activate( )
bool OWizTypeSelect::LeavePage()
{
bool bDuplicateName = false;
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
if ( pField )
{
m_xTypeControl->SaveData(pField);
@@ -339,7 +337,7 @@ bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
for( sal_Int32 j = 0; m_bPKey && j < nCount; ++j )
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(aRows[j]).toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xControl->get_id(aRows[j]));
if(!pField || pField->getTypeInfo()->nSearchType == ColumnSearch::NONE)
return false;
}
@@ -374,7 +372,7 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
bool bCheckOk = false;
for(sal_Int32 j = 0 ; j < nCount ; ++j)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
// if at least one of the fields is selected but not in the primary key,
// or is in the primary key but not selected, then don't check the
// primary key checkbox.
@@ -390,13 +388,13 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
if (bCheckOk)
xContextMenu->set_active("primarykey", true);
- OString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+ OUString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
if (sCommand != "primarykey")
return true;
for (sal_Int32 j = 0 ; j < nCount; ++j)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
if (pFieldDescr)
{
if(!bCheckOk && m_xControl->is_selected(j))
diff --git a/dbaccess/source/ui/misc/asyncmodaldialog.cxx b/dbaccess/source/ui/misc/asyncmodaldialog.cxx
index 3c59a58f8b85..8323d47dba6f 100644
--- a/dbaccess/source/ui/misc/asyncmodaldialog.cxx
+++ b/dbaccess/source/ui/misc/asyncmodaldialog.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaui
{
diff --git a/dbaccess/source/ui/misc/charsets.cxx b/dbaccess/source/ui/misc/charsets.cxx
index 546d21cb0859..5224e65d3c63 100644
--- a/dbaccess/source/ui/misc/charsets.cxx
+++ b/dbaccess/source/ui/misc/charsets.cxx
@@ -23,6 +23,7 @@
#include <strings.hrc>
#include <rtl/tencinfo.h>
#include <svx/txenctab.hxx>
+#include <utility>
namespace dbaui
{
@@ -61,7 +62,7 @@ namespace dbaui
return const_iterator( this, aBaseIter );
}
- OCharsetDisplay::const_iterator OCharsetDisplay::findIanaName(const OUString& _rIanaName) const
+ OCharsetDisplay::const_iterator OCharsetDisplay::findIanaName(std::u16string_view _rIanaName) const
{
OCharsetMap::const_iterator aBaseIter = OCharsetMap::findIanaName(_rIanaName);
return const_iterator( this, aBaseIter );
@@ -86,17 +87,17 @@ namespace dbaui
{
}
- CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, const OUString& _rDisplayName)
+ CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, OUString _sDisplayName)
:CharsetDisplayDerefHelper_Base(_rBase)
- ,m_sDisplayName(_rDisplayName)
+ ,m_sDisplayName(std::move(_sDisplayName))
{
OSL_ENSURE( !m_sDisplayName.isEmpty(), "CharsetDisplayDerefHelper::CharsetDisplayDerefHelper: invalid display name!" );
}
// OCharsetDisplay::ExtendedCharsetIterator
- OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, const base_iterator& _rPosition )
+ OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, base_iterator _aPosition )
:m_pContainer(_pContainer)
- ,m_aPosition(_rPosition)
+ ,m_aPosition(std::move(_aPosition))
{
OSL_ENSURE(m_pContainer, "OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator : invalid container!");
}
diff --git a/dbaccess/source/ui/misc/controllerframe.cxx b/dbaccess/source/ui/misc/controllerframe.cxx
index 3634a56eb7e3..365e144390c0 100644
--- a/dbaccess/source/ui/misc/controllerframe.cxx
+++ b/dbaccess/source/ui/misc/controllerframe.cxx
@@ -29,7 +29,7 @@
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
#include <sfx2/objsh.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/window.hxx>
@@ -42,7 +42,6 @@ namespace dbaui
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::frame::XFrame;
using ::com::sun::star::frame::FrameAction;
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index e59622276433..47c3932ca21a 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -31,7 +31,8 @@
#include <connectivity/dbtools.hxx>
#include <osl/diagnose.h>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <utility>
#include <vcl/window.hxx>
namespace dbaui
@@ -51,11 +52,11 @@ namespace dbaui
DatabaseObjectView::DatabaseObjectView( const Reference< XComponentContext >& _rxORB,
const Reference< XDatabaseDocumentUI >& _rxApplication,
const Reference< XFrame >& _rxParentFrame,
- const OUString& _rComponentURL )
+ OUString _sComponentURL )
:m_xORB ( _rxORB )
,m_xParentFrame ( _rxParentFrame )
,m_xApplication ( _rxApplication )
- ,m_sComponentURL ( _rComponentURL )
+ ,m_sComponentURL (std::move( _sComponentURL ))
{
OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" );
OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" );
@@ -71,7 +72,7 @@ namespace dbaui
Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs )
{
- return doCreateView( makeAny( _xDataSource ), OUString(), i_rDispatchArgs );
+ return doCreateView( Any( _xDataSource ), OUString(), i_rDispatchArgs );
}
Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const OUString& _rName,
@@ -159,7 +160,7 @@ namespace dbaui
// QueryDesigner
QueryDesigner::QueryDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication,
const Reference< XFrame >& _rxParentFrame, bool _bCreateView )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? OUString(URL_COMPONENT_VIEWDESIGN) : OUString(URL_COMPONENT_QUERYDESIGN) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN )
,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY )
{
}
@@ -188,7 +189,7 @@ namespace dbaui
// TableDesigner
TableDesigner::TableDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< OUString >( URL_COMPONENT_TABLEDESIGN ) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_TABLEDESIGN )
{
}
@@ -242,7 +243,7 @@ namespace dbaui
// ResultSetBrowser
ResultSetBrowser::ResultSetBrowser( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame,
bool _bTable )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast < OUString >( URL_COMPONENT_DATASOURCEBROWSER ) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_DATASOURCEBROWSER )
,m_bTable(_bTable)
{
}
@@ -252,27 +253,27 @@ namespace dbaui
{
DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName );
OSL_ENSURE( !_rQualifiedName.isEmpty(),"A Table name must be set");
- OUString sCatalog;
- OUString sSchema;
- OUString sTable;
- if ( m_bTable )
- ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation );
-
- i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName );
i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false );
if ( m_bTable )
{
+ OUString sCatalog;
+ OUString sSchema;
+ OUString sTable;
+ ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation );
i_rDispatchArgs.put( PROPERTY_UPDATE_CATALOGNAME, sCatalog );
i_rDispatchArgs.put( PROPERTY_UPDATE_SCHEMANAME, sSchema );
i_rDispatchArgs.put( PROPERTY_UPDATE_TABLENAME, sTable );
+ i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, CommandType::TABLE );
}
+ else
+ i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, CommandType::QUERY );
}
// RelationDesigner
RelationDesigner::RelationDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< OUString >( URL_COMPONENT_RELATIONDESIGN ) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_RELATIONDESIGN )
{
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index 49053e569000..a170d02963f9 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -30,10 +30,12 @@
#include <connectivity/dbexception.hxx>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <UITools.hxx>
+#include <utility>
+#include <vcl/mnemonic.hxx>
#include <vcl/outdev.hxx>
#include <vcl/stdtext.hxx>
#include <vcl/weld.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <strings.hrc>
#include <strings.hxx>
@@ -59,10 +61,10 @@ namespace dbaui
}
ODatasourceConnector::ODatasourceConnector( const Reference< XComponentContext >& _rxContext, weld::Window* _pMessageParent,
- const OUString& _rContextInformation )
+ OUString _sContextInformation )
:m_pErrorMessageParent(_pMessageParent)
,m_xContext(_rxContext)
- ,m_sContextInformation( _rContextInformation )
+ ,m_sContextInformation(std::move( _sContextInformation ))
{
}
@@ -155,11 +157,9 @@ namespace dbaui
{
OUString sMessage( DBA_RES( STR_WARNINGS_DURING_CONNECT ) );
sMessage = sMessage.replaceFirst( "$buttontext$", GetStandardText( StandardButtonType::More ) );
- sMessage = OutputDevice::GetNonMnemonicString( sMessage );
+ sMessage = removeMnemonicFromString( sMessage );
- SQLWarning aContext;
- aContext.Message = sMessage;
- aContext.NextException = aWarnings;
+ SQLWarning aContext(sMessage, {}, {}, 0, aWarnings);
aInfo = aContext;
}
xConnectionWarnings->clearWarnings();
@@ -174,10 +174,7 @@ namespace dbaui
{
if ( !m_sContextInformation.isEmpty() )
{
- SQLException aError;
- aError.Message = m_sContextInformation;
- aError.NextException = aInfo.get();
-
+ SQLException aError(m_sContextInformation, {}, {}, 0, aInfo.get());
aInfo = aError;
}
}
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index e736e365aea9..0d3676db5d80 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -42,7 +42,7 @@
#include <sal/log.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -152,14 +152,14 @@ namespace dbaui
bool documentHasScriptSupport() const
{
- OSL_PRECOND( !!m_aDocScriptSupport,
+ OSL_PRECOND( m_aDocScriptSupport.has_value(),
"DBSubComponentController_Impl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
- return !!m_aDocScriptSupport && *m_aDocScriptSupport;
+ return m_aDocScriptSupport.has_value() && *m_aDocScriptSupport;
}
void setDocumentScriptSupport( const bool _bSupport )
{
- OSL_PRECOND( !m_aDocScriptSupport,
+ OSL_PRECOND( !m_aDocScriptSupport.has_value(),
"DBSubComponentController_Impl::setDocumentScriptSupport: already initialized!" );
m_aDocScriptSupport = ::std::optional< bool >( _bSupport );
}
@@ -176,11 +176,9 @@ namespace dbaui
{
}
- void DBSubComponentController::impl_initialize()
+ void DBSubComponentController::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
- OGenericUnoController::impl_initialize();
-
- const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
+ OGenericUnoController::impl_initialize(rArguments);
Reference< XConnection > xConnection;
xConnection = rArguments.getOrDefault( PROPERTY_ACTIVE_CONNECTION, xConnection );
@@ -210,7 +208,7 @@ namespace dbaui
if ( _rType.equals( cppu::UnoType<XScriptInvocationContext>::get() ) )
{
if ( m_pImpl->documentHasScriptSupport() )
- return makeAny( Reference< XScriptInvocationContext >( this ) );
+ return Any( Reference< XScriptInvocationContext >( this ) );
return Any();
}
@@ -535,8 +533,7 @@ namespace dbaui
Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
if ( xTitle.is() )
{
- sTitle.append( xTitle->getTitle() );
- sTitle.append(" : ");
+ sTitle.append( xTitle->getTitle() + " : ");
}
sTitle.append( getPrivateTitle() );
return sTitle.makeStringAndClear();
diff --git a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
index 53ef26fa3284..cc44de2bdee0 100644
--- a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
+++ b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/tools/XConnectionTools.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <connectivity/dbexception.hxx>
@@ -32,7 +31,7 @@
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <memory>
@@ -47,7 +46,6 @@ namespace dbaui
using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::sdbc::XConnection;
- using ::com::sun::star::sdb::tools::XObjectNames;
using ::com::sun::star::sdb::tools::XConnectionTools;
using ::com::sun::star::uno::UNO_QUERY;
@@ -60,29 +58,20 @@ namespace dbaui
{
void lcl_fillNameExistsError( std::u16string_view _rObjectName, SQLExceptionInfo& _out_rErrorToDisplay )
{
- SQLException aError;
OUString sErrorMessage = DBA_RES(STR_NAMED_OBJECT_ALREADY_EXISTS);
- aError.Message = sErrorMessage.replaceAll("$#$", _rObjectName);
+ SQLException aError(sErrorMessage.replaceAll("$#$", _rObjectName), {}, {}, 0, {});
_out_rErrorToDisplay = aError;
}
}
- // HierarchicalNameCheck_Impl
- struct HierarchicalNameCheck_Impl
- {
- Reference< XHierarchicalNameAccess > xHierarchicalNames;
- OUString sRelativeRoot;
- };
-
// HierarchicalNameCheck
HierarchicalNameCheck::HierarchicalNameCheck( const Reference< XHierarchicalNameAccess >& _rxNames, const OUString& _rRelativeRoot )
- :m_pImpl( new HierarchicalNameCheck_Impl )
{
- m_pImpl->xHierarchicalNames = _rxNames;
- m_pImpl->sRelativeRoot = _rRelativeRoot;
+ mxHierarchicalNames = _rxNames;
+ msRelativeRoot = _rRelativeRoot;
- if ( !m_pImpl->xHierarchicalNames.is() )
+ if ( !mxHierarchicalNames.is() )
throw IllegalArgumentException();
}
@@ -95,15 +84,14 @@ namespace dbaui
try
{
OUStringBuffer aCompleteName;
- if ( !m_pImpl->sRelativeRoot.isEmpty() )
+ if ( !msRelativeRoot.isEmpty() )
{
- aCompleteName.append( m_pImpl->sRelativeRoot );
- aCompleteName.append( "/" );
+ aCompleteName.append( msRelativeRoot + "/" );
}
aCompleteName.append( _rObjectName );
OUString sCompleteName( aCompleteName.makeStringAndClear() );
- if ( !m_pImpl->xHierarchicalNames->hasByHierarchicalName( sCompleteName ) )
+ if ( !mxHierarchicalNames->hasByHierarchicalName( sCompleteName ) )
return true;
}
catch( const Exception& )
@@ -115,26 +103,18 @@ namespace dbaui
return false;
}
- // DynamicTableOrQueryNameCheck_Impl
- struct DynamicTableOrQueryNameCheck_Impl
- {
- sal_Int32 nCommandType;
- Reference< XObjectNames > xObjectNames;
- };
-
// DynamicTableOrQueryNameCheck
DynamicTableOrQueryNameCheck::DynamicTableOrQueryNameCheck( const Reference< XConnection >& _rxSdbLevelConnection, sal_Int32 _nCommandType )
- :m_pImpl( new DynamicTableOrQueryNameCheck_Impl )
{
Reference< XConnectionTools > xConnTools( _rxSdbLevelConnection, UNO_QUERY );
if ( xConnTools.is() )
- m_pImpl->xObjectNames.set( xConnTools->getObjectNames() );
- if ( !m_pImpl->xObjectNames.is() )
+ mxObjectNames.set( xConnTools->getObjectNames() );
+ if ( !mxObjectNames.is() )
throw IllegalArgumentException();
if ( ( _nCommandType != CommandType::QUERY ) && ( _nCommandType != CommandType::TABLE ) )
throw IllegalArgumentException();
- m_pImpl->nCommandType = _nCommandType;
+ mnCommandType = _nCommandType;
}
DynamicTableOrQueryNameCheck::~DynamicTableOrQueryNameCheck()
@@ -145,7 +125,7 @@ namespace dbaui
{
try
{
- m_pImpl->xObjectNames->checkNameForCreate( m_pImpl->nCommandType, _rObjectName );
+ mxObjectNames->checkNameForCreate( mnCommandType, _rObjectName );
return true;
}
catch( const SQLException& )
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 286ce63aace2..3673d4d3d9bb 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -28,7 +28,6 @@
namespace dbaui
{
- using namespace dbaccess;
using namespace ::com::sun::star;
namespace {
@@ -140,26 +139,9 @@ namespace dbaui
return s_aSupport[ _sURL ].eAuthentication;
}
- // DataSourceMetaData_Impl
- class DataSourceMetaData_Impl
- {
- public:
- explicit DataSourceMetaData_Impl(const OUString& rURL);
-
- const OUString& getType() const { return m_sURL; }
-
- private:
- const OUString m_sURL;
- };
-
- DataSourceMetaData_Impl::DataSourceMetaData_Impl( const OUString& _sURL )
- :m_sURL( _sURL )
- {
- }
-
// DataSourceMetaData
DataSourceMetaData::DataSourceMetaData( const OUString& _sURL )
- :m_pImpl( std::make_shared<DataSourceMetaData_Impl>( _sURL ) )
+ :m_sURL( _sURL )
{
}
@@ -169,7 +151,7 @@ namespace dbaui
const FeatureSet& DataSourceMetaData::getFeatureSet() const
{
- return lcl_getFeatureSet( m_pImpl->getType() );
+ return lcl_getFeatureSet( m_sURL );
}
AuthenticationMode DataSourceMetaData::getAuthentication( const OUString& _sURL )
diff --git a/dbaccess/source/ui/misc/imageprovider.cxx b/dbaccess/source/ui/misc/imageprovider.cxx
index b69ec70e6a80..388df30e271f 100644
--- a/dbaccess/source/ui/misc/imageprovider.cxx
+++ b/dbaccess/source/ui/misc/imageprovider.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaui
{
@@ -43,26 +43,16 @@ namespace dbaui
namespace GraphicColorMode = css::graphic::GraphicColorMode;
namespace DatabaseObject = css::sdb::application::DatabaseObject;
- // ImageProvider_Data
- struct ImageProvider_Data
- {
- /// the connection we work with
- Reference< XConnection > xConnection;
- /// the views of the connection, if the DB supports views
- Reference< XNameAccess > xViews;
- /// interface for providing table's UI
- Reference< XTableUIProvider > xTableUI;
- };
-
namespace
{
- void lcl_getConnectionProvidedTableIcon_nothrow( const ImageProvider_Data& _rData,
+ void lcl_getConnectionProvidedTableIcon_nothrow(
+ const css::uno::Reference< css::sdb::application::XTableUIProvider >& _xTableUI,
const OUString& _rName, Reference< XGraphic >& _out_rxGraphic )
{
try
{
- if ( _rData.xTableUI.is() )
- _out_rxGraphic = _rData.xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL );
+ if ( _xTableUI.is() )
+ _out_rxGraphic = _xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL );
}
catch( const Exception& )
{
@@ -70,13 +60,15 @@ namespace dbaui
}
}
- void lcl_getTableImageResourceID_nothrow( const ImageProvider_Data& _rData, const OUString& _rName,
+ void lcl_getTableImageResourceID_nothrow(
+ const css::uno::Reference< css::container::XNameAccess >& _xViews,
+ const OUString& _rName,
OUString& _out_rResourceID)
{
_out_rResourceID = OUString();
try
{
- bool bIsView = _rData.xViews.is() && _rData.xViews->hasByName( _rName );
+ bool bIsView = _xViews.is() && _xViews->hasByName( _rName );
if ( bIsView )
{
_out_rResourceID = VIEW_TREE_ICON;
@@ -94,21 +86,19 @@ namespace dbaui
}
// ImageProvider
ImageProvider::ImageProvider()
- :m_pData( std::make_shared<ImageProvider_Data>() )
{
}
ImageProvider::ImageProvider( const Reference< XConnection >& _rxConnection )
- :m_pData( std::make_shared<ImageProvider_Data>() )
+ : mxConnection(_rxConnection)
{
- m_pData->xConnection = _rxConnection;
try
{
- Reference< XViewsSupplier > xSuppViews( m_pData->xConnection, UNO_QUERY );
+ Reference< XViewsSupplier > xSuppViews( mxConnection, UNO_QUERY );
if ( xSuppViews.is() )
- m_pData->xViews.set( xSuppViews->getViews(), UNO_SET_THROW );
+ mxViews.set( xSuppViews->getViews(), UNO_SET_THROW );
- m_pData->xTableUI.set( _rxConnection, UNO_QUERY );
+ mxTableUI.set( _rxConnection, UNO_QUERY );
}
catch( const Exception& )
{
@@ -127,7 +117,7 @@ namespace dbaui
{
// no -> determine by type
OUString sImageResourceID;
- lcl_getTableImageResourceID_nothrow( *m_pData, _rName, sImageResourceID );
+ lcl_getTableImageResourceID_nothrow( mxViews, _rName, sImageResourceID );
return sImageResourceID;
}
}
@@ -138,7 +128,7 @@ namespace dbaui
if (_nDatabaseObjectType == DatabaseObject::TABLE)
{
// check whether the connection can give us an icon
- lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic );
+ lcl_getConnectionProvidedTableIcon_nothrow( mxTableUI, _rName, xGraphic );
}
return xGraphic;
}
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index 8a5448e623f9..169512ce723b 100644
--- a/dbaccess/source/ui/misc/indexcollection.cxx
+++ b/dbaccess/source/ui/misc/indexcollection.cxx
@@ -18,7 +18,7 @@
*/
#include <indexcollection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbcx/XAppend.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -122,10 +122,10 @@ namespace dbaui
}
// set the properties
- static constexpr OUStringLiteral s_sNamePropertyName = u"Name";
+ static constexpr OUString s_sNamePropertyName = u"Name"_ustr;
// the index' own props
- xIndexDescriptor->setPropertyValue("IsUnique", css::uno::makeAny(_rPos->bUnique));
- xIndexDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(_rPos->sName));
+ xIndexDescriptor->setPropertyValue("IsUnique", css::uno::Any(_rPos->bUnique));
+ xIndexDescriptor->setPropertyValue(s_sNamePropertyName, Any(_rPos->sName));
// the fields
for (auto const& field : _rPos->aFields)
@@ -136,8 +136,8 @@ namespace dbaui
OSL_ENSURE(xColDescriptor.is(), "OIndexCollection::commitNewIndex: invalid column descriptor!");
if (xColDescriptor.is())
{
- xColDescriptor->setPropertyValue("IsAscending", css::uno::makeAny(field.bSortAscending));
- xColDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(field.sFieldName));
+ xColDescriptor->setPropertyValue("IsAscending", css::uno::Any(field.bSortAscending));
+ xColDescriptor->setPropertyValue(s_sNamePropertyName, Any(field.sFieldName));
xAppendCols->appendByDescriptor(xColDescriptor);
}
}
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 192331ced226..d1f7fa6aa1a1 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -20,7 +20,7 @@
#include <core_resource.hxx>
#include <linkeddocuments.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/confignode.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/namedvaluecollection.hxx>
@@ -38,6 +38,7 @@
#include <browserids.hxx>
#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
#include <comphelper/mimeconfighelper.hxx>
+#include <utility>
#include <vcl/weld.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -51,13 +52,10 @@ namespace dbaui
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::task;
- using namespace ::svt;
namespace
{
@@ -88,13 +86,13 @@ namespace dbaui
// OLinkedDocumentsAccess
OLinkedDocumentsAccess::OLinkedDocumentsAccess( weld::Window* pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI,
const Reference< XComponentContext >& _rxContext, const Reference< XNameAccess >& _rxContainer,
- const Reference< XConnection>& _xConnection, const OUString& _sDataSourceName )
+ const Reference< XConnection>& _xConnection, OUString _sDataSourceName )
:m_xContext(_rxContext)
,m_xDocumentContainer(_rxContainer)
,m_xConnection(_xConnection)
,m_xDocumentUI( i_rDocumentUI )
,m_pDialogParent(pDialogParent)
- ,m_sDataSourceName(_sDataSourceName)
+ ,m_sDataSourceName(std::move(_sDataSourceName))
{
OSL_ENSURE(m_xContext.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid service factory!");
assert(m_pDialogParent && "OLinkedDocumentsAccess::OLinkedDocumentsAccess: really need a dialog parent!");
@@ -117,15 +115,15 @@ namespace dbaui
OUString sOpenMode;
switch ( _eOpenMode )
{
- case E_OPEN_NORMAL:
+ case ElementOpenMode::Normal:
sOpenMode = "open";
break;
- case E_OPEN_FOR_MAIL:
+ case ElementOpenMode::Mail:
aArguments.put( "Hidden", true );
[[fallthrough]];
- case E_OPEN_DESIGN:
+ case ElementOpenMode::Design:
sOpenMode = "openDesign";
break;
@@ -302,16 +300,13 @@ namespace dbaui
OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC);
sMessage = sMessage.replaceFirst("$file$",_rLinkName);
- css::sdbc::SQLException aSQLException;
- aSQLException.Message = sMessage;
+ css::sdbc::SQLException aSQLException(sMessage, {}, {}, 0, {});
aInfo = dbtools::SQLExceptionInfo(aSQLException);
}
}
catch(const css::io::WrongFormatException &e)
{
- css::sdbc::SQLException aSQLException;
- aSQLException.Message = e.Message;
- aSQLException.Context = e.Context;
+ css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {});
aInfo = dbtools::SQLExceptionInfo(aSQLException);
// more like a hack, insert an empty message
@@ -329,9 +324,7 @@ namespace dbaui
css::sdbc::SQLException a;
if ( !(aAny >>= a) || (a.ErrorCode != dbtools::ParameterInteractionCancelled) )
{
- css::sdbc::SQLException aSQLException;
- aSQLException.Message = e.Message;
- aSQLException.Context = e.Context;
+ css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {});
aInfo = dbtools::SQLExceptionInfo(aSQLException);
// more like a hack, insert an empty message
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 28b0c9e774bd..6f58676629d0 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -35,22 +35,10 @@ namespace dbaui
using ::com::sun::star::document::XUndoManager;
using ::com::sun::star::beans::PropertyValue;
- // OSingleDocumentController_Data
- struct OSingleDocumentController_Data
- {
- // no Reference! see UndoManager::acquire
- std::unique_ptr<UndoManager> m_pUndoManager;
-
- OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
- : m_pUndoManager(new UndoManager(i_parent, i_mutex))
- {
- }
- };
-
// OSingleDocumentController
OSingleDocumentController::OSingleDocumentController( const Reference< XComponentContext >& _rxORB )
:OSingleDocumentController_Base( _rxORB )
- ,m_pData( new OSingleDocumentController_Data( *this, getMutex() ) )
+ ,m_pUndoManager(new UndoManager(*this, getMutex()))
{
}
@@ -62,7 +50,7 @@ namespace dbaui
{
OSingleDocumentController_Base::disposing();
ClearUndoManager();
- m_pData->m_pUndoManager->disposing();
+ m_pUndoManager->disposing();
}
void OSingleDocumentController::ClearUndoManager()
@@ -72,7 +60,7 @@ namespace dbaui
SfxUndoManager& OSingleDocumentController::GetUndoManager() const
{
- return m_pData->m_pUndoManager->GetSfxUndoManager();
+ return m_pUndoManager->GetSfxUndoManager();
}
void OSingleDocumentController::addUndoActionAndInvalidate(std::unique_ptr<SfxUndoAction> _pAction)
@@ -91,7 +79,7 @@ namespace dbaui
Reference< XUndoManager > SAL_CALL OSingleDocumentController::getUndoManager( )
{
// see UndoManager::acquire
- return m_pData->m_pUndoManager.get();
+ return m_pUndoManager.get();
}
FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index 96086d60b682..b22a05424df3 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -22,6 +22,7 @@
#include <TableWindow.hxx>
#include <TableWindowListBox.hxx>
#include <TableConnection.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <math.h>
#include <osl/diagnose.h>
@@ -121,9 +122,9 @@ namespace
}
}
-OConnectionLine::OConnectionLine( OTableConnection* _pConn, OConnectionLineDataRef const & _pLineData )
+OConnectionLine::OConnectionLine( OTableConnection* _pConn, OConnectionLineDataRef _pLineData )
: m_pTabConn( _pConn )
- , m_pData( _pLineData )
+ , m_pData(std::move( _pLineData ))
{
}
@@ -307,7 +308,7 @@ static double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Poin
{
Point v(p2 - p1);
Point w(pM - p1);
- double a = sqrt(static_cast<double>(v.X()*v.X() + v.Y()*v.Y()));
+ double a = std::hypot(v.X(), v.Y());
double l = (v.X() * w.Y() - v.Y() * w.X()) / a;
double a2 = w.X()*v.X()+w.Y()*v.Y();
a = a2 / (a * a);
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index f11ca853c930..1fa17c06207c 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -25,18 +25,16 @@
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <TableConnection.hxx>
#include <TableWindow.hxx>
-#include <comphelper/sequence.hxx>
namespace dbaui
{
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
OConnectionLineAccess::OConnectionLineAccess(OTableConnection* _pLine)
- : VCLXAccessibleComponent(_pLine->GetComponentInterface().is() ? _pLine->GetWindowPeer() : nullptr)
+ : ImplInheritanceHelper(_pLine->GetComponentInterface().is() ? _pLine->GetWindowPeer() : nullptr)
,m_pLine(_pLine)
{
}
@@ -45,32 +43,23 @@ namespace dbaui
m_pLine = nullptr;
VCLXAccessibleComponent::disposing();
}
- Any SAL_CALL OConnectionLineAccess::queryInterface( const Type& aType )
- {
- Any aRet(VCLXAccessibleComponent::queryInterface( aType ));
- return aRet.hasValue() ? aRet : OConnectionLineAccess_BASE::queryInterface( aType );
- }
- Sequence< Type > SAL_CALL OConnectionLineAccess::getTypes( )
- {
- return ::comphelper::concatSequences(VCLXAccessibleComponent::getTypes(),OConnectionLineAccess_BASE::getTypes());
- }
OUString SAL_CALL OConnectionLineAccess::getImplementationName()
{
return "org.openoffice.comp.dbu.ConnectionLineAccessibility";
}
// XAccessibleContext
- sal_Int32 SAL_CALL OConnectionLineAccess::getAccessibleChildCount( )
+ sal_Int64 SAL_CALL OConnectionLineAccess::getAccessibleChildCount( )
{
return 0;
}
- Reference< XAccessible > SAL_CALL OConnectionLineAccess::getAccessibleChild( sal_Int32 /*i*/ )
+ Reference< XAccessible > SAL_CALL OConnectionLineAccess::getAccessibleChild( sal_Int64 /*i*/ )
{
return Reference< XAccessible >();
}
- sal_Int32 SAL_CALL OConnectionLineAccess::getAccessibleIndexInParent( )
+ sal_Int64 SAL_CALL OConnectionLineAccess::getAccessibleIndexInParent( )
{
::osl::MutexGuard aGuard( m_aMutex );
- sal_Int32 nIndex = -1;
+ sal_Int64 nIndex = -1;
if( m_pLine )
{
// search the position of our table window in the table window map
@@ -113,7 +102,7 @@ namespace dbaui
{
::osl::MutexGuard aGuard( m_aMutex );
tools::Rectangle aRect(m_pLine ? m_pLine->GetBoundingRect() : tools::Rectangle());
- return awt::Rectangle(aRect.Left(),aRect.Top(),aRect.getWidth(),aRect.getHeight());
+ return awt::Rectangle(aRect.Left(),aRect.Top(),aRect.getOpenWidth(),aRect.getOpenHeight());
}
awt::Point SAL_CALL OConnectionLineAccess::getLocation( )
{
@@ -144,7 +133,7 @@ namespace dbaui
if( nIndex < 0 || nIndex >= getRelationCount() )
throw IndexOutOfBoundsException();
- Sequence< Reference<XInterface> > aSeq;
+ Sequence<Reference<XAccessible>> aSeq;
if( m_pLine )
{
aSeq = { m_pLine->GetSourceWin()->GetAccessible(),
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineData.cxx b/dbaccess/source/ui/querydesign/ConnectionLineData.cxx
index db7177294e64..8267cc3ed8c2 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineData.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineData.cxx
@@ -18,15 +18,16 @@
*/
#include <ConnectionLineData.hxx>
+#include <utility>
using namespace dbaui;
OConnectionLineData::OConnectionLineData()
{
}
-OConnectionLineData::OConnectionLineData( const OUString& rSourceFieldName, const OUString& rDestFieldName )
- :m_aSourceFieldName( rSourceFieldName )
- ,m_aDestFieldName( rDestFieldName )
+OConnectionLineData::OConnectionLineData( OUString sSourceFieldName, OUString sDestFieldName )
+ :m_aSourceFieldName(std::move( sSourceFieldName ))
+ ,m_aDestFieldName(std::move( sDestFieldName ))
{
}
diff --git a/dbaccess/source/ui/querydesign/JAccess.cxx b/dbaccess/source/ui/querydesign/JAccess.cxx
index 8068f0fa7f21..13a18b918db7 100644
--- a/dbaccess/source/ui/querydesign/JAccess.cxx
+++ b/dbaccess/source/ui/querydesign/JAccess.cxx
@@ -29,11 +29,10 @@ namespace dbaui
{
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
OJoinDesignViewAccess::OJoinDesignViewAccess(OJoinTableView* _pTableView)
- :VCLXAccessibleComponent(_pTableView->GetComponentInterface().is() ? _pTableView->GetWindowPeer() : nullptr)
+ :ImplInheritanceHelper(_pTableView->GetComponentInterface().is() ? _pTableView->GetWindowPeer() : nullptr)
,m_pTableView(_pTableView)
{
}
@@ -47,24 +46,24 @@ namespace dbaui
m_pTableView = nullptr;
}
// XAccessibleContext
- sal_Int32 SAL_CALL OJoinDesignViewAccess::getAccessibleChildCount( )
+ sal_Int64 SAL_CALL OJoinDesignViewAccess::getAccessibleChildCount( )
{
// TODO may be this will change to only visible windows
// this is the same assumption mt implements
::osl::MutexGuard aGuard( m_aMutex );
- sal_Int32 nChildCount = 0;
+ sal_Int64 nChildCount = 0;
if ( m_pTableView )
nChildCount = m_pTableView->GetTabWinCount() + m_pTableView->getTableConnections().size();
return nChildCount;
}
- Reference< XAccessible > SAL_CALL OJoinDesignViewAccess::getAccessibleChild( sal_Int32 i )
+ Reference< XAccessible > SAL_CALL OJoinDesignViewAccess::getAccessibleChild( sal_Int64 i )
{
Reference< XAccessible > aRet;
::osl::MutexGuard aGuard( m_aMutex );
if(i < 0 || i >= getAccessibleChildCount() || !m_pTableView)
throw IndexOutOfBoundsException();
// check if we should return a table window or a connection
- sal_Int32 nTableWindowCount = m_pTableView->GetTabWinCount();
+ sal_Int64 nTableWindowCount = m_pTableView->GetTabWinCount();
if( i < nTableWindowCount )
{
OJoinTableView::OTableWindowMap::const_iterator aIter = std::next(m_pTableView->GetTabWinMap().begin(), i);
@@ -82,10 +81,6 @@ namespace dbaui
{
return this;
}
- // XInterface
- IMPLEMENT_FORWARD_XINTERFACE2( OJoinDesignViewAccess, VCLXAccessibleComponent, OJoinDesignViewAccess_BASE )
- // XTypeProvider
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( OJoinDesignViewAccess, VCLXAccessibleComponent, OJoinDesignViewAccess_BASE )
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 114f77d99865..5ef77a5ebc18 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -34,12 +34,8 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::ui::dialogs;
using namespace ::dbtools;
using namespace ::comphelper;
@@ -204,6 +200,7 @@ AddTableDialogContext& OJoinController::impl_getDialogContext() const
OJoinController* pNonConstThis = const_cast< OJoinController* >( this );
pNonConstThis->m_pDialogContext.reset( new AddTableDialogContext( *pNonConstThis ) );
}
+ assert(m_pDialogContext && "always exists at this point");
return *m_pDialogContext;
}
@@ -277,7 +274,7 @@ void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabW
void OJoinController::removeConnectionData(const TTableConnectionData::value_type& _pData)
{
- m_vTableConnectionData.erase( std::remove(m_vTableConnectionData.begin(),m_vTableConnectionData.end(),_pData),m_vTableConnectionData.end());
+ std::erase(m_vTableConnectionData, _pData);
}
void OJoinController::describeSupportedFeatures()
diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx
index c0d3ea81c7a0..ae09be66c26b 100644
--- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx
@@ -24,11 +24,6 @@
#include <vcl/settings.hxx>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
namespace dbaui
{
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
index 9a06fa7ab488..8b218ccf269f 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -24,7 +24,6 @@
namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::datatransfer;
void OJoinExchObj::setDescriptors(const OJoinExchangeData& jxdSource,bool _bFirstEntry)
@@ -61,7 +60,7 @@ namespace dbaui
return aReturn;
}
- Sequence< sal_Int8 > OJoinExchObj::getUnoTunnelId()
+ const Sequence< sal_Int8 > & OJoinExchObj::getUnoTunnelId()
{
static const comphelper::UnoIdInit implId;
return implId.getSeq();
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index b28ea923ebf2..88085c8eadd8 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -46,7 +46,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <cppuhelper/exc_hlp.hxx>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
#include <functional>
@@ -54,7 +54,6 @@ using namespace dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
#define LINE_SIZE 50
@@ -66,14 +65,14 @@ using namespace ::com::sun::star::lang;
#define TABWIN_HEIGHT_STD 120
OScrollWindowHelper::OScrollWindowHelper( vcl::Window* pParent) : Window( pParent)
- ,m_aHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) )
- ,m_aVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) )
- ,m_pCornerWindow(VclPtr<ScrollBarBox>::Create(this, WB_3DLOOK))
+ ,m_aHScrollBar( VclPtr<ScrollAdaptor>::Create(this, true) )
+ ,m_aVScrollBar( VclPtr<ScrollAdaptor>::Create(this, false) )
,m_pTableView(nullptr)
{
+ StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
+ SetBackground(aSystemStyle.GetFaceColor());
// ScrollBars
-
GetHScrollBar().SetRange( Range(0, 1000) );
GetVScrollBar().SetRange( Range(0, 1000) );
@@ -82,7 +81,6 @@ OScrollWindowHelper::OScrollWindowHelper( vcl::Window* pParent) : Window( pParen
GetHScrollBar().Show();
GetVScrollBar().Show();
- m_pCornerWindow->Show();
// normally we should be SCROLL_PANE
SetAccessibleRole(AccessibleRole::SCROLL_PANE);
@@ -97,7 +95,6 @@ void OScrollWindowHelper::dispose()
{
m_aHScrollBar.disposeAndClear();
m_aVScrollBar.disposeAndClear();
- m_pCornerWindow.disposeAndClear();
m_pTableView.clear();
vcl::Window::dispose();
}
@@ -106,8 +103,8 @@ void OScrollWindowHelper::setTableView(OJoinTableView* _pTableView)
{
m_pTableView = _pTableView;
// ScrollBars
- GetHScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) );
- GetVScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) );
+ GetHScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, HorzScrollHdl) );
+ GetVScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, VertScrollHdl) );
}
void OScrollWindowHelper::resetRange(const Point& _aSize)
@@ -135,11 +132,6 @@ void OScrollWindowHelper::Resize()
Size( nVScrollWidth, aTotalOutputSize.Height()-nHScrollHeight )
);
- m_pCornerWindow->SetPosSizePixel(
- Point( aTotalOutputSize.Width() - nVScrollWidth, aTotalOutputSize.Height() - nHScrollHeight),
- Size( nVScrollWidth, nHScrollHeight )
- );
-
GetHScrollBar().SetPageSize( aTotalOutputSize.Width() );
GetHScrollBar().SetVisibleSize( aTotalOutputSize.Width() );
@@ -201,10 +193,16 @@ void OJoinTableView::dispose()
vcl::Window::dispose();
}
-IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar, void )
+IMPL_LINK(OJoinTableView, HorzScrollHdl, weld::Scrollbar&, rScrollbar, void)
+{
+ // move all windows
+ ScrollPane(rScrollbar.adjustment_get_value() - m_aScrollOffset.X(), true, false);
+}
+
+IMPL_LINK(OJoinTableView, VertScrollHdl, weld::Scrollbar&, rScrollbar, void)
{
// move all windows
- ScrollPane( pScrollBar->GetDelta(), (pScrollBar == &GetHScrollBar()), false );
+ ScrollPane(rScrollbar.adjustment_get_value() - m_aScrollOffset.Y(), false, false);
}
void OJoinTableView::Resize()
@@ -237,7 +235,7 @@ void OJoinTableView::Resize()
}
}
-sal_uLong OJoinTableView::GetTabWinCount() const
+sal_Int64 OJoinTableView::GetTabWinCount() const
{
return m_aTableMap.size();
}
@@ -258,7 +256,7 @@ bool OJoinTableView::RemoveConnection(VclPtr<OTableConnection>& rConn, bool _bDe
modified();
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(xConn->GetAccessible()),
+ Any(xConn->GetAccessible()),
Any());
if (_bDelete)
xConn->disposeOnce();
@@ -338,7 +336,7 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
Any(),
- makeAny(pNewTabWin->GetAccessible()));
+ Any(pNewTabWin->GetAccessible()));
}
else
{
@@ -374,7 +372,7 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
{
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(pTabWin->GetAccessible()),Any()
+ Any(pTabWin->GetAccessible()),Any()
);
pTabWin->Hide();
@@ -405,7 +403,7 @@ namespace
bool isScrollAllowed( OJoinTableView* _pView,tools::Long nDelta, bool bHoriz)
{
// adjust ScrollBar-Positions
- ScrollBar& rBar = bHoriz ? _pView->GetHScrollBar() : _pView->GetVScrollBar() ;
+ ScrollAdaptor& rBar = bHoriz ? _pView->GetHScrollBar() : _pView->GetVScrollBar();
tools::Long nOldThumbPos = rBar.GetThumbPos();
tools::Long nNewThumbPos = nOldThumbPos + nDelta;
@@ -1123,7 +1121,7 @@ void OJoinTableView::executePopup(const Point& rPos, VclPtr<OTableConnection>& r
weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "dbaccess/ui/joinviewmenu.ui"));
std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu("menu"));
- OString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "delete")
RemoveConnection(rSelConnection, true);
else if (sIdent == "edit")
@@ -1219,7 +1217,7 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
bool bHandled = false;
switch (rNEvt.GetType())
{
- case MouseNotifyEvent::COMMAND:
+ case NotifyEventType::COMMAND:
{
const CommandEvent* pCommand = rNEvt.GetCommandEvent();
if (pCommand->GetCommand() == CommandEventId::Wheel)
@@ -1236,7 +1234,7 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
}
}
break;
- case MouseNotifyEvent::KEYINPUT:
+ case NotifyEventType::KEYINPUT:
{
if (m_aTableMap.empty())
// no tab wins -> no conns -> no traveling
@@ -1364,7 +1362,7 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
}
}
break;
- case MouseNotifyEvent::GETFOCUS:
+ case NotifyEventType::GETFOCUS:
{
if (m_aTableMap.empty())
// no tab wins -> no conns -> no focus change
@@ -1546,7 +1544,7 @@ void OJoinTableView::addConnection(OTableConnection* _pConnection,bool _bAddData
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
Any(),
- makeAny(_pConnection->GetAccessible()));
+ Any(_pConnection->GetAccessible()));
}
bool OJoinTableView::allowQueries() const
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index cc70e1276a19..93cbf6026d4c 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -34,7 +34,6 @@
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace dbaui;
OQueryTableWindow::OQueryTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData)
@@ -110,7 +109,7 @@ void OQueryTableWindow::OnEntryDoubleClicked(weld::TreeIter& rEntry)
return;
weld::TreeView& rTreeView = m_xListBox->get_widget();
- OTableFieldInfo* pInf = reinterpret_cast<OTableFieldInfo*>(rTreeView.get_id(rEntry).toUInt64());
+ OTableFieldInfo* pInf = weld::fromId<OTableFieldInfo*>(rTreeView.get_id(rEntry));
OSL_ENSURE(pInf != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
// build up DragInfo
@@ -144,7 +143,7 @@ bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDes
{
if (bCase(strFieldName, rTreeView.get_text(*xEntry)))
{
- OTableFieldInfo* pInf = reinterpret_cast<OTableFieldInfo*>(rTreeView.get_id(*xEntry).toUInt64());
+ OTableFieldInfo* pInf = weld::fromId<OTableFieldInfo*>(rTreeView.get_id(*xEntry));
assert(pInf && "OQueryTableWindow::ExistsField : field doesn't have FieldInfo !");
rInfo->SetTabWindow(this);
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index ce6c45673688..7de007624f3d 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -23,8 +23,9 @@
#include <querycontroller.hxx>
#include <sqlbison.hxx>
#include <vcl/split.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -52,12 +53,10 @@
#include <string_view>
using namespace ::dbaui;
-using namespace ::utl;
using namespace ::connectivity;
using namespace ::dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::i18n;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -96,7 +95,7 @@ namespace
bool bHaving,
bool _bAddOrOnOneLine);
- OUString quoteTableAlias(bool _bQuote, const OUString& _sAliasName, const OUString& _sQuote)
+ OUString quoteTableAlias(bool _bQuote, const OUString& _sAliasName, std::u16string_view _sQuote)
{
OUString sRet;
if ( _bQuote && !_sAliasName.isEmpty() )
@@ -160,12 +159,8 @@ namespace
OUString aSourceFieldName(_aDragLeft->GetField());
OUString aDestFieldName(_aDragRight->GetField());
// the connection could point on the other side
- if(pConn->GetSourceWin() == _aDragRight->GetTabWindow())
- {
- OUString aTmp(aSourceFieldName);
- aSourceFieldName = aDestFieldName;
- aDestFieldName = aTmp;
- }
+ if (pConn->GetSourceWin() == _aDragRight->GetTabWindow())
+ std::swap(aSourceFieldName, aDestFieldName);
pConn->GetData()->AppendConnLine( aSourceFieldName,aDestFieldName);
pConn->UpdateLineList();
// Modified-Flag
@@ -290,11 +285,12 @@ namespace
{
if(!aCondition.isEmpty())
aCondition.append(C_AND);
- aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote));
- aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) ));
- aCondition.append(" = ");
- aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote));
- aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) ));
+ aCondition.append(
+ quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote)
+ + ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) )
+ + " = "
+ + quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote)
+ + ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) ));
}
}
catch(SQLException&)
@@ -658,8 +654,7 @@ namespace
if ( field->isAggregateFunction() )
{
OSL_ENSURE(!field->GetFunction().isEmpty(),"Function name must not be empty! ;-(");
- OUStringBuffer aTmpStr2( field->GetFunction() + "(" + aTmpStr.makeStringAndClear() + ")");
- aTmpStr = aTmpStr2;
+ aTmpStr = field->GetFunction() + "(" + aTmpStr + ")";
}
if (!rFieldAlias.isEmpty() &&
@@ -667,10 +662,10 @@ namespace
field->isNumericOrAggregateFunction() ||
field->isOtherFunction()))
{
- aTmpStr.append(" AS ");
- aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias));
+ aTmpStr.append(" AS " + ::dbtools::quoteName(aQuote, rFieldAlias));
}
- aFieldListStr.append(aTmpStr.makeStringAndClear());
+ aFieldListStr.append(aTmpStr);
+ aTmpStr.setLength(0);
aFieldListStr.append(", ");
}
}
@@ -919,14 +914,11 @@ namespace
{
aWorkStr += quoteTableAlias(bMulti,field->GetAlias(),aQuote) + ::dbtools::quoteName(aQuote, aColumnName);
}
- aWorkStr += " " + OUString( ";ASC;DESC" ).getToken( static_cast<sal_uInt16>(eOrder), ';' ) + ",";
+ aWorkStr += OUString::Concat(" ") + o3tl::getToken( u";ASC;DESC", static_cast<sal_uInt16>(eOrder), ';' ) + ",";
}
}
- {
- OUString sTemp(comphelper::string::stripEnd(aWorkStr, ','));
- aWorkStr = sTemp;
- }
+ aWorkStr = comphelper::string::stripEnd(aWorkStr, ',');
if ( !aWorkStr.isEmpty() )
{
@@ -1141,8 +1133,7 @@ namespace
if ( !aGroupByStr.isEmpty() )
{
aGroupByStr = aGroupByStr.replaceAt(aGroupByStr.getLength()-1,1, u" " );
- OUString aGroupByStr2 = " GROUP BY " + aGroupByStr;
- aGroupByStr = aGroupByStr2;
+ aGroupByStr = " GROUP BY " + aGroupByStr;
}
}
catch(SQLException&)
@@ -2171,7 +2162,7 @@ namespace
if ( SQL_ISRULE(pColumnRef,general_set_fct) )
{
aInfo->SetFunctionType(nFunctionType|FKT_AGGREGATE);
- aInfo->SetFunction(comphelper::string::stripEnd(aColumns.getToken(0,'('), ' '));
+ aInfo->SetFunction(OUString(comphelper::string::stripEnd(o3tl::getToken(aColumns,0,'('), ' ')));
}
else
aInfo->SetFunctionType(nFunctionType|FKT_OTHER);
@@ -2679,7 +2670,7 @@ void OQueryDesignView::fillValidFields(std::u16string_view sAliasName, weld::Com
bool OQueryDesignView::PreNotify(NotifyEvent& rNEvt)
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
{
if ( m_pSelectionBox && m_pSelectionBox->HasChildPathFocus() )
m_eChildFocus = SELECTION;
@@ -2769,14 +2760,11 @@ OUString OQueryDesignView::getStatement()
OUStringBuffer aSqlCmd("SELECT ");
if(rController.isDistinct())
aSqlCmd.append(" DISTINCT ");
- aSqlCmd.append(aFieldListStr);
- aSqlCmd.append(" FROM ");
- aSqlCmd.append(aTableListStr);
+ aSqlCmd.append(aFieldListStr + " FROM " + aTableListStr);
if (!aCriteriaListStr.isEmpty())
{
- aSqlCmd.append(" WHERE ");
- aSqlCmd.append(aCriteriaListStr.makeStringAndClear());
+ aSqlCmd.append(" WHERE " + aCriteriaListStr);
}
Reference<XDatabaseMetaData> xMeta;
if ( xConnection.is() )
@@ -2789,8 +2777,7 @@ OUString OQueryDesignView::getStatement()
// ----------------- construct GroupBy and attach ------------
if(!aHavingStr.isEmpty())
{
- aSqlCmd.append(" HAVING ");
- aSqlCmd.append(aHavingStr.makeStringAndClear());
+ aSqlCmd.append(" HAVING " + aHavingStr);
}
// ----------------- construct sorting and attach ------------
OUString sOrder;
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 9b252dbf8b1e..663d3a9e65a6 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -19,7 +19,7 @@
#include <QueryTableView.hxx>
#include <TableFieldDescription.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <helpids.h>
#include "QTableWindow.hxx"
@@ -224,7 +224,7 @@ void OQueryTableView::ReSync()
pTabWin.disposeAndClear();
arrInvalidTables.push_back(pData->GetAliasName());
- rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
+ std::erase(rTabWinDataList, *aIter);
continue;
}
@@ -253,7 +253,7 @@ void OQueryTableView::ReSync()
if (bInvalid)
{
// no -> bad luck, no connection
- rTabConnDataList.erase( std::remove(rTabConnDataList.begin(), rTabConnDataList.end(), *aConIter), rTabConnDataList.end());
+ std::erase(rTabConnDataList, *aConIter);
continue;
}
@@ -430,7 +430,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
Any(),
- makeAny(pNewTabWin->GetAccessible())
+ Any(pNewTabWin->GetAccessible())
);
do {
@@ -561,11 +561,7 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
{
// the connection could point on the other side
if(pConn->GetSourceWin() == pDestWin)
- {
- OUString aTmp(aSourceFieldName);
- aSourceFieldName = aDestFieldName;
- aDestFieldName = aTmp;
- }
+ std::swap(aSourceFieldName, aDestFieldName);
pConn->GetData()->AppendConnLine( aSourceFieldName,aDestFieldName );
@@ -693,7 +689,7 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
modified();
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(pTabWin->GetAccessible()),
+ Any(pTabWin->GetAccessible()),
Any()
);
}
@@ -738,7 +734,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
// the TabWin data must also be passed out of my responsibility
TTableWindowData& rTabWinDataList = m_pView->getController().getTableWindowData();
- rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), pTabWin->GetData()), rTabWinDataList.end());
+ std::erase(rTabWinDataList, pTabWin->GetData());
// The data should not be destroyed as TabWin itself - which is still alive - needs them
// Either it goes back into my responsibility, (via ShowTabWin), then I add the data back,
// or the Undo-Action, which currently has full responsibility for the window
diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx
index 9805c2aca62e..f8d8471e53e3 100644
--- a/dbaccess/source/ui/querydesign/QueryTextView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx
@@ -26,8 +26,6 @@
#include <undosqledit.hxx>
using namespace dbaui;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
// end of temp classes
OQueryTextView::OQueryTextView(OQueryContainerWindow* pParent, OQueryController& rController)
@@ -42,6 +40,7 @@ OQueryTextView::OQueryTextView(OQueryContainerWindow* pParent, OQueryController&
m_xSQL->DisableInternalUndo();
m_xSQL->SetHelpId(HID_CTL_QRYSQLEDIT);
m_xSQL->SetModifyHdl(LINK(this, OQueryTextView, ModifyHdl));
+ m_xSQL->SetAcceptsTab(true);
m_timerUndoActionCreation.SetTimeout(1000);
m_timerUndoActionCreation.SetInvokeHandler(LINK(this, OQueryTextView, OnUndoActionTimer));
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 235ed9bd1c41..fbf7abdafb77 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -48,7 +48,8 @@
#include <i18nlangtag/languagetag.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::svt;
using namespace ::dbaui;
@@ -56,8 +57,6 @@ using namespace ::connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::accessibility;
#define DEFAULT_QUERY_COLS 20
@@ -68,14 +67,14 @@ using namespace ::com::sun::star::accessibility;
namespace
{
- bool isFieldNameAsterisk(const OUString& _sFieldName )
+ bool isFieldNameAsterisk(std::u16string_view _sFieldName )
{
- bool bAsterisk = _sFieldName.isEmpty() || _sFieldName.toChar() == '*';
+ bool bAsterisk = _sFieldName.empty() || _sFieldName[0] == '*';
if ( !bAsterisk )
{
sal_Int32 nTokenCount = comphelper::string::getTokenCount(_sFieldName, '.');
- if ( (nTokenCount == 2 && _sFieldName.getToken(1,'.')[0] == '*' )
- || (nTokenCount == 3 && _sFieldName.getToken(2,'.')[0] == '*' ) )
+ if ( (nTokenCount == 2 && o3tl::getToken(_sFieldName,1,'.')[0] == '*' )
+ || (nTokenCount == 3 && o3tl::getToken(_sFieldName,2,'.')[0] == '*' ) )
{
bAsterisk = true;
}
@@ -146,7 +145,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
const OUString aTxt(DBA_RES(STR_QUERY_SORTTEXT));
for (sal_Int32 nIdx {0}; nIdx>=0;)
- rOrderBox.append_text(aTxt.getToken(0, ';', nIdx));
+ rOrderBox.append_text(OUString(o3tl::getToken(aTxt, 0, ';', nIdx)));
m_bVisibleRow.insert(m_bVisibleRow.end(), BROW_ROW_CNT, true);
@@ -492,7 +491,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, sal
getDesignView()->fillValidFields(aTable, rComboBox);
// replace with alias.*
- if (aField.trim() == "*")
+ if (o3tl::trim(aField) == u"*")
{
aField = aTable + ".*";
}
@@ -575,7 +574,7 @@ void OSelectionBrowseBox::notifyFunctionFieldChanged(const OUString& _sOldFuncti
RowModified(GetBrowseRow(BROW_FUNCTION_ROW), _nColumnId);
}
-void OSelectionBrowseBox::clearEntryFunctionField(const OUString& _sFieldName,OTableFieldDescRef const & _pEntry, bool& _bListAction,sal_uInt16 _nColumnId)
+void OSelectionBrowseBox::clearEntryFunctionField(std::u16string_view _sFieldName,OTableFieldDescRef const & _pEntry, bool& _bListAction,sal_uInt16 _nColumnId)
{
if ( !(isFieldNameAsterisk( _sFieldName ) && (!_pEntry->isNoneFunction() || _pEntry->IsGroupBy())) )
return;
@@ -1053,7 +1052,7 @@ bool OSelectionBrowseBox::SaveModified()
sal_Int32 nPos = rComboBox.get_active();
// these functions are only available in CORE
OUString sFunctionName = rComboBox.get_text(nPos);
- OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1);
+ std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1);
bool bGroupBy = false;
if ( sGroupFunctionName == sFunctionName ) // check if the function name is GROUP
{
@@ -1556,7 +1555,7 @@ OTableFieldDescRef OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxd
weld::TreeView& rTreeView = jxdSource.pListBox->get_widget();
OUString aFieldName = rTreeView.get_text(jxdSource.nEntry);
sal_uInt32 nFieldIndex = jxdSource.nEntry;
- OTableFieldInfo* pInf = reinterpret_cast<OTableFieldInfo*>(rTreeView.get_id(jxdSource.nEntry).toUInt64());
+ OTableFieldInfo* pInf = weld::fromId<OTableFieldInfo*>(rTreeView.get_id(jxdSource.nEntry));
// construct DragInfo, such that I use the other InsertField
OTableFieldDescRef aInfo = new OTableFieldDesc(pSourceWin->GetTableName(),aFieldName);
@@ -1952,7 +1951,7 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "dbaccess/ui/querycolmenu.ui"));
std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu("menu"));
- OString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "delete")
RemoveField(nColId);
else if (sIdent == "width")
@@ -1972,7 +1971,7 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
xContextMenu->set_active("alias", m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
xContextMenu->set_active("distinct", static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
- OString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "functions")
{
SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW));
@@ -2087,8 +2086,8 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const
{
sal_Int32 nErg(0);
// only the first 11 rows are interesting
- sal_Int32 const nSize = SAL_N_ELEMENTS(nVisibleRowMask);
- for(sal_Int32 i=0;i<nSize;i++)
+ std::size_t const nSize = std::size(nVisibleRowMask);
+ for(std::size_t i=0;i<nSize;i++)
{
if(!m_bVisibleRow[i])
nErg |= nVisibleRowMask[i];
@@ -2099,8 +2098,8 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const
void OSelectionBrowseBox::SetNoneVisibleRow(sal_Int32 nRows)
{
// only the first 11 rows are interesting
- sal_Int32 const nSize = SAL_N_ELEMENTS(nVisibleRowMask);
- for(sal_Int32 i=0;i< nSize;i++)
+ std::size_t const nSize = std::size(nVisibleRowMask);
+ for(std::size_t i=0;i< nSize;i++)
m_bVisibleRow[i] = !(nRows & nVisibleRowMask[i]);
}
@@ -2281,16 +2280,16 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con
break;
case BROW_FUNCTION_ROW:
{
- OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1);
+ std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1);
pEntry->SetFunction(strNewText);
// first reset this two member
sal_Int32 nFunctionType = pEntry->GetFunctionType();
nFunctionType &= ~FKT_AGGREGATE;
pEntry->SetFunctionType(nFunctionType);
- if ( pEntry->IsGroupBy() && !sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) )
+ if ( pEntry->IsGroupBy() && !o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) )
pEntry->SetGroupBy(false);
- if ( sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) )
+ if ( o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) )
pEntry->SetGroupBy(true);
else if ( !strNewText.isEmpty() )
{
@@ -2535,7 +2534,7 @@ void OSelectionBrowseBox::enableControl(const OTableFieldDescRef& _rEntry,Window
_pControl->EnableInput(bEnable);
}
-void OSelectionBrowseBox::setTextCellContext(const OTableFieldDescRef& _rEntry,const OUString& _sText,const OString& _sHelpId)
+void OSelectionBrowseBox::setTextCellContext(const OTableFieldDescRef& _rEntry,const OUString& _sText,const OUString& _sHelpId)
{
weld::Entry& rEntry = m_pTextCell->get_widget();
rEntry.set_text(_sText);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index 761870fb8180..d5e11c03e332 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -227,7 +227,7 @@ namespace dbaui
void appendUndoAction(const OUString& _rOldValue,std::u16string_view _rNewValue,sal_Int32 _nRow);
OTableFields& getFields() const;
static void enableControl(const OTableFieldDescRef& _rEntry,Window* _pControl);
- void setTextCellContext(const OTableFieldDescRef& _rEntry,const OUString& _sText,const OString& _sHelpId);
+ void setTextCellContext(const OTableFieldDescRef& _rEntry,const OUString& _sText,const OUString& _sHelpId);
void invalidateUndoRedo();
OTableFieldDescRef getEntry(OTableFields::size_type _nPos);
@@ -306,7 +306,7 @@ namespace dbaui
@param _bListAction
When <TRUE/> a list action will be created.
*/
- void clearEntryFunctionField(const OUString& _sFieldName,OTableFieldDescRef const & _pEntry, bool& _bListAction,sal_uInt16 _nColumnId);
+ void clearEntryFunctionField(std::u16string_view _sFieldName,OTableFieldDescRef const & _pEntry, bool& _bListAction,sal_uInt16 _nColumnId);
/** remove or insert the necessary function types
@param _pEntry
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index ada4b5990890..1e9d31f419c0 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -21,17 +21,16 @@
#include <ConnectionLine.hxx>
#include <TableConnectionData.hxx>
#include <JoinTableView.hxx>
+#include <utility>
using namespace dbaui;
-using namespace comphelper;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;
namespace dbaui
{
- OTableConnection::OTableConnection( OJoinTableView* _pContainer,const TTableConnectionData::value_type& _pTabConnData )
+ OTableConnection::OTableConnection( OJoinTableView* _pContainer, TTableConnectionData::value_type _aTabConnData )
:Window(_pContainer)
- ,m_pData( _pTabConnData )
+ ,m_pData(std::move( _aTabConnData ))
,m_pParent( _pContainer )
,m_bSelected( false )
{
diff --git a/dbaccess/source/ui/querydesign/TableConnectionData.cxx b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
index 107d8a9d1a48..aa524a5ac7f9 100644
--- a/dbaccess/source/ui/querydesign/TableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
@@ -18,6 +18,7 @@
*/
#include <TableConnectionData.hxx>
+#include <utility>
#include <osl/diagnose.h>
using namespace dbaui;
@@ -27,10 +28,10 @@ OTableConnectionData::OTableConnectionData()
Init();
}
-OTableConnectionData::OTableConnectionData(const TTableWindowData::value_type& _pReferencingTable
- ,const TTableWindowData::value_type& _pReferencedTable )
- :m_pReferencingTable(_pReferencingTable)
- ,m_pReferencedTable(_pReferencedTable)
+OTableConnectionData::OTableConnectionData(TTableWindowData::value_type _pReferencingTable
+ ,TTableWindowData::value_type _pReferencedTable )
+ :m_pReferencingTable(std::move(_pReferencingTable))
+ ,m_pReferencedTable(std::move(_pReferencedTable))
{
Init();
}
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index 1e8604181886..4d556f94f203 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -23,7 +23,6 @@
#include <com/sun/star/sdbc/DataType.hpp>
#include <comphelper/namedvaluecollection.hxx>
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace comphelper;
diff --git a/dbaccess/source/ui/querydesign/TableFieldInfo.cxx b/dbaccess/source/ui/querydesign/TableFieldInfo.cxx
index a0c8ff747e34..808862c11c4e 100644
--- a/dbaccess/source/ui/querydesign/TableFieldInfo.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldInfo.cxx
@@ -27,6 +27,4 @@ OTableFieldInfo::OTableFieldInfo()
{
}
-OTableFieldInfo::~OTableFieldInfo() {}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/TableFieldInfo.hxx b/dbaccess/source/ui/querydesign/TableFieldInfo.hxx
index 14e588845d39..e7d2c9b72da4 100644
--- a/dbaccess/source/ui/querydesign/TableFieldInfo.hxx
+++ b/dbaccess/source/ui/querydesign/TableFieldInfo.hxx
@@ -31,7 +31,6 @@ namespace dbaui
public:
OTableFieldInfo();
- ~OTableFieldInfo();
ETableFieldType GetKeyType() const { return m_eFieldType; }
void SetKey(ETableFieldType bKey) { m_eFieldType = bKey; }
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 8660a503f1a4..a1e4d34c1d56 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -25,6 +25,7 @@
#include <JoinTableView.hxx>
#include <JoinDesignView.hxx>
#include <osl/diagnose.h>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/commandevent.hxx>
@@ -32,7 +33,7 @@
#include <vcl/ptrstyle.hxx>
#include <vcl/wall.hxx>
#include <vcl/weldutils.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -43,15 +44,11 @@
#include <connectivity/dbtools.hxx>
using namespace dbaui;
-using namespace ::utl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::accessibility;
namespace DatabaseObject = css::sdb::application::DatabaseObject;
@@ -86,11 +83,11 @@ void Draw3DBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR
}
-OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData )
+OTableWindow::OTableWindow( vcl::Window* pParent, TTableWindowData::value_type pTabWinData )
: ::comphelper::OContainerListener(m_aMutex)
, Window( pParent, WB_3DLOOK|WB_MOVEABLE )
, m_xTitle( VclPtr<OTableWindowTitle>::Create(this) )
- , m_pData( pTabWinData )
+ , m_pData(std::move( pTabWinData ))
, m_nMoveCount(0)
, m_nMoveIncrement(1)
, m_nSizingFlags( SizingFlags::NONE )
@@ -192,7 +189,7 @@ void OTableWindow::FillListBox()
if (GetData()->IsShowAll())
{
- rTreeView.append(OUString::number(reinterpret_cast<sal_uInt64>(createUserData(nullptr,false))), OUString("*"));
+ rTreeView.append(weld::toId(createUserData(nullptr,false)), OUString("*"));
}
Reference<XNameAccess> xPKeyColumns;
@@ -220,7 +217,7 @@ void OTableWindow::FillListBox()
OUString sId;
Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
if (xColumn.is())
- sId = OUString::number(reinterpret_cast<sal_uInt64>(createUserData(xColumn, bPrimaryKeyColumn)));
+ sId = weld::toId(createUserData(xColumn, bPrimaryKeyColumn));
rTreeView.append(sId, *pIter);
@@ -255,7 +252,7 @@ void OTableWindow::clearListBox()
weld::TreeView& rTreeView = m_xListBox->get_widget();
rTreeView.all_foreach([this, &rTreeView](weld::TreeIter& rEntry){
- void* pUserData = reinterpret_cast<void*>(rTreeView.get_id(rEntry).toUInt64());
+ void* pUserData = weld::fromId<void*>(rTreeView.get_id(rEntry));
deleteUserData(pUserData);
return false;
});
@@ -563,7 +560,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
bool bHandled = false;
switch (rNEvt.GetType())
{
- case MouseNotifyEvent::KEYINPUT:
+ case NotifyEventType::KEYINPUT:
{
if ( getDesignView()->getController().isReadOnly() )
break;
@@ -673,7 +670,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
}
break;
}
- case MouseNotifyEvent::KEYUP:
+ case NotifyEventType::KEYUP:
{
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index 787d257b59e1..138850267c47 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -24,19 +24,17 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <comphelper/sequence.hxx>
#include <vcl/vclevent.hxx>
namespace dbaui
{
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
OTableWindowAccess::OTableWindowAccess(OTableWindow* _pTable)
- :VCLXAccessibleComponent(_pTable->GetComponentInterface().is() ? _pTable->GetWindowPeer() : nullptr)
+ :ImplInheritanceHelper(_pTable->GetComponentInterface().is() ? _pTable->GetWindowPeer() : nullptr)
,m_pTable(_pTable)
{
}
@@ -55,15 +53,6 @@ namespace dbaui
VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
}
- Any SAL_CALL OTableWindowAccess::queryInterface( const Type& aType )
- {
- Any aRet(VCLXAccessibleComponent::queryInterface( aType ));
- return aRet.hasValue() ? aRet : OTableWindowAccess_BASE::queryInterface( aType );
- }
- Sequence< Type > SAL_CALL OTableWindowAccess::getTypes( )
- {
- return ::comphelper::concatSequences(VCLXAccessibleComponent::getTypes(),OTableWindowAccess_BASE::getTypes());
- }
OUString SAL_CALL OTableWindowAccess::getImplementationName()
{
return "org.openoffice.comp.dbu.TableWindowAccessibility";
@@ -74,10 +63,10 @@ namespace dbaui
"com.sun.star.accessibility.AccessibleContext" };
}
// XAccessibleContext
- sal_Int32 SAL_CALL OTableWindowAccess::getAccessibleChildCount( )
+ sal_Int64 SAL_CALL OTableWindowAccess::getAccessibleChildCount( )
{
::osl::MutexGuard aGuard( m_aMutex );
- sal_Int32 nCount = 0;
+ sal_Int64 nCount = 0;
if(m_pTable)
{
++nCount;
@@ -86,7 +75,7 @@ namespace dbaui
}
return nCount;
}
- Reference< XAccessible > SAL_CALL OTableWindowAccess::getAccessibleChild( sal_Int32 i )
+ Reference< XAccessible > SAL_CALL OTableWindowAccess::getAccessibleChild( sal_Int64 i )
{
::osl::MutexGuard aGuard( m_aMutex );
Reference< XAccessible > aRet;
@@ -114,10 +103,10 @@ namespace dbaui
}
return aRet;
}
- sal_Int32 SAL_CALL OTableWindowAccess::getAccessibleIndexInParent( )
+ sal_Int64 SAL_CALL OTableWindowAccess::getAccessibleIndexInParent( )
{
::osl::MutexGuard aGuard( m_aMutex );
- sal_Int32 nIndex = -1;
+ sal_Int64 nIndex = -1;
if( m_pTable )
{
// search the position of our table window in the table window map
@@ -151,8 +140,8 @@ namespace dbaui
Reference< XAccessible > aRet;
if(m_pTable && !m_pTable->isDisposed())
{
- Point aPoint(_aPoint.X,_aPoint.Y);
- tools::Rectangle aRect(m_pTable->GetDesktopRectPixel());
+ AbsoluteScreenPixelPoint aPoint(_aPoint.X,_aPoint.Y);
+ AbsoluteScreenPixelRectangle aRect(m_pTable->GetDesktopRectPixel());
if( aRect.Contains(aPoint) )
aRet = this;
else if( m_pTable->GetListBox()->GetDesktopRectPixel().Contains(aPoint))
@@ -160,7 +149,7 @@ namespace dbaui
}
return aRet;
}
- Reference< XAccessible > OTableWindowAccess::getParentChild(sal_Int32 _nIndex)
+ Reference< XAccessible > OTableWindowAccess::getParentChild(sal_Int64 _nIndex)
{
Reference< XAccessible > xReturn;
Reference< XAccessible > xParent = getAccessibleParent();
@@ -212,19 +201,19 @@ namespace dbaui
auto aIter = pView->getTableConnections(m_pTable);
auto aEnd = rConnectionList.end();
- std::vector< Reference<XInterface> > aRelations;
+ std::vector< Reference<css::accessibility::XAccessible> > aRelations;
aRelations.reserve(5); // just guessing
// TODO JNA aIter comes from pView->getTableConnections(m_pTable)
// and aEnd comes from pView->getTableConnections().end()
for (; aIter != aEnd ; ++aIter )
{
- uno::Reference<uno::XInterface> xInterface(
+ uno::Reference<css::accessibility::XAccessible> xAccessible(
getParentChild(aIter - rConnectionList.begin()));
- aRelations.push_back(xInterface);
+ aRelations.push_back(xAccessible);
}
- Sequence< Reference<XInterface> > aSeq(aRelations.data(), aRelations.size());
- return AccessibleRelation(AccessibleRelationType::CONTROLLER_FOR,aSeq);
+ Sequence<Reference<css::accessibility::XAccessible>> aSeq(aRelations.data(), aRelations.size());
+ return AccessibleRelation(AccessibleRelationType::CONTROLLER_FOR, aSeq);
}
return AccessibleRelation();
}
diff --git a/dbaccess/source/ui/querydesign/TableWindowData.cxx b/dbaccess/source/ui/querydesign/TableWindowData.cxx
index d07c8214a17c..3cbead6e406c 100644
--- a/dbaccess/source/ui/querydesign/TableWindowData.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowData.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <utility>
using namespace dbaui;
using namespace ::com::sun::star::lang;
@@ -37,13 +38,13 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
OTableWindowData::OTableWindowData( const Reference< XPropertySet>& _xTable
- ,const OUString& _rComposedName
- ,const OUString& rTableName
- ,const OUString& rWinName )
+ ,OUString _sComposedName
+ ,OUString sTableName
+ ,OUString sWinName )
:m_xTable(_xTable)
- ,m_aTableName( rTableName )
- ,m_aWinName( rWinName )
- ,m_sComposedName(_rComposedName)
+ ,m_aTableName(std::move( sTableName ))
+ ,m_aWinName(std::move( sWinName ))
+ ,m_sComposedName(std::move(_sComposedName))
,m_aPosition( Point(-1,-1) )
,m_aSize( Size(-1,-1) )
,m_bShowAll( true )
diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
index a1a8a17c4735..3066f8429f35 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include <vcl/svapp.hxx>
#include <vcl/commandevent.hxx>
+#include <o3tl/string_view.hxx>
using namespace dbaui;
using namespace ::com::sun::star::sdbc;
@@ -92,7 +93,7 @@ void OTableWindowListBox::dispose()
InterimItemWindow::dispose();
}
-int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText)
+int OTableWindowListBox::GetEntryFromText(std::u16string_view rEntryText)
{
// iterate through the list
OJoinDesignView* pView = m_pTabWin->getDesignView();
@@ -111,7 +112,7 @@ int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText)
for (int nEntry = 0, nCount = m_xTreeView->n_children(); nEntry < nCount; ++nEntry)
{
if (bCase ? rEntryText == m_xTreeView->get_text(nEntry)
- : rEntryText.equalsIgnoreAsciiCase(m_xTreeView->get_text(nEntry)))
+ : o3tl::equalsIgnoreAsciiCase(rEntryText, m_xTreeView->get_text(nEntry)))
return nEntry;
}
}
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 50eb19c28b47..0b0ebaa4c7e1 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -26,8 +26,6 @@
#include <JoinController.hxx>
using namespace dbaui;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::uno;
OTableWindowTitle::OTableWindowTitle(OTableWindow* pParent)
: InterimItemWindow(pParent, "dbaccess/ui/tabletitle.ui", "TableTitle")
, m_pTabWin( pParent )
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index 8b6884338063..37624aceb419 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -174,7 +174,7 @@ IMPL_LINK_NOARG(LimitBox, ActivateHdl, weld::ComboBox&, bool)
LimitBoxController::LimitBoxController(
const uno::Reference< uno::XComponentContext >& rxContext ) :
- svt::ToolboxController( rxContext,
+ LimitBoxController_Base( rxContext,
uno::Reference< frame::XFrame >(),
".uno:DBLimit" ),
m_xLimitBox( nullptr )
@@ -185,27 +185,6 @@ LimitBoxController::~LimitBoxController()
{
}
-/// XInterface
-uno::Any SAL_CALL LimitBoxController::queryInterface( const uno::Type& aType )
-{
- uno::Any a = ToolboxController::queryInterface( aType );
- if ( a.hasValue() )
- return a;
-
- return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this ));
-}
-
-void SAL_CALL LimitBoxController::acquire() noexcept
-{
- ToolboxController::acquire();
-}
-
-void SAL_CALL LimitBoxController::release() noexcept
-{
- ToolboxController::release();
-}
-
-
/// XServiceInfo
OUString SAL_CALL LimitBoxController::getImplementationName()
{
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
index af1e5a666882..142280937235 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
@@ -24,19 +24,14 @@ class LimitBox;
* It is communicating with querycontroller and this channel make enable
* to set\get the value of limitbox when switching between views
*/
-class LimitBoxController: public svt::ToolboxController,
- public css::lang::XServiceInfo
+typedef cppu::ImplInheritanceHelper< ::svt::ToolboxController, css::lang::XServiceInfo> LimitBoxController_Base;
+class LimitBoxController: public LimitBoxController_Base
{
public:
explicit LimitBoxController(
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
virtual ~LimitBoxController() override;
- /// XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
- virtual void SAL_CALL acquire() noexcept override;
- virtual void SAL_CALL release() noexcept override;
-
/// XServiceInfo
DECLARE_SERVICE_INFO();
diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
index 68b4c5c86865..29c69856b41b 100644
--- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
+++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
@@ -35,7 +35,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
@@ -157,7 +156,7 @@ namespace dbaui
}
bool OQueryContainerWindow::PreNotify( NotifyEvent& rNEvt )
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS && m_pViewSwitch)
+ if (rNEvt.GetType() == NotifyEventType::GETFOCUS && m_pViewSwitch)
{
OJoinController& rController = m_pViewSwitch->getDesignView()->getController();
rController.InvalidateFeature(SID_CUT);
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 360cd2821235..d963ca3c293d 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -62,12 +62,14 @@
#include <cppuhelper/exc_hlp.hxx>
#include <svl/undo.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
+#include <utility>
#include <vcl/stdtext.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <osl/mutex.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <vector>
@@ -128,13 +130,11 @@ namespace dbaui
}
}
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::ui;
-using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::awt;
using namespace ::dbtools;
@@ -149,8 +149,8 @@ namespace
return;
xLayoutManager->lock();
- static constexpr OUStringLiteral s_sDesignToolbar = u"private:resource/toolbar/designobjectbar";
- static constexpr OUStringLiteral s_sSqlToolbar = u"private:resource/toolbar/sqlobjectbar";
+ static constexpr OUString s_sDesignToolbar = u"private:resource/toolbar/designobjectbar"_ustr;
+ static constexpr OUString s_sSqlToolbar = u"private:resource/toolbar/sqlobjectbar"_ustr;
if ( _bDesign )
{
xLayoutManager->destroyElement( s_sSqlToolbar );
@@ -478,6 +478,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
std::unique_ptr<::connectivity::OSQLParseNode> pNode = m_aSqlParser.parseTree(aErrorMsg,m_sStatement,m_bGraphicalDesign);
if ( pNode )
{
+ assert(m_pSqlIterator && "SqlIterator must exist");
delete m_pSqlIterator->getParseTree();
m_pSqlIterator->setParseTree(pNode.release());
m_pSqlIterator->traverseAll();
@@ -611,11 +612,9 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
void OQueryController::impl_showAutoSQLViewError( const css::uno::Any& _rErrorDetails )
{
- SQLContext aErrorContext;
- aErrorContext.Message = lcl_getObjectResourceString( STR_ERROR_PARSING_STATEMENT, m_nCommandType );
- aErrorContext.Context = *this;
- aErrorContext.Details = lcl_getObjectResourceString( STR_INFO_OPENING_IN_SQL_VIEW, m_nCommandType );
- aErrorContext.NextException = _rErrorDetails;
+ SQLContext aErrorContext(
+ lcl_getObjectResourceString(STR_ERROR_PARSING_STATEMENT, m_nCommandType), *this, {}, 0,
+ _rErrorDetails, lcl_getObjectResourceString(STR_INFO_OPENING_IN_SQL_VIEW, m_nCommandType));
showError( aErrorContext );
}
@@ -647,11 +646,9 @@ void OQueryController::impl_setViewMode( ::dbtools::SQLExceptionInfo* _pErrorInf
setModified( wasModified );
}
-void OQueryController::impl_initialize()
+void OQueryController::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
- OJoinController::impl_initialize();
-
- const NamedValueCollection& rArguments( getInitParams() );
+ OJoinController::impl_initialize(rArguments);
OUString sCommand;
m_nCommandType = CommandType::QUERY;
@@ -874,7 +871,7 @@ OUString OQueryController::getPrivateTitle( ) const
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
OUString aDefaultName = DBA_RES(editingView() ? STR_VIEW_TITLE : STR_QRY_TITLE);
- return aDefaultName.getToken(0, ' ') + OUString::number(getCurrentStartNumber());
+ return o3tl::getToken(aDefaultName, 0, ' ') + OUString::number(getCurrentStartNumber());
}
}
return m_sName;
@@ -1114,15 +1111,15 @@ void OQueryController::executeQuery()
{
auto aProps(::comphelper::InitPropertySequence(
{
- { PROPERTY_DATASOURCENAME, makeAny(sDataSourceName) },
- { PROPERTY_COMMAND_TYPE, makeAny(CommandType::COMMAND) },
- { PROPERTY_COMMAND, makeAny(sTranslatedStmt) },
- { PROPERTY_ENABLE_BROWSER, makeAny(false) },
- { PROPERTY_ACTIVE_CONNECTION, makeAny(getConnection()) },
- { PROPERTY_UPDATE_CATALOGNAME, makeAny(m_sUpdateCatalogName) },
- { PROPERTY_UPDATE_SCHEMANAME, makeAny(m_sUpdateSchemaName) },
- { PROPERTY_UPDATE_TABLENAME, makeAny(OUString()) },
- { PROPERTY_ESCAPE_PROCESSING, makeAny(m_bEscapeProcessing) }
+ { PROPERTY_DATASOURCENAME, Any(sDataSourceName) },
+ { PROPERTY_COMMAND_TYPE, Any(CommandType::COMMAND) },
+ { PROPERTY_COMMAND, Any(sTranslatedStmt) },
+ { PROPERTY_ENABLE_BROWSER, Any(false) },
+ { PROPERTY_ACTIVE_CONNECTION, Any(getConnection()) },
+ { PROPERTY_UPDATE_CATALOGNAME, Any(m_sUpdateCatalogName) },
+ { PROPERTY_UPDATE_SCHEMANAME, Any(m_sUpdateSchemaName) },
+ { PROPERTY_UPDATE_TABLENAME, Any(OUString()) },
+ { PROPERTY_ESCAPE_PROCESSING, Any(m_bEscapeProcessing) }
}));
xDisp->dispatch(aWantToDispatch, aProps);
@@ -1262,7 +1259,7 @@ bool OQueryController::doSaveAsDoc(bool _bSaveAs)
{
xQuery = xFact->createDataDescriptor();
// to set the name is only allowed when the query is new
- xQuery->setPropertyValue( PROPERTY_NAME, makeAny( m_sName ) );
+ xQuery->setPropertyValue( PROPERTY_NAME, Any( m_sName ) );
}
else
{
@@ -1287,18 +1284,18 @@ bool OQueryController::doSaveAsDoc(bool _bSaveAs)
}
else
{ // we're creating a query, or a *new* view
- xQuery->setPropertyValue( PROPERTY_COMMAND, makeAny( sTranslatedStmt ) );
+ xQuery->setPropertyValue( PROPERTY_COMMAND, Any( sTranslatedStmt ) );
if ( editingView() )
{
- xQuery->setPropertyValue( PROPERTY_CATALOGNAME, makeAny( m_sUpdateCatalogName ) );
- xQuery->setPropertyValue( PROPERTY_SCHEMANAME, makeAny( m_sUpdateSchemaName ) );
+ xQuery->setPropertyValue( PROPERTY_CATALOGNAME, Any( m_sUpdateCatalogName ) );
+ xQuery->setPropertyValue( PROPERTY_SCHEMANAME, Any( m_sUpdateSchemaName ) );
}
if ( editingQuery() )
{
- xQuery->setPropertyValue( PROPERTY_UPDATE_TABLENAME, makeAny( OUString() ) );
- xQuery->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, css::uno::makeAny( m_bEscapeProcessing ) );
+ xQuery->setPropertyValue( PROPERTY_UPDATE_TABLENAME, Any( OUString() ) );
+ xQuery->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, css::uno::Any( m_bEscapeProcessing ) );
xQuery->setPropertyValue( PROPERTY_LAYOUTINFORMATION, getViewData() );
}
@@ -1315,7 +1312,7 @@ bool OQueryController::doSaveAsDoc(bool _bSaveAs)
{
Reference< XNameContainer > xCont( xElements, UNO_QUERY );
if ( xCont.is() )
- xCont->insertByName( m_sName, makeAny( xQuery ) );
+ xCont->insertByName( m_sName, Any( xQuery ) );
}
if ( editingView() )
@@ -1380,8 +1377,8 @@ struct CommentStrip
{
OUString maComment;
bool mbLastOnLine;
- CommentStrip( const OUString& rComment, bool bLastOnLine )
- : maComment( rComment), mbLastOnLine( bLastOnLine) {}
+ CommentStrip( OUString sComment, bool bLastOnLine )
+ : maComment(std::move( sComment)), mbLastOnLine( bLastOnLine) {}
};
}
@@ -1680,7 +1677,7 @@ void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings
{
if ( !i_bForceCurrentControllerSettings && m_bGraphicalDesign && !editingView() )
{
- impl_showAutoSQLViewError( makeAny( m_pSqlIterator->getErrors() ) );
+ impl_showAutoSQLViewError( Any( m_pSqlIterator->getErrors() ) );
}
bError = true;
}
@@ -1723,9 +1720,9 @@ void OQueryController::reset()
void OQueryController::setStatement_fireEvent( const OUString& _rNewStatement, bool _bFireStatementChange )
{
- Any aOldValue = makeAny( m_sStatement );
+ Any aOldValue( m_sStatement );
m_sStatement = _rNewStatement;
- Any aNewValue = makeAny( m_sStatement );
+ Any aNewValue( m_sStatement );
sal_Int32 nHandle = PROPERTY_ID_ACTIVECOMMAND;
if ( _bFireStatementChange )
@@ -1737,9 +1734,9 @@ void OQueryController::setEscapeProcessing_fireEvent( const bool _bEscapeProcess
if ( _bEscapeProcessing == m_bEscapeProcessing )
return;
- Any aOldValue = makeAny( m_bEscapeProcessing );
+ Any aOldValue( m_bEscapeProcessing );
m_bEscapeProcessing = _bEscapeProcessing;
- Any aNewValue = makeAny( m_bEscapeProcessing );
+ Any aNewValue( m_bEscapeProcessing );
sal_Int32 nHandle = PROPERTY_ID_ESCAPE_PROCESSING;
fire( &nHandle, &aNewValue, &aOldValue, 1, false );
@@ -1761,9 +1758,7 @@ bool OQueryController::allowQueries() const
if ( !getSdbMetaData().supportsSubqueriesInFrom() )
return false;
- const NamedValueCollection& rArguments( getInitParams() );
- sal_Int32 nCommandType = rArguments.getOrDefault( PROPERTY_COMMAND_TYPE, sal_Int32(CommandType::QUERY) );
- bool bCreatingView = ( nCommandType == CommandType::TABLE );
+ bool bCreatingView = ( m_nCommandType == CommandType::TABLE );
return !bCreatingView;
}
@@ -1776,7 +1771,7 @@ Any SAL_CALL OQueryController::getViewData()
::comphelper::NamedValueCollection aViewSettings;
saveViewSettings( aViewSettings, false );
- return makeAny( aViewSettings.getPropertyValues() );
+ return Any( aViewSettings.getPropertyValues() );
}
void SAL_CALL OQueryController::restoreViewData(const Any& /*Data*/)
diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx
index 5a21998d9946..a54b78e24353 100644
--- a/dbaccess/source/ui/querydesign/querydlg.cxx
+++ b/dbaccess/source/ui/querydesign/querydlg.cxx
@@ -21,7 +21,7 @@
#include <JoinController.hxx>
#include <JoinDesignView.hxx>
#include <strings.hrc>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "QTableConnectionData.hxx"
#include <core_resource.hxx>
#include <QueryTableView.hxx>
@@ -167,13 +167,9 @@ IMPL_LINK_NOARG( DlgQryJoin, LBChangeHdl, weld::ComboBox&, void )
eJoinType = LEFT_JOIN;
break;
case ID_RIGHT_JOIN:
- {
- pResId = STR_QUERY_LEFTRIGHT_JOIN;
- eJoinType = RIGHT_JOIN;
- OUString sTemp = sFirstWinName;
- sFirstWinName = sSecondWinName;
- sSecondWinName = sTemp;
- }
+ pResId = STR_QUERY_LEFTRIGHT_JOIN;
+ eJoinType = RIGHT_JOIN;
+ std::swap( sFirstWinName, sSecondWinName );
break;
case ID_FULL_JOIN:
pResId = STR_QUERY_FULL_JOIN;
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index c1c408ee8f1a..46b3671c40e2 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -38,7 +38,6 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
ORelationTableConnectionData::ORelationTableConnectionData()
:m_nUpdateRules(KeyRule::NO_ACTION)
@@ -112,9 +111,7 @@ void ORelationTableConnectionData::ChangeOrientation()
}
// adapt member
- TTableWindowData::value_type pTemp = m_pReferencingTable;
- m_pReferencingTable = m_pReferencedTable;
- m_pReferencedTable = pTemp;
+ std::swap( m_pReferencingTable, m_pReferencedTable );
}
void ORelationTableConnectionData::SetCardinality()
@@ -256,11 +253,11 @@ bool ORelationTableConnectionData::Update()
xTableProp->getPropertyValue(PROPERTY_NAME) >>= sSourceName;
OUString sKeyName = sSourceName + getReferencedTable()->GetTableName();
- xKey->setPropertyValue(PROPERTY_NAME,makeAny(sKeyName));
- xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::FOREIGN));
- xKey->setPropertyValue(PROPERTY_REFERENCEDTABLE,makeAny(getReferencedTable()->GetTableName()));
- xKey->setPropertyValue(PROPERTY_UPDATERULE, makeAny(GetUpdateRules()));
- xKey->setPropertyValue(PROPERTY_DELETERULE, makeAny(GetDeleteRules()));
+ xKey->setPropertyValue(PROPERTY_NAME,Any(sKeyName));
+ xKey->setPropertyValue(PROPERTY_TYPE,Any(KeyType::FOREIGN));
+ xKey->setPropertyValue(PROPERTY_REFERENCEDTABLE,Any(getReferencedTable()->GetTableName()));
+ xKey->setPropertyValue(PROPERTY_UPDATERULE, Any(GetUpdateRules()));
+ xKey->setPropertyValue(PROPERTY_DELETERULE, Any(GetDeleteRules()));
}
Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
@@ -278,8 +275,8 @@ bool ORelationTableConnectionData::Update()
Reference<XPropertySet> xColumn = xColumnFactory->createDataDescriptor();
if ( xColumn.is() )
{
- xColumn->setPropertyValue(PROPERTY_NAME,makeAny(elem->GetSourceFieldName()));
- xColumn->setPropertyValue(PROPERTY_RELATEDCOLUMN,makeAny(elem->GetDestFieldName()));
+ xColumn->setPropertyValue(PROPERTY_NAME,Any(elem->GetSourceFieldName()));
+ xColumn->setPropertyValue(PROPERTY_RELATEDCOLUMN,Any(elem->GetDestFieldName()));
xColumnAppend->appendByDescriptor(xColumn);
}
}
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 0750a77a01df..ebeca9a64b24 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -44,7 +44,7 @@
#include <RTableConnectionData.hxx>
#include <RelationTableView.hxx>
#include <RelationDesignView.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/thread.hxx>
#include <osl/mutex.hxx>
@@ -58,16 +58,13 @@ org_openoffice_comp_dbu_ORelationDesign_get_implementation(
}
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::ui::dialogs;
-using namespace ::com::sun::star::util;
using namespace ::dbtools;
using namespace ::dbaui;
using namespace ::comphelper;
@@ -138,7 +135,7 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue
{
::comphelper::NamedValueCollection aWindowsData;
saveTableWindows( aWindowsData );
- getDataSource()->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aWindowsData.getPropertyValues() ) );
+ getDataSource()->setPropertyValue( PROPERTY_LAYOUTINFORMATION, Any( aWindowsData.getPropertyValues() ) );
setModified(false);
}
}
@@ -159,9 +156,9 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue
InvalidateFeature(_nId);
}
-void ORelationController::impl_initialize()
+void ORelationController::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
- OJoinController::impl_initialize();
+ OJoinController::impl_initialize(rArguments);
if( !getSdbMetaData().supportsRelations() )
{// check if this database supports relations
diff --git a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
index 014579cf7c7f..161702f08196 100644
--- a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
@@ -24,10 +24,6 @@
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
ORelationDesignView::ORelationDesignView(vcl::Window* _pParent, ORelationController& _rController,const Reference< XComponentContext >& _rxContext)
:OJoinDesignView( _pParent, _rController, _rxContext )
@@ -51,7 +47,7 @@ void ORelationDesignView::initialize()
bool ORelationDesignView::PreNotify( NotifyEvent& rNEvt )
{
bool bDone = false;
- if(rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ if(rNEvt.GetType() == NotifyEventType::GETFOCUS)
{
if(m_pTableView && !m_pTableView->HasChildPathFocus())
{
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index d18f1cfa8037..87a769ce83b3 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <helpids.h>
#include <RelationDesignView.hxx>
#include <JoinController.hxx>
@@ -51,7 +51,6 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::accessibility;
@@ -110,7 +109,7 @@ void ORelationTableView::ReSync()
pTabWin.disposeAndClear();
arrInvalidTables.push_back(pData->GetTableName());
- rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
+ std::erase(rTabWinDataList, *aIter);
continue;
}
@@ -140,7 +139,7 @@ void ORelationTableView::ReSync()
if (bInvalid)
{
// no -> bad luck, the connection is gone
- rTabConnDataList.erase( std::remove(rTabConnDataList.begin(), rTabConnDataList.end(), *aConIter), rTabConnDataList.end() );
+ std::erase(rTabConnDataList, *aConIter);
continue;
}
}
@@ -309,7 +308,7 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
Any(),
- makeAny(pNewTabWin->GetAccessible()));
+ Any(pNewTabWin->GetAccessible()));
}
else
{
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index dc81cfa0ecad..4a4a499380a9 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -18,7 +18,7 @@
*/
#include <FieldDescriptions.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <strings.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <comphelper/types.hxx>
@@ -187,7 +187,10 @@ void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,bool _bForce
SetPrecision(std::min<sal_Int32>(nPrec,_pType->nPrecision));
}
break;
+ case DataType::TIME:
+ case DataType::TIME_WITH_TIMEZONE:
case DataType::TIMESTAMP:
+ case DataType::TIMESTAMP_WITH_TIMEZONE:
if ( bForce && _pType->nMaximumScale)
{
SetScale(std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
@@ -235,7 +238,7 @@ void OFieldDescription::SetName(const OUString& _rName)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_NAME) )
- m_xDest->setPropertyValue(PROPERTY_NAME,makeAny(_rName));
+ m_xDest->setPropertyValue(PROPERTY_NAME,Any(_rName));
else
m_sName = _rName;
}
@@ -250,7 +253,7 @@ void OFieldDescription::SetHelpText(const OUString& _sHelpText)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- m_xDest->setPropertyValue(PROPERTY_HELPTEXT,makeAny(_sHelpText));
+ m_xDest->setPropertyValue(PROPERTY_HELPTEXT,Any(_sHelpText));
else
m_sHelpText = _sHelpText;
}
@@ -265,7 +268,7 @@ void OFieldDescription::SetDescription(const OUString& _rDescription)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DESCRIPTION) )
- m_xDest->setPropertyValue(PROPERTY_DESCRIPTION,makeAny(_rDescription));
+ m_xDest->setPropertyValue(PROPERTY_DESCRIPTION,Any(_rDescription));
else
m_sDescription = _rDescription;
}
@@ -308,7 +311,7 @@ void OFieldDescription::SetAutoIncrementValue(const OUString& _sAutoIncValue)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
- m_xDest->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,makeAny(_sAutoIncValue));
+ m_xDest->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,Any(_sAutoIncValue));
else
m_sAutoIncrementValue = _sAutoIncValue;
}
@@ -327,7 +330,7 @@ void OFieldDescription::SetType(const TOTypeInfoSP& _pType)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
- m_xDest->setPropertyValue(PROPERTY_TYPE,makeAny(m_pType->nType));
+ m_xDest->setPropertyValue(PROPERTY_TYPE,Any(m_pType->nType));
else
m_nType = m_pType->nType;
}
@@ -342,7 +345,7 @@ void OFieldDescription::SetTypeValue(sal_Int32 _nType)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
- m_xDest->setPropertyValue(PROPERTY_TYPE,makeAny(_nType));
+ m_xDest->setPropertyValue(PROPERTY_TYPE,Any(_nType));
else
{
m_nType = _nType;
@@ -360,7 +363,7 @@ void OFieldDescription::SetPrecision(sal_Int32 _rPrecision)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_PRECISION) )
- m_xDest->setPropertyValue(PROPERTY_PRECISION,makeAny(_rPrecision));
+ m_xDest->setPropertyValue(PROPERTY_PRECISION,Any(_rPrecision));
else
m_nPrecision = _rPrecision;
}
@@ -375,7 +378,7 @@ void OFieldDescription::SetScale(sal_Int32 _rScale)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_SCALE) )
- m_xDest->setPropertyValue(PROPERTY_SCALE,makeAny(_rScale));
+ m_xDest->setPropertyValue(PROPERTY_SCALE,Any(_rScale));
else
m_nScale = _rScale;
}
@@ -390,7 +393,7 @@ void OFieldDescription::SetIsNullable(sal_Int32 _rIsNullable)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
- m_xDest->setPropertyValue(PROPERTY_ISNULLABLE,makeAny(_rIsNullable));
+ m_xDest->setPropertyValue(PROPERTY_ISNULLABLE,Any(_rIsNullable));
else
m_nIsNullable = _rIsNullable;
}
@@ -405,7 +408,7 @@ void OFieldDescription::SetFormatKey(sal_Int32 _rFormatKey)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
- m_xDest->setPropertyValue(PROPERTY_FORMATKEY,makeAny(_rFormatKey));
+ m_xDest->setPropertyValue(PROPERTY_FORMATKEY,Any(_rFormatKey));
else
m_nFormatKey = _rFormatKey;
}
@@ -420,7 +423,7 @@ void OFieldDescription::SetHorJustify(const SvxCellHorJustify& _rHorJustify)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ALIGN) )
- m_xDest->setPropertyValue(PROPERTY_ALIGN,makeAny( dbaui::mapTextAlign(_rHorJustify)));
+ m_xDest->setPropertyValue(PROPERTY_ALIGN,Any( dbaui::mapTextAlign(_rHorJustify)));
else
m_eHorJustify = _rHorJustify;
}
@@ -435,7 +438,7 @@ void OFieldDescription::SetAutoIncrement(bool _bAuto)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) )
- m_xDest->setPropertyValue(PROPERTY_ISAUTOINCREMENT,makeAny(_bAuto));
+ m_xDest->setPropertyValue(PROPERTY_ISAUTOINCREMENT,Any(_bAuto));
else
m_bIsAutoIncrement = _bAuto;
}
@@ -602,7 +605,7 @@ void OFieldDescription::SetTypeName(const OUString& _sTypeName)
try
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPENAME) )
- m_xDest->setPropertyValue(PROPERTY_TYPENAME,makeAny(_sTypeName));
+ m_xDest->setPropertyValue(PROPERTY_TYPENAME,Any(_sTypeName));
else
m_sTypeName = _sTypeName;
}
@@ -620,11 +623,11 @@ void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _r
Reference<XPropertySetInfo> xInfo = _rxColumn->getPropertySetInfo();
if ( GetFormatKey() != NumberFormat::ALL && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
- _rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(GetFormatKey()));
+ _rxColumn->setPropertyValue(PROPERTY_FORMATKEY,Any(GetFormatKey()));
if ( GetHorJustify() != SvxCellHorJustify::Standard && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
- _rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAlign(GetHorJustify())));
+ _rxColumn->setPropertyValue(PROPERTY_ALIGN,Any(dbaui::mapTextAlign(GetHorJustify())));
if ( !GetHelpText().isEmpty() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetHelpText()));
+ _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,Any(GetHelpText()));
if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
_rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
@@ -633,7 +636,7 @@ void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _r
if(xInfo->hasPropertyByName(PROPERTY_WIDTH))
_rxColumn->setPropertyValue(PROPERTY_WIDTH,m_aWidth);
if(xInfo->hasPropertyByName(PROPERTY_HIDDEN))
- _rxColumn->setPropertyValue(PROPERTY_HIDDEN,makeAny(m_bHidden));
+ _rxColumn->setPropertyValue(PROPERTY_HIDDEN,Any(m_bHidden));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 728b21cf55d6..b9328604b277 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -36,6 +36,7 @@
#include <connectivity/dbtools.hxx>
#include <SqlNameEdit.hxx>
#include <TableRowExchange.hxx>
+#include <o3tl/safeint.hxx>
#include <sot/storage.hxx>
#include <svx/svxids.hrc>
#include <UITools.hxx>
@@ -48,14 +49,10 @@ using namespace ::dbaui;
using namespace ::comphelper;
using namespace ::svt;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdb;
#define HANDLE_ID 0
@@ -477,7 +474,7 @@ void OTableEditorCtrl::CursorMoved()
OTableRowView::CursorMoved();
}
-sal_Int32 OTableEditorCtrl::HasFieldName( const OUString& rFieldName )
+sal_Int32 OTableEditorCtrl::HasFieldName( std::u16string_view rFieldName )
{
Reference<XConnection> xCon = GetView()->getController().getConnection();
@@ -773,9 +770,8 @@ void OTableEditorCtrl::InsertRows( sal_Int32 nRow )
TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
if(aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED))
{
- ::tools::SvRef<SotTempStream> aStreamRef;
- bool bOk = aTransferData.GetSotStorageStream(SotClipboardFormatId::SBA_TABED,aStreamRef);
- if (bOk && aStreamRef.is())
+ std::unique_ptr<SvStream> aStreamRef = aTransferData.GetSotStorageStream(SotClipboardFormatId::SBA_TABED);
+ if (aStreamRef)
{
aStreamRef->Seek(STREAM_SEEK_TO_BEGIN);
aStreamRef->ResetError();
@@ -970,7 +966,7 @@ void OTableEditorCtrl::SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const css
case FIELD_PROPERTY_BOOL_DEFAULT:
sValue = GetView()->GetDescWin()->BoolStringPersistent(::comphelper::getString(_rNewData));
- pFieldDescr->SetControlDefault(makeAny(sValue));
+ pFieldDescr->SetControlDefault(Any(sValue));
break;
case FIELD_PROPERTY_FORMAT:
@@ -1050,7 +1046,7 @@ Any OTableEditorCtrl::GetCellData( sal_Int32 nRow, sal_uInt16 nColId )
break;
}
- return makeAny(sValue);
+ return Any(sValue);
}
OUString OTableEditorCtrl::GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const
@@ -1411,11 +1407,25 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
xContextMenu->remove("paste");
if (!IsDeleteAllowed())
xContextMenu->remove("delete");
- if (!IsPrimaryKeyAllowed())
- xContextMenu->remove("primarykey");
- if (!IsInsertNewAllowed(nRow))
+ // tdf#71224: WORKAROUND for the moment, we don't implement insert field at specific position
+ // It's not SQL standard and each database has made its choice (some use "BEFORE", other "FIRST" and "AFTER")
+ // and some, like Postgresql, don't allow this.
+ // So for the moment, test if the table already exists (and so it's an edition), in this case only
+ // we remove "Insert Fields" entry. Indeed, in case of new table, there's no pb.
+ //
+ // The real fix is to implement the insert for each database + error message for those which don't support this
+ //if (!IsInsertNewAllowed(nRow))
+ if ( GetView()->getController().getTable().is() )
xContextMenu->remove("insert");
- xContextMenu->set_active("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey());
+
+ if (IsPrimaryKeyAllowed())
+ {
+ xContextMenu->set_active("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey());
+ }
+ else
+ {
+ xContextMenu->remove("primarykey");
+ }
if( SetDataPtr(m_nDataPos) )
pDescrWin->SaveData( pActRow->GetActFieldDescr() );
@@ -1423,7 +1433,7 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
// All actions which change the number of rows must be run asynchronously
// otherwise there may be problems between the Context menu and the Browser
m_nDataPos = GetCurRow();
- OString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "cut")
cut();
else if (sIdent == "copy")
@@ -1602,7 +1612,7 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
// Store the old description
pDescrWin->SaveData( pActFieldDescr );
- if ( nRow < 0 || nRow > static_cast<tools::Long>(m_pRowList->size()) )
+ if ( nRow < 0 || o3tl::make_unsigned(nRow) > m_pRowList->size() )
return;
// Show the new description
std::shared_ptr<OTableRow> pRow = (*m_pRowList)[nRow];
@@ -1660,7 +1670,7 @@ void OTableEditorCtrl::DeactivateCell(bool bUpdate)
bool OTableEditorCtrl::PreNotify( NotifyEvent& rNEvt )
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
{
if( pHelpTextCell && pHelpTextCell->HasChildPathFocus() )
m_eChildFocus = HELPTEXT;
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index 74e3594cf0b2..7b1d467815db 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -176,7 +176,7 @@ namespace dbaui
DECL_LINK( InvalidateFieldType, void*, void );
void InitCellController();
- sal_Int32 HasFieldName( const OUString& rFieldName );
+ sal_Int32 HasFieldName( std::u16string_view rFieldName );
OUString GenerateName( const OUString& rName );
bool SetDataPtr( sal_Int32 nRow );
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 17ad5ed2f28d..924d9010b362 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -50,9 +50,10 @@
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
+#include <o3tl/string_view.hxx>
#include <algorithm>
#include <functional>
@@ -67,7 +68,6 @@ org_openoffice_comp_dbu_OTableDesign_get_implementation(
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
@@ -75,7 +75,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::ui;
using namespace ::com::sun::star::util;
using namespace ::dbtools;
using namespace ::dbaui;
@@ -314,9 +313,9 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
xTable = xFact->createDataDescriptor();
OSL_ENSURE(xTable.is(),"OTableController::doSaveDoc: Create query failed!");
// to set the name is only allowed when the query is new
- xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xTable->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xTable->setPropertyValue(PROPERTY_NAME,makeAny(m_sName));
+ xTable->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xTable->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xTable->setPropertyValue(PROPERTY_NAME,Any(m_sName));
// now append the columns
Reference<XColumnsSupplier> xColSup(xTable,UNO_QUERY);
@@ -454,13 +453,11 @@ void OTableController::doEditIndexes()
}
-void OTableController::impl_initialize()
+void OTableController::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
try
{
- OTableController_BASE::impl_initialize();
-
- const NamedValueCollection& rArguments( getInitParams() );
+ OTableController_BASE::impl_initialize(rArguments);
rArguments.get_ensureType( PROPERTY_CURRENTTABLE, m_sName );
@@ -662,7 +659,7 @@ void OTableController::appendColumns(Reference<XColumnsSupplier> const & _rxColS
if(!_bKeyColumns)
::dbaui::setColumnProperties(xColumn,pField);
else
- xColumn->setPropertyValue(PROPERTY_NAME,makeAny(pField->GetName()));
+ xColumn->setPropertyValue(PROPERTY_NAME,Any(pField->GetName()));
xAppend->appendByDescriptor(xColumn);
xColumn = nullptr;
@@ -721,7 +718,7 @@ void OTableController::appendPrimaryKey(Reference<XKeysSupplier> const & _rxSup,
Reference<XPropertySet> xKey = xKeyFactory->createDataDescriptor();
OSL_ENSURE(xKey.is(),"Key is null!");
- xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::PRIMARY));
+ xKey->setPropertyValue(PROPERTY_TYPE,Any(KeyType::PRIMARY));
Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
if(xColSup.is())
@@ -902,15 +899,15 @@ bool OTableController::checkColumns(bool _bNew)
{
case RET_YES:
{
- auto pNewRow = std::make_shared<OTableRow>();
TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
if ( !pTypeInfo )
break;
+ auto pNewRow = std::make_shared<OTableRow>();
pNewRow->SetFieldType( pTypeInfo );
OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
- pActFieldDescr->SetAutoIncrement(false);
+ pActFieldDescr->SetAutoIncrement(pTypeInfo->bAutoIncrement);
pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
pActFieldDescr->SetName( createUniqueName("ID" ));
@@ -1120,14 +1117,14 @@ void OTableController::alterColumns()
xColumns->getByName(pField->GetName()) >>= xColumn;
Reference<XPropertySetInfo> xInfo = xColumn->getPropertySetInfo();
if ( xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetHelpText()));
+ xColumn->setPropertyValue(PROPERTY_HELPTEXT,Any(pField->GetHelpText()));
if(xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
if(xInfo->hasPropertyByName(PROPERTY_FORMATKEY))
- xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+ xColumn->setPropertyValue(PROPERTY_FORMATKEY,Any(pField->GetFormatKey()));
if(xInfo->hasPropertyByName(PROPERTY_ALIGN))
- xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAlign(pField->GetHorJustify())));
+ xColumn->setPropertyValue(PROPERTY_ALIGN,Any(dbaui::mapTextAlign(pField->GetHorJustify())));
}
}
// second drop all columns which could be found by name
@@ -1163,15 +1160,11 @@ void OTableController::alterColumns()
}
catch (const SQLException&)
{
+ const auto caughtException = ::cppu::getCaughtException();
OUString sError( DBA_RES( STR_TABLEDESIGN_COULD_NOT_DROP_COL ) );
sError = sError.replaceFirst( "$column$", rColumnName );
- SQLException aNewException;
- aNewException.Message = sError;
- aNewException.SQLState = "S1000";
- aNewException.NextException = ::cppu::getCaughtException();
-
- throw aNewException;
+ throw SQLException(sError, {}, "S1000", 0, caughtException);
}
}
}
@@ -1443,7 +1436,7 @@ OUString OTableController::getPrivateTitle() const
if ( sTitle.isEmpty() )
{
OUString aName = DBA_RES(STR_TBL_TITLE);
- sTitle = aName.getToken(0,' ') + OUString::number(getCurrentStartNumber());
+ sTitle = o3tl::getToken(aName,0,' ') + OUString::number(getCurrentStartNumber());
}
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
index 1526682eddd7..18e24c3d5e12 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
@@ -116,7 +116,7 @@ void OTableRowView::Command(const CommandEvent& rEvt)
sal_Int32 nSelectRowCount = GetSelectRowCount();
xContextMenu->set_sensitive("cut", nSelectRowCount != 0);
xContextMenu->set_sensitive("copy", nSelectRowCount != 0);
- OString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "cut")
cut();
else if (sIdent == "copy")
diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
index f0570ddba9db..e16bf2e546bf 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
@@ -30,11 +30,9 @@
#include <memory>
using namespace ::dbaui;
-using namespace ::utl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::datatransfer::clipboard;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
OTableBorderWindow::OTableBorderWindow(OTableDesignView* pParent)
: InterimItemWindow(pParent, "dbaccess/ui/tableborderwindow.ui", "TableBorderWindow", false)
@@ -166,7 +164,7 @@ IMPL_LINK_NOARG(OTableDesignView, FieldDescFocusIn, weld::Widget&, void)
bool OTableDesignView::PreNotify( NotifyEvent& rNEvt )
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
{
if( GetDescWin() && GetDescWin()->HasChildPathFocus() )
m_eChildFocus = DESCRIPTION;
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
index 7e6c4f111e5f..9f110d472017 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
@@ -28,9 +28,9 @@ using namespace dbaui;
OTableFieldDescWin::OTableFieldDescWin(weld::Container* pParent, OTableDesignView* pView)
: OChildWindow(pParent, "dbaccess/ui/fielddescpanel.ui", "FieldDescPanel")
- , m_xHelpBar(new OTableDesignHelpBar(m_xBuilder->weld_text_view("textview")))
+ , m_aHelpBar(m_xBuilder->weld_text_view("textview"))
, m_xBox(m_xBuilder->weld_container("box"))
- , m_xFieldControl(new OTableFieldControl(m_xBox.get(), m_xHelpBar.get(), pView))
+ , m_xFieldControl(new OTableFieldControl(m_xBox.get(), &m_aHelpBar, pView))
, m_xHeader(m_xBuilder->weld_label("header"))
, m_eChildFocus(NONE)
{
@@ -39,13 +39,13 @@ OTableFieldDescWin::OTableFieldDescWin(weld::Container* pParent, OTableDesignVie
m_xFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
- m_xHelpBar->connect_focus_in(LINK(this, OTableFieldDescWin, HelpFocusIn));
+ m_aHelpBar.connect_focus_in(LINK(this, OTableFieldDescWin, HelpFocusIn));
m_xFieldControl->connect_focus_in(LINK(this, OTableFieldDescWin, FieldFocusIn));
}
bool OTableFieldDescWin::HasChildPathFocus() const
{
- return m_xFieldControl->HasChildPathFocus() || m_xHelpBar->HasFocus();
+ return m_xFieldControl->HasChildPathFocus() || m_aHelpBar.HasFocus();
}
OTableFieldDescWin::~OTableFieldDescWin()
@@ -81,7 +81,7 @@ IClipboardTest* OTableFieldDescWin::getActiveChild() const
pTest = m_xFieldControl.get();
break;
default:
- pTest = m_xHelpBar.get();
+ pTest = const_cast<OTableDesignHelpBar*>(&m_aHelpBar);
break;
}
return pTest;
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
index 9f15c1e1b90b..f14e468c561e 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
@@ -21,10 +21,10 @@
#include <IClipBoardTest.hxx>
#include <ChildWindow.hxx>
#include "TableFieldControl.hxx"
+#include <TableDesignHelpBar.hxx>
namespace dbaui
{
- class OTableDesignHelpBar;
class OTableDesignView;
class OFieldDescription;
@@ -38,7 +38,7 @@ namespace dbaui
NONE
};
private:
- std::unique_ptr<OTableDesignHelpBar> m_xHelpBar;
+ OTableDesignHelpBar m_aHelpBar;
std::unique_ptr<weld::Container> m_xBox;
std::unique_ptr<OTableFieldControl> m_xFieldControl;
std::unique_ptr<weld::Label> m_xHeader;
diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx
index 8f13193e1c41..02976fb59589 100644
--- a/dbaccess/source/ui/tabledesign/TableRow.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRow.cxx
@@ -23,9 +23,7 @@
#include <comphelper/types.hxx>
using namespace dbaui;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
OTableRow::OTableRow()
:m_pActFieldDescr( nullptr )
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
index c56450ac1c26..19917e7a26d1 100644
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
@@ -26,21 +26,20 @@ namespace dbaui
{
constexpr sal_uInt32 FORMAT_OBJECT_ID_SBA_TABED = 1;
- using namespace ::com::sun::star::uno;
OTableRowExchange::OTableRowExchange(std::vector< std::shared_ptr<OTableRow> >&& _rvTableRow)
: m_vTableRow(std::move(_rvTableRow))
{
}
- bool OTableRowExchange::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
+ bool OTableRowExchange::WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
{
if(nUserObjectId == FORMAT_OBJECT_ID_SBA_TABED)
{
std::vector< std::shared_ptr<OTableRow> >* pRows = static_cast< std::vector< std::shared_ptr<OTableRow> >* >(pUserObject);
if(pRows)
{
- (*rxOStm).WriteInt32( pRows->size() ); // first stream the size
+ rOStm.WriteInt32( pRows->size() ); // first stream the size
for (auto const& row : *pRows)
- WriteOTableRow(*rxOStm, *row);
+ WriteOTableRow(rOStm, *row);
return true;
}
}
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx
index d60756a2e697..7829a09d6959 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.cxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx
@@ -25,6 +25,7 @@
#include <TableDesignView.hxx>
#include <FieldDescriptions.hxx>
#include <svx/svxids.hrc>
+#include <utility>
using namespace dbaui;
using namespace ::svt;
@@ -116,11 +117,11 @@ OTableEditorUndoAct::~OTableEditorUndoAct()
{
}
-OTableEditorTypeSelUndoAct::OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn, const TOTypeInfoSP& _pOldType )
+OTableEditorTypeSelUndoAct::OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn, TOTypeInfoSP _pOldType )
:OTableEditorUndoAct( pOwner ,STR_TABED_UNDO_TYPE_CHANGED)
,m_nCol( nColumn )
,m_nRow( nRowID )
- ,m_pOldType( _pOldType )
+ ,m_pOldType(std::move( _pOldType ))
{
}
@@ -178,7 +179,7 @@ OTableEditorDelUndoAct::~OTableEditorDelUndoAct()
void OTableEditorDelUndoAct::Undo()
{
// Insert the deleted line
- sal_uLong nPos;
+ sal_Int32 nPos;
std::shared_ptr<OTableRow> pNewOrigRow;
std::vector< std::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList();
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.hxx b/dbaccess/source/ui/tabledesign/TableUndo.hxx
index 5ad23b84fb0f..1863555f7556 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.hxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.hxx
@@ -78,7 +78,7 @@ namespace dbaui
virtual void Undo() override;
virtual void Redo() override;
public:
- OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn, const TOTypeInfoSP& _pOldType );
+ OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn, TOTypeInfoSP _pOldType );
virtual ~OTableEditorTypeSelUndoAct() override;
};
diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
index 3d24cfc242a7..50d2f92723d3 100644
--- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
+++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
@@ -28,7 +28,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
namespace {
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
index 0d26048f8e32..78b0f2fee53c 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -35,7 +35,6 @@ namespace dbaui
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
OColumnControl::OColumnControl(const Reference<XComponentContext>& rxContext)
@@ -61,7 +60,7 @@ css::uno::Sequence< OUString > SAL_CALL OColumnControl::getSupportedServiceNames
return { "com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl" };
}
-OUString OColumnControl::GetComponentServiceName()
+OUString OColumnControl::GetComponentServiceName() const
{
return "com.sun.star.sdb.ColumnDescriptorControl";
}
@@ -77,7 +76,7 @@ void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit
vcl::Window* pParentWin = nullptr;
if (rParentPeer.is())
{
- VCLXWindow* pParent = comphelper::getFromUnoTunnel<VCLXWindow>(rParentPeer);
+ VCLXWindow* pParent = dynamic_cast<VCLXWindow*>(rParentPeer.get());
if (pParent)
pParentWin = pParent->GetWindow();
}
diff --git a/dbaccess/source/ui/uno/ColumnControl.hxx b/dbaccess/source/ui/uno/ColumnControl.hxx
index 9c6054d623e2..63f06651284c 100644
--- a/dbaccess/source/ui/uno/ColumnControl.hxx
+++ b/dbaccess/source/ui/uno/ColumnControl.hxx
@@ -33,7 +33,7 @@ namespace dbaui
explicit OColumnControl(const css::uno::Reference< css::uno::XComponentContext>& rxContext);
// UnoControl
- virtual OUString GetComponentServiceName() override;
+ virtual OUString GetComponentServiceName() const override;
// XServiceInfo
DECLARE_SERVICE_INFO();
diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx
index 48f5fbce5692..34c4a23da647 100644
--- a/dbaccess/source/ui/uno/ColumnPeer.cxx
+++ b/dbaccess/source/ui/uno/ColumnPeer.cxx
@@ -25,10 +25,8 @@
namespace dbaui
{
-using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext>& _rxContext)
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
index 8c9d16596386..c7fbb5e1614d 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
@@ -34,7 +34,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
ODBTypeWizDialog::ODBTypeWizDialog(const Reference< XComponentContext >& _rxORB)
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
index 63c3d6304b0d..4942f2bcb89c 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
@@ -36,9 +36,7 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdbc;
ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference< XComponentContext >& _rxORB)
:ODatabaseAdministrationDialog(_rxORB)
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx
index cd01f2587370..01f9f9d0d7ba 100644
--- a/dbaccess/source/ui/uno/TableFilterDlg.cxx
+++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx
@@ -34,7 +34,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
OTableFilterDialog::OTableFilterDialog(const Reference< XComponentContext >& _rxORB)
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
index 7039c7396d86..64903bedc812 100644
--- a/dbaccess/source/ui/uno/UserSettingsDlg.cxx
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
@@ -34,7 +34,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
OUserSettingsDialog::OUserSettingsDialog(const Reference< XComponentContext >& _rxORB)
diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx
index 3e524372eea5..d27eb12901f6 100644
--- a/dbaccess/source/ui/uno/admindlg.cxx
+++ b/dbaccess/source/ui/uno/admindlg.cxx
@@ -33,7 +33,6 @@ org_openoffice_comp_dbu_ODatasourceAdministrationDialog_get_implementation(
namespace dbaui
{
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
ODataSourcePropertyDialog::ODataSourcePropertyDialog(const Reference<XComponentContext>& _rxORB)
diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx
index d05f3239d15b..9551f96f78b2 100644
--- a/dbaccess/source/ui/uno/composerdialogs.cxx
+++ b/dbaccess/source/ui/uno/composerdialogs.cxx
@@ -26,7 +26,7 @@
#include <queryorder.hxx>
#include <strings.hxx>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/svapp.hxx>
@@ -53,7 +53,6 @@ constexpr OUStringLiteral PROPERTY_QUERYCOMPOSER = u"QueryComposer";
constexpr OUStringLiteral PROPERTY_ROWSET = u"RowSet";
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
@@ -186,9 +185,9 @@ constexpr OUStringLiteral PROPERTY_ROWSET = u"RowSet";
aArguments[1] >>= xRowSet;
Reference<css::awt::XWindow> xParentWindow;
aArguments[2] >>= xParentWindow;
- setPropertyValue( "QueryComposer", makeAny( xQueryComposer ) );
- setPropertyValue( "RowSet", makeAny( xRowSet ) );
- setPropertyValue( "ParentWindow", makeAny( xParentWindow ) );
+ setPropertyValue( "QueryComposer", Any( xQueryComposer ) );
+ setPropertyValue( "RowSet", Any( xRowSet ) );
+ setPropertyValue( "ParentWindow", Any( xParentWindow ) );
}
else
ComposerDialog::initialize(aArguments);
@@ -239,13 +238,13 @@ constexpr OUStringLiteral PROPERTY_ROWSET = u"RowSet";
aArguments[0] >>= xQueryComposer;
Reference<css::beans::XPropertySet> xRowSet;
aArguments[1] >>= xRowSet;
- setPropertyValue( "QueryComposer", makeAny( xQueryComposer ) );
- setPropertyValue( "RowSet", makeAny( xRowSet ) );
+ setPropertyValue( "QueryComposer", Any( xQueryComposer ) );
+ setPropertyValue( "RowSet", Any( xRowSet ) );
if (aArguments.getLength() == 3)
{
Reference<css::awt::XWindow> xParentWindow;
aArguments[2] >>= xParentWindow;
- setPropertyValue("ParentWindow", makeAny(xParentWindow));
+ setPropertyValue("ParentWindow", Any(xParentWindow));
}
}
else
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 51420d74995c..880600342dea 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -60,11 +60,12 @@
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/interfacecontainer3.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <svtools/genericunodialog.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <vcl/svapp.hxx>
@@ -79,7 +80,6 @@ namespace dbaui
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::Sequence;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::beans::XPropertySetInfo;
@@ -572,8 +572,7 @@ namespace
// see whether the document model can provide a handler
if ( xDocumentModel.is() )
{
- ::comphelper::NamedValueCollection aModelArgs( xDocumentModel->getArgs() );
- xHandler = aModelArgs.getOrDefault( "InteractionHandler", xHandler );
+ xHandler = ::comphelper::NamedValueCollection::getOrDefault( xDocumentModel->getArgs(), u"InteractionHandler", xHandler );
}
return xHandler;
@@ -660,7 +659,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
OUString sUnsupportedSetting;
const OUString aSettings[] = {
- OUString(PROPERTY_FILTER), OUString(PROPERTY_ORDER), OUString(PROPERTY_HAVING_CLAUSE), OUString(PROPERTY_GROUP_BY)
+ PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY
};
for (const auto & aSetting : aSettings)
{
@@ -942,40 +941,39 @@ namespace
class ValueTransfer
{
public:
- ValueTransfer( const sal_Int32& _rSourcePos, const sal_Int32& _rDestPos, std::vector< sal_Int32 >&& _rColTypes,
+ ValueTransfer( std::vector< sal_Int32 > _rColTypes,
const Reference< XRow >& _rxSource, const Reference< XParameters >& _rxDest )
- :m_rSourcePos( _rSourcePos )
- ,m_rDestPos( _rDestPos )
- ,m_rColTypes( std::move(_rColTypes) )
+ :m_ColTypes( std::move(_rColTypes) )
,m_xSource( _rxSource )
,m_xDest( _rxDest )
{
}
template< typename VALUE_TYPE >
- void transferValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
+ void transferValue( sal_Int32 _nSourcePos, sal_Int32 _nDestPos,
+ VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
void (SAL_CALL XParameters::*_pSetter)( sal_Int32, VALUE_TYPE ) )
{
- VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ VALUE_TYPE value( (m_xSource.get()->*_pGetter)( _nSourcePos ) );
if ( m_xSource->wasNull() )
- m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] );
+ m_xDest->setNull( _nDestPos, m_ColTypes[ _nSourcePos ] );
else
- (m_xDest.get()->*_pSetter)( m_rDestPos, value );
+ (m_xDest.get()->*_pSetter)( _nDestPos, value );
}
- template< typename VALUE_TYPE >
- void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
+
+ template< typename VALUE_TYPE >
+ void transferComplexValue( sal_Int32 _nSourcePos, sal_Int32 _nDestPos,
+ VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) )
{
- const VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ const VALUE_TYPE value( (m_xSource.get()->*_pGetter)( _nSourcePos ) );
if ( m_xSource->wasNull() )
- m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] );
+ m_xDest->setNull( _nDestPos, m_ColTypes[ _nSourcePos ] );
else
- (m_xDest.get()->*_pSetter)( m_rDestPos, value );
+ (m_xDest.get()->*_pSetter)( _nDestPos, value );
}
private:
- const sal_Int32& m_rSourcePos;
- const sal_Int32& m_rDestPos;
- const std::vector< sal_Int32 > m_rColTypes;
+ const std::vector< sal_Int32 > m_ColTypes;
const Reference< XRow > m_xSource;
const Reference< XParameters > m_xDest;
};
@@ -1013,26 +1011,22 @@ bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _r
try
{
- SQLContext aError;
- aError.Context = *this;
- aError.Message = DBA_RES(STR_ERROR_OCCURRED_WHILE_COPYING);
-
+ css::uno::Any next;
::dbtools::SQLExceptionInfo aInfo( _rEvent.Error );
if ( aInfo.isValid() )
- aError.NextException = _rEvent.Error;
+ next = _rEvent.Error;
else
{
// a non-SQL exception happened
Exception aException;
OSL_VERIFY( _rEvent.Error >>= aException );
- SQLContext aContext;
- aContext.Context = aException.Context;
- aContext.Message = aException.Message;
- aContext.Details = _rEvent.Error.getValueTypeName();
- aError.NextException <<= aContext;
+ SQLContext aContext(aException.Message, aException.Context, {}, 0, {},
+ _rEvent.Error.getValueTypeName());
+ next <<= aContext;
}
+ SQLContext aError(DBA_RES(STR_ERROR_OCCURRED_WHILE_COPYING), *this, {}, 0, next, {});
- ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
+ ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( Any( aError ) ) );
::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove;
xRequest->addContinuation( xYes );
@@ -1067,6 +1061,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
const OCopyTableWizard& rWizard = impl_getDialog_throw();
ODatabaseExport::TPositions aColumnPositions = rWizard.GetColumnPositions();
+ const bool bShouldCreatePrimaryKey = rWizard.shouldCreatePrimaryKey();
Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW );
Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY_THROW );
@@ -1091,7 +1086,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
}
// now create, fill and execute the prepared statement
- Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnPositions ), UNO_SET_THROW );
+ Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatement( xDestMetaData, _rxDestTable, aColumnPositions ), UNO_SET_THROW );
Reference< XParameters > xStatementParams( xStatement, UNO_QUERY_THROW );
const bool bSelectedRecordsOnly = m_aSourceSelection.hasElements();
@@ -1138,16 +1133,16 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
aCopyEvent.Error.clear();
try
{
+ bool bInsertedPrimaryKey = false;
// notify listeners
m_aCopyTableListeners.notifyEach( &XCopyTableListener::copyingRow, aCopyEvent );
- sal_Int32 nDestColumn( 0 );
sal_Int32 nSourceColumn( 1 );
- ValueTransfer aTransfer( nSourceColumn, nDestColumn, std::vector(aSourceColTypes), xRow, xStatementParams );
+ ValueTransfer aTransfer( aSourceColTypes, xRow, xStatementParams );
for ( auto const& rColumnPos : aColumnPositions )
{
- nDestColumn = rColumnPos.first;
+ sal_Int32 nDestColumn = rColumnPos.first;
if ( nDestColumn == COLUMN_POSITION_NOT_FOUND )
{
++nSourceColumn;
@@ -1155,7 +1150,15 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
continue;
}
- if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= static_cast<sal_Int32>(aSourceColTypes.size()) ) )
+ if ( bShouldCreatePrimaryKey && !bInsertedPrimaryKey )
+ {
+ xStatementParams->setInt( 1, nRowCount );
+ ++nSourceColumn;
+ bInsertedPrimaryKey = true;
+ continue;
+ }
+
+ if ( ( nSourceColumn < 1 ) || ( o3tl::make_unsigned(nSourceColumn) >= aSourceColTypes.size() ) )
{ // ( we have to check here against 1 because the parameters are 1 based)
::dbtools::throwSQLException("Internal error: invalid column type index.",
::dbtools::StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this);
@@ -1165,7 +1168,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
{
case DataType::DOUBLE:
case DataType::REAL:
- aTransfer.transferValue( &XRow::getDouble, &XParameters::setDouble );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getDouble, &XParameters::setDouble );
break;
case DataType::CHAR:
@@ -1173,64 +1176,64 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
case DataType::LONGVARCHAR:
case DataType::DECIMAL:
case DataType::NUMERIC:
- aTransfer.transferComplexValue( &XRow::getString, &XParameters::setString );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getString, &XParameters::setString );
break;
case DataType::BIGINT:
- aTransfer.transferValue( &XRow::getLong, &XParameters::setLong );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getLong, &XParameters::setLong );
break;
case DataType::FLOAT:
- aTransfer.transferValue( &XRow::getFloat, &XParameters::setFloat );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getFloat, &XParameters::setFloat );
break;
case DataType::LONGVARBINARY:
case DataType::BINARY:
case DataType::VARBINARY:
- aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getBytes, &XParameters::setBytes );
break;
case DataType::DATE:
- aTransfer.transferComplexValue( &XRow::getDate, &XParameters::setDate );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getDate, &XParameters::setDate );
break;
case DataType::TIME:
- aTransfer.transferComplexValue( &XRow::getTime, &XParameters::setTime );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getTime, &XParameters::setTime );
break;
case DataType::TIMESTAMP:
- aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getTimestamp, &XParameters::setTimestamp );
break;
case DataType::BIT:
if ( aSourcePrec[nSourceColumn] > 1 )
{
- aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getBytes, &XParameters::setBytes );
break;
}
[[fallthrough]];
case DataType::BOOLEAN:
- aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getBoolean, &XParameters::setBoolean );
break;
case DataType::TINYINT:
- aTransfer.transferValue( &XRow::getByte, &XParameters::setByte );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getByte, &XParameters::setByte );
break;
case DataType::SMALLINT:
- aTransfer.transferValue( &XRow::getShort, &XParameters::setShort );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getShort, &XParameters::setShort );
break;
case DataType::INTEGER:
- aTransfer.transferValue( &XRow::getInt, &XParameters::setInt );
+ aTransfer.transferValue( nSourceColumn, nDestColumn, &XRow::getInt, &XParameters::setInt );
break;
case DataType::BLOB:
- aTransfer.transferComplexValue( &XRow::getBlob, &XParameters::setBlob );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getBlob, &XParameters::setBlob );
break;
case DataType::CLOB:
- aTransfer.transferComplexValue( &XRow::getClob, &XParameters::setClob );
+ aTransfer.transferComplexValue( nSourceColumn, nDestColumn, &XRow::getClob, &XParameters::setClob );
break;
default:
@@ -1256,6 +1259,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
}
catch( const Exception& )
{
+ TOOLS_WARN_EXCEPTION("dbaccess", "");
aCopyEvent.Error = ::cppu::getCaughtException();
}
@@ -1350,42 +1354,48 @@ void CopyTableWizard::impl_doCopy_nothrow()
// tdf#119962
const Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_SET_THROW );
- const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, xTable, ::dbtools::EComposeRule::InDataManipulation, true );
+ OUString sDatabaseDest = xDestMetaData->getDatabaseProductName().toAsciiLowerCase();
+ // If we created a new primary key, then it won't necessarily be an IDENTITY column
+ const bool bShouldCreatePrimaryKey = rWizard.shouldCreatePrimaryKey();
+ if ( !bShouldCreatePrimaryKey && (sDatabaseDest.indexOf("firebird") != -1) )
+ {
+ const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, xTable, ::dbtools::EComposeRule::InDataManipulation, true );
- OUString aSchema,aTable;
- xTable->getPropertyValue("SchemaName") >>= aSchema;
- xTable->getPropertyValue("Name") >>= aTable;
- Any aCatalog = xTable->getPropertyValue("CatalogName");
+ OUString aSchema,aTable;
+ xTable->getPropertyValue("SchemaName") >>= aSchema;
+ xTable->getPropertyValue("Name") >>= aTable;
+ Any aCatalog = xTable->getPropertyValue("CatalogName");
- const Reference< XResultSet > xResultPKCL(xDestMetaData->getPrimaryKeys(aCatalog,aSchema,aTable));
- Reference< XRow > xRowPKCL(xResultPKCL, UNO_QUERY_THROW);
- OUString sPKCL;
- if ( xRowPKCL.is() )
- {
- if (xResultPKCL->next())
+ const Reference< XResultSet > xResultPKCL(xDestMetaData->getPrimaryKeys(aCatalog,aSchema,aTable));
+ Reference< XRow > xRowPKCL(xResultPKCL, UNO_QUERY_THROW);
+ OUString sPKCL;
+ if ( xRowPKCL.is() )
{
- sPKCL = xRowPKCL->getString(4);
+ if (xResultPKCL->next())
+ {
+ sPKCL = xRowPKCL->getString(4);
+ }
}
- }
- if (!sPKCL.isEmpty())
- {
- OUString strSql = "SELECT MAX(\"" + sPKCL + "\") FROM " + sComposedTableName;
+ if (!sPKCL.isEmpty())
+ {
+ OUString strSql = "SELECT MAX(\"" + sPKCL + "\") FROM " + sComposedTableName;
- Reference< XResultSet > xResultMAXNUM(m_xDestConnection->createStatement()->executeQuery(strSql));
- Reference< XRow > xRow(xResultMAXNUM, UNO_QUERY_THROW);
+ Reference< XResultSet > xResultMAXNUM(m_xDestConnection->createStatement()->executeQuery(strSql));
+ Reference< XRow > xRow(xResultMAXNUM, UNO_QUERY_THROW);
- sal_Int64 maxVal = -1L;
- if (xResultMAXNUM->next())
- {
- maxVal = xRow->getLong(1);
- }
+ sal_Int64 maxVal = -1L;
+ if (xResultMAXNUM->next())
+ {
+ maxVal = xRow->getLong(1);
+ }
- if (maxVal > 0L)
- {
- strSql = "ALTER TABLE " + sComposedTableName + " ALTER \"" + sPKCL + "\" RESTART WITH " + OUString::number(maxVal + 1);
+ if (maxVal > 0L)
+ {
+ strSql = "ALTER TABLE " + sComposedTableName + " ALTER \"" + sPKCL + "\" RESTART WITH " + OUString::number(maxVal + 1);
- m_xDestConnection->createStatement()->execute(strSql);
+ m_xDestConnection->createStatement()->execute(strSql);
+ }
}
}
}
@@ -1403,6 +1413,7 @@ void CopyTableWizard::impl_doCopy_nothrow()
catch( const Exception& )
{
aError = ::cppu::getCaughtException();
+ SAL_WARN("dbaccess", exceptionToString(aError));
// silence the error of the user cancelling the parameter's dialog
SQLException aSQLError;
@@ -1445,7 +1456,7 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference<
}
}
const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true );
- OUString sSql("INSERT INTO " + sComposedTableName + " ( " + sColumns.makeStringAndClear() + " ) " + m_pSourceObject->getSelectStatement());
+ OUString sSql("INSERT INTO " + sComposedTableName + " ( " + sColumns + " ) " + m_pSourceObject->getSelectStatement());
return sSql;
}
diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx
index ad7480c1a197..8b6b5abe178d 100644
--- a/dbaccess/source/ui/uno/dbinteraction.cxx
+++ b/dbaccess/source/ui/uno/dbinteraction.cxx
@@ -18,7 +18,7 @@
*/
#include "dbinteraction.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <connectivity/dbexception.hxx>
#include <sqlmessage.hxx>
@@ -54,9 +54,7 @@ namespace dbaui
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::task;
- using namespace ::com::sun::star::beans;
using namespace ::dbtools;
// BasicInteractionHandler
diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx
index 7b3a4cc6c8dd..0a59588a3633 100644
--- a/dbaccess/source/ui/uno/unoDirectSql.cxx
+++ b/dbaccess/source/ui/uno/unoDirectSql.cxx
@@ -26,7 +26,7 @@
#include <directsql.hxx>
#include <datasourceconnector.hxx>
#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -40,10 +40,8 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
// ODirectSQLDialog
diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx
index 3d863b92e8f9..b2c50fc3ab0e 100644
--- a/dbaccess/source/ui/uno/unoadmin.cxx
+++ b/dbaccess/source/ui/uno/unoadmin.cxx
@@ -27,15 +27,13 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XComponentContext >& _rxORB)
- :ODatabaseAdministrationDialogBase(_rxORB)
- ,m_pItemPoolDefaults(nullptr)
+: ODatabaseAdministrationDialogBase(_rxORB)
{
m_pCollection.reset( new ::dbaccess::ODsnTypeCollection(_rxORB) );
- ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection.get());
+ ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pCollection.get());
}
ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
@@ -43,7 +41,7 @@ ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
::osl::MutexGuard aGuard(m_aMutex);
if (m_xDialog)
destroyDialog();
- ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
+ ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool);
}
void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)