summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx36
-rw-r--r--dbaccess/source/core/api/BookmarkSet.hxx4
-rw-r--r--dbaccess/source/core/api/CIndexes.cxx9
-rw-r--r--dbaccess/source/core/api/CIndexes.hxx14
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.cxx53
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.hxx5
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx73
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.hxx15
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx16
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx4
-rw-r--r--dbaccess/source/core/api/FilteredContainer.cxx83
-rw-r--r--dbaccess/source/core/api/HelperCollections.cxx21
-rw-r--r--dbaccess/source/core/api/HelperCollections.hxx21
-rw-r--r--dbaccess/source/core/api/KeySet.cxx173
-rw-r--r--dbaccess/source/core/api/KeySet.hxx27
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx45
-rw-r--r--dbaccess/source/core/api/OptimisticSet.hxx6
-rw-r--r--dbaccess/source/core/api/PrivateRow.cxx27
-rw-r--r--dbaccess/source/core/api/PrivateRow.hxx6
-rw-r--r--dbaccess/source/core/api/RowSet.cxx343
-rw-r--r--dbaccess/source/core/api/RowSet.hxx43
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx121
-rw-r--r--dbaccess/source/core/api/RowSetBase.hxx40
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx57
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx4
-rw-r--r--dbaccess/source/core/api/RowSetCacheIterator.hxx9
-rw-r--r--dbaccess/source/core/api/RowSetRow.hxx9
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx224
-rw-r--r--dbaccess/source/core/api/StaticSet.cxx21
-rw-r--r--dbaccess/source/core/api/StaticSet.hxx4
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx75
-rw-r--r--dbaccess/source/core/api/View.cxx14
-rw-r--r--dbaccess/source/core/api/WrappedResultSet.cxx38
-rw-r--r--dbaccess/source/core/api/WrappedResultSet.hxx4
-rw-r--r--dbaccess/source/core/api/callablestatement.cxx53
-rw-r--r--dbaccess/source/core/api/column.cxx60
-rw-r--r--dbaccess/source/core/api/columnsettings.cxx18
-rw-r--r--dbaccess/source/core/api/datacolumn.cxx5
-rw-r--r--dbaccess/source/core/api/datacolumn.hxx9
-rw-r--r--dbaccess/source/core/api/datasettings.cxx2
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx98
-rw-r--r--dbaccess/source/core/api/preparedstatement.cxx82
-rw-r--r--dbaccess/source/core/api/query.cxx45
-rw-r--r--dbaccess/source/core/api/query.hxx7
-rw-r--r--dbaccess/source/core/api/querycomposer.cxx12
-rw-r--r--dbaccess/source/core/api/querycontainer.cxx47
-rw-r--r--dbaccess/source/core/api/querydescriptor.cxx39
-rw-r--r--dbaccess/source/core/api/querydescriptor.hxx19
-rw-r--r--dbaccess/source/core/api/resultcolumn.cxx62
-rw-r--r--dbaccess/source/core/api/resultcolumn.hxx4
-rw-r--r--dbaccess/source/core/api/resultset.cxx38
-rw-r--r--dbaccess/source/core/api/resultset.hxx8
-rw-r--r--dbaccess/source/core/api/statement.cxx107
-rw-r--r--dbaccess/source/core/api/table.cxx67
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx99
-rw-r--r--dbaccess/source/core/api/viewcontainer.cxx36
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx25
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.hxx7
-rw-r--r--dbaccess/source/core/dataaccess/ContentHelper.cxx156
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx323
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.cxx76
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.hxx47
-rw-r--r--dbaccess/source/core/dataaccess/bookmarkcontainer.cxx34
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.cxx14
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.cxx41
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx82
-rw-r--r--dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx78
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx120
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx358
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.hxx51
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx68
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.hxx12
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx366
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx15
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx41
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx129
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx281
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.hxx11
-rw-r--r--dbaccess/source/core/dataaccess/documenteventexecutor.cxx49
-rw-r--r--dbaccess/source/core/dataaccess/documenteventexecutor.hxx17
-rw-r--r--dbaccess/source/core/dataaccess/documenteventnotifier.cxx45
-rw-r--r--dbaccess/source/core/dataaccess/documenteventnotifier.hxx37
-rw-r--r--dbaccess/source/core/dataaccess/documentevents.cxx142
-rw-r--r--dbaccess/source/core/dataaccess/intercept.cxx64
-rw-r--r--dbaccess/source/core/dataaccess/intercept.hxx9
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.cxx200
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.hxx53
-rw-r--r--dbaccess/source/core/dataaccess/myucp_resultset.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/myucp_resultset.hxx7
-rw-r--r--dbaccess/source/core/inc/ContainerMediator.hxx5
-rw-r--r--dbaccess/source/core/inc/ContentHelper.hxx20
-rw-r--r--dbaccess/source/core/inc/DatabaseDataProvider.hxx21
-rw-r--r--dbaccess/source/core/inc/FilteredContainer.hxx12
-rw-r--r--dbaccess/source/core/inc/ModelImpl.hxx161
-rw-r--r--dbaccess/source/core/inc/PropertyForward.hxx7
-rw-r--r--dbaccess/source/core/inc/RefreshListener.hxx5
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx10
-rw-r--r--dbaccess/source/core/inc/TableDeco.hxx16
-rw-r--r--dbaccess/source/core/inc/View.hxx5
-rw-r--r--dbaccess/source/core/inc/bookmarkcontainer.hxx13
-rw-r--r--dbaccess/source/core/inc/callablestatement.hxx10
-rw-r--r--dbaccess/source/core/inc/column.hxx24
-rw-r--r--dbaccess/source/core/inc/columnsettings.hxx5
-rw-r--r--dbaccess/source/core/inc/commandbase.hxx5
-rw-r--r--dbaccess/source/core/inc/composertools.hxx5
-rw-r--r--dbaccess/source/core/inc/connection.hxx (renamed from dbaccess/source/core/dataaccess/connection.hxx)39
-rw-r--r--dbaccess/source/core/inc/containerapprove.hxx5
-rw-r--r--dbaccess/source/core/inc/databasecontext.hxx34
-rw-r--r--dbaccess/source/core/inc/datasettings.hxx5
-rw-r--r--dbaccess/source/core/inc/definitioncolumn.hxx8
-rw-r--r--dbaccess/source/core/inc/definitioncontainer.hxx10
-rw-r--r--dbaccess/source/core/inc/documentevents.hxx19
-rw-r--r--dbaccess/source/core/inc/migrwarndlg.hxx5
-rw-r--r--dbaccess/source/core/inc/objectnameapproval.hxx12
-rw-r--r--dbaccess/source/core/inc/preparedstatement.hxx10
-rw-r--r--dbaccess/source/core/inc/querycomposer.hxx8
-rw-r--r--dbaccess/source/core/inc/querycontainer.hxx8
-rw-r--r--dbaccess/source/core/inc/recovery/dbdocrecovery.hxx9
-rw-r--r--dbaccess/source/core/inc/sdbcoretools.hxx19
-rw-r--r--dbaccess/source/core/inc/statement.hxx23
-rw-r--r--dbaccess/source/core/inc/table.hxx12
-rw-r--r--dbaccess/source/core/inc/tablecontainer.hxx13
-rw-r--r--dbaccess/source/core/inc/veto.hxx7
-rw-r--r--dbaccess/source/core/inc/viewcontainer.hxx18
-rw-r--r--dbaccess/source/core/misc/ContainerMediator.cxx6
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx136
-rw-r--r--dbaccess/source/core/misc/PropertyForward.cxx7
-rw-r--r--dbaccess/source/core/misc/apitools.cxx96
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx176
-rw-r--r--dbaccess/source/core/misc/migrwarndlg.cxx5
-rw-r--r--dbaccess/source/core/misc/objectnameapproval.cxx20
-rw-r--r--dbaccess/source/core/misc/sdbcoretools.cxx29
-rw-r--r--dbaccess/source/core/misc/services.cxx59
-rw-r--r--dbaccess/source/core/misc/veto.cxx5
-rw-r--r--dbaccess/source/core/recovery/dbdocrecovery.cxx60
-rw-r--r--dbaccess/source/core/recovery/settingsimport.cxx12
-rw-r--r--dbaccess/source/core/recovery/settingsimport.hxx7
-rw-r--r--dbaccess/source/core/recovery/storagestream.cxx3
-rw-r--r--dbaccess/source/core/recovery/storagestream.hxx5
-rw-r--r--dbaccess/source/core/recovery/storagetextstream.cxx22
-rw-r--r--dbaccess/source/core/recovery/storagetextstream.hxx12
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.cxx56
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.hxx20
-rw-r--r--dbaccess/source/core/recovery/subcomponentloader.cxx2
-rw-r--r--dbaccess/source/core/recovery/subcomponentloader.hxx5
-rw-r--r--dbaccess/source/core/recovery/subcomponentrecovery.cxx64
-rw-r--r--dbaccess/source/core/recovery/subcomponentrecovery.hxx10
-rw-r--r--dbaccess/source/core/recovery/subcomponents.hxx5
-rw-r--r--dbaccess/source/core/resource/core_resource.cxx25
-rw-r--r--dbaccess/source/filter/hsqldb/alterparser.hxx5
-rw-r--r--dbaccess/source/filter/hsqldb/columndef.cxx16
-rw-r--r--dbaccess/source/filter/hsqldb/columndef.hxx9
-rw-r--r--dbaccess/source/filter/hsqldb/createparser.cxx142
-rw-r--r--dbaccess/source/filter/hsqldb/createparser.hxx11
-rw-r--r--dbaccess/source/filter/hsqldb/fbalterparser.cxx8
-rw-r--r--dbaccess/source/filter/hsqldb/fbalterparser.hxx5
-rw-r--r--dbaccess/source/filter/hsqldb/fbcreateparser.cxx71
-rw-r--r--dbaccess/source/filter/hsqldb/fbcreateparser.hxx5
-rw-r--r--dbaccess/source/filter/hsqldb/hsqlbinarynode.cxx2
-rw-r--r--dbaccess/source/filter/hsqldb/hsqlbinarynode.hxx5
-rw-r--r--dbaccess/source/filter/hsqldb/hsqlimport.cxx15
-rw-r--r--dbaccess/source/filter/hsqldb/hsqlimport.hxx9
-rw-r--r--dbaccess/source/filter/hsqldb/parseschema.cxx40
-rw-r--r--dbaccess/source/filter/hsqldb/parseschema.hxx5
-rw-r--r--dbaccess/source/filter/hsqldb/rowinputbinary.cxx123
-rw-r--r--dbaccess/source/filter/hsqldb/rowinputbinary.hxx5
-rw-r--r--dbaccess/source/filter/hsqldb/utils.cxx63
-rw-r--r--dbaccess/source/filter/hsqldb/utils.hxx20
-rw-r--r--dbaccess/source/filter/xml/dbloader2.cxx82
-rw-r--r--dbaccess/source/filter/xml/xmlAutoStyle.cxx3
-rw-r--r--dbaccess/source/filter/xml/xmlAutoStyle.hxx8
-rw-r--r--dbaccess/source/filter/xml/xmlColumn.cxx29
-rw-r--r--dbaccess/source/filter/xml/xmlColumn.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlComponent.cxx19
-rw-r--r--dbaccess/source/filter/xml/xmlComponent.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlConnectionData.cxx1
-rw-r--r--dbaccess/source/filter/xml/xmlConnectionData.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlConnectionResource.cxx11
-rw-r--r--dbaccess/source/filter/xml/xmlConnectionResource.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlDataSource.cxx41
-rw-r--r--dbaccess/source/filter/xml/xmlDataSource.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceInfo.cxx13
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceInfo.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceSetting.cxx50
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceSetting.hxx8
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceSettings.cxx1
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceSettings.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlDatabase.cxx9
-rw-r--r--dbaccess/source/filter/xml/xmlDatabase.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlDatabaseDescription.cxx1
-rw-r--r--dbaccess/source/filter/xml/xmlDatabaseDescription.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlDocuments.cxx16
-rw-r--r--dbaccess/source/filter/xml/xmlDocuments.hxx13
-rw-r--r--dbaccess/source/filter/xml/xmlEnums.hxx5
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx200
-rw-r--r--dbaccess/source/filter/xml/xmlExport.hxx28
-rw-r--r--dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx8
-rw-r--r--dbaccess/source/filter/xml/xmlFileBasedDatabase.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlHelper.cxx94
-rw-r--r--dbaccess/source/filter/xml/xmlHelper.hxx4
-rw-r--r--dbaccess/source/filter/xml/xmlHierarchyCollection.cxx21
-rw-r--r--dbaccess/source/filter/xml/xmlHierarchyCollection.hxx9
-rw-r--r--dbaccess/source/filter/xml/xmlLogin.cxx15
-rw-r--r--dbaccess/source/filter/xml/xmlLogin.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlQuery.cxx27
-rw-r--r--dbaccess/source/filter/xml/xmlQuery.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlServerDatabase.cxx28
-rw-r--r--dbaccess/source/filter/xml/xmlServerDatabase.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlStyleImport.cxx89
-rw-r--r--dbaccess/source/filter/xml/xmlStyleImport.hxx30
-rw-r--r--dbaccess/source/filter/xml/xmlTable.cxx26
-rw-r--r--dbaccess/source/filter/xml/xmlTable.hxx9
-rw-r--r--dbaccess/source/filter/xml/xmlTableFilterList.cxx7
-rw-r--r--dbaccess/source/filter/xml/xmlTableFilterList.hxx8
-rw-r--r--dbaccess/source/filter/xml/xmlTableFilterPattern.cxx3
-rw-r--r--dbaccess/source/filter/xml/xmlTableFilterPattern.hxx7
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx139
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.hxx8
-rw-r--r--dbaccess/source/inc/OAuthenticationContinuation.hxx15
-rw-r--r--dbaccess/source/inc/apitools.hxx157
-rw-r--r--dbaccess/source/inc/dsntypes.hxx52
-rw-r--r--dbaccess/source/inc/stringconstants.hxx291
-rw-r--r--dbaccess/source/sdbtools/connection/connectiontools.cxx8
-rw-r--r--dbaccess/source/sdbtools/connection/objectnames.cxx29
-rw-r--r--dbaccess/source/sdbtools/connection/tablename.cxx46
-rw-r--r--dbaccess/source/sdbtools/connection/tablename.hxx8
-rw-r--r--dbaccess/source/sdbtools/inc/connectiondependent.hxx6
-rw-r--r--dbaccess/source/shared/registrationhelper.cxx152
-rw-r--r--dbaccess/source/ui/app/AppController.cxx575
-rw-r--r--dbaccess/source/ui/app/AppController.hxx56
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx114
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx64
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx1067
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx139
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx722
-rw-r--r--dbaccess/source/ui/app/AppDetailView.hxx171
-rw-r--r--dbaccess/source/ui/app/AppIconControl.cxx225
-rw-r--r--dbaccess/source/ui/app/AppIconControl.hxx46
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.cxx144
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.hxx36
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.cxx161
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.hxx51
-rw-r--r--dbaccess/source/ui/app/AppView.cxx164
-rw-r--r--dbaccess/source/ui/app/AppView.hxx59
-rw-r--r--dbaccess/source/ui/app/ChildWindow.cxx25
-rw-r--r--dbaccess/source/ui/app/DocumentInfoPreview.cxx154
-rw-r--r--dbaccess/source/ui/app/DocumentInfoPreview.hxx59
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx45
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.hxx7
-rw-r--r--dbaccess/source/ui/app/templwin.cxx (renamed from dbaccess/source/ui/control/ScrollHelper.cxx)35
-rw-r--r--dbaccess/source/ui/app/templwin.hxx (renamed from dbaccess/source/core/inc/object.hxx)13
-rw-r--r--dbaccess/source/ui/browser/AsynchronousLink.cxx30
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx304
-rw-r--r--dbaccess/source/ui/browser/brwview.cxx72
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx56
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx62
-rw-r--r--dbaccess/source/ui/browser/dbloader.cxx67
-rw-r--r--dbaccess/source/ui/browser/dbtreemodel.hxx10
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.cxx90
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.hxx66
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx186
-rw-r--r--dbaccess/source/ui/browser/dsbrowserDnD.cxx159
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx17
-rw-r--r--dbaccess/source/ui/browser/formadapter.cxx375
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx242
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx364
-rw-r--r--dbaccess/source/ui/browser/sbamultiplex.cxx500
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx1328
-rw-r--r--dbaccess/source/ui/control/ColumnControlWindow.cxx29
-rw-r--r--dbaccess/source/ui/control/FieldControls.cxx8
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx317
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx48
-rw-r--r--dbaccess/source/ui/control/SqlNameEdit.cxx51
-rw-r--r--dbaccess/source/ui/control/TableGrantCtrl.cxx58
-rw-r--r--dbaccess/source/ui/control/VertSplitView.cxx180
-rw-r--r--dbaccess/source/ui/control/charsetlistbox.cxx6
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx643
-rw-r--r--dbaccess/source/ui/control/listviewitems.cxx68
-rw-r--r--dbaccess/source/ui/control/marktree.cxx206
-rw-r--r--dbaccess/source/ui/control/opendoccontrols.cxx49
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx505
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx472
-rw-r--r--dbaccess/source/ui/control/undosqledit.cxx6
-rw-r--r--dbaccess/source/ui/dlg/CollectionView.cxx47
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx70
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx15
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx51
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.hxx5
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.cxx24
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.hxx10
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx278
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx57
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx134
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.hxx9
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.hxx6
-rw-r--r--dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx13
-rw-r--r--dbaccess/source/ui/dlg/RelationDlg.cxx24
-rw-r--r--dbaccess/source/ui/dlg/TablesSingleDlg.cxx4
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.cxx84
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.hxx11
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.cxx192
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.hxx11
-rw-r--r--dbaccess/source/ui/dlg/UserAdminDlg.cxx12
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.cxx30
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.hxx7
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx17
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx27
-rw-r--r--dbaccess/source/ui/dlg/adodatalinks.cxx189
-rw-r--r--dbaccess/source/ui/dlg/adodatalinks.hxx7
-rw-r--r--dbaccess/source/ui/dlg/adtabdlg.cxx61
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx87
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx18
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx309
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.cxx57
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.hxx19
-rw-r--r--dbaccess/source/ui/dlg/dbwiz.cxx13
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx124
-rw-r--r--dbaccess/source/ui/dlg/detailpages.cxx128
-rw-r--r--dbaccess/source/ui/dlg/detailpages.hxx18
-rw-r--r--dbaccess/source/ui/dlg/directsql.cxx330
-rw-r--r--dbaccess/source/ui/dlg/dlgattr.cxx17
-rw-r--r--dbaccess/source/ui/dlg/dlgsave.cxx263
-rw-r--r--dbaccess/source/ui/dlg/dlgsize.cxx12
-rw-r--r--dbaccess/source/ui/dlg/dsnItem.hxx6
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx15
-rw-r--r--dbaccess/source/ui/dlg/dsselect.hxx22
-rw-r--r--dbaccess/source/ui/dlg/finteraction.hxx5
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx126
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx14
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx84
-rw-r--r--dbaccess/source/ui/dlg/indexfieldscontrol.cxx25
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.cxx24
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.hxx5
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.cxx1
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.hxx8
-rw-r--r--dbaccess/source/ui/dlg/paramdialog.cxx32
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx185
-rw-r--r--dbaccess/source/ui/dlg/queryorder.cxx33
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx75
-rw-r--r--dbaccess/source/ui/dlg/tablespage.cxx31
-rw-r--r--dbaccess/source/ui/dlg/tablespage.hxx7
-rw-r--r--dbaccess/source/ui/dlg/textconnectionsettings.cxx6
-rw-r--r--dbaccess/source/ui/inc/AppElementType.hxx20
-rw-r--r--dbaccess/source/ui/inc/ChildWindow.hxx38
-rw-r--r--dbaccess/source/ui/inc/CollectionView.hxx12
-rw-r--r--dbaccess/source/ui/inc/ColumnControlWindow.hxx25
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx6
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineAccess.hxx52
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineData.hxx6
-rw-r--r--dbaccess/source/ui/inc/DExport.hxx9
-rw-r--r--dbaccess/source/ui/inc/FieldControls.hxx13
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx80
-rw-r--r--dbaccess/source/ui/inc/FieldDescriptions.hxx4
-rw-r--r--dbaccess/source/ui/inc/GeneralUndo.hxx6
-rw-r--r--dbaccess/source/ui/inc/HtmlReader.hxx6
-rw-r--r--dbaccess/source/ui/inc/IClipBoardTest.hxx4
-rw-r--r--dbaccess/source/ui/inc/IItemSetHelper.hxx7
-rw-r--r--dbaccess/source/ui/inc/IUpdateHelper.hxx5
-rw-r--r--dbaccess/source/ui/inc/JAccess.hxx23
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx8
-rw-r--r--dbaccess/source/ui/inc/JoinDesignView.hxx6
-rw-r--r--dbaccess/source/ui/inc/JoinExchange.hxx22
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx39
-rw-r--r--dbaccess/source/ui/inc/QEnumTypes.hxx4
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx10
-rw-r--r--dbaccess/source/ui/inc/QueryPropertiesDialog.hxx5
-rw-r--r--dbaccess/source/ui/inc/QueryTableView.hxx6
-rw-r--r--dbaccess/source/ui/inc/QueryTextView.hxx37
-rw-r--r--dbaccess/source/ui/inc/QueryViewSwitch.hxx6
-rw-r--r--dbaccess/source/ui/inc/RTableConnectionData.hxx6
-rw-r--r--dbaccess/source/ui/inc/RelControliFace.hxx4
-rw-r--r--dbaccess/source/ui/inc/RelationControl.hxx5
-rw-r--r--dbaccess/source/ui/inc/RelationController.hxx13
-rw-r--r--dbaccess/source/ui/inc/RelationDesignView.hxx4
-rw-r--r--dbaccess/source/ui/inc/RelationDlg.hxx4
-rw-r--r--dbaccess/source/ui/inc/RelationTableView.hxx4
-rw-r--r--dbaccess/source/ui/inc/RtfReader.hxx6
-rw-r--r--dbaccess/source/ui/inc/ScrollHelper.hxx67
-rw-r--r--dbaccess/source/ui/inc/SqlNameEdit.hxx36
-rw-r--r--dbaccess/source/ui/inc/TableConnection.hxx10
-rw-r--r--dbaccess/source/ui/inc/TableConnectionData.hxx8
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx7
-rw-r--r--dbaccess/source/ui/inc/TableCopyHelper.hxx27
-rw-r--r--dbaccess/source/ui/inc/TableDesignControl.hxx26
-rw-r--r--dbaccess/source/ui/inc/TableDesignHelpBar.hxx33
-rw-r--r--dbaccess/source/ui/inc/TableDesignView.hxx38
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx6
-rw-r--r--dbaccess/source/ui/inc/TableGrantCtrl.hxx23
-rw-r--r--dbaccess/source/ui/inc/TableRow.hxx10
-rw-r--r--dbaccess/source/ui/inc/TableRowExchange.hxx8
-rw-r--r--dbaccess/source/ui/inc/TableWindow.hxx25
-rw-r--r--dbaccess/source/ui/inc/TableWindowAccess.hxx48
-rw-r--r--dbaccess/source/ui/inc/TableWindowData.hxx12
-rw-r--r--dbaccess/source/ui/inc/TableWindowListBox.hxx73
-rw-r--r--dbaccess/source/ui/inc/TableWindowTitle.hxx25
-rw-r--r--dbaccess/source/ui/inc/TablesSingleDlg.hxx5
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx11
-rw-r--r--dbaccess/source/ui/inc/TypeInfo.hxx5
-rw-r--r--dbaccess/source/ui/inc/UITools.hxx31
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx10
-rw-r--r--dbaccess/source/ui/inc/VertSplitView.hxx54
-rw-r--r--dbaccess/source/ui/inc/WCPage.hxx11
-rw-r--r--dbaccess/source/ui/inc/WColumnSelect.hxx10
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx21
-rw-r--r--dbaccess/source/ui/inc/WExtendPages.hxx4
-rw-r--r--dbaccess/source/ui/inc/WNameMatch.hxx4
-rw-r--r--dbaccess/source/ui/inc/WTabPage.hxx6
-rw-r--r--dbaccess/source/ui/inc/WTypeSelect.hxx13
-rw-r--r--dbaccess/source/ui/inc/adtabdlg.hxx8
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx7
-rw-r--r--dbaccess/source/ui/inc/asyncmodaldialog.hxx5
-rw-r--r--dbaccess/source/ui/inc/browserids.hxx6
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx13
-rw-r--r--dbaccess/source/ui/inc/brwview.hxx19
-rw-r--r--dbaccess/source/ui/inc/callbacks.hxx34
-rw-r--r--dbaccess/source/ui/inc/charsetlistbox.hxx11
-rw-r--r--dbaccess/source/ui/inc/charsets.hxx11
-rw-r--r--dbaccess/source/ui/inc/commontypes.hxx5
-rw-r--r--dbaccess/source/ui/inc/curledit.hxx7
-rw-r--r--dbaccess/source/ui/inc/databaseobjectview.hxx7
-rw-r--r--dbaccess/source/ui/inc/datasourceconnector.hxx7
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx22
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx25
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx172
-rw-r--r--dbaccess/source/ui/inc/dbu_dlg.hxx9
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx18
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx17
-rw-r--r--dbaccess/source/ui/inc/defaultobjectnamecheck.hxx16
-rw-r--r--dbaccess/source/ui/inc/directsql.hxx49
-rw-r--r--dbaccess/source/ui/inc/dlgattr.hxx9
-rw-r--r--dbaccess/source/ui/inc/dlgsave.hxx28
-rw-r--r--dbaccess/source/ui/inc/dlgsize.hxx7
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx130
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx12
-rw-r--r--dbaccess/source/ui/inc/exsrcbrw.hxx10
-rw-r--r--dbaccess/source/ui/inc/formadapter.hxx29
-rw-r--r--dbaccess/source/ui/inc/imageprovider.hxx63
-rw-r--r--dbaccess/source/ui/inc/indexcollection.hxx6
-rw-r--r--dbaccess/source/ui/inc/indexdialog.hxx9
-rw-r--r--dbaccess/source/ui/inc/indexes.hxx9
-rw-r--r--dbaccess/source/ui/inc/indexfieldscontrol.hxx19
-rw-r--r--dbaccess/source/ui/inc/linkeddocuments.hxx16
-rw-r--r--dbaccess/source/ui/inc/listviewitems.hxx54
-rw-r--r--dbaccess/source/ui/inc/marktree.hxx63
-rw-r--r--dbaccess/source/ui/inc/objectnamecheck.hxx5
-rw-r--r--dbaccess/source/ui/inc/opendoccontrols.hxx17
-rw-r--r--dbaccess/source/ui/inc/paramdialog.hxx10
-rw-r--r--dbaccess/source/ui/inc/propertystorage.hxx5
-rw-r--r--dbaccess/source/ui/inc/querycontainerwindow.hxx7
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx9
-rw-r--r--dbaccess/source/ui/inc/queryfilter.hxx49
-rw-r--r--dbaccess/source/ui/inc/queryorder.hxx33
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hrc4
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx45
-rw-r--r--dbaccess/source/ui/inc/sbamultiplex.hxx546
-rw-r--r--dbaccess/source/ui/inc/singledoccontroller.hxx11
-rw-r--r--dbaccess/source/ui/inc/sqledit.hxx88
-rw-r--r--dbaccess/source/ui/inc/sqlmessage.hxx19
-rw-r--r--dbaccess/source/ui/inc/stringlistitem.hxx17
-rw-r--r--dbaccess/source/ui/inc/tabletree.hxx148
-rw-r--r--dbaccess/source/ui/inc/textconnectionsettings.hxx5
-rw-r--r--dbaccess/source/ui/inc/undosqledit.hxx15
-rw-r--r--dbaccess/source/ui/inc/unoadmin.hxx10
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx148
-rw-r--r--dbaccess/source/ui/inc/unosqlmessage.hxx6
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx97
-rw-r--r--dbaccess/source/ui/misc/HtmlReader.cxx12
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx23
-rw-r--r--dbaccess/source/ui/misc/RtfReader.cxx8
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx74
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx331
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx312
-rw-r--r--dbaccess/source/ui/misc/UpdateHelperImpl.hxx5
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx54
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx40
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx153
-rw-r--r--dbaccess/source/ui/misc/WExtendPages.cxx4
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx34
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx77
-rw-r--r--dbaccess/source/ui/misc/asyncmodaldialog.cxx4
-rw-r--r--dbaccess/source/ui/misc/charsets.cxx14
-rw-r--r--dbaccess/source/ui/misc/controllerframe.cxx8
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx77
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx24
-rw-r--r--dbaccess/source/ui/misc/dbaundomanager.cxx5
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx36
-rw-r--r--dbaccess/source/ui/misc/defaultobjectnamecheck.cxx47
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx105
-rw-r--r--dbaccess/source/ui/misc/imageprovider.cxx108
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx56
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx124
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx27
-rw-r--r--dbaccess/source/ui/misc/stringlistitem.cxx17
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx62
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx74
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineData.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/JAccess.cxx31
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx72
-rw-r--r--dbaccess/source/ui/querydesign/JoinDesignView.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/JoinExchange.cxx48
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx178
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnection.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnectionData.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnectionData.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx30
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.hxx6
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindowData.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx12
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx7
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx161
-rw-r--r--dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx5
-rw-r--r--dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx28
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx7
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx8
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx46
-rw-r--r--dbaccess/source/ui/querydesign/QueryTextView.cxx151
-rw-r--r--dbaccess/source/ui/querydesign/QueryViewSwitch.cxx13
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx200
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx51
-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.cxx62
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldInfo.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldInfo.hxx5
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx209
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowAccess.cxx87
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowData.cxx13
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowListBox.cxx300
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowTitle.cxx136
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx59
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.hxx16
-rw-r--r--dbaccess/source/ui/querydesign/querycontainerwindow.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx185
-rw-r--r--dbaccess/source/ui/querydesign/querydlg.cxx37
-rw-r--r--dbaccess/source/ui/querydesign/querydlg.hxx6
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.cxx6
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.hxx4
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx62
-rw-r--r--dbaccess/source/ui/relationdesign/RTableWindow.hxx4
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx39
-rw-r--r--dbaccess/source/ui/relationdesign/RelationDesignView.cxx6
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx41
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx149
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx74
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx45
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx221
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx56
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx88
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignControl.cxx35
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx79
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignView.cxx132
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldControl.cxx22
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldControl.hxx16
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx203
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx60
-rw-r--r--dbaccess/source/ui/tabledesign/TableRow.cxx98
-rw-r--r--dbaccess/source/ui/tabledesign/TableRowExchange.cxx14
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.cxx43
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.hxx28
-rw-r--r--dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx6
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx29
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.hxx8
-rw-r--r--dbaccess/source/ui/uno/ColumnModel.cxx42
-rw-r--r--dbaccess/source/ui/uno/ColumnModel.hxx12
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.cxx26
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.hxx4
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.cxx6
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.hxx5
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx11
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx5
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.cxx6
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.hxx5
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.cxx6
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.hxx5
-rw-r--r--dbaccess/source/ui/uno/admindlg.cxx37
-rw-r--r--dbaccess/source/ui/uno/admindlg.hxx5
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.cxx65
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.hxx10
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx341
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.cxx51
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.hxx6
-rw-r--r--dbaccess/source/ui/uno/textconnectionsettings_uno.cxx48
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.cxx36
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.hxx10
-rw-r--r--dbaccess/source/ui/uno/unoadmin.cxx20
-rw-r--r--dbaccess/source/ui/uno/unosqlmessage.cxx5
594 files changed, 14891 insertions, 18679 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index b21d7cbbb666..75b369885e3b 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -27,12 +27,8 @@ using namespace dbaccess;
using namespace ::connectivity;
using namespace ::dbtools;
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 ::com::sun::star::lang;
-using namespace ::osl;
void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter)
{
@@ -142,56 +138,56 @@ void OBookmarkSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate >& _
break;
case DataType::CHAR:
case DataType::VARCHAR:
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIGINT:
if ( _rValue.isSigned() )
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
else
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIT:
case DataType::BOOLEAN:
- _xParameter->updateBoolean(nPos,bool(_rValue));
+ _xParameter->updateBoolean(nPos,_rValue.getBool());
break;
case DataType::TINYINT:
if ( _rValue.isSigned() )
- _xParameter->updateByte(nPos,_rValue);
+ _xParameter->updateByte(nPos,_rValue.getInt8());
else
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
break;
case DataType::SMALLINT:
if ( _rValue.isSigned() )
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
else
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
break;
case DataType::INTEGER:
if ( _rValue.isSigned() )
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
else
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
break;
case DataType::FLOAT:
- _xParameter->updateFloat(nPos,_rValue);
+ _xParameter->updateFloat(nPos,_rValue.getFloat());
break;
case DataType::DOUBLE:
case DataType::REAL:
- _xParameter->updateDouble(nPos,_rValue);
+ _xParameter->updateDouble(nPos,_rValue.getDouble());
break;
case DataType::DATE:
- _xParameter->updateDate(nPos,_rValue);
+ _xParameter->updateDate(nPos,_rValue.getDate());
break;
case DataType::TIME:
- _xParameter->updateTime(nPos,_rValue);
+ _xParameter->updateTime(nPos,_rValue.getTime());
break;
case DataType::TIMESTAMP:
- _xParameter->updateTimestamp(nPos,_rValue);
+ _xParameter->updateTimestamp(nPos,_rValue.getDateTime());
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- _xParameter->updateBytes(nPos,_rValue);
+ _xParameter->updateBytes(nPos,_rValue.getSequence());
break;
case DataType::BLOB:
case DataType::CLOB:
diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx
index 6567d50b75b6..9863a80ecb82 100644
--- a/dbaccess/source/core/api/BookmarkSet.hxx
+++ b/dbaccess/source/core/api/BookmarkSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_BOOKMARKSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_BOOKMARKSET_HXX
+#pragma once
#include "CacheSet.hxx"
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -54,6 +53,5 @@ namespace dbaccess
virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_BOOKMARKSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CIndexes.cxx b/dbaccess/source/core/api/CIndexes.cxx
index 409d877288b8..8cf1c601d85a 100644
--- a/dbaccess/source/core/api/CIndexes.cxx
+++ b/dbaccess/source/core/api/CIndexes.cxx
@@ -25,16 +25,13 @@ using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbaccess;
-using namespace cppu;
-ObjectType OIndexes::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OIndexes::createObject(const OUString& _rName)
{
- ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if ( m_xIndexes.is() && m_xIndexes->hasByName(_rName) )
xRet.set(m_xIndexes->getByName(_rName),UNO_QUERY);
else
@@ -53,7 +50,7 @@ Reference< XPropertySet > OIndexes::createDescriptor()
}
// XAppend
-ObjectType OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
Reference<XAppend> xData( m_xIndexes,UNO_QUERY);
if ( !xData.is() )
diff --git a/dbaccess/source/core/api/CIndexes.hxx b/dbaccess/source/core/api/CIndexes.hxx
index 0ee3d5ced152..953811e94e82 100644
--- a/dbaccess/source/core/api/CIndexes.hxx
+++ b/dbaccess/source/core/api/CIndexes.hxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CINDEXES_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CINDEXES_HXX
+#pragma once
#include <connectivity/TIndexes.hxx>
+#include <utility>
namespace dbaccess
{
@@ -28,23 +28,21 @@ namespace dbaccess
{
css::uno::Reference< css::container::XNameAccess > m_xIndexes;
protected:
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual connectivity::sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
public:
OIndexes(connectivity::OTableHelper* _pTable,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector,
- const css::uno::Reference< css::container::XNameAccess >& _rxIndexes
+ css::uno::Reference< css::container::XNameAccess > _rxIndexes
) : connectivity::OIndexesHelper(_pTable,_rMutex,_rVector)
- ,m_xIndexes(_rxIndexes)
+ ,m_xIndexes(std::move(_rxIndexes))
{}
virtual void disposing() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_CINDEXES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx
index cef90a8e8521..98435b7c4498 100644
--- a/dbaccess/source/core/api/CRowSetColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetColumn.cxx
@@ -19,9 +19,11 @@
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
#include "CRowSetColumn.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
@@ -42,31 +44,30 @@ ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData
::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_SEQUENCE(21)
-
- DECL_PROP1( CATALOGNAME, OUString, READONLY );
- DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY );
- DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY );
- DECL_PROP1_BOOL( ISCURRENCY, READONLY );
- DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY );
- DECL_PROP1( ISNULLABLE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISREADONLY, BOUND );
- DECL_PROP1_BOOL( ISROWVERSION, READONLY );
- DECL_PROP1_BOOL( ISSEARCHABLE, READONLY );
- DECL_PROP1_BOOL( ISSIGNED, READONLY );
- DECL_PROP1_BOOL( ISWRITABLE, READONLY );
- DECL_PROP1( LABEL, OUString, READONLY );
- DECL_PROP1( PRECISION, sal_Int32, READONLY );
- DECL_PROP1( SCALE, sal_Int32, READONLY );
- DECL_PROP1( SCHEMANAME, OUString, READONLY );
- DECL_PROP1( SERVICENAME, OUString, READONLY );
- DECL_PROP1( TABLENAME, OUString, READONLY );
- DECL_PROP1( TYPE, sal_Int32, READONLY );
- DECL_PROP1( TYPENAME, OUString, READONLY );
- DECL_PROP2( VALUE, Any, READONLY, BOUND );
-
- END_PROPERTY_SEQUENCE()
+ css::uno::Sequence< css::beans::Property> aDescriptor
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_DISPLAYSIZE, PROPERTY_ID_DISPLAYSIZE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCASESENSITIVE, PROPERTY_ID_ISCASESENSITIVE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISDEFINITELYWRITABLE, PROPERTY_ID_ISDEFINITELYWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSEARCHABLE, PROPERTY_ID_ISSEARCHABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSIGNED, PROPERTY_ID_ISSIGNED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISWRITABLE, PROPERTY_ID_ISWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LABEL, PROPERTY_ID_LABEL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SERVICENAME, PROPERTY_ID_SERVICENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_VALUE, PROPERTY_ID_VALUE, cppu::UnoType<Any>::get(), css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::BOUND}
+ };
Sequence< Property > aRegisteredProperties;
describeProperties( aRegisteredProperties );
diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx
index 25c4b3310705..bc0ae7eedf5a 100644
--- a/dbaccess/source/core/api/CRowSetColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetColumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETCOLUMN_HXX
+#pragma once
#include "RowSetRow.hxx"
#include <connectivity/CommonTools.hxx>
@@ -47,6 +46,4 @@ namespace dbaccess
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETCOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index f1d845e11517..fa99533c0f61 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -20,11 +20,12 @@
#include "CRowSetDataColumn.hxx"
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
+#include <utility>
using namespace dbaccess;
using namespace comphelper;
@@ -34,7 +35,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace cppu;
using namespace osl;
@@ -44,13 +44,13 @@ ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >& _x
const Reference < XRowUpdate >& _xRowUpdate,
sal_Int32 _nPos,
const Reference< XDatabaseMetaData >& _rxDBMeta,
- const OUString& _rDescription,
- const OUString& i_sLabel,
- const std::function<const ORowSetValue& (sal_Int32)> &_getValue)
+ OUString i_sDescription,
+ OUString i_sLabel,
+ std::function<const ORowSetValue& (sal_Int32)> _getValue)
:ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
- ,m_pGetValue(_getValue)
- ,m_sLabel(i_sLabel)
- ,m_aDescription(_rDescription)
+ ,m_pGetValue(std::move(_getValue))
+ ,m_sLabel(std::move(i_sLabel))
+ ,m_aDescription(std::move(i_sDescription))
{
OColumnSettings::registerProperties( *this );
registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, PropertyAttribute::READONLY, &m_aDescription, cppu::UnoType<decltype(m_aDescription)>::get() );
@@ -63,31 +63,30 @@ ORowSetDataColumn::~ORowSetDataColumn()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* ORowSetDataColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_SEQUENCE(21)
-
- DECL_PROP1( CATALOGNAME, OUString, READONLY );
- DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY );
- DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY );
- DECL_PROP1_BOOL( ISCURRENCY, READONLY );
- DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY );
- DECL_PROP1( ISNULLABLE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISREADONLY, BOUND );
- DECL_PROP1_BOOL( ISROWVERSION, READONLY );
- DECL_PROP1_BOOL( ISSEARCHABLE, READONLY );
- DECL_PROP1_BOOL( ISSIGNED, READONLY );
- DECL_PROP1_BOOL( ISWRITABLE, READONLY );
- DECL_PROP1( LABEL, OUString, READONLY );
- DECL_PROP1( PRECISION, sal_Int32, READONLY );
- DECL_PROP1( SCALE, sal_Int32, READONLY );
- DECL_PROP1( SCHEMANAME, OUString, READONLY );
- DECL_PROP1( SERVICENAME, OUString, READONLY );
- DECL_PROP1( TABLENAME, OUString, READONLY );
- DECL_PROP1( TYPE, sal_Int32, READONLY );
- DECL_PROP1( TYPENAME, OUString, READONLY );
- DECL_PROP1( VALUE, Any, BOUND );
-
- END_PROPERTY_SEQUENCE()
+ css::uno::Sequence< css::beans::Property> aDescriptor
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_DISPLAYSIZE, PROPERTY_ID_DISPLAYSIZE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCASESENSITIVE, PROPERTY_ID_ISCASESENSITIVE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISDEFINITELYWRITABLE, PROPERTY_ID_ISDEFINITELYWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSEARCHABLE, PROPERTY_ID_ISSEARCHABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSIGNED, PROPERTY_ID_ISSIGNED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISWRITABLE, PROPERTY_ID_ISWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LABEL, PROPERTY_ID_LABEL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SERVICENAME, PROPERTY_ID_SERVICENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_VALUE, PROPERTY_ID_VALUE, cppu::UnoType<Any>::get(), css::beans::PropertyAttribute::BOUND }
+ };
Sequence< Property > aRegisteredProperties;
describeProperties( aRegisteredProperties );
@@ -193,12 +192,12 @@ void ORowSetDataColumn::fireValueChange(const ORowSetValue& _rOldValue)
ORowSetDataColumns::ORowSetDataColumns(
bool _bCase,
- const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ ::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector
) : connectivity::sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
- ,m_aColumns(_rColumns)
+ ,m_aColumns(std::move(_xColumns))
{
}
@@ -206,9 +205,9 @@ ORowSetDataColumns::~ORowSetDataColumns()
{
}
-sdbcx::ObjectType ORowSetDataColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > ORowSetDataColumns::createObject(const OUString& _rName)
{
- connectivity::sdbcx::ObjectType xNamed;
+ css::uno::Reference< css::beans::XPropertySet > xNamed;
::comphelper::UStringMixEqual aCase(isCaseSensitive());
::connectivity::OSQLColumns::Vector::const_iterator first = ::connectivity::find(m_aColumns->begin(),m_aColumns->end(),_rName,aCase);
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx
index 24863cb0a2ce..cc8157c96055 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETDATACOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETDATACOLUMN_HXX
+#pragma once
#include "datacolumn.hxx"
#include "RowSetRow.hxx"
@@ -50,9 +49,9 @@ namespace dbaccess
const css::uno::Reference < css::sdbc::XRowUpdate >& _xRowUpdate,
sal_Int32 _nPos,
const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMeta,
- const OUString& _rDescription,
- const OUString& i_sLabel,
- const std::function<const ::connectivity::ORowSetValue& (sal_Int32)> &_getValue);
+ OUString i_sDescription,
+ OUString i_sLabel,
+ std::function<const ::connectivity::ORowSetValue& (sal_Int32)> _getValue);
// css::lang::XTypeProvider
@@ -80,12 +79,12 @@ namespace dbaccess
{
::rtl::Reference< ::connectivity::OSQLColumns> m_aColumns;
protected:
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual void impl_refresh() override;
public:
ORowSetDataColumns(
bool _bCase,
- const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ ::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector
@@ -97,6 +96,4 @@ namespace dbaccess
};
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index 92c1484edd75..064d020e87cd 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -36,6 +36,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace comphelper;
@@ -49,7 +50,6 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io;
-using namespace ::osl;
OCacheSet::OCacheSet(sal_Int32 i_nMaxRows)
@@ -120,7 +120,7 @@ OCacheSet::~OCacheSet()
}
catch(Exception&)
{
- SAL_WARN("dbaccess", "Exception occurred");
+ TOOLS_WARN_EXCEPTION("dbaccess", "");
}
catch(...)
{
@@ -159,14 +159,14 @@ void OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQ
connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->end();
for(; aIter != aEnd;++aIter)
{
- aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) ).append(",");
+ aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + ",");
aValues.append("?,");
}
aSql[aSql.getLength() - 1] = ')';
aValues[aValues.getLength() - 1] = ')';
- aSql.append(aValues.makeStringAndClear());
+ aSql.append(aValues);
// now create end execute the prepared statement
{
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
@@ -226,8 +226,8 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
sal_Int32 nCheckCount = 1; // index for the original values
sal_Int32 i = 1;
- OUString sIsNull(" IS NULL");
- OUString sParam(" = ?");
+ OUString sIsNull(u" IS NULL"_ustr);
+ OUString sParam(u" = ?"_ustr);
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->begin()+1;
ORowVector< ORowSetValue >::Vector::const_iterator aEnd = _rRow->end();
for(; aIter != aEnd;++aIter,++nCheckCount,++i)
@@ -260,7 +260,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
}
if(aIter->isModified())
{
- _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) ).append("?,");
+ _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + "?,");
}
}
}
@@ -281,7 +281,7 @@ void OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOri
{
aCondition.setLength(aCondition.getLength()-5);
- aSql.append(" WHERE " ).append( aCondition.makeStringAndClear());
+ aSql.append(" WHERE " + aCondition);
}
else
::dbtools::throwSQLException(
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 522d77fafc01..1006b9662f01 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CACHESET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CACHESET_HXX
+#pragma once
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
@@ -169,6 +168,5 @@ namespace dbaccess
virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_CACHESET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx
index 0e8b2926c37e..7936be564af9 100644
--- a/dbaccess/source/core/api/FilteredContainer.cxx
+++ b/dbaccess/source/core/api/FilteredContainer.cxx
@@ -26,7 +26,7 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <tools/wldcrd.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <optional>
#include <sal/log.hxx>
@@ -34,12 +34,8 @@ namespace dbaccess
{
using namespace dbtools;
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::util;
using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
@@ -75,15 +71,11 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
return nShiftPos;
}
- static bool lcl_isElementAllowed( const OUString& _rName,
+ static bool lcl_isElementAllowed(std::u16string_view _rName,
const Sequence< OUString >& _rTableFilter,
const std::vector< WildCard >& _rWCSearch )
{
- sal_Int32 nTableFilterLen = _rTableFilter.getLength();
-
- const OUString* tableFilter = _rTableFilter.getConstArray();
- const OUString* tableFilterEnd = _rTableFilter.getConstArray() + nTableFilterLen;
- bool bFilterMatch = std::find( tableFilter, tableFilterEnd, _rName ) != tableFilterEnd;
+ bool bFilterMatch = std::find(_rTableFilter.begin(), _rTableFilter.end(), _rName) != _rTableFilter.end();
// the table is allowed to "pass" if we had no filters at all or any of the non-wildcard filters matches
if (!bFilterMatch && !_rWCSearch.empty())
{ // or if one of the wildcard expression matches
@@ -117,8 +109,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
TableInfo( const OUString& _catalog, const OUString& _schema, const OUString& _name,
const OUString& _type )
- :sComposedName()
- ,sType( _type )
+ :sType( _type )
,sCatalog( _catalog )
,sSchema( _schema )
,sName( _name )
@@ -133,7 +124,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
static void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData )
{
if ( !_metaData.is() )
- throw RuntimeException();
+ throw RuntimeException(u"lcl_ensureComposedName: _metaData cannot be null!"_ustr);
if ( !_io_tableInfo.sComposedName )
{
@@ -154,7 +145,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
lcl_ensureComposedName( _io_tableInfo, _metaData );
if ( !_masterContainer.is() )
- throw RuntimeException();
+ throw RuntimeException(u"lcl_ensureType: _masterContainer cannot be null!"_ustr);
OUString sTypeName;
try
@@ -169,7 +160,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
_io_tableInfo.sType = OptionalString( sTypeName );
}
- static ::std::vector< OUString> lcl_filter( const TableInfos& _unfilteredTables,
+ static ::std::vector< OUString> lcl_filter( TableInfos&& _unfilteredTables,
const Sequence< OUString >& _tableFilter, const Sequence< OUString >& _tableTypeFilter,
const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer )
{
@@ -180,7 +171,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
bool dontFilterTableNames = ( ( nTableFilterCount == 1 ) && _tableFilter[0] == "%" );
if( dontFilterTableNames )
{
- aFilteredTables = _unfilteredTables;
+ aFilteredTables = std::move(_unfilteredTables);
}
else
{
@@ -190,7 +181,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
Sequence< OUString > aNonWildCardTableFilter = _tableFilter;
nTableFilterCount = createWildCardVector( aNonWildCardTableFilter, aWildCardTableFilter );
- TableInfos aUnfilteredTables( _unfilteredTables );
+ TableInfos aUnfilteredTables( std::move(_unfilteredTables) );
aUnfilteredTables.reserve( nTableFilterCount + ( aWildCardTableFilter.size() * 10 ) );
for (auto & unfilteredTable : aUnfilteredTables)
@@ -212,15 +203,12 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
TableInfos aUnfilteredTables;
aUnfilteredTables.swap( aFilteredTables );
- const OUString* pTableTypeFilterBegin = _tableTypeFilter.getConstArray();
- const OUString* pTableTypeFilterEnd = pTableTypeFilterBegin + _tableTypeFilter.getLength();
-
for (auto & unfilteredTable : aUnfilteredTables)
{
// ensure that we know the table type
lcl_ensureType( unfilteredTable, _metaData, _masterContainer );
- if ( std::find( pTableTypeFilterBegin, pTableTypeFilterEnd, *unfilteredTable.sType ) != pTableTypeFilterEnd )
+ if (std::find(_tableTypeFilter.begin(), _tableTypeFilter.end(), *unfilteredTable.sType) != _tableTypeFilter.end())
aFilteredTables.push_back(unfilteredTable);
}
}
@@ -272,13 +260,12 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
TableInfos aUnfilteredTables;
- Sequence< OUString > aNames = m_xMasterContainer->getElementNames();
- const OUString* name = aNames.getConstArray();
- const OUString* nameEnd = name + aNames.getLength();
- for ( ; name != nameEnd; ++name )
- aUnfilteredTables.emplace_back( *name );
+ Sequence<OUString> aNames = m_xMasterContainer->getElementNames();
+ aUnfilteredTables.reserve(aNames.getLength());
+ for (auto& name : aNames)
+ aUnfilteredTables.emplace_back(name);
- reFill( lcl_filter( aUnfilteredTables,
+ reFill( lcl_filter( std::move(aUnfilteredTables),
_rTableFilter, _rTableTypeFilter, m_xMetaData, m_xMasterContainer ) );
m_bConstructed = true;
@@ -313,22 +300,16 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
{
if ( _rTableTypeFilter.hasElements() )
{
- const OUString* tableType = _rTableTypeFilter.getConstArray();
- const OUString* tableTypeEnd = tableType + _rTableTypeFilter.getLength();
- for ( ; tableType != tableTypeEnd; ++tableType )
- {
- if ( *tableType == sInherentTableTypeRestriction )
- break;
- }
- if ( tableType == tableTypeEnd )
+ if (std::find(_rTableTypeFilter.begin(), _rTableTypeFilter.end(),
+ sInherentTableTypeRestriction)
+ == _rTableTypeFilter.end())
{ // the only table type which can be part of this container is not allowed
// by the externally provided table type filter.
m_bConstructed = true;
return;
}
}
- aTableTypeFilter.realloc( 1 );
- aTableTypeFilter[0] = sInherentTableTypeRestriction;
+ aTableTypeFilter = { sInherentTableTypeRestriction };
}
else
{
@@ -343,7 +324,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
}
}
- static const char sAll[] = "%";
+ static constexpr OUString sAll = u"%"_ustr;
Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter );
Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW );
@@ -360,7 +341,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
aUnfilteredTables.emplace_back( sCatalog, sSchema, sName, sType );
}
- reFill( lcl_filter( aUnfilteredTables,
+ reFill( lcl_filter( std::move(aUnfilteredTables),
_rTableFilter, aTableTypeFilter, m_xMetaData, nullptr ) );
disposeComponent( xTables );
@@ -400,7 +381,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
}
}
- OUString OFilteredContainer::getNameForObject(const ObjectType& _xObject)
+ OUString OFilteredContainer::getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject)
{
OSL_ENSURE( _xObject.is(), "OFilteredContainer::getNameForObject: Object is NULL!" );
return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::EComposeRule::InDataManipulation, false );
@@ -427,14 +408,14 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
// obtain the data source we belong to, and the TableTypeFilterMode setting
Any aFilterModeSetting;
- if ( getDataSourceSetting( getDataSource( Reference< XInterface >(m_rParent) ), "TableTypeFilterMode", aFilterModeSetting ) )
+ if (getDataSourceSetting(getDataSource(Reference<XInterface>(m_rParent)), u"TableTypeFilterMode"_ustr, aFilterModeSetting))
{
OSL_VERIFY( aFilterModeSetting >>= nFilterMode );
}
- const OUString sAll( "%" );
- const OUString sView( "VIEW" );
- const OUString sTable( "TABLE" );
+ static constexpr OUString sAll( u"%"_ustr );
+ static constexpr OUString sView( u"VIEW"_ustr );
+ static constexpr OUString sTable( u"TABLE"_ustr );
switch ( nFilterMode )
{
@@ -442,19 +423,13 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
SAL_WARN("dbaccess", "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" );
[[fallthrough]];
case FILTER_MODE_MIX_ALL:
- _rFilter.realloc( 3 );
- _rFilter[0] = sView;
- _rFilter[1] = sTable;
- _rFilter[2] = sAll;
+ _rFilter = { sView, sTable, sAll };
break;
case FILTER_MODE_FIXED:
- _rFilter.realloc( 2 );
- _rFilter[0] = sView;
- _rFilter[1] = sTable;
+ _rFilter = { sView, sTable };
break;
case FILTER_MODE_WILDCARD:
- _rFilter.realloc( 1 );
- _rFilter[0] = sAll;
+ _rFilter = { sAll };
break;
case FILTER_MODE_STANDARD:
_rFilter.realloc( 0 );
diff --git a/dbaccess/source/core/api/HelperCollections.cxx b/dbaccess/source/core/api/HelperCollections.cxx
index dfc18badc688..3f29b50fe9e1 100644
--- a/dbaccess/source/core/api/HelperCollections.cxx
+++ b/dbaccess/source/core/api/HelperCollections.cxx
@@ -20,6 +20,7 @@
#include "HelperCollections.hxx"
#include <strings.hxx>
+#include <utility>
#include <osl/diagnose.h>
@@ -30,23 +31,19 @@ namespace dbaccess
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::script;
using namespace ::cppu;
using namespace ::osl;
- OPrivateColumns::OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ OPrivateColumns::OPrivateColumns(::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
bool _bCase,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector,
bool _bUseAsIndex
) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector,_bUseAsIndex)
- ,m_aColumns(_rColumns)
+ ,m_aColumns(std::move(_xColumns))
{
}
@@ -74,30 +71,30 @@ namespace dbaccess
OPrivateColumns_Base::disposing();
}
- connectivity::sdbcx::ObjectType OPrivateColumns::createObject(const OUString& _rName)
+ css::uno::Reference< css::beans::XPropertySet > OPrivateColumns::createObject(const OUString& _rName)
{
if ( m_aColumns.is() )
{
- ::connectivity::OSQLColumns::Vector::const_iterator aIter = find(m_aColumns->begin(),m_aColumns->end(),_rName,isCaseSensitive());
+ ::connectivity::OSQLColumns::Vector::const_iterator aIter = find(m_aColumns->begin(),m_aColumns->end(),_rName,UStringMixEqual(isCaseSensitive()));
if(aIter == m_aColumns->end())
- aIter = findRealName(m_aColumns->begin(),m_aColumns->end(),_rName,isCaseSensitive());
+ aIter = findRealName(m_aColumns->begin(),m_aColumns->end(),_rName,UStringMixEqual(isCaseSensitive()));
if(aIter != m_aColumns->end())
- return connectivity::sdbcx::ObjectType(*aIter,UNO_QUERY);
+ return *aIter;
OSL_FAIL("Column not found in collection!");
}
return nullptr;
}
- connectivity::sdbcx::ObjectType OPrivateTables::createObject(const OUString& _rName)
+ css::uno::Reference< css::beans::XPropertySet > OPrivateTables::createObject(const OUString& _rName)
{
if ( !m_aTables.empty() )
{
OSQLTables::iterator aIter = m_aTables.find(_rName);
OSL_ENSURE(aIter != m_aTables.end(),"Table not found!");
OSL_ENSURE(aIter->second.is(),"Table is null!");
- return connectivity::sdbcx::ObjectType(m_aTables.find(_rName)->second,UNO_QUERY);
+ return css::uno::Reference< css::beans::XPropertySet >(m_aTables.find(_rName)->second,UNO_QUERY);
}
return nullptr;
}
diff --git a/dbaccess/source/core/api/HelperCollections.hxx b/dbaccess/source/core/api/HelperCollections.hxx
index c2406dc492aa..f0f38c80a48e 100644
--- a/dbaccess/source/core/api/HelperCollections.hxx
+++ b/dbaccess/source/core/api/HelperCollections.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <connectivity/dbconversion.hxx>
@@ -26,15 +25,10 @@
namespace dbaccess
{
using namespace dbtools;
- using namespace comphelper;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::script;
using namespace ::cppu;
using namespace ::osl;
@@ -44,14 +38,14 @@ namespace dbaccess
{
::rtl::Reference< ::connectivity::OSQLColumns> m_aColumns;
protected:
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual void impl_refresh() override {}
virtual Reference< XPropertySet > createDescriptor() override
{
return nullptr;
}
public:
- OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ OPrivateColumns(::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
bool _bCase,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
@@ -77,20 +71,20 @@ namespace dbaccess
{
OSQLTables m_aTables;
protected:
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual void impl_refresh() override {}
virtual Reference< XPropertySet > createDescriptor() override
{
return nullptr;
}
public:
- OPrivateTables( const OSQLTables& _rTables,
+ OPrivateTables( OSQLTables _rTables,
bool _bCase,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
- const std::vector< OUString> &_rVector
+ std::vector< OUString> && _rVector
) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
- ,m_aTables(_rTables)
+ ,m_aTables(std::move(_rTables))
{
}
virtual void disposing() override
@@ -103,6 +97,5 @@ namespace dbaccess
}
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index c9f9ac8a3e22..90775495b96d 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -18,6 +18,8 @@
*/
#include <memory>
+#include <string_view>
+
#include "KeySet.hxx"
#include <sal/log.hxx>
#include <core_resource.hxx>
@@ -38,13 +40,13 @@
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
#include <comphelper/types.hxx>
-#include <com/sun/star/sdbcx/KeyType.hpp>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbexception.hxx>
#include <algorithm>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <composertools.hxx>
+#include <utility>
#include "PrivateRow.hxx"
using namespace dbaccess;
@@ -61,7 +63,6 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star;
using namespace ::cppu;
-using namespace ::osl;
using std::vector;
namespace
@@ -102,17 +103,17 @@ namespace
}
-OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
- const OUString& _rUpdateTableName, // this can be the alias or the full qualified name
+OKeySet::OKeySet(connectivity::OSQLTable _xTable,
+ OUString _sUpdateTableName, // this can be the alias or the full qualified name
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
sal_Int32 i_nMaxRows,
sal_Int32& o_nRowCount)
:OCacheSet(i_nMaxRows)
,m_aParameterValueForCache(new ORowSetValueVector(_aParameterValueForCache))
- ,m_xTable(_xTable)
+ ,m_xTable(std::move(_xTable))
,m_xComposer(_xComposer)
- ,m_sUpdateTableName(_rUpdateTableName)
+ ,m_sUpdateTableName(std::move(_sUpdateTableName))
,m_rRowCount(o_nRowCount)
,m_bRowCountFinal(false)
{
@@ -135,10 +136,10 @@ void OKeySet::initColumns()
{
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
bool bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers();
- m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) );
- m_pColumnNames.reset( new SelectColumnsMetaData(bCase) );
- m_pParameterNames.reset( new SelectColumnsMetaData(bCase) );
- m_pForeignColumnNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pKeyColumnNames.reset( new SelectColumnsMetaData(comphelper::UStringMixLess(bCase)) );
+ m_pColumnNames.reset( new SelectColumnsMetaData(comphelper::UStringMixLess(bCase)) );
+ m_pParameterNames.reset( new SelectColumnsMetaData(comphelper::UStringMixLess(bCase)) );
+ m_pForeignColumnNames.reset( new SelectColumnsMetaData(comphelper::UStringMixLess(bCase)) );
}
void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable,
@@ -160,10 +161,11 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable,
Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
const sal_Int32 nParaCount = xQueryParameters->getCount();
Sequence< OUString> aParameterColumns(nParaCount);
+ auto aParameterColumnsRange = asNonConstRange(aParameterColumns);
for(sal_Int32 i = 0; i< nParaCount;++i)
{
Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
- xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
+ xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumnsRange[i];
}
OUString sUpdateTableName( i_rUpdateTableName );
@@ -193,7 +195,7 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable,
if ( o_pKeyColumnNames->empty() )
{
- ::dbtools::throwGenericSQLException("Could not find any key column.", *this );
+ ::dbtools::throwGenericSQLException(u"Could not find any key column."_ustr, *this );
}
for (auto const& keyColumn : *o_pKeyColumnNames)
@@ -210,20 +212,20 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable,
namespace
{
- void appendOneKeyColumnClause( const OUString &tblName, const OUString &colName, const connectivity::ORowSetValue &_rValue, OUStringBuffer &o_buf )
+ void appendOneKeyColumnClause( std::u16string_view tblName, const OUString &colName, const connectivity::ORowSetValue &_rValue, OUStringBuffer &o_buf )
{
OUString fullName;
- if (tblName.isEmpty())
+ if (tblName.empty())
fullName = colName;
else
- fullName = tblName + "." + colName;
+ fullName = OUString::Concat(tblName) + "." + colName;
if ( _rValue.isNull() )
{
- o_buf.append(fullName).append(" IS NULL ");
+ o_buf.append(fullName + " IS NULL ");
}
else
{
- o_buf.append(fullName).append(" = ? ");
+ o_buf.append(fullName + " = ? ");
}
}
}
@@ -243,7 +245,7 @@ void OKeySet::setOneKeyColumnParameter( sal_Int32 &nPos, const Reference< XParam
OUStringBuffer OKeySet::createKeyFilter()
{
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->begin();
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.m_aRowSetRow->begin();
static const char aAnd[] = " AND ";
const OUString aQuote = getIdentifierQuoteString();
@@ -280,7 +282,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
Reference<XColumnsSupplier> xQueryColSup(m_xComposer, UNO_QUERY);
const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
- findTableColumnsMatching_throw( makeAny(m_xTable), m_sUpdateTableName, xMeta, xQueryColumns, m_pKeyColumnNames );
+ findTableColumnsMatching_throw( Any(m_xTable), m_sUpdateTableName, xMeta, xQueryColumns, m_pKeyColumnNames );
Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
@@ -291,13 +293,11 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin
const Sequence< OUString> aSeq = xSelectTables->getElementNames();
if ( aSeq.getLength() > 1 ) // special handling for join
{
- const OUString* pIter = aSeq.getConstArray();
- const OUString* const pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& name : aSeq)
{
- if ( *pIter != m_sUpdateTableName )
+ if (name != m_sUpdateTableName)
{
- connectivity::OSQLTable xSelColSup(xSelectTables->getByName(*pIter),uno::UNO_QUERY);
+ connectivity::OSQLTable xSelColSup(xSelectTables->getByName(name), uno::UNO_QUERY);
Reference<XPropertySet> xProp(xSelColSup,uno::UNO_QUERY);
OUString sSelectTableName = ::dbtools::composeTableName( xMeta, xProp, ::dbtools::EComposeRule::InDataManipulation, false );
@@ -311,7 +311,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin
// the first row is empty because it's now easier for us to distinguish when we are beforefirst or first
// without extra variable to be set
- OKeySetValue keySetValue(nullptr,std::pair<sal_Int32,Reference<XRow> >(0,Reference<XRow>()));
+ OKeySetValue keySetValue{nullptr,0,nullptr};
m_aKeyMap.emplace(0, keySetValue);
m_aKeyIter = m_aKeyMap.begin();
}
@@ -321,7 +321,7 @@ void OKeySet::reset(const Reference< XResultSet>& _xDriverSet)
OCacheSet::construct(_xDriverSet, m_sRowSetFilter);
m_bRowCountFinal = false;
m_aKeyMap.clear();
- OKeySetValue keySetValue(nullptr,std::pair<sal_Int32,Reference<XRow> >(0,Reference<XRow>()));
+ OKeySetValue keySetValue{nullptr,0,nullptr};
m_aKeyMap.emplace(0,keySetValue);
m_aKeyIter = m_aKeyMap.begin();
}
@@ -331,8 +331,8 @@ void OKeySet::ensureStatement( )
// do we already have a statement for the current combination of NULLness
// of key & foreign columns?
std::vector<bool> FilterColumnsNULL;
- FilterColumnsNULL.reserve(m_aKeyIter->second.first->size());
- for (auto const& elem : *m_aKeyIter->second.first)
+ FilterColumnsNULL.reserve(m_aKeyIter->second.m_aRowSetRow->size());
+ for (auto const& elem : *m_aKeyIter->second.m_aRowSetRow)
FilterColumnsNULL.push_back(elem.isNull());
vStatements_t::const_iterator pNewStatement(m_vStatements.find(FilterColumnsNULL));
if(pNewStatement == m_vStatements.end())
@@ -373,19 +373,14 @@ void OKeySet::executeStatement(OUStringBuffer& io_aFilter, Reference<XSingleSele
io_xAnalyzer->setFilter(io_aFilter.makeStringAndClear());
if ( bFilterSet )
{
- Sequence< Sequence< PropertyValue > > aFilter2 = io_xAnalyzer->getStructuredFilter();
- const Sequence< PropertyValue >* pOr = aFilter2.getConstArray();
- const Sequence< PropertyValue >* pOrEnd = pOr + aFilter2.getLength();
- for(;pOr != pOrEnd;++pOr)
+ for (auto& rOr : io_xAnalyzer->getStructuredFilter())
{
- const PropertyValue* pAnd = pOr->getConstArray();
- const PropertyValue* pAndEnd = pAnd + pOr->getLength();
- for(;pAnd != pAndEnd;++pAnd)
+ for (auto& rAnd : rOr)
{
OUString sValue;
- if ( !(pAnd->Value >>= sValue) || !( sValue == "?" || sValue.startsWith( ":" ) ) )
+ if (!(rAnd.Value >>= sValue) || !(sValue == "?" || sValue.startsWith(":")))
{ // we have a criteria which has to be taken into account for updates
- m_aFilterColumns.push_back(pAnd->Name);
+ m_aFilterColumns.push_back(rAnd.Name);
}
}
}
@@ -404,7 +399,7 @@ Any OKeySet::getBookmark()
{
OSL_ENSURE(m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(),
"getBookmark is only possible when we stand on a valid row!");
- return makeAny(m_aKeyIter->first);
+ return Any(m_aKeyIter->first);
}
bool OKeySet::moveToBookmark( const Any& bookmark )
@@ -442,11 +437,11 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
OUStringBuffer aSql = "UPDATE " + m_aComposedTableName + " SET ";
// list all columns that should be set
- static OUString aPara(" = ?,");
+ static constexpr OUStringLiteral aPara(u" = ?,");
OUString aQuote = getIdentifierQuoteString();
- static OUString aAnd(" AND ");
- OUString sIsNull(" IS NULL");
- OUString sParam(" = ?");
+ static constexpr OUString aAnd(u" AND "_ustr);
+ OUString sIsNull(u" IS NULL"_ustr);
+ OUString sParam(u" = ?"_ustr);
// use keys and indexes for exact positioning
Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
@@ -461,7 +456,6 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
std::vector<sal_Int32> aIndexColumnPositions;
const sal_Int32 nOldLength = aSql.getLength();
- sal_Int32 i = 1;
// here we build the condition part for the update statement
for (auto const& columnName : *m_pColumnNames)
{
@@ -495,9 +489,8 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
}
if((*_rInsertRow)[columnName.second.nPosition].isModified())
{
- aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(aPara);
+ aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + aPara);
}
- ++i;
}
if( aSql.getLength() != nOldLength )
@@ -512,15 +505,15 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
aSql.append(" WHERE ");
if(!sKeyCondition.isEmpty() && !sIndexCondition.isEmpty())
{
- aSql.append(sKeyCondition.makeStringAndClear()).append(sIndexCondition.makeStringAndClear());
+ aSql.append(sKeyCondition + sIndexCondition);
}
else if(!sKeyCondition.isEmpty())
{
- aSql.append(sKeyCondition.makeStringAndClear());
+ aSql.append(sKeyCondition);
}
else if(!sIndexCondition.isEmpty())
{
- aSql.append(sIndexCondition.makeStringAndClear());
+ aSql.append(sIndexCondition);
}
aSql.setLength(aSql.getLength()-5); // remove the last AND
}
@@ -528,22 +521,21 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
::dbtools::throwSQLException( DBA_RES( RID_STR_NO_CONDITION_FOR_PK ), StandardSQLState::GENERAL_ERROR, m_xConnection );
// now create end execute the prepared statement
- executeUpdate(_rInsertRow ,_rOriginalRow,aSql.makeStringAndClear(),"",aIndexColumnPositions);
+ executeUpdate(_rInsertRow ,_rOriginalRow,aSql.makeStringAndClear(),u"",aIndexColumnPositions);
}
-void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const OUString& i_sSQL,const OUString& i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions)
+void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const OUString& i_sSQL,std::u16string_view i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions)
{
// now create end execute the prepared statement
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
bool bRefetch = true;
- Reference<XRow> xRow;
sal_Int32 i = 1;
// first the set values
for (auto const& columnName : *m_pColumnNames)
{
- if ( i_sTableName.isEmpty() || columnName.second.sTableName == i_sTableName )
+ if ( i_sTableName.empty() || columnName.second.sTableName == i_sTableName )
{
sal_Int32 nPos = columnName.second.nPosition;
if((*_rInsertRow)[nPos].isModified())
@@ -561,7 +553,7 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO
// and then the values of the where condition
for (auto const& keyColumnName : *m_pKeyColumnNames)
{
- if ( i_sTableName.isEmpty() || keyColumnName.second.sTableName == i_sTableName )
+ if ( i_sTableName.empty() || keyColumnName.second.sTableName == i_sTableName )
{
setParameter(i++,xParameter,(*_rOriginalRow)[keyColumnName.second.nPosition],keyColumnName.second.nType,keyColumnName.second.nScale);
}
@@ -582,9 +574,10 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO
{
const sal_Int32 nBookmark = ::comphelper::getINT32((*_rInsertRow)[0].getAny());
m_aKeyIter = m_aKeyMap.find(nBookmark);
- m_aKeyIter->second.second.first = 2;
- m_aKeyIter->second.second.second = xRow;
- copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
+ assert(m_aKeyIter != m_aKeyMap.end());
+ m_aKeyIter->second.m_nUpdateInsert = 2;
+ m_aKeyIter->second.m_xRow.clear();
+ copyRowValue(_rInsertRow, m_aKeyIter->second.m_aRowSetRow, nBookmark);
tryRefetch(_rInsertRow,bRefetch);
}
}
@@ -610,7 +603,7 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT
{
bRefetch = std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),columnName.second.sRealName) == m_aFilterColumns.end();
}
- aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(",");
+ aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + ",");
aValues.append("?,");
bModified = true;
}
@@ -620,12 +613,12 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT
aSql[aSql.getLength() - 1] = ')';
aValues[aValues.getLength() - 1] = ')';
- aSql.append(aValues.makeStringAndClear());
+ aSql.append(aValues);
// now create,fill and execute the prepared statement
- executeInsert(_rInsertRow,aSql.makeStringAndClear(),"",bRefetch);
+ executeInsert(_rInsertRow,aSql.makeStringAndClear(),u"",bRefetch);
}
-void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQL,const OUString& i_sTableName,bool bRefetch )
+void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQL,std::u16string_view i_sTableName,bool bRefetch )
{
// now create,fill and execute the prepared statement
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
@@ -634,7 +627,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
sal_Int32 i = 1;
for (auto const& columnName : *m_pColumnNames)
{
- if ( i_sTableName.isEmpty() || columnName.second.sTableName == i_sTableName )
+ if ( i_sTableName.empty() || columnName.second.sTableName == i_sTableName )
{
const sal_Int32 nPos = columnName.second.nPosition;
if((*_rInsertRow)[nPos].isModified())
@@ -704,7 +697,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
::comphelper::disposeComponent(xPrep);
- if ( i_sTableName.isEmpty() && !bAutoValuesFetched && m_bInserted )
+ if ( i_sTableName.empty() && !bAutoValuesFetched && m_bInserted )
{
// first check if all key column values were set
const OUString sQuote = getIdentifierQuoteString();
@@ -716,14 +709,14 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
SelectColumnsMetaData::const_iterator aFind = m_pKeyColumnNames->find(autoColumn);
if ( aFind != aEnd )
{
- sMaxStmt.append(" MAX(").append(::dbtools::quoteName( sQuote,aFind->second.sRealName)).append("),");
+ sMaxStmt.append(" MAX(" + ::dbtools::quoteName( sQuote,aFind->second.sRealName) + "),");
}
}
if(!sMaxStmt.isEmpty())
{
sMaxStmt[sMaxStmt.getLength()-1] = ' ';
- OUString sStmt = "SELECT " + sMaxStmt.makeStringAndClear() + "FROM ";
+ OUString sStmt = "SELECT " + sMaxStmt + "FROM ";
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
@@ -759,9 +752,9 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
- m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue(aKeyRow,std::pair<sal_Int32,Reference<XRow> >(1,Reference<XRow>())) ).first;
+ m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue{aKeyRow,1,nullptr} ).first;
// now we set the bookmark for this row
- (*_rInsertRow)[0] = makeAny(static_cast<sal_Int32>(m_aKeyIter->first));
+ (*_rInsertRow)[0] = Any(static_cast<sal_Int32>(m_aKeyIter->first));
tryRefetch(_rInsertRow,bRefetch);
}
}
@@ -781,7 +774,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch)
}
if ( !bRefetch )
{
- m_aKeyIter->second.second.second = new OPrivateRow(*_rInsertRow);
+ m_aKeyIter->second.m_xRow = new OPrivateRow(std::vector(*_rInsertRow));
}
}
@@ -804,7 +797,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow, ORowSetRow const & _rK
rtl::Reference aCopy(
new ORowSetValueVector(*m_aParameterValueForCache));
(*aCopy)[i] = (*_rInsertRow)[parameterName.second.nPosition];
- m_aUpdatedParameter[i_nBookmark] = aCopy;
+ m_aUpdatedParameter[i_nBookmark] = std::move(aCopy);
bChanged = true;
}
++aParaValuesIter;
@@ -884,7 +877,7 @@ void OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTa
}
}
}
- aSql.append(sIndexCondition.makeStringAndClear());
+ aSql.append(sIndexCondition);
aSql.setLength(aSql.getLength()-5);
// now create end execute the prepared statement
@@ -910,7 +903,9 @@ void OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTa
if(m_bDeleted)
{
sal_Int32 nBookmark = ::comphelper::getINT32((*_rDeleteRow)[0].getAny());
- if(m_aKeyIter == m_aKeyMap.find(nBookmark) && m_aKeyIter != m_aKeyMap.end())
+ const auto iter = m_aKeyMap.find(nBookmark);
+ assert(iter != m_aKeyMap.end());
+ if(m_aKeyIter == iter && m_aKeyIter != m_aKeyMap.end())
++m_aKeyIter;
m_aKeyMap.erase(nBookmark);
m_bDeleted = true;
@@ -1107,7 +1102,7 @@ bool OKeySet::doTryRefetch_throw()
}
// now set the primary key column values
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->begin();
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.m_aRowSetRow->begin();
for (auto const& keyColumnName : *m_pKeyColumnNames)
setOneKeyColumnParameter(nPos,xParameter,*aIter++,keyColumnName.second.nType,keyColumnName.second.nScale);
for (auto const& foreignColumnName : *m_pForeignColumnNames)
@@ -1125,9 +1120,9 @@ void OKeySet::refreshRow()
if(isBeforeFirst() || isAfterLast())
return;
- if ( m_aKeyIter->second.second.second.is() )
+ if ( m_aKeyIter->second.m_xRow.is() )
{
- m_xRow = m_aKeyIter->second.second.second;
+ m_xRow = m_aKeyIter->second.m_xRow;
return;
}
@@ -1202,7 +1197,7 @@ bool OKeySet::fetchRow()
aIter->fill(rColDesc.nPosition, rColDesc.nType, m_xRow);
++aIter;
}
- m_aKeyIter = m_aKeyMap.emplace( m_aKeyMap.rbegin()->first+1,OKeySetValue(aKeyRow,std::pair<sal_Int32,Reference<XRow> >(0,Reference<XRow>())) ).first;
+ m_aKeyIter = m_aKeyMap.emplace( m_aKeyMap.rbegin()->first+1,OKeySetValue{aKeyRow,0,nullptr} ).first;
}
else
m_bRowCountFinal = true;
@@ -1227,7 +1222,7 @@ bool OKeySet::fillAllRows()
sal_Bool SAL_CALL OKeySet::wasNull( )
{
if ( ! m_xRow.is() )
- throwGenericSQLException("Must call getFOO() for some FOO before wasNull()", *this);
+ throwGenericSQLException(u"Must call getFOO() for some FOO before wasNull()"_ustr, *this);
OSL_ENSURE(m_xRow.is(),"m_xRow is null! I've thrown, but function execution continued?");
return m_xRow->wasNull();
@@ -1238,7 +1233,7 @@ inline void OKeySet::ensureRowForData( )
if (! m_xRow.is() )
refreshRow();
if (! m_xRow.is() )
- throwSQLException("Failed to refetch row", "02000", *this, -2);
+ throwSQLException(u"Failed to refetch row"_ustr, u"02000"_ustr, *this, -2);
OSL_ENSURE(m_xRow.is(),"m_xRow is null! I've called throwSQLException but execution continued?");
}
@@ -1359,12 +1354,12 @@ Reference< XArray > SAL_CALL OKeySet::getArray( sal_Int32 columnIndex )
bool OKeySet::rowUpdated( )
{
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 2;
+ return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.m_nUpdateInsert == 2;
}
bool OKeySet::rowInserted( )
{
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 1;
+ return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.m_nUpdateInsert == 1;
}
bool OKeySet::rowDeleted( )
@@ -1379,32 +1374,27 @@ namespace dbaccess
void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
const css::uno::Sequence< OUString >& _aColumnNames,
- const OUString& _rsUpdateTableName,
+ std::u16string_view _rsUpdateTableName,
SelectColumnsMetaData& o_rColumnNames,
bool i_bAppendTableName)
{
// get the real name of the columns
- Sequence< OUString> aSelNames(_rxQueryColumns->getElementNames());
- const OUString* pSelIter = aSelNames.getConstArray();
- const OUString* pSelEnd = pSelIter + aSelNames.getLength();
-
- const OUString* pTblColumnIter = _aColumnNames.getConstArray();
- const OUString* pTblColumnEnd = pTblColumnIter + _aColumnNames.getLength();
-
::comphelper::UStringMixEqual bCase(o_rColumnNames.key_comp().isCaseSensitive());
- for(sal_Int32 nPos = 1;pSelIter != pSelEnd;++pSelIter,++nPos)
+ sal_Int32 nPos = 0;
+ for (auto& queryColumnName : _rxQueryColumns->getElementNames())
{
- Reference<XPropertySet> xQueryColumnProp(_rxQueryColumns->getByName(*pSelIter),UNO_QUERY_THROW);
+ ++nPos;
+ Reference<XPropertySet> xQueryColumnProp(_rxQueryColumns->getByName(queryColumnName),UNO_QUERY_THROW);
OUString sRealName,sTableName;
OSL_ENSURE(xQueryColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME),"Property REALNAME not available!");
OSL_ENSURE(xQueryColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_TABLENAME),"Property TABLENAME not available!");
xQueryColumnProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
xQueryColumnProp->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
- for(;pTblColumnIter != pTblColumnEnd;++pTblColumnIter)
+ for (auto& tableColumnName : _aColumnNames)
{
- if(bCase(sRealName,*pTblColumnIter) && bCase(_rsUpdateTableName,sTableName) && o_rColumnNames.find(*pTblColumnIter) == o_rColumnNames.end())
+ if(bCase(sRealName,tableColumnName) && bCase(_rsUpdateTableName,sTableName) && o_rColumnNames.find(tableColumnName) == o_rColumnNames.end())
{
sal_Int32 nType = 0;
xQueryColumnProp->getPropertyValue(PROPERTY_TYPE) >>= nType;
@@ -1429,12 +1419,11 @@ void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
{
sName = sRealName;
}
- o_rColumnNames[sName] = aColDesc;
+ o_rColumnNames[sName] = std::move(aColDesc);
break;
}
}
- pTblColumnIter = _aColumnNames.getConstArray();
}
}
}
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 417774cae70f..b23f89d4cedb 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -17,13 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_KEYSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_KEYSET_HXX
+#pragma once
#include "CacheSet.hxx"
+#include "PrivateRow.hxx"
#include <memory>
#include <map>
+#include <utility>
#include <vector>
#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
@@ -50,8 +51,8 @@ namespace dbaccess
{
}
- SelectColumnDescription( sal_Int32 _nPosition, sal_Int32 _nType, sal_Int32 _nScale,bool _bNullable, const OUString& _rDefaultValue )
- :sDefaultValue( _rDefaultValue )
+ SelectColumnDescription( sal_Int32 _nPosition, sal_Int32 _nType, sal_Int32 _nScale, bool _bNullable, OUString _sDefaultValue )
+ :sDefaultValue(std::move( _sDefaultValue ))
,nPosition( _nPosition )
,nType( _nType )
,nScale( _nScale )
@@ -64,11 +65,16 @@ namespace dbaccess
// the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME
void getColumnPositions(const css::uno::Reference< css::container::XNameAccess >& _rxQueryColumns,
const css::uno::Sequence< OUString >& _rColumnNames,
- const OUString& _rsUpdateTableName,
+ std::u16string_view _rsUpdateTableName,
SelectColumnsMetaData& o_rColumnNames /* out */,
bool i_bAppendTableName = false);
- typedef std::pair<ORowSetRow,std::pair<sal_Int32,css::uno::Reference< css::sdbc::XRow> > > OKeySetValue;
+ struct OKeySetValue
+ {
+ ORowSetRow m_aRowSetRow;
+ sal_Int32 m_nUpdateInsert;
+ rtl::Reference<OPrivateRow> m_xRow;
+ };
typedef std::map<sal_Int32,OKeySetValue > OKeySetMatrix;
typedef std::map<sal_Int32, rtl::Reference<ORowSetValueVector> > OUpdatedParameter;
// is used when the source supports keys
@@ -137,14 +143,14 @@ namespace dbaccess
/// @throws css::uno::RuntimeException
bool doTryRefetch_throw();
void tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch);
- void executeUpdate(const ORowSetRow& _rInsertRow, const ORowSetRow& _rOriginalRow, const OUString& i_sSQL, const OUString& i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions = std::vector<sal_Int32>());
- void executeInsert( const ORowSetRow& _rInsertRow, const OUString& i_sSQL, const OUString& i_sTableName, bool bRefetch = false);
+ void executeUpdate(const ORowSetRow& _rInsertRow, const ORowSetRow& _rOriginalRow, const OUString& i_sSQL, std::u16string_view i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions = std::vector<sal_Int32>());
+ void executeInsert( const ORowSetRow& _rInsertRow, const OUString& i_sSQL, std::u16string_view i_sTableName, bool bRefetch = false);
void executeStatement(OUStringBuffer& io_aFilter, css::uno::Reference< css::sdb::XSingleSelectQueryComposer>& io_xAnalyzer);
virtual ~OKeySet() override;
public:
- OKeySet(const connectivity::OSQLTable& _xTable,
- const OUString& _rUpdateTableName,
+ OKeySet(connectivity::OSQLTable _aTable,
+ OUString _sUpdateTableName,
const css::uno::Reference< css::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
sal_Int32 i_nMaxRows,
@@ -213,6 +219,5 @@ namespace dbaccess
virtual void insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_KEYSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 67fd18aaaea7..b58ce088a72b 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -23,7 +23,6 @@
#include <core_resource.hxx>
#include <strings.hrc>
#include <strings.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
@@ -36,27 +35,24 @@
#include <algorithm>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <composertools.hxx>
+#include "PrivateRow.hxx"
using namespace dbaccess;
using namespace ::connectivity;
using namespace ::dbtools;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star;
-using namespace ::cppu;
-using namespace ::osl;
typedef std::map<OUString, OUStringBuffer> TSQLStatements;
namespace
{
- void lcl_fillKeyCondition(const OUString& i_sTableName,const OUString& i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
+ void lcl_fillKeyCondition(const OUString& i_sTableName,std::u16string_view i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
{
OUStringBuffer& rKeyCondition = io_aKeyConditions[i_sTableName];
if ( !rKeyCondition.isEmpty() )
@@ -100,19 +96,16 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const OU
const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY);
const Reference<XNameAccess> xTables = xTabSup->getTables();
- const Sequence< OUString> aTableNames = xTables->getElementNames();
- const OUString* pTableNameIter = aTableNames.getConstArray();
- const OUString* pTableNameEnd = pTableNameIter + aTableNames.getLength();
- for( ; pTableNameIter != pTableNameEnd ; ++pTableNameIter)
+ for (auto& tableName : xTables->getElementNames())
{
- std::unique_ptr<SelectColumnsMetaData> pKeyColumNames(new SelectColumnsMetaData(bCase));
- findTableColumnsMatching_throw(xTables->getByName(*pTableNameIter),*pTableNameIter,xMeta,xQueryColumns,pKeyColumNames);
+ std::unique_ptr<SelectColumnsMetaData> pKeyColumNames(new SelectColumnsMetaData(comphelper::UStringMixLess(bCase)));
+ findTableColumnsMatching_throw(xTables->getByName(tableName),tableName,xMeta,xQueryColumns,pKeyColumNames);
m_pKeyColumnNames->insert(pKeyColumNames->begin(),pKeyColumNames->end());
}
// the first row is empty because it's now easier for us to distinguish when we are beforefirst or first
// without extra variable to be set
- OKeySetValue keySetValue(nullptr,std::pair<sal_Int32,Reference<XRow> >(0,Reference<XRow>()));
+ OKeySetValue keySetValue{nullptr,0,nullptr};
m_aKeyMap.emplace(0,keySetValue);
m_aKeyIter = m_aKeyMap.begin();
@@ -188,7 +181,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _
OUStringBuffer& rPart = aSql[columnName.second.sTableName];
if ( !rPart.isEmpty() )
rPart.append(", ");
- rPart.append(sQuotedColumnName).append(" = ?");
+ rPart.append(sQuotedColumnName + " = ?");
}
}
@@ -208,10 +201,10 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUStringBuffer sSql("UPDATE " + ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ) +
- " SET " + elem.second.toString());
+ " SET " + elem.second);
OUStringBuffer& rCondition = aKeyConditions[elem.first];
if ( !rCondition.isEmpty() )
- sSql.append(" WHERE ").append( rCondition.toString() );
+ sSql.append(" WHERE " + rCondition );
executeUpdate(_rInsertRow ,_rOriginalRow,sSql.makeStringAndClear(),elem.first);
}
@@ -266,14 +259,14 @@ void OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity:
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
- OUString sSql("INSERT INTO " + sComposedTableName + " ( " + elem.second.toString() +
- ") VALUES ( " + aParameter[elem.first].toString() + " )");
+ OUString sSql("INSERT INTO " + sComposedTableName + " ( " + elem.second +
+ ") VALUES ( " + aParameter[elem.first] + " )");
OUStringBuffer& rCondition = aKeyConditions[elem.first];
if ( !rCondition.isEmpty() )
{
- OUString sQuery("SELECT " + elem.second.toString() + " FROM " + sComposedTableName +
- " WHERE " + rCondition.toString());
+ OUString sQuery("SELECT " + elem.second + " FROM " + sComposedTableName +
+ " WHERE " + rCondition);
try
{
@@ -330,13 +323,13 @@ void OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,keyCondition.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUString sSql("DELETE FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ) +
- " WHERE " + rCondition.toString() );
+ " WHERE " + rCondition );
executeDelete(_rDeleteRow, sSql, keyCondition.first);
}
}
}
-void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,const OUString& i_sTableName)
+void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,std::u16string_view i_sTableName)
{
// now create and execute the prepared statement
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
@@ -353,7 +346,9 @@ void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString&
if(m_bDeleted)
{
sal_Int32 nBookmark = ::comphelper::getINT32((*_rDeleteRow)[0].getAny());
- if(m_aKeyIter == m_aKeyMap.find(nBookmark) && m_aKeyIter != m_aKeyMap.end())
+ const auto iter = m_aKeyMap.find(nBookmark);
+ assert(iter != m_aKeyMap.end());
+ if(m_aKeyIter == iter && m_aKeyIter != m_aKeyMap.end())
++m_aKeyIter;
m_aKeyMap.erase(nBookmark);
m_bDeleted = true;
@@ -544,8 +539,8 @@ void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
- OUString sQuery("SELECT " + elem.second.toString() + " FROM " + sComposedTableName + " WHERE " +
- rCondition.makeStringAndClear());
+ OUString sQuery("SELECT " + elem.second + " FROM " + sComposedTableName + " WHERE " + rCondition);
+ rCondition.setLength(0);
try
{
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index db380d071041..bf5e3a80370a 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_OPTIMISTICSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_OPTIMISTICSET_HXX
+#pragma once
#include "KeySet.hxx"
@@ -40,7 +39,7 @@ namespace dbaccess
mutable bool m_bResultSetChanged;
- void executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,const OUString& i_sTableName);
+ void executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,std::u16string_view i_sTableName);
void fillJoinedColumns_throw(const std::vector< ::connectivity::TNodePair>& i_aJoinColumns);
void fillJoinedColumns_throw(const OUString& i_sLeftColumn,const OUString& i_sRightColumn);
protected:
@@ -73,6 +72,5 @@ namespace dbaccess
const std::map<sal_Int32,sal_Int32>& getJoinedKeyColumns() const { return m_aJoinedKeyColumns; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_OPTIMISTICSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/PrivateRow.cxx b/dbaccess/source/core/api/PrivateRow.cxx
index 22adc74f138a..7e2df82aaeed 100644
--- a/dbaccess/source/core/api/PrivateRow.cxx
+++ b/dbaccess/source/core/api/PrivateRow.cxx
@@ -21,12 +21,9 @@
using namespace dbaccess;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star;
@@ -37,62 +34,62 @@ sal_Bool SAL_CALL OPrivateRow::wasNull( )
OUString SAL_CALL OPrivateRow::getString( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getString();
}
sal_Bool SAL_CALL OPrivateRow::getBoolean( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return bool(m_aRow[m_nPos]);
+ return m_aRow[m_nPos].getBool();
}
::sal_Int8 SAL_CALL OPrivateRow::getByte( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getInt8();
}
::sal_Int16 SAL_CALL OPrivateRow::getShort( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getInt16();
}
::sal_Int32 SAL_CALL OPrivateRow::getInt( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getInt32();
}
::sal_Int64 SAL_CALL OPrivateRow::getLong( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getLong();
}
float SAL_CALL OPrivateRow::getFloat( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getFloat();
}
double SAL_CALL OPrivateRow::getDouble( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getDouble();
}
Sequence< ::sal_Int8 > SAL_CALL OPrivateRow::getBytes( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getSequence();
}
css::util::Date SAL_CALL OPrivateRow::getDate( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getDate();
}
css::util::Time SAL_CALL OPrivateRow::getTime( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getTime();
}
css::util::DateTime SAL_CALL OPrivateRow::getTimestamp( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getDateTime();
}
Reference< css::io::XInputStream > SAL_CALL OPrivateRow::getBinaryStream( ::sal_Int32 columnIndex )
{
diff --git a/dbaccess/source/core/api/PrivateRow.hxx b/dbaccess/source/core/api/PrivateRow.hxx
index 3f8edf0bc7b9..c5ce74f15f43 100644
--- a/dbaccess/source/core/api/PrivateRow.hxx
+++ b/dbaccess/source/core/api/PrivateRow.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_PRIVATEROW_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_PRIVATEROW_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -30,7 +29,7 @@ namespace dbaccess
ORowSetValueVector::Vector m_aRow;
sal_Int32 m_nPos;
public:
- explicit OPrivateRow(const ORowSetValueVector::Vector& i_aRow) : m_aRow(i_aRow),m_nPos(0)
+ explicit OPrivateRow(ORowSetValueVector::Vector&& i_aRow) : m_aRow(std::move(i_aRow)),m_nPos(0)
{
}
virtual sal_Bool SAL_CALL wasNull( ) override;
@@ -55,6 +54,5 @@ namespace dbaccess
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( ::sal_Int32 columnIndex ) override;
};
} // dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_PRIVATEROW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 62383ecd5479..5d9f5eaa787e 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -31,11 +31,13 @@
#include "CRowSetDataColumn.hxx"
#include "RowSetCache.hxx"
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <tablecontainer.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/ErrorCondition.hpp>
@@ -54,7 +56,6 @@
#include <comphelper/extract.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/sequence.hxx>
-#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <comphelper/uno3.hxx>
#include <connectivity/BlobHelper.hxx>
@@ -62,15 +63,13 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <o3tl/safeint.hxx>
#include <unotools/syslocale.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-using namespace utl;
using namespace dbaccess;
using namespace connectivity;
using namespace comphelper;
@@ -95,24 +94,6 @@ com_sun_star_comp_dba_ORowSet_get_implementation(css::uno::XComponentContext* co
return cppu::acquire(new ORowSet(context));
}
-#define NOTIFY_LISTENERS_CHECK(_rListeners,T,method) \
- std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
- \
- _rGuard.clear(); \
- bool bCheck = std::all_of(aListenerSeq.rbegin(), aListenerSeq.rend(), \
- [&aEvt](Reference<XInterface>& rxItem) { \
- try \
- { \
- return static_cast<bool>(static_cast<T*>(rxItem.get())->method(aEvt)); \
- } \
- catch( RuntimeException& ) \
- { \
- return true; \
- } \
- }); \
- _rGuard.reset();
-
-
namespace dbaccess
{
ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
@@ -123,6 +104,7 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
,m_aRowsetListeners(*m_pMutex)
,m_aApproveListeners(*m_pMutex)
,m_aRowsChangeListener(*m_pMutex)
+ ,m_sErrorString(ResourceManager::loadString(RID_STR_COMMAND_LEADING_TO_ERROR))
,m_nFetchDirection(FetchDirection::FORWARD)
,m_nFetchSize(50)
,m_nMaxFieldSize(0)
@@ -274,7 +256,7 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const
break;
case PROPERTY_ID_FETCHDIRECTION:
if( m_nResultSetType == ResultSetType::FORWARD_ONLY)
- throw Exception("resultsettype is FORWARD_ONLY", nullptr);
+ throw Exception(u"resultsettype is FORWARD_ONLY"_ustr, nullptr);
[[fallthrough]];
default:
OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
@@ -424,32 +406,16 @@ Any SAL_CALL ORowSet::queryInterface( const Type & rType )
return ORowSet_BASE1::queryInterface( rType);
}
-void SAL_CALL ORowSet::acquire() throw()
+void SAL_CALL ORowSet::acquire() noexcept
{
ORowSet_BASE1::acquire();
}
-void SAL_CALL ORowSet::release() throw()
+void SAL_CALL ORowSet::release() noexcept
{
ORowSet_BASE1::release();
}
-// css::XUnoTunnel
-sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId )
-{
- if (isUnoTunnelId<ORowSet>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
-Sequence< sal_Int8 > ORowSet::getUnoTunnelId()
-{
- static ::cppu::OImplementationId s_Id;
-
- return s_Id.getImplementationId();
-}
-
// css::XAggregation
Any SAL_CALL ORowSet::queryAggregation( const Type& rType )
{
@@ -462,7 +428,7 @@ Any SAL_CALL ORowSet::queryAggregation( const Type& rType )
// css::XServiceInfo
OUString SAL_CALL ORowSet::getImplementationName()
{
- return "com.sun.star.comp.dba.ORowSet";
+ return u"com.sun.star.comp.dba.ORowSet"_ustr;
}
sal_Bool SAL_CALL ORowSet::supportsService( const OUString& _rServiceName )
@@ -493,11 +459,7 @@ void SAL_CALL ORowSet::disposing()
// remove myself as dispose listener
Reference< XComponent > xComponent(m_xActiveConnection, UNO_QUERY);
if (xComponent.is())
- {
- Reference<XEventListener> xEvt;
- query_aggregation(this,xEvt);
- xComponent->removeEventListener(xEvt);
- }
+ xComponent->removeEventListener(query_aggregation<XEventListener>(this));
m_aActiveConnection = Any(); // the any contains a reference too
if(m_bOwnConnection)
@@ -515,7 +477,7 @@ void ORowSet::freeResources( bool _bComplete )
// free all clones
for (auto const& clone : m_aClones)
{
- Reference< XComponent > xComp(clone.get(), UNO_QUERY);
+ rtl::Reference< ORowSetClone > xComp(clone);
if (xComp.is())
xComp->dispose();
}
@@ -578,11 +540,7 @@ void ORowSet::setActiveConnection( Reference< XConnection > const & _rxNewConn,
// remove the event listener for the old connection
Reference< XComponent > xComponent(m_xActiveConnection, UNO_QUERY);
if (xComponent.is())
- {
- Reference<XEventListener> xListener;
- query_aggregation(this, xListener);
- xComponent->removeEventListener(xListener);
- }
+ xComponent->removeEventListener(query_aggregation<XEventListener>(this));
// if we owned the connection, remember it for later disposing
if(m_bOwnConnection)
@@ -607,11 +565,7 @@ void ORowSet::setActiveConnection( Reference< XConnection > const & _rxNewConn,
// register as event listener for the new connection
xComponent.set(m_xActiveConnection,UNO_QUERY);
if (xComponent.is())
- {
- Reference<XEventListener> xListener;
- query_aggregation(this, xListener);
- xComponent->addEventListener(xListener);
- }
+ xComponent->addEventListener(query_aggregation<XEventListener>(this));
}
// css::XEventListener
@@ -637,7 +591,7 @@ void SAL_CALL ORowSet::close( )
MutexGuard aGuard( m_aMutex );
::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
}
- // additionals things to set
+ // additional things to set
freeResources( true );
}
@@ -664,7 +618,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -680,7 +634,7 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex )
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -768,7 +722,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer
checkUpdateConditions(columnIndex);
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -812,7 +766,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x )
if (!::dbtools::implUpdateObject(this, columnIndex, aNewValue))
{ // there is no other updateXXX call which can handle the value in x
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -826,7 +780,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x,
checkUpdateConditions(columnIndex);
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateNumericObject(columnIndex,x,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -993,7 +947,7 @@ void SAL_CALL ORowSet::deleteRow( )
// this call position the cache indirect
Any aBookmarkToDelete( m_aBookmark );
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
sal_Int32 nDeletePosition = m_pCache->getRow();
notifyRowSetAndClonesRowDelete( aBookmarkToDelete );
@@ -1040,7 +994,7 @@ void ORowSet::implCancelRowUpdates( bool _bNotifyModified )
if ( m_bNew || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
throwFunctionSequenceException(*this);
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
ORowSetRow aOldValues;
if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() )
@@ -1112,13 +1066,40 @@ void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard,
bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard)
{
EventObject aEvt(*m_pMySelf);
- NOTIFY_LISTENERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove);
+ std::vector< Reference< css::sdb::XRowSetApproveListener > > aListenerSeq = m_aApproveListeners.getElements();
+ _rGuard.clear();
+ bool bCheck = std::all_of(aListenerSeq.rbegin(), aListenerSeq.rend(),
+ [&aEvt](Reference<css::sdb::XRowSetApproveListener>& rxItem) {
+ try
+ {
+ return static_cast<bool>(rxItem->approveCursorMove(aEvt));
+ }
+ catch( RuntimeException& )
+ {
+ return true;
+ }
+ });
+ _rGuard.reset();
return bCheck;
}
void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt)
{
- NOTIFY_LISTENERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange);
+ std::vector< Reference< css::sdb::XRowSetApproveListener > > aListenerSeq = m_aApproveListeners.getElements();
+ _rGuard.clear();
+ bool bCheck = std::all_of(aListenerSeq.rbegin(), aListenerSeq.rend(),
+ [&aEvt](Reference<css::sdb::XRowSetApproveListener>& rxItem) {
+ try
+ {
+ return static_cast<bool>(rxItem->approveRowChange(aEvt));
+ }
+ catch( RuntimeException& )
+ {
+ return true;
+ }
+ });
+ _rGuard.reset();
+
if ( !bCheck )
m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() );
}
@@ -1163,12 +1144,12 @@ void SAL_CALL ORowSet::moveToInsertRow( )
ORowSetRow aOldValues;
if ( rowDeleted() )
{
- positionCache( MOVE_FORWARD );
+ positionCache( CursorMoveDirection::Forward );
m_pCache->next();
setCurrentRow( true, false, aOldValues, aGuard);
}
else
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
// check before because the resultset could be empty
if ( !m_bBeforeFirst
@@ -1218,18 +1199,18 @@ void ORowSet::impl_setDataColumnsWriteable_throw()
dataColumn->getPropertyValue(PROPERTY_ISREADONLY) >>= bReadOnly;
*aReadIter = bReadOnly;
- dataColumn->setPropertyValue(PROPERTY_ISREADONLY,makeAny(false));
+ dataColumn->setPropertyValue(PROPERTY_ISREADONLY,Any(false));
++aReadIter;
}
}
void ORowSet::impl_restoreDataColumnsWriteable_throw()
{
- assert(m_aDataColumns.size() == m_aReadOnlyDataColumns.size() || m_aReadOnlyDataColumns.size() == 0 );
+ assert(m_aDataColumns.size() == m_aReadOnlyDataColumns.size() || m_aReadOnlyDataColumns.empty());
TDataColumns::const_iterator aIter = m_aDataColumns.begin();
for (bool readOnlyDataColumn : m_aReadOnlyDataColumns)
{
- (*aIter)->setPropertyValue(PROPERTY_ISREADONLY, makeAny(readOnlyDataColumn) );
+ (*aIter)->setPropertyValue(PROPERTY_ISREADONLY, Any(readOnlyDataColumn) );
++aIter;
}
m_aReadOnlyDataColumns.clear();
@@ -1257,7 +1238,7 @@ void SAL_CALL ORowSet::moveToCurrentRow( )
if ( !notifyAllListenersCursorBeforeMove( aGuard ) )
return;
- positionCache( MOVE_NONE_REFRESH );
+ positionCache( CursorMoveDirection::CurrentRefresh );
ORowSetNotifier aNotifier( this );
@@ -1294,74 +1275,73 @@ const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex)
OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getString();
}
sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- // the extra cast is to recognise the "true" or "false" strings
- return static_cast<bool>(getInsertValue(columnIndex));
+ return getInsertValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getInt8();
}
sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getInt16();
}
sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getInt32();
}
sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getLong();
}
float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getFloat();
}
double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getDouble();
}
Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getSequence();
}
css::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getDate();
}
css::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getDateTime();
}
Reference< css::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex )
@@ -1504,7 +1484,7 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( )
// our caller could change our parameters at any time
m_bParametersDirty = true;
- return m_pParameters.get();
+ return m_pParameters;
}
void ORowSet::approveExecution()
@@ -1512,13 +1492,13 @@ void ORowSet::approveExecution()
::osl::MutexGuard aGuard( m_aColumnsMutex );
EventObject aEvt(*this);
- OInterfaceIteratorHelper2 aApproveIter( m_aApproveListeners );
+ OInterfaceIteratorHelper3 aApproveIter( m_aApproveListeners );
while ( aApproveIter.hasMoreElements() )
{
- Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aApproveIter.next() ) );
+ Reference< XRowSetApproveListener > xListener( aApproveIter.next() );
try
{
- if ( xListener.is() && !xListener->approveRowSetChange( aEvt ) )
+ if ( !xListener->approveRowSetChange( aEvt ) )
throw RowSetVetoException();
}
catch ( const DisposedException& e )
@@ -1571,7 +1551,7 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta
// #i15113#
bool bRespectDriverRST = false;
Any aSetting;
- if ( getDataSourceSetting( ::dbaccess::getDataSource( m_xActiveConnection ), "RespectDriverResultSetType", aSetting ) )
+ if (getDataSourceSetting(::dbaccess::getDataSource(m_xActiveConnection), u"RespectDriverResultSetType"_ustr, aSetting))
{
OSL_VERIFY( aSetting >>= bRespectDriverRST );
}
@@ -1609,8 +1589,8 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta
}
}
- _rxStatement->setPropertyValue( PROPERTY_RESULTSETTYPE, makeAny( nResultSetType ) );
- _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) );
+ _rxStatement->setPropertyValue( PROPERTY_RESULTSETTYPE, Any( nResultSetType ) );
+ _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, Any( nResultSetConcurrency ) );
}
void ORowSet::impl_ensureStatement_throw()
@@ -1637,8 +1617,8 @@ void ORowSet::impl_ensureStatement_throw()
// set the result set type and concurrency
try
{
- xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( true ) );
- xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) );
+ xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, Any( true ) );
+ xStatementProps->setPropertyValue( PROPERTY_MAXROWS, Any( m_nMaxRows ) );
setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency );
}
@@ -1648,21 +1628,17 @@ void ORowSet::impl_ensureStatement_throw()
// then the driver doesn't support this feature
}
}
- catch( const SQLException& )
+ catch (SQLException& rException)
{
- SQLExceptionInfo aError( ::cppu::getCaughtException() );
- OSL_ENSURE( aError.isValid(), "ORowSet::impl_makeNewStatement_throw: caught an SQLException which we cannot analyze!" );
+ css::sdbc::SQLException* pLastExceptionInChain = SQLExceptionInfo::getLastException(&rException);
+ assert(pLastExceptionInChain && "will at least be &rException");
// append information about what we were actually going to execute
- try
- {
- OUString sInfo(DBA_RES_PARAM( RID_STR_COMMAND_LEADING_TO_ERROR, "$command$", sCommandToExecute ) );
- aError.append( SQLExceptionInfo::TYPE::SQLContext, sInfo );
- }
- catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
+ OUString sInfo(m_sErrorString.replaceFirst("$command$", sCommandToExecute));
+ pLastExceptionInChain->NextException = SQLExceptionInfo::createException(SQLExceptionInfo::TYPE::SQLContext, sInfo, OUString(), 0);
// propagate
- aError.doThrow();
+ throw;
}
}
@@ -1716,8 +1692,8 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS
// a number of properties is plain copied
const OUString aPropertyNames[] = {
- OUString(PROPERTY_ALIGN), OUString(PROPERTY_RELATIVEPOSITION), OUString(PROPERTY_WIDTH), OUString(PROPERTY_HIDDEN), OUString(PROPERTY_CONTROLMODEL),
- OUString(PROPERTY_HELPTEXT), OUString(PROPERTY_CONTROLDEFAULT)
+ PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL,
+ PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT
};
for (const auto & aPropertyName : aPropertyNames)
{
@@ -1737,7 +1713,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS
}
if ( !nFormatKey && m_xNumberFormatTypes.is() )
nFormatKey = ::dbtools::getDefaultNumberFormat( _rxTemplateColumn, m_xNumberFormatTypes, SvtSysLocale().GetLanguageTag().getLocale() );
- _rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, makeAny( nFormatKey ) );
+ _rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, Any( nFormatKey ) );
}
catch(Exception&)
{
@@ -1843,17 +1819,17 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
// retrieve the name of the column
OUString sName = xMetaData->getColumnName(i + 1);
// check for duplicate entries
- if(aColumnMap.find(sName) != aColumnMap.end())
+ if(aColumnMap.contains(sName))
{
OUString sAlias(sName);
sal_Int32 searchIndex=1;
- while(aColumnMap.find(sAlias) != aColumnMap.end())
+ while(aColumnMap.contains(sAlias))
{
sAlias = sName + OUString::number(searchIndex++);
}
sName = sAlias;
}
- ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
+ rtl::Reference<ORowSetDataColumn> pColumn = new ORowSetDataColumn( getMetaData(),
this,
this,
i+1,
@@ -1867,9 +1843,9 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
aColumns->emplace_back(pColumn);
pColumn->setName(sName);
aNames.push_back(sName);
- m_aDataColumns.push_back(pColumn);
+ m_aDataColumns.push_back(pColumn.get());
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i+1) != rKeyColumns.end()));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,Any(rKeyColumns.find(i+1) != rKeyColumns.end()));
try
{
@@ -1878,10 +1854,10 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
nFormatKey = ::dbtools::getDefaultNumberFormat(pColumn,m_xNumberFormatTypes,aLocale);
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,makeAny(sal_Int32(i+1)));
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,makeAny(sal_Int32(227)));
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,makeAny(sal_Int32(0)));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,Any(nFormatKey));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,Any(sal_Int32(i+1)));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,Any(sal_Int32(227)));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,Any(sal_Int32(0)));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN, css::uno::Any(false));
}
catch(Exception&)
@@ -1937,7 +1913,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
Sequence< OUString> aSeq = m_xColumns->getElementNames();
if( i <= aSeq.getLength())
{
- m_xColumns->getByName(aSeq.getConstArray()[i-1]) >>= xColumn;
+ m_xColumns->getByName(aSeq[i-1]) >>= xColumn;
}
}
}
@@ -1957,7 +1933,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
{
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
}
- ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
+ rtl::Reference<ORowSetDataColumn> pColumn = new ORowSetDataColumn( getMetaData(),
this,
this,
i,
@@ -1969,7 +1945,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
});
aColumns->emplace_back(pColumn);
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i) != rKeyColumns.end()));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,Any(rKeyColumns.find(i) != rKeyColumns.end()));
if(sColumnLabel.isEmpty())
{
@@ -1980,7 +1956,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
}
pColumn->setName(sColumnLabel);
aNames.push_back(sColumnLabel);
- m_aDataColumns.push_back(pColumn);
+ m_aDataColumns.push_back(pColumn.get());
if ( xColumn.is() )
impl_initializeColumnSettings_nothrow( xColumn, pColumn );
@@ -2066,10 +2042,9 @@ Reference< XResultSet > SAL_CALL ORowSet::createResultSet( )
if(m_xStatement.is())
{
- ORowSetClone* pClone = new ORowSetClone( m_aContext, *this, m_pMutex );
- Reference< XResultSet > xRet(pClone);
- m_aClones.emplace_back(xRet);
- return xRet;
+ rtl::Reference<ORowSetClone> pClone = new ORowSetClone( m_aContext, *this, m_pMutex );
+ m_aClones.emplace_back(pClone);
+ return pClone;
}
return Reference< XResultSet >();
}
@@ -2096,25 +2071,23 @@ Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows
notifyAllListenersRowBeforeChange(aGuard,aEvt);
Sequence< sal_Int32 > aResults( rows.getLength() );
- const Any* row = rows.getConstArray();
- const Any* rowEnd = rows.getConstArray() + rows.getLength();
sal_Int32* result = aResults.getArray();
- for ( ; row != rowEnd; ++row, ++result )
+ for (sal_Int32 i = 0; i < rows.getLength(); ++i)
{
- *result = 0;
- if ( !m_pCache->moveToBookmark( *row ) )
+ result[i] = 0;
+ if (!m_pCache->moveToBookmark(rows[i]))
continue;
sal_Int32 nDeletePosition = m_pCache->getRow();
// first notify the clones so that they can save their position
- notifyRowSetAndClonesRowDelete( *row );
+ notifyRowSetAndClonesRowDelete(rows[i]);
// now delete the row
if ( !m_pCache->deleteRow() )
continue;
- *result = 1;
+ result[i] = 1;
// now notify that we have deleted
- notifyRowSetAndClonesRowDeleted( *row, nDeletePosition );
+ notifyRowSetAndClonesRowDeleted(rows[i], nDeletePosition);
}
aEvt.Rows = aResults.getLength();
@@ -2142,7 +2115,7 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
// notify the clones
for (auto const& elem : m_aClones)
{
- auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(elem.get());
+ rtl::Reference<ORowSetClone> pClone = elem.get();
if(pClone)
pClone->onDeleteRow( _rBookmark );
}
@@ -2155,7 +2128,7 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32
// notify the clones
for (auto const& clone : m_aClones)
{
- auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(clone.get());
+ rtl::Reference<ORowSetClone> pClone = clone.get();
if(pClone)
pClone->onDeletedRow( _rBookmark, _nPos );
}
@@ -2193,7 +2166,7 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH
{
Any aError = ::cppu::getCaughtException();
OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE,
- "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) );
+ u"$name$", m_aDataSourceName, u"$error$", extractExceptionMessage( m_aContext, aError ) );
::dbtools::throwGenericSQLException( sMessage, *this, aError );
}
}
@@ -2232,9 +2205,9 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend);
+ m_xTables.reset(new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend));
xTables = m_xTables.get();
- Sequence<OUString> aTableFilter { "%" };
+ Sequence<OUString> aTableFilter { u"%"_ustr };
m_xTables->construct(aTableFilter,Sequence< OUString>());
}
@@ -2255,7 +2228,7 @@ void ORowSet::impl_resetTables_nothrow()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xTables.clear();
+ m_xTables.reset();
}
void ORowSet::impl_initComposer_throw( OUString& _out_rCommandToExecute )
@@ -2291,7 +2264,7 @@ void ORowSet::impl_initComposer_throw( OUString& _out_rCommandToExecute )
// don't simply overwrite an existent filter, this would lead to problems if this existent
// filter contains parameters (since a keyset may add parameters itself)
m_xComposer->setElementaryQuery( m_xComposer->getQuery( ) );
- m_xComposer->setFilter( "0 = 1" );
+ m_xComposer->setFilter( u"0 = 1"_ustr );
}
m_xComposer->setOrder( m_aOrder );
@@ -2404,7 +2377,7 @@ void ORowSet::impl_initParametersContainer_nothrow()
{
OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" );
- m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() );
+ m_pParameters = new param::ParameterWrapperContainer( m_xComposer );
// copy the premature parameters into the final ones
size_t nParamCount( std::min( m_pParameters->size(), m_aPrematureParamValues->size() ) );
for ( size_t i=0; i<nParamCount; ++i )
@@ -2557,7 +2530,7 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc
catch( Exception const & )
{
css::uno::Any anyEx = cppu::getCaughtException();
- throw SQLException("ORowSet::setBinaryStream", *this, "S1000", 0,anyEx);
+ throw SQLException(u"ORowSet::setBinaryStream"_ustr, *this, u"S1000"_ustr, 0,anyEx);
}
}
@@ -2581,7 +2554,7 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer
catch( Exception const & )
{
css::uno::Any anyEx = cppu::getCaughtException();
- throw SQLException("ORowSet::setCharacterStream", *this, "S1000", 0, anyEx);
+ throw SQLException(u"ORowSet::setCharacterStream"_ustr, *this, u"S1000"_ustr, 0, anyEx);
}
}
@@ -2604,22 +2577,22 @@ void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x
void SAL_CALL ORowSet::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setRef", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setRef"_ustr, *this );
}
void SAL_CALL ORowSet::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setBlob", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setBlob"_ustr, *this );
}
void SAL_CALL ORowSet::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setClob", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setClob"_ustr, *this );
}
void SAL_CALL ORowSet::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setArray", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setArray"_ustr, *this );
}
void SAL_CALL ORowSet::clearParameters( )
@@ -2698,7 +2671,7 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex)
if ( m_aCurrentRow.isNull() )
::dbtools::throwSQLException( DBA_RES( RID_STR_INVALID_CURSOR_STATE ), StandardSQLState::INVALID_CURSOR_STATE, *this );
- if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->size()) <= columnIndex )
+ if ( columnIndex <= 0 || (*m_aCurrentRow)->size() <= o3tl::make_unsigned(columnIndex) )
::dbtools::throwSQLException( DBA_RES( RID_STR_INVALID_INDEX ), StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this );
}
@@ -2733,9 +2706,9 @@ void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard)
// ***********************************************************
ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex )
- :OSubComponent(m_aMutex, rParent)
- ,ORowSetBase( _rContext, OComponentHelper::rBHelper, _pMutex )
- ,m_pParent(&rParent)
+ : ::cppu::WeakComponentImplHelper<>(m_aMutex)
+ ,ORowSetBase( _rContext, WeakComponentImplHelper::rBHelper, _pMutex )
+ ,m_xParent(&rParent)
,m_nFetchDirection(rParent.m_nFetchDirection)
,m_nFetchSize(rParent.m_nFetchSize)
,m_bIsBookmarkable(true)
@@ -2763,19 +2736,19 @@ ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowS
if ( rParent.m_pColumns )
{
Sequence< OUString> aSeq = rParent.m_pColumns->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
aColumns->reserve(aSeq.getLength()+1);
- for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i)
+ sal_Int32 i = 0;
+ for (auto& columnName : aSeq)
{
+ ++i;
Reference<XPropertySet> xColumn;
- rParent.m_pColumns->getByName(*pIter) >>= xColumn;
+ rParent.m_pColumns->getByName(columnName) >>= xColumn;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
OUString sParseLabel;
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
- ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(),
+ rtl::Reference<ORowSetColumn> pColumn = new ORowSetColumn( rParent.getMetaData(),
this,
i,
rParent.m_xActiveConnection->getMetaData(),
@@ -2785,16 +2758,16 @@ ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowS
return this->getValue(column);
});
aColumns->emplace_back(pColumn);
- pColumn->setName(*pIter);
- aNames.push_back(*pIter);
- m_aDataColumns.push_back(pColumn);
+ pColumn->setName(columnName);
+ aNames.push_back(columnName);
+ m_aDataColumns.push_back(pColumn.get());
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN));
sal_Int32 nFormatKey = 0;
xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT) >>= nFormatKey;
if(!nFormatKey && xColumn.is() && m_xNumberFormatTypes.is())
nFormatKey = ::dbtools::getDefaultNumberFormat(xColumn,m_xNumberFormatTypes,aLocale);
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,Any(nFormatKey));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,xColumn->getPropertyValue(PROPERTY_RELATIVEPOSITION));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,xColumn->getPropertyValue(PROPERTY_WIDTH));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,xColumn->getPropertyValue(PROPERTY_HIDDEN));
@@ -2826,7 +2799,7 @@ ORowSetClone::~ORowSetClone()
// css::XTypeProvider
Sequence< Type > ORowSetClone::getTypes()
{
- return ::comphelper::concatSequences(OSubComponent::getTypes(),ORowSetBase::getTypes());
+ return ::comphelper::concatSequences(::cppu::WeakComponentImplHelper<>::getTypes(),ORowSetBase::getTypes());
}
// css::XInterface
@@ -2834,24 +2807,24 @@ Any ORowSetClone::queryInterface( const Type & rType )
{
Any aRet = ORowSetBase::queryInterface(rType);
if(!aRet.hasValue())
- aRet = OSubComponent::queryInterface(rType);
+ aRet = ::cppu::WeakComponentImplHelper<>::queryInterface(rType);
return aRet;
}
-void ORowSetClone::acquire() throw()
+void ORowSetClone::acquire() noexcept
{
- OSubComponent::acquire();
+ ::cppu::WeakComponentImplHelper<>::acquire();
}
-void ORowSetClone::release() throw()
+void ORowSetClone::release() noexcept
{
- OSubComponent::release();
+ ::cppu::WeakComponentImplHelper<>::release();
}
// XServiceInfo
OUString ORowSetClone::getImplementationName( )
{
- return "com.sun.star.sdb.ORowSetClone";
+ return u"com.sun.star.sdb.ORowSetClone"_ustr;
}
sal_Bool ORowSetClone::supportsService( const OUString& _rServiceName )
@@ -2870,9 +2843,9 @@ void ORowSetClone::disposing()
MutexGuard aGuard( m_aMutex );
ORowSetBase::disposing();
- m_pParent = nullptr;
+ m_xParent = nullptr;
m_pMutex = &m_aMutex; // this must be done here because someone could hold a ref to us and try to do something
- OSubComponent::disposing();
+ ::cppu::WeakComponentImplHelper<>::disposing();
}
// XCloseable
@@ -2880,8 +2853,8 @@ void ORowSetClone::close()
{
{
MutexGuard aGuard( m_aMutex );
- if (OComponentHelper::rBHelper.bDisposed)
- throw DisposedException();
+ if (WeakComponentImplHelper::rBHelper.bDisposed)
+ return;
}
dispose();
}
@@ -2900,28 +2873,12 @@ void ORowSetClone::close()
return *::comphelper::OPropertyArrayUsageHelper<ORowSetClone>::getArrayHelper();
}
-Sequence< sal_Int8 > ORowSetClone::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::XUnoTunnel
-sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId )
-{
- if (isUnoTunnelId<ORowSetClone>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if ( nHandle == PROPERTY_ID_FETCHSIZE )
{
- if ( m_pParent )
- m_pParent->setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ if ( auto xParent = m_xParent.get() )
+ xParent->setFastPropertyValue_NoBroadcast( nHandle, rValue );
}
OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
@@ -2948,17 +2905,17 @@ bool ORowSetClone::isNew( )
void SAL_CALL ORowSetClone::execute( )
{
- throwFunctionNotSupportedSQLException( "RowSetClone::XRowSet::execute", *this );
+ throwFunctionNotSupportedSQLException( u"RowSetClone::XRowSet::execute"_ustr, *this );
}
void SAL_CALL ORowSetClone::addRowSetListener( const Reference< XRowSetListener >& )
{
- throwFunctionNotSupportedRuntimeException( "RowSetClone::XRowSet", *this );
+ throwFunctionNotSupportedRuntimeException( u"RowSetClone::XRowSet"_ustr, *this );
}
void SAL_CALL ORowSetClone::removeRowSetListener( const Reference< XRowSetListener >& )
{
- throwFunctionNotSupportedRuntimeException( "RowSetClone::XRowSet", *this );
+ throwFunctionNotSupportedRuntimeException( u"RowSetClone::XRowSet"_ustr, *this );
}
} // dbaccess
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index effbdb87a8df..245bc7308fcf 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -17,15 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
+#pragma once
#include <sal/config.h>
#include <atomic>
#include <cstddef>
-#include <apitools.hxx>
#include "RowSetBase.hxx"
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
@@ -43,15 +41,19 @@
#include <com/sun/star/sdb/XParametersSupplier.hpp>
#include <com/sun/star/sdb/XRowsChangeBroadcaster.hpp>
+#include <cppuhelper/compbase.hxx>
#include <cppuhelper/compbase12.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <connectivity/paramwrapper.hxx>
#include <connectivity/FValue.hxx>
#include <connectivity/warningscontainer.hxx>
+#include <unotools/weakref.hxx>
namespace dbaccess
{
+ class ORowSetClone;
+
typedef ::cppu::WeakAggComponentImplHelper12 < css::sdb::XResultSetAccess
, css::sdb::XRowSetApproveBroadcaster
, css::sdb::XRowsChangeBroadcaster
@@ -83,7 +85,7 @@ namespace dbaccess
css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xComposer;
css::uno::Reference< css::container::XNameAccess > m_xColumns; // the columns from a table or query
- connectivity::OWeakRefArray m_aClones;
+ std::vector<unotools::WeakReference<ORowSetClone>> m_aClones;
/** our parameters as XPropertySet instances and ORowSetValue instances
*/
::dbtools::param::ParametersContainerRef m_pParameters;
@@ -95,13 +97,14 @@ namespace dbaccess
std::vector<bool> m_aParametersSet;
std::vector<bool> m_aReadOnlyDataColumns;
- ::comphelper::OInterfaceContainerHelper2 m_aRowsetListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aApproveListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aRowsChangeListener;
+ ::comphelper::OInterfaceContainerHelper3<css::sdbc::XRowSetListener> m_aRowsetListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::sdb::XRowSetApproveListener> m_aApproveListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::sdb::XRowsChangeListener> m_aRowsChangeListener;
::dbtools::WarningsContainer m_aWarnings;
- rtl::Reference<OTableContainer> m_xTables;
+ // no Reference! see OCollection::acquire
+ std::unique_ptr<OTableContainer> m_xTables;
OUString m_aCommand;
OUString m_aDataSourceName;
@@ -116,6 +119,7 @@ namespace dbaccess
OUString m_aUpdateCatalogName; // is set by a query
OUString m_aUpdateSchemaName; // is set by a query
OUString m_aUpdateTableName; // is set by a query
+ OUString m_sErrorString;
sal_Int32 m_nFetchDirection;
sal_Int32 m_nFetchSize;
@@ -251,12 +255,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
-
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::uno::XAggregation
virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
@@ -448,11 +448,11 @@ namespace dbaccess
// ORowSetClone
class ORowSetClone : public cppu::BaseMutex
- ,public OSubComponent
+ ,public ::cppu::WeakComponentImplHelper<>
,public ORowSetBase
,public ::comphelper::OPropertyArrayUsageHelper < ORowSetClone >
{
- ORowSet* m_pParent;
+ unotools::WeakReference<ORowSet> m_xParent;
sal_Int32 m_nFetchDirection;
sal_Int32 m_nFetchSize;
bool m_bIsBookmarkable;
@@ -478,18 +478,14 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -522,6 +518,5 @@ namespace dbaccess
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 0bbe5e80ae0a..2b49e8f1650d 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -34,6 +34,7 @@
#include <comphelper/seqstream.hxx>
#include <connectivity/dbexception.hxx>
#include <o3tl/safeint.hxx>
+#include <comphelper/diagnose_ex.hxx>
using namespace dbaccess;
using namespace connectivity;
@@ -59,7 +60,7 @@ class OEmptyCollection : public sdbcx::OCollection
{
protected:
virtual void impl_refresh() override;
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
public:
OEmptyCollection(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) : OCollection(_rParent, true, _rMutex, std::vector< OUString>()){}
};
@@ -68,9 +69,9 @@ void OEmptyCollection::impl_refresh()
{
}
-connectivity::sdbcx::ObjectType OEmptyCollection::createObject(const OUString& /*_rName*/)
+css::uno::Reference< css::beans::XPropertySet > OEmptyCollection::createObject(const OUString& /*_rName*/)
{
- return connectivity::sdbcx::ObjectType();
+ return css::uno::Reference< css::beans::XPropertySet >();
}
// ORowSetBase
@@ -93,7 +94,7 @@ ORowSetBase::ORowSetBase( const Reference<XComponentContext>& _rContext, ::cppu:
{
sal_Int32 nRBT = PropertyAttribute::READONLY | PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT;
- registerPropertyNoMember( PROPERTY_ROWCOUNT, PROPERTY_ID_ROWCOUNT, nRBT, cppu::UnoType<sal_Int32>::get(), css::uno::makeAny<sal_Int32>(0) );
+ registerPropertyNoMember( PROPERTY_ROWCOUNT, PROPERTY_ID_ROWCOUNT, nRBT, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)) );
registerPropertyNoMember( PROPERTY_ISROWCOUNTFINAL, PROPERTY_ID_ISROWCOUNTFINAL, nRBT, cppu::UnoType<bool>::get(), css::uno::Any(false) );
}
@@ -206,7 +207,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
if ( !bValidCurrentRow )
{
// currentrow is null when the clone moves the window
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_aCurrentRow = m_pCache->m_aMatrixIter;
m_bIsInsertRow = false;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null.");
@@ -227,14 +228,19 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
for (; k != m_pCache->getEnd(); ++k)
{
ORowSetValueVector* pTemp = k->get();
- OSL_ENSURE( pTemp != reinterpret_cast<void*>(0xfeeefeee),"HALT!" );
+ OSL_ENSURE( pTemp != reinterpret_cast<void*>(sal_uIntPtr(0xfeeefeee)),"HALT!" );
}
OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid iterator set for currentrow!");
- ORowSetRow rRow = *m_aCurrentRow;
- OSL_ENSURE(rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size(),"Invalid size of vector!");
#endif
+ ORowSetRow rRow = *m_aCurrentRow;
+ bool bValidPosition = rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size();
+ if (!bValidPosition)
+ {
+ SAL_WARN("dbaccess", "ORowSetBase::getValue: Invalid size of vector!");
+ ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
+ }
m_nLastColumnIndex = columnIndex;
- return (**m_aCurrentRow)[m_nLastColumnIndex];
+ return (*rRow)[m_nLastColumnIndex];
}
// we should normally never reach this
@@ -244,73 +250,73 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getString();
}
sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return bool(getValue(columnIndex));
+ return getValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt8();
}
sal_Int16 SAL_CALL ORowSetBase::getShort( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt16();
}
sal_Int32 SAL_CALL ORowSetBase::getInt( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt32();
}
sal_Int64 SAL_CALL ORowSetBase::getLong( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getLong();
}
float SAL_CALL ORowSetBase::getFloat( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getFloat();
}
double SAL_CALL ORowSetBase::getDouble( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getDouble();
}
Sequence< sal_Int8 > SAL_CALL ORowSetBase::getBytes( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getSequence();
}
css::util::Date SAL_CALL ORowSetBase::getDate( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getDate();
}
css::util::Time SAL_CALL ORowSetBase::getTime( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL ORowSetBase::getTimestamp( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getDateTime();
}
Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_Int32 columnIndex )
@@ -332,7 +338,7 @@ Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_In
bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
if ( !bValidCurrentRow )
{
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_aCurrentRow = m_pCache->m_aMatrixIter;
m_bIsInsertRow = false;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null.");
@@ -365,8 +371,7 @@ Any SAL_CALL ORowSetBase::getObject( sal_Int32 columnIndex, const Reference< XNa
Reference< XRef > SAL_CALL ORowSetBase::getRef( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRef", *m_pMySelf );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XRow::getRef"_ustr, *m_pMySelf );
}
Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 columnIndex )
@@ -381,8 +386,7 @@ Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 columnIndex )
Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getArray", *m_pMySelf );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XRow::getArray"_ustr, *m_pMySelf );
}
// css::sdbcx::XRowLocate
@@ -573,7 +577,7 @@ sal_Bool SAL_CALL ORowSetBase::next( )
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_FORWARD );
+ positionCache( CursorMoveDirection::Forward );
bool bAfterLast = m_pCache->isAfterLast();
bRet = m_pCache->next();
doCancelModification( );
@@ -656,7 +660,7 @@ sal_Bool SAL_CALL ORowSetBase::isFirst( )
if ( impl_rowDeleted() )
return ( m_nDeletedPosition == 1 );
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
bool bIsFirst = m_pCache->isFirst();
SAL_INFO("dbaccess", "ORowSetBase::isFirst() = " << bIsFirst << " Clone = " << m_bClone);
@@ -686,7 +690,7 @@ sal_Bool SAL_CALL ORowSetBase::isLast( )
return ( m_nDeletedPosition == impl_getRowCount() );
}
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
bool bIsLast = m_pCache->isLast();
SAL_INFO("dbaccess", "ORowSetBase::isLast() = " << bIsLast << " Clone = " << m_bClone);
@@ -858,7 +862,7 @@ sal_Int32 ORowSetBase::impl_getRow()
nPos = 0;
else
{
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
nPos = m_pCache->getRow();
}
SAL_INFO("dbaccess", "ORowSetBase::impl_getRow() = " << nPos << " Clone = " << m_bClone);
@@ -938,7 +942,7 @@ sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows )
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( rows > 0 ? MOVE_FORWARD : MOVE_BACKWARD );
+ positionCache( rows > 0 ? CursorMoveDirection::Forward : CursorMoveDirection::Backward );
bRet = m_pCache->relative(rows);
doCancelModification( );
@@ -986,7 +990,7 @@ sal_Bool SAL_CALL ORowSetBase::previous( )
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_BACKWARD );
+ positionCache( CursorMoveDirection::Backward );
bRet = m_pCache->previous();
doCancelModification( );
@@ -1083,13 +1087,13 @@ void SAL_CALL ORowSetBase::refreshRow( )
::osl::MutexGuard aGuard( *m_pMutex );
checkCache();
if ( impl_rowDeleted() )
- throwSQLException( "The current row is deleted", StandardSQLState::INVALID_CURSOR_STATE, Reference< XRowSet >( this ) );
+ throwSQLException( u"The current row is deleted"_ustr, StandardSQLState::INVALID_CURSOR_STATE, Reference< XRowSet >( this ) );
if(!(m_bBeforeFirst || m_bAfterLast))
{
bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_pCache->refreshRow();
firePropertyChange(aOldValues);
}
@@ -1174,7 +1178,7 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow)
}
catch (const Exception&)
{
- SAL_WARN("dbaccess", "firePropertyChange: Exception on column " << i);
+ TOOLS_WARN_EXCEPTION("dbaccess", "firePropertyChange: Exception on column " << i);
}
++i;
}
@@ -1207,8 +1211,8 @@ bool ORowSetBase::isPropertyChangeNotificationEnabled() const
void ORowSetBase::fireProperty( sal_Int32 _nProperty, bool _bNew, bool _bOld )
{
- Any aNew = css::uno::makeAny( _bNew );
- Any aOld = css::uno::makeAny( _bOld );
+ Any aNew( _bNew );
+ Any aOld( _bOld );
fire( &_nProperty, &aNew, &aOld, 1, false );
}
@@ -1219,7 +1223,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
bool bSuccess = false;
if ( m_aBookmark.hasValue() )
{
- if (_ePrepareForDirection == MOVE_NONE_REFRESH ||
+ if (_ePrepareForDirection == CursorMoveDirection::CurrentRefresh ||
(m_pCache->isAfterLast() != bool(isAfterLast())) || ( m_pCache->isBeforeFirst() != bool(isBeforeFirst()) ) ||
m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
bSuccess = m_pCache->moveToBookmark( m_aBookmark );
@@ -1243,7 +1247,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
OSL_ENSURE( m_nDeletedPosition >= 1, "ORowSetBase::positionCache: no bookmark, and no valid 'deleted position'!" );
switch ( _ePrepareForDirection )
{
- case MOVE_FORWARD:
+ case CursorMoveDirection::Forward:
if ( m_nDeletedPosition > 1 )
bSuccess = m_pCache->absolute( m_nDeletedPosition - 1 );
else
@@ -1253,7 +1257,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
}
break;
- case MOVE_BACKWARD:
+ case CursorMoveDirection::Backward:
if ( m_pCache->m_bRowCountFinal && ( m_nDeletedPosition == impl_getRowCount() ) )
{
m_pCache->afterLast();
@@ -1263,8 +1267,8 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
bSuccess = m_pCache->absolute( m_nDeletedPosition );
break;
- case MOVE_NONE:
- case MOVE_NONE_REFRESH:
+ case CursorMoveDirection::Current:
+ case CursorMoveDirection::CurrentRefresh:
bSuccess = false; // will be asserted below
break;
}
@@ -1318,7 +1322,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark )
//OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL )
{
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_nDeletedPosition = m_pCache->getRow();
}
}
@@ -1352,12 +1356,6 @@ sal_Int32 ORowSetBase::impl_getRowCount() const
return nRowCount;
}
-struct ORowSetNotifierImpl
-{
- std::vector<sal_Int32> aChangedColumns;
- ORowSetValueVector::Vector aRow;
-};
-
ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet )
:m_pRowSet( _pRowSet )
@@ -1376,15 +1374,13 @@ ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet )
m_pRowSet->doCancelModification( ORowSetBase::GrantNotifierAccess() );
}
-ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet,const ORowSetValueVector::Vector& i_aRow )
- :m_pImpl(new ORowSetNotifierImpl)
- ,m_pRowSet( _pRowSet )
+ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet, ORowSetValueVector::Vector&& i_aRow )
+ :m_pRowSet( _pRowSet )
,m_bWasNew( false )
,m_bWasModified( false )
{
-
OSL_ENSURE( m_pRowSet, "ORowSetNotifier::ORowSetNotifier: invalid row set. This will crash." );
- m_pImpl->aRow = i_aRow; // yes, create a copy to store the old values
+ aRow = std::move(i_aRow); // yes, create a copy to store the old values
}
ORowSetNotifier::~ORowSetNotifier( )
@@ -1407,24 +1403,19 @@ void ORowSetNotifier::fire()
m_pRowSet->fireProperty( PROPERTY_ID_ISNEW, false, true, ORowSetBase::GrantNotifierAccess() );
}
-std::vector<sal_Int32>& ORowSetNotifier::getChangedColumns() const
+std::vector<sal_Int32>& ORowSetNotifier::getChangedColumns()
{
- OSL_ENSURE(m_pImpl, "Illegal CTor call, use the other one!");
- return m_pImpl->aChangedColumns;
+ return aChangedColumns;
}
void ORowSetNotifier::firePropertyChange()
{
- OSL_ENSURE(m_pImpl, "Illegal CTor call, use the other one!");
- if (m_pImpl)
+ for (auto const& changedColumn : aChangedColumns)
{
- for (auto const& changedColumn : m_pImpl->aChangedColumns)
- {
- m_pRowSet->firePropertyChange(changedColumn-1 ,m_pImpl->aRow[changedColumn-1], ORowSetBase::GrantNotifierAccess());
- }
- if ( !m_pImpl->aChangedColumns.empty() )
- m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,true,false, ORowSetBase::GrantNotifierAccess());
+ m_pRowSet->firePropertyChange(changedColumn-1, aRow[changedColumn-1], ORowSetBase::GrantNotifierAccess());
}
+ if ( !aChangedColumns.empty() )
+ m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,true,false, ORowSetBase::GrantNotifierAccess());
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 1031ed5dcce7..8e2506c8803b 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -16,11 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
+#pragma once
#include <memory>
-#include <cppuhelper/implbase10.hxx>
+#include <cppuhelper/implbase9.hxx>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
@@ -29,7 +28,6 @@
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/interfacecontainer.h>
#include <connectivity/sqlerror.hxx>
#include <connectivity/CommonTools.hxx>
@@ -37,22 +35,16 @@
#include <comphelper/proparrhlp.hxx>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include "RowSetRow.hxx"
#include "RowSetCacheIterator.hxx"
#include <functional>
-namespace com::sun::star {
- namespace sdb { struct RowChangeEvent; }
- namespace lang { struct Locale; }
-}
-
namespace dbaccess
{
class OEmptyCollection;
- typedef ::cppu::ImplHelper10< css::sdbcx::XRowLocate,
+ typedef ::cppu::ImplHelper9< css::sdbcx::XRowLocate,
css::sdbc::XRow,
css::sdbc::XResultSetMetaDataSupplier,
css::sdbc::XWarningsSupplier,
@@ -60,12 +52,10 @@ namespace dbaccess
css::sdbcx::XColumnsSupplier,
css::lang::XServiceInfo,
css::sdbc::XRowSet,
- css::sdbc::XCloseable,
- css::lang::XUnoTunnel> ORowSetBase_BASE;
+ css::sdbc::XCloseable> ORowSetBase_BASE;
class ORowSetCache;
class ORowSetDataColumns;
- class ORowSetCacheIterator;
class ORowSetDataColumn;
class ORowSetBase : public ORowSetBase_BASE,
public ::comphelper::OPropertyStateContainer,
@@ -144,16 +134,16 @@ namespace dbaccess
virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, css::uno::Any& _rDefault ) const override;
virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue,sal_Int32 nHandle) const override;
- enum CursorMoveDirection
+ enum class CursorMoveDirection
{
/// denotes a cursor move forward
- MOVE_FORWARD,
+ Forward,
/// denotes a cursor move backwards
- MOVE_BACKWARD,
+ Backward,
/// denotes no cursor move at all, but move cache to current row (if it is not there already)
- MOVE_NONE,
+ Current,
/// denotes no cursor move at all, but force the cache to move to current row (and refresh the row)
- MOVE_NONE_REFRESH
+ CurrentRefresh
};
/** positions the cache in preparation of a cursor move
@@ -348,11 +338,11 @@ namespace dbaccess
<p>The class can only be used on the stack, within a method of ORowSetBase (or derivees)</p>
*/
- struct ORowSetNotifierImpl;
class ORowSetNotifier
{
private:
- std::unique_ptr<ORowSetNotifierImpl> m_pImpl;
+ std::vector<sal_Int32> aChangedColumns;
+ ORowSetValueVector::Vector aRow;
ORowSetBase* m_pRowSet;
// not acquired! This is not necessary because this class here is to be used on the stack within
// a method of ORowSetBase (or derivees)
@@ -368,7 +358,7 @@ namespace dbaccess
/** use this one to construct a vector for change value notification
*/
- ORowSetNotifier( ORowSetBase* m_pRowSet,const ORowSetValueVector::Vector& i_aRow );
+ ORowSetNotifier( ORowSetBase* m_pRowSet, ORowSetValueVector::Vector&& i_aRow );
// destructs the object. <member>fire</member> has to be called before.
~ORowSetNotifier( );
@@ -392,14 +382,12 @@ namespace dbaccess
*/
void firePropertyChange();
- /** use this one to store the inde of the changed column values
+ /** use this one to store the index of the changed column values
*/
- std::vector<sal_Int32>& getChangedColumns() const;
+ std::vector<sal_Int32>& getChangedColumns();
};
} // end of namespace
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 21098ccacdfb..46c01a27207b 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -45,7 +45,7 @@
#include <connectivity/sqlnode.hxx>
#include <connectivity/sqlparse.hxx>
#include <sqlbison.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
@@ -60,11 +60,7 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::cppu;
-using namespace ::osl;
-
-#define CHECK_MATRIX_POS(M) OSL_ENSURE(((M) >= static_cast<ORowSetMatrix::difference_type>(0)) && ((M) < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!")
// This class calls m_pCacheSet->FOO_checked(..., sal_False)
// (where FOO is absolute, last, previous)
@@ -112,6 +108,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if ( bBookmarkable )
{
xUp->moveToInsertRow();
+ xUp->moveToCurrentRow();
xUp->cancelRowUpdates();
_xRs->beforeFirst();
m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE;
@@ -165,7 +162,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if ( aTableNames.getLength() > 1 && _rUpdateTableName.isEmpty() && bNeedKeySet )
{// here we have a join or union and nobody told us which table to update, so we update them all
m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE;
- OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
+ rtl::Reference<OptimisticSet> pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
m_xCacheSet = pCursor;
try
{
@@ -207,9 +204,9 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
{
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
- SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
+ SelectColumnsMetaData aColumnNames(comphelper::UStringMixLess(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()));
::dbaccess::getColumnPositions(xSelColumns,xPrimaryKeyColumns->getElementNames(),aUpdateTableName,aColumnNames);
- bAllKeysFound = !aColumnNames.empty() && sal_Int32(aColumnNames.size()) == xPrimaryKeyColumns->getElementNames().getLength();
+ bAllKeysFound = !aColumnNames.empty() && aColumnNames.size() == o3tl::make_unsigned(xPrimaryKeyColumns->getElementNames().getLength());
}
}
}
@@ -273,7 +270,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
else
{
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
- SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
+ SelectColumnsMetaData aColumnNames(comphelper::UStringMixLess(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()));
Reference<XColumnsSupplier> xColSup(_xAnalyzer,UNO_QUERY);
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
Reference<XNameAccess> xColumns = m_aUpdateTable->getColumns();
@@ -283,18 +280,15 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
m_nPrivileges = Privilege::SELECT;
bool bNoInsert = false;
- Sequence< OUString> aNames(xColumns->getElementNames());
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& columnName : xColumns->getElementNames())
{
- Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xColumn(xColumns->getByName(columnName), UNO_QUERY);
OSL_ENSURE(xColumn.is(),"Column in table is null!");
if(xColumn.is())
{
sal_Int32 nNullable = 0;
xColumn->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullable;
- if(nNullable == ColumnValue::NO_NULLS && aColumnNames.find(*pIter) == aColumnNames.end())
+ if(nNullable == ColumnValue::NO_NULLS && aColumnNames.find(columnName) == aColumnNames.end())
{ // we found a column where null is not allowed so we can't insert new values
bNoInsert = true;
break; // one column is enough
@@ -302,7 +296,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
}
- OKeySet* pKeySet = new OKeySet(m_aUpdateTable, aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
+ rtl::Reference<OKeySet> pKeySet = new OKeySet(m_aUpdateTable, aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
try
{
m_xCacheSet = pKeySet;
@@ -406,7 +400,7 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize)
{
if ( rPosChange.second )
{
- CHECK_MATRIX_POS(*aIter);
+ OSL_ENSURE((*aIter >= static_cast<ORowSetMatrix::difference_type>(0)) && (*aIter < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!");
if ( *aIter < _nSize )
aCacheIter->second.aIterator = m_pMatrix->begin() + *aIter++;
else
@@ -457,7 +451,7 @@ static Any lcl_getBookmark(ORowSetValue& i_aValue,OCacheSet* i_pCacheSet)
case DataType::TINYINT:
case DataType::SMALLINT:
case DataType::INTEGER:
- return makeAny(static_cast<sal_Int32>(i_aValue));
+ return Any(i_aValue.getInt32());
default:
if ( i_pCacheSet && i_aValue.isNull())
i_aValue = i_pCacheSet->getBookmark();
@@ -593,7 +587,7 @@ void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference
rInsert[columnIndex].setBound(true);
rInsert[columnIndex] = aSeq;
rInsert[columnIndex].setModified(true);
- io_aRow[columnIndex] = makeAny(x);
+ io_aRow[columnIndex] = Any(x);
m_xCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
@@ -612,7 +606,7 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x
if ( rInsert[columnIndex] != aTemp )
{
rInsert[columnIndex].setBound(true);
- rInsert[columnIndex] = aTemp;
+ rInsert[columnIndex] = std::move(aTemp);
rInsert[columnIndex].setModified(true);
io_aRow[columnIndex] = rInsert[columnIndex];
@@ -634,7 +628,7 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x
if ( rInsert[columnIndex] != aTemp )
{
rInsert[columnIndex].setBound(true);
- rInsert[columnIndex] = aTemp;
+ rInsert[columnIndex] = std::move(aTemp);
rInsert[columnIndex].setModified(true);
io_aRow[columnIndex] = rInsert[columnIndex];
@@ -882,13 +876,13 @@ void ORowSetCache::moveWindow()
ORowSetMatrix::iterator aNewEnd (aEnd + nStartPosOffset);
// *m_pMatrix now looks like:
// [0; nOverlapSize) i.e. [begin(); aEnd): data kept
- // [nOverlapSize; nOverlapSize + nStartPosOffet) i.e. [aEnd, aNewEnd): new data of positions < old m_nStartPos
- // [nOverlapSize + nStartPosOffet; size()) i.e. [aNewEnd, end()): unused
- // Note that nOverlapSize + nStartPosOffet == m_nEndPos - m_nStartPos (new values)
+ // [nOverlapSize; nOverlapSize + nStartPosOffset) i.e. [aEnd, aNewEnd): new data of positions < old m_nStartPos
+ // [nOverlapSize + nStartPosOffset; size()) i.e. [aNewEnd, end()): unused
+ // Note that nOverlapSize + nStartPosOffset == m_nEndPos - m_nStartPos (new values)
// When we are finished:
// [0; nStartPosOffset) i.e. [begin(); aEnd): new data of positions < old m_nStartPos
- // [nStartPosOffset; nOverlapSize + nStartPosOffet) i.e. [aEnd, aNewEnd): kept
- // [nOverlapSize + nStartPosOffet; size()) i.e. [aNewEnd, end()): unused
+ // [nStartPosOffset; nOverlapSize + nStartPosOffset) i.e. [aEnd, aNewEnd): kept
+ // [nOverlapSize + nStartPosOffset; size()) i.e. [aNewEnd, end()): unused
if ( bCheck )
{
@@ -917,7 +911,8 @@ void ORowSetCache::moveWindow()
else
{
// Inside overlap area: move to correct position
- CHECK_MATRIX_POS( (nDist + nStartPosOffset) );
+ OSL_ENSURE(((nDist + nStartPosOffset) >= static_cast<ORowSetMatrix::difference_type>(0)) &&
+ ((nDist + nStartPosOffset) < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!");
rCacheIter.second.aIterator += nStartPosOffset;
OSL_ENSURE(rCacheIter.second.aIterator >= m_pMatrix->begin()
&& rCacheIter.second.aIterator < m_pMatrix->end(),"Iterator out of area!");
@@ -947,7 +942,7 @@ void ORowSetCache::moveWindow()
if ( nRowsInCache < m_nFetchSize )
{
// There is some unused space in *m_pMatrix; fill it
- CHECK_MATRIX_POS(nRowsInCache);
+ OSL_ENSURE((nRowsInCache >= static_cast<ORowSetMatrix::difference_type>(0)) && (o3tl::make_unsigned(nRowsInCache) < m_pMatrix->size()),"Position is invalid!");
sal_Int32 nPos = m_nEndPos + 1;
bool bCheck = m_xCacheSet->absolute(nPos);
ORowSetMatrix::iterator aIter = m_pMatrix->begin() + nRowsInCache;
@@ -965,7 +960,7 @@ void ORowSetCache::moveWindow()
// The rows behind this can be reused
ORowSetMatrix::iterator aIter = m_pMatrix->begin();
const sal_Int32 nNewStartPosInMatrix = nNewStartPos - m_nStartPos;
- CHECK_MATRIX_POS( nNewStartPosInMatrix );
+ OSL_ENSURE((nNewStartPosInMatrix >= static_cast<ORowSetMatrix::difference_type>(0)) && (o3tl::make_unsigned(nNewStartPosInMatrix) < m_pMatrix->size()),"Position is invalid!");
// first position we reuse
const ORowSetMatrix::const_iterator aEnd = m_pMatrix->begin() + nNewStartPosInMatrix;
// End of used portion of the matrix. Is < m_pMatrix->end() if less data than window size
@@ -1624,8 +1619,8 @@ void ORowSetCache::clearInsertRow()
ORowSetMatrix::iterator ORowSetCache::calcPosition() const
{
sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1;
- CHECK_MATRIX_POS(nValue);
- return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue);
+ OSL_ENSURE((nValue >= static_cast<ORowSetMatrix::difference_type>(0)) && (o3tl::make_unsigned(nValue) < m_pMatrix->size()),"Position is invalid!");
+ return ( nValue < 0 || o3tl::make_unsigned(nValue) >= m_pMatrix->size() ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue);
}
TORowSetOldRowHelperRef ORowSetCache::registerOldRow()
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 082b6522c098..01ed6394dc47 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHE_HXX
+#pragma once
#include <connectivity/CommonTools.hxx>
#include <com/sun/star/io/XInputStream.hpp>
@@ -187,6 +186,5 @@ namespace dbaccess
void reset(const css::uno::Reference< css::sdbc::XResultSet>& _xDriverSet);
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetCacheIterator.hxx b/dbaccess/source/core/api/RowSetCacheIterator.hxx
index 39f139c276cf..f5d5e6783b65 100644
--- a/dbaccess/source/core/api/RowSetCacheIterator.hxx
+++ b/dbaccess/source/core/api/RowSetCacheIterator.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHEITERATOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHEITERATOR_HXX
+#pragma once
#include <sal/config.h>
#include <map>
+#include <utility>
#include "RowSetRow.hxx"
@@ -44,8 +44,8 @@ namespace dbaccess
ORowSetCache* m_pCache;
ORowSetBase* m_pRowSet;
- ORowSetCacheIterator(const ORowSetCacheMap::iterator& _rIter,ORowSetCache* _pCache,ORowSetBase* _pRowSet)
- : m_aIter(_rIter)
+ ORowSetCacheIterator(ORowSetCacheMap::iterator _aIter, ORowSetCache* _pCache,ORowSetBase* _pRowSet)
+ : m_aIter(std::move(_aIter))
,m_pCache(_pCache)
,m_pRowSet(_pRowSet)
{
@@ -69,6 +69,5 @@ namespace dbaccess
const ORowSetCacheMap::iterator& getIter() const { return m_aIter; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHEITERATOR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetRow.hxx b/dbaccess/source/core/api/RowSetRow.hxx
index 11337dec7cb6..a847399dd1e9 100644
--- a/dbaccess/source/core/api/RowSetRow.hxx
+++ b/dbaccess/source/core/api/RowSetRow.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
+#pragma once
#include <rtl/ref.hxx>
#include <connectivity/CommonTools.hxx>
#include <connectivity/FValue.hxx>
#include <salhelper/simplereferenceobject.hxx>
+#include <utility>
namespace dbaccess
{
@@ -37,8 +37,8 @@ namespace dbaccess
ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH) = delete;
ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh) = delete;
public:
- explicit ORowSetOldRowHelper(const ORowSetRow& _rRow)
- : m_aRow(_rRow)
+ explicit ORowSetOldRowHelper(ORowSetRow _aRow)
+ : m_aRow(std::move(_aRow))
{}
const ORowSetRow& getRow() const { return m_aRow; }
@@ -49,6 +49,5 @@ namespace dbaccess
typedef ::rtl::Reference< ORowSetOldRowHelper > TORowSetOldRowHelperRef;
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 9f96f84295c7..c8c6f7ecbd2a 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <composertools.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <stringconstants.hxx>
#include "HelperCollections.hxx"
@@ -48,11 +49,12 @@
#include <connectivity/dbtools.hxx>
#include <connectivity/PColumn.hxx>
#include <connectivity/predicateinput.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <unotools/sharedunocomponent.hxx>
#include <memory>
+#include <string_view>
using namespace ::dbaccess;
using namespace ::dbtools;
@@ -76,18 +78,18 @@ namespace dbaccess {
namespace BooleanComparisonMode = ::com::sun::star::sdb::BooleanComparisonMode;
}
-#define STR_SELECT "SELECT "
-#define STR_FROM " FROM "
-#define STR_WHERE " WHERE "
-#define STR_GROUP_BY " GROUP BY "
-#define STR_HAVING " HAVING "
-#define STR_ORDER_BY " ORDER BY "
-#define STR_AND " AND "
-#define STR_OR " OR "
-#define STR_LIKE OUString(" LIKE ")
-#define L_BRACKET "("
-#define R_BRACKET ")"
-#define COMMA ","
+constexpr OUStringLiteral STR_SELECT = u"SELECT ";
+constexpr OUStringLiteral STR_FROM = u" FROM ";
+constexpr OUString STR_WHERE = u" WHERE "_ustr;
+constexpr OUStringLiteral STR_GROUP_BY = u" GROUP BY ";
+constexpr OUStringLiteral STR_HAVING = u" HAVING ";
+constexpr OUStringLiteral STR_ORDER_BY = u" ORDER BY ";
+constexpr OUString STR_AND = u" AND "_ustr;
+constexpr OUString STR_OR = u" OR "_ustr;
+constexpr OUStringLiteral STR_LIKE = u" LIKE ";
+constexpr OUString L_BRACKET = u"("_ustr;
+constexpr OUString R_BRACKET = u")"_ustr;
+constexpr OUStringLiteral COMMA = u",";
namespace
{
@@ -104,8 +106,8 @@ namespace
{
OUString sSQLStateGeneralError( getStandardSQLState( StandardSQLState::GENERAL_ERROR ) );
SQLException aError2( aErrorMsg, _rxContext, sSQLStateGeneralError, 1000, Any() );
- SQLException aError1( _rStatement, _rxContext, sSQLStateGeneralError, 1000, makeAny( aError2 ) );
- throw SQLException(_rParser.getContext().getErrorMessage(OParseContext::ErrorCode::General),_rxContext,sSQLStateGeneralError,1000,makeAny(aError1));
+ SQLException aError1( _rStatement, _rxContext, sSQLStateGeneralError, 1000, Any( aError2 ) );
+ throw SQLException(_rParser.getContext().getErrorMessage(OParseContext::ErrorCode::General),_rxContext,sSQLStateGeneralError,1000,Any(aError1));
}
return pNewSqlParseNode;
}
@@ -131,7 +133,7 @@ namespace
// and now really ...
SQLException aError1( _rOriginatingCommand, _rxContext, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, Any() );
throw SQLException( DBA_RES( RID_STR_ONLY_QUERY ), _rxContext,
- getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, makeAny( aError1 ) );
+ getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, Any( aError1 ) );
}
delete pOldNode;
@@ -168,33 +170,33 @@ namespace
delete pSqlParseNode;
_rIterator.dispose();
}
- void lcl_addFilterCriteria_throw(sal_Int32 i_nFilterOperator,const OUString& i_sValue,OUStringBuffer& o_sRet)
+ void lcl_addFilterCriteria_throw(sal_Int32 i_nFilterOperator,std::u16string_view i_sValue,OUStringBuffer& o_sRet)
{
switch( i_nFilterOperator )
{
case SQLFilterOperator::EQUAL:
- o_sRet.append(" = " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" = ") + i_sValue);
break;
case SQLFilterOperator::NOT_EQUAL:
- o_sRet.append(" <> " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" <> ") + i_sValue);
break;
case SQLFilterOperator::LESS:
- o_sRet.append(" < " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" < ") + i_sValue);
break;
case SQLFilterOperator::GREATER:
- o_sRet.append(" > " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" > ") + i_sValue);
break;
case SQLFilterOperator::LESS_EQUAL:
- o_sRet.append(" <= " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" <= ") + i_sValue);
break;
case SQLFilterOperator::GREATER_EQUAL:
- o_sRet.append(" >= " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" >= ") + i_sValue);
break;
case SQLFilterOperator::LIKE:
- o_sRet.append(" LIKE " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" LIKE ") + i_sValue);
break;
case SQLFilterOperator::NOT_LIKE:
- o_sRet.append(" NOT LIKE " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" NOT LIKE ") + i_sValue);
break;
case SQLFilterOperator::SQLNULL:
o_sRet.append(" IS NULL");
@@ -215,7 +217,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
const Reference<XComponentContext>& _rContext )
:OSubComponent(m_aMutex,_xConnection)
,OPropertyContainer(m_aBHelper)
- ,m_aSqlParser( _rContext, &m_aParseContext )
+ ,m_aSqlParser( _rContext, &m_aParseContext, &m_aNeutralContext )
,m_aSqlIterator( _xConnection, _rxTables, m_aSqlParser )
,m_aAdditiveIterator( _xConnection, _rxTables, m_aSqlParser )
,m_aElementaryParts( size_t(SQLPartCount) )
@@ -243,7 +245,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
{
Any aValue;
Reference<XInterface> xDs = dbaccess::getDataSource(_xConnection);
- if ( dbtools::getDataSourceSetting(xDs,static_cast <OUString> (PROPERTY_BOOLEANCOMPARISONMODE),aValue) )
+ if ( dbtools::getDataSourceSetting(xDs,PROPERTY_BOOLEANCOMPARISONMODE,aValue) )
{
OSL_VERIFY( aValue >>= m_nBoolCompareMode );
}
@@ -277,15 +279,54 @@ void SAL_CALL OSingleSelectQueryComposer::disposing()
}
IMPLEMENT_FORWARD_XINTERFACE3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer)
-IMPLEMENT_SERVICE_INFO1(OSingleSelectQueryComposer,"org.openoffice.comp.dba.OSingleSelectQueryComposer",SERVICE_NAME_SINGLESELECTQUERYCOMPOSER)
+OUString SAL_CALL OSingleSelectQueryComposer::getImplementationName()
+ {
+ return u"org.openoffice.comp.dba.OSingleSelectQueryComposer"_ustr;
+ }
+sal_Bool SAL_CALL OSingleSelectQueryComposer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OSingleSelectQueryComposer::getSupportedServiceNames()
+{
+ return { SERVICE_NAME_SINGLESELECTQUERYCOMPOSER };
+}
css::uno::Sequence<sal_Int8> OSingleSelectQueryComposer::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer)
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OSingleSelectQueryComposer)
+css::uno::Sequence< css::uno::Type > OSingleSelectQueryComposer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OSubComponent::getTypes( ),
+ OSingleSelectQueryComposer_BASE::getTypes( ),
+ OPropertyContainer::getTypes( )
+ );
+}
+
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OSingleSelectQueryComposer::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& OSingleSelectQueryComposer::getInfoHelper()
+{
+ return *OSingleSelectQueryComposer::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* OSingleSelectQueryComposer::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
// XSingleSelectQueryAnalyzer
OUString SAL_CALL OSingleSelectQueryComposer::getQuery( )
@@ -430,11 +471,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc
|| !m_aCurrentColumns[SelectColumns]
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
)
- {
- OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
- SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
- throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) );
- }
+ {
+ OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
+ SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
+ throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any(aErr) );
+ }
OUString aName, aNewName;
column->getPropertyValue(PROPERTY_NAME) >>= aName;
@@ -455,13 +496,13 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc
m_aCurrentColumns[SelectColumns]->getByName(aName) >>= xColumn;
OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME),"Property REALNAME not available!");
OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_TABLENAME),"Property TABLENAME not available!");
- OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName("Function"),"Property FUNCTION not available!");
+ OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(u"Function"_ustr),"Property FUNCTION not available!");
OUString sRealName, sTableName;
xColumn->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
xColumn->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
bool bFunction = false;
- xColumn->getPropertyValue("Function") >>= bFunction;
+ xColumn->getPropertyValue(u"Function"_ustr) >>= bFunction;
if ( sRealName == aName )
{
if ( bFunction )
@@ -470,9 +511,9 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc
{
if(sTableName.indexOf('.') != -1)
{
- 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 );
}
else if (!sTableName.isEmpty())
sTableName = ::dbtools::quoteName(aQuote,sTableName);
@@ -500,11 +541,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnNameOrderBy_throw(const Refer
|| !m_aCurrentColumns[SelectColumns]
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
)
- {
- OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
- SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
- throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) );
- }
+ {
+ OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
+ SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
+ throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any(aErr) );
+ }
OUString aName;
column->getPropertyValue(PROPERTY_NAME) >>= aName;
@@ -610,7 +651,7 @@ void SAL_CALL OSingleSelectQueryComposer::setElementaryQuery( const OUString& _r
namespace
{
OUString getComposedClause( const OUString& _rElementaryClause, const OUString& _rAdditionalClause,
- TokenComposer& _rComposer, const OUString& _rKeyword )
+ TokenComposer& _rComposer, std::u16string_view _rKeyword )
{
_rComposer.clear();
_rComposer.append( _rElementaryClause );
@@ -716,7 +757,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( )
for (auto const& elem : aTables)
aNames.push_back(elem.first);
- m_pTables.reset( new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames) );
+ m_pTables.reset( new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,std::move(aNames)) );
}
return m_pTables.get();
@@ -751,14 +792,14 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
bCase = m_xMetaData->supportsMixedCaseQuotedIdentifiers();
aSelectColumns = m_aSqlIterator.getSelectColumns();
- OUStringBuffer aSQL( m_aPureSelectSQL + STR_WHERE " ( 0 = 1 )");
+ OUStringBuffer aSQL( m_aPureSelectSQL + STR_WHERE + " ( 0 = 1 )");
// preserve the original WHERE clause
// #i102234#
OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, false );
if ( !sOriginalWhereClause.isEmpty() )
{
- aSQL.append( " AND ( " ).append( sOriginalWhereClause ).append( " ) " );
+ aSQL.append( " AND ( " + sOriginalWhereClause + " ) " );
}
OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, true );
@@ -806,7 +847,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
{
xStatement.reset( Reference< XStatement >( m_xConnection->createStatement(), UNO_SET_THROW ) );
Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW );
- try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( false ) ); }
+ try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, Any( false ) ); }
catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_SET_THROW );
@@ -885,13 +926,13 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
// we can now only look if we found it under the realname property
// here we have to make the assumption that the position is correct
OSQLColumns::Vector::const_iterator aFind2 = aSelectColumns->begin() + i-1;
- Reference<XPropertySet> xProp = *aFind2;
+ const Reference<XPropertySet>& xProp = *aFind2;
if ( !xProp.is() || !xProp->getPropertySetInfo()->hasPropertyByName( PROPERTY_REALNAME ) )
continue;
- ::connectivity::parse::OParseColumn* pColumn = new ::connectivity::parse::OParseColumn(xProp,bCase);
- pColumn->setFunction(::comphelper::getBOOL(xProp->getPropertyValue("Function")));
- pColumn->setAggregateFunction(::comphelper::getBOOL(xProp->getPropertyValue("AggregateFunction")));
+ rtl::Reference<::connectivity::parse::OParseColumn> pColumn = new ::connectivity::parse::OParseColumn(xProp,bCase);
+ pColumn->setFunction(::comphelper::getBOOL(xProp->getPropertyValue(u"Function"_ustr)));
+ pColumn->setAggregateFunction(::comphelper::getBOOL(xProp->getPropertyValue(u"AggregateFunction"_ustr)));
OUString sRealName;
xProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
@@ -1313,7 +1354,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
OUString sReturn;
if(m_pTables && m_pTables->getCount() > 1)
{
- OUString aCatalog,aSchema,aTable,aComposedName,aColumnName;
+ OUString aCatalog,aSchema,aTable,aColumnName;
if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_CATALOGNAME))
column->getPropertyValue(PROPERTY_CATALOGNAME) >>= aCatalog;
if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_SCHEMANAME))
@@ -1323,8 +1364,8 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
column->getPropertyValue(PROPERTY_NAME) >>= aColumnName;
Sequence< OUString> aNames(m_pTables->getElementNames());
- const OUString* pBegin = aNames.getConstArray();
- const OUString* const pEnd = pBegin + aNames.getLength();
+ const OUString* pBegin = aNames.begin();
+ const OUString* const pEnd = aNames.end();
if(aTable.isEmpty())
{ // we haven't found a table name, now we must search every table for this column
@@ -1342,7 +1383,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
}
else
{
- aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
+ OUString aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
// Is this the right case for the table name?
// Else, look for it with different case, if applicable.
@@ -1483,9 +1524,9 @@ OUString OSingleSelectQueryComposer::getStatementPart( TGetParseNode const & _aG
namespace
{
- OUString lcl_getDecomposedColumnName(const OUString& rComposedName, const OUString& rQuoteString)
+ OUString lcl_getDecomposedColumnName(const OUString& rComposedName, std::u16string_view rQuoteString)
{
- const sal_Int32 nQuoteLength = rQuoteString.getLength();
+ const size_t nQuoteLength = rQuoteString.size();
OUString sName = rComposedName.trim();
OUString sColumnName;
sal_Int32 nPos, nRPos = 0;
@@ -1498,7 +1539,7 @@ namespace
nRPos = sName.indexOf( rQuoteString, nPos + nQuoteLength );
if ( nRPos > nPos )
{
- if ( nRPos + nQuoteLength < sName.getLength() )
+ if ( static_cast<sal_Int32>(nRPos + nQuoteLength) < sName.getLength() )
{
nRPos += nQuoteLength; // -1 + 1 skip dot
}
@@ -1520,24 +1561,25 @@ namespace
OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,
const OPredicateInputController& i_aPredicateInputController,
const Reference< XNameAccess >& i_xSelectColumns,
- const OUString& rQuoteString)
+ std::u16string_view rQuoteString)
{
OUStringBuffer sRet;
- const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
- const Sequence< PropertyValue >* pOrEnd = pOrIter + filter.getLength();
- while ( pOrIter != pOrEnd )
+ for (auto& rOr : filter)
{
- if ( pOrIter->hasElements() )
+ if (rOr.hasElements())
{
+ if (!sRet.isEmpty())
+ sRet.append(STR_OR);
sRet.append(L_BRACKET);
- const PropertyValue* pAndIter = pOrIter->getConstArray();
- const PropertyValue* pAndEnd = pAndIter + pOrIter->getLength();
- while ( pAndIter != pAndEnd )
+ OUStringBuffer sAnd;
+ for (auto& rAnd : rOr)
{
- sRet.append(pAndIter->Name);
+ if (!sAnd.isEmpty())
+ sAnd.append(STR_AND);
+ sAnd.append(rAnd.Name);
OUString sValue;
- pAndIter->Value >>= sValue;
- const OUString sColumnName = lcl_getDecomposedColumnName( pAndIter->Name, rQuoteString );
+ rAnd.Value >>= sValue;
+ const OUString sColumnName = lcl_getDecomposedColumnName( rAnd.Name, rQuoteString );
if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(sColumnName) )
{
Reference<XPropertySet> xColumn(i_xSelectColumns->getByName(sColumnName),UNO_QUERY);
@@ -1545,18 +1587,12 @@ namespace
}
else
{
- sValue = i_aPredicateInputController.getPredicateValueStr(pAndIter->Name,sValue);
+ sValue = i_aPredicateInputController.getPredicateValueStr(rAnd.Name,sValue);
}
- lcl_addFilterCriteria_throw(pAndIter->Handle,sValue,sRet);
- ++pAndIter;
- if ( pAndIter != pAndEnd )
- sRet.append(STR_AND);
+ lcl_addFilterCriteria_throw(rAnd.Handle, sValue, sAnd);
}
- sRet.append(R_BRACKET);
+ sRet.append(OUString::unacquired(sAnd) + R_BRACKET);
}
- ++pOrIter;
- if ( pOrIter != pOrEnd && !sRet.isEmpty() )
- sRet.append(STR_OR);
}
return sRet.makeStringAndClear();
}
@@ -1612,21 +1648,21 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
m_aCurrentColumns[SelectColumns]->getByName(aName) >>= xColumn;
OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME),"Property REALNAME not available!");
OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_TABLENAME),"Property TABLENAME not available!");
- OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName("AggregateFunction"),"Property AggregateFunction not available!");
+ OSL_ENSURE(xColumn->getPropertySetInfo()->hasPropertyByName(u"AggregateFunction"_ustr),"Property AggregateFunction not available!");
OUString sRealName,sTableName;
xColumn->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
xColumn->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
if(sTableName.indexOf('.') != -1)
{
- 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 );
}
else
sTableName = ::dbtools::quoteName(aQuote,sTableName);
- if ( !::comphelper::getBOOL(xColumn->getPropertyValue("Function")) )
+ if ( !::comphelper::getBOOL(xColumn->getPropertyValue(u"Function"_ustr)) )
{
aSQL = sTableName + "." + ::dbtools::quoteName( aQuote, sRealName );
}
@@ -1646,7 +1682,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( nType != DataType::BOOLEAN && DataType::BIT != nType )
{
- lcl_addFilterCriteria_throw(filterOperator,"",aSQL);
+ lcl_addFilterCriteria_throw(filterOperator,u"",aSQL);
}
switch(nType)
@@ -1664,7 +1700,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
const ::sal_Int64 nLength = xClob->length();
if ( sal_Int64(nLength + aSQL.getLength() + STR_LIKE.getLength() ) < sal_Int64(SAL_MAX_INT32) )
{
- aSQL.append("'").append(xClob->getSubString(1,static_cast<sal_Int32>(nLength))).append("'");
+ aSQL.append("'" + xClob->getSubString(1,static_cast<sal_Int32>(nLength)) + "'");
}
}
else
@@ -1685,12 +1721,8 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
aSQL.append( "\'" );
}
aSQL.append( "0x" );
- const sal_Int8* pBegin = aSeq.getConstArray();
- const sal_Int8* pEnd = pBegin + aSeq.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- aSQL.append( static_cast<sal_Int32>(*pBegin), 16 );
- }
+ for (sal_Int32 byte : aSeq)
+ aSQL.append(byte, 16);
if(nSearchable == ColumnSearch::CHAR)
aSQL.append( "\'" );
}
@@ -1715,7 +1747,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
sal_Int32 nFilterOp = filterOperator;
if ( filterOperator != SQLFilterOperator::SQLNULL && filterOperator != SQLFilterOperator::NOT_SQLNULL )
nFilterOp = SQLFilterOperator::SQLNULL;
- lcl_addFilterCriteria_throw(nFilterOp,"",aSQL);
+ lcl_addFilterCriteria_throw(nFilterOp,u"",aSQL);
}
// Attach filter
@@ -1725,7 +1757,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( !sFilter.isEmpty() && !aSQL.isEmpty() )
{
sFilter = L_BRACKET + sFilter + R_BRACKET +
- (andCriteria ? OUStringLiteral(STR_AND) : OUStringLiteral(STR_OR));
+ (andCriteria ? std::u16string_view(STR_AND) : std::u16string_view(STR_OR));
}
sFilter += aSQL;
diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx
index 0a5bd2c2d5fe..254734ad7dce 100644
--- a/dbaccess/source/core/api/StaticSet.cxx
+++ b/dbaccess/source/core/api/StaticSet.cxx
@@ -20,20 +20,16 @@
#include "StaticSet.hxx"
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <connectivity/CommonTools.hxx>
#include <comphelper/types.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
using namespace dbaccess;
using namespace connectivity;
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 ::com::sun::star::lang;
-using namespace ::osl;
void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
{
@@ -43,7 +39,7 @@ void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
// css::sdbcx::XRowLocate
Any OStaticSet::getBookmark()
{
- return makeAny(getRow());
+ return Any(getRow());
}
bool OStaticSet::moveToBookmark( const Any& bookmark )
@@ -80,7 +76,7 @@ bool OStaticSet::fetchRow()
m_aSet.push_back(new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()));
m_aSetIter = m_aSet.end() - 1;
(**m_aSetIter)[0] = getRow();
- OCacheSet::fillValueRow(*m_aSetIter,(**m_aSetIter)[0]);
+ OCacheSet::fillValueRow(*m_aSetIter,(**m_aSetIter)[0].getInt32());
}
else
m_bEnd = true;
@@ -99,7 +95,7 @@ void OStaticSet::fillAllRows()
m_aSet.push_back(pRow);
m_aSetIter = m_aSet.end() - 1;
(*pRow)[0] = getRow();
- OCacheSet::fillValueRow(pRow,(*pRow)[0]);
+ OCacheSet::fillValueRow(pRow,(*pRow)[0].getInt32());
}
m_bEnd = true;
}
@@ -193,7 +189,7 @@ bool OStaticSet::absolute( sal_Int32 row )
}
else if(row > 0)
{
- if(row >= static_cast<sal_Int32>(m_aSet.size()))
+ if(o3tl::make_unsigned(row) >= m_aSet.size())
{
if(!m_bEnd)
{
@@ -202,7 +198,7 @@ bool OStaticSet::absolute( sal_Int32 row )
bNext = fetchRow();
}
- if(row > static_cast<sal_Int32>(m_aSet.size()))
+ if(o3tl::make_unsigned(row) > m_aSet.size())
m_aSetIter = m_aSet.end(); // check again
else
m_aSetIter = m_aSet.begin() + row;
@@ -270,10 +266,7 @@ void OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OS
void OStaticSet::reset(const Reference< XResultSet> &_xDriverSet)
{
OCacheSet::construct(_xDriverSet, m_sRowSetFilter);
- {
- ORowSetMatrix t;
- m_aSet.swap(t);
- }
+ ORowSetMatrix().swap(m_aSet);
m_aSetIter = m_aSet.end();
m_bEnd = false;
m_aSet.emplace_back(nullptr); // this is the beforefirst record
diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx
index 8c466d29e208..9f765996b860 100644
--- a/dbaccess/source/core/api/StaticSet.hxx
+++ b/dbaccess/source/core/api/StaticSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_STATICSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_STATICSET_HXX
+#pragma once
#include "CacheSet.hxx"
@@ -72,6 +71,5 @@ namespace dbaccess
virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_STATICSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index b8a8da27371e..3d7d9c56b1a5 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -18,15 +18,14 @@
*/
#include <TableDeco.hxx>
-#include <apitools.hxx>
#include <definitioncolumn.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include <osl/diagnose.h>
#include <sal/log.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <comphelper/property.hxx>
#include <comphelper/servicehelper.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
@@ -311,7 +310,7 @@ void ODBTableDecorator::construct()
Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
Sequence< Property > aTableProps = xInfo->getProperties();
- for (Property & prop : aTableProps)
+ for (Property & prop : asNonConstRange(aTableProps))
{
if (prop.Name == PROPERTY_CATALOGNAME)
prop.Handle = PROPERTY_ID_CATALOGNAME;
@@ -351,7 +350,24 @@ void ODBTableDecorator::construct()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO1(ODBTableDecorator, "com.sun.star.sdb.dbaccess.ODBTableDecorator", SERVICE_SDBCX_TABLE)
+OUString SAL_CALL ODBTableDecorator::getImplementationName()
+ {
+ return u"com.sun.star.sdb.dbaccess.ODBTableDecorator"_ustr;
+ }
+sal_Bool SAL_CALL ODBTableDecorator::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL ODBTableDecorator::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_TABLE };
+}
+
Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType )
{
@@ -451,8 +467,8 @@ OUString SAL_CALL ODBTableDecorator::getName()
sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<ODBTableDecorator>(rId))
- return reinterpret_cast<sal_Int64>(this);
+ if (comphelper::isUnoTunnelId<ODBTableDecorator>(rId))
+ return comphelper::getSomething_cast(this);
sal_Int64 nRet = 0;
Reference<XUnoTunnel> xTunnel(m_xTable,UNO_QUERY);
@@ -461,11 +477,10 @@ sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >&
return nRet;
}
-Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelId()
+const Sequence< sal_Int8 > & ODBTableDecorator::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
void ODBTableDecorator::fillPrivileges() const
@@ -534,11 +549,8 @@ void ODBTableDecorator::refreshColumns()
xNames = m_xTable->getColumns();
if(xNames.is())
{
- Sequence< OUString> aNames = xNames->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
- aVector.push_back(*pIter);
+ const Sequence< OUString> aNames = xNames->getElementNames();
+ aVector.insert(aVector.end(), aNames.begin(), aNames.end());
}
}
if(!m_pColumns)
@@ -549,18 +561,18 @@ void ODBTableDecorator::refreshColumns()
m_xMetaData.is() && m_xMetaData->supportsAlterTableWithDropColumn());
pCol->setParent(*this);
- OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
+ rtl::Reference<OContainerMediator> pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
m_xColumnMediator = pMediator;
- pCol->setMediator( pMediator );
+ pCol->setMediator( pMediator.get() );
m_pColumns.reset(pCol);
}
else
m_pColumns->reFill(aVector);
}
-OColumn* ODBTableDecorator::createColumn(const OUString& _rName) const
+rtl::Reference<OColumn> ODBTableDecorator::createColumn(const OUString& _rName) const
{
- OColumn* pReturn = nullptr;
+ rtl::Reference<OColumn> pReturn;
Reference<XNameAccess> xNames;
if ( m_xTable.is() )
@@ -571,11 +583,11 @@ OColumn* ODBTableDecorator::createColumn(const OUString& _rName) const
{
Reference<XPropertySet> xProp(xNames->getByName(_rName),UNO_QUERY);
- Reference<XPropertySet> xColumnDefintion;
+ Reference<XPropertySet> xColumnDefinition;
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName))
- xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
+ xColumnDefinition.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
+ pReturn = new OTableColumnWrapper( xProp, xColumnDefinition, false );
}
}
return pReturn;
@@ -595,28 +607,27 @@ void ODBTableDecorator::columnDropped(const OUString& _sName)
Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor()
{
- Reference<XDataDescriptorFactory> xNames;
- if(m_xTable.is())
- xNames.set(m_xTable->getColumns(),UNO_QUERY);
- Reference< XPropertySet > xRet;
- if ( xNames.is() )
- xRet = new OTableColumnDescriptorWrapper( xNames->createDataDescriptor(), false, true );
- return xRet;
+ if(!m_xTable.is())
+ return nullptr;
+ Reference<XDataDescriptorFactory> xNames(m_xTable->getColumns(),UNO_QUERY);
+ if ( !xNames.is() )
+ return nullptr;
+ return new OTableColumnDescriptorWrapper( xNames->createDataDescriptor(), false, true );
}
-void SAL_CALL ODBTableDecorator::acquire() throw()
+void SAL_CALL ODBTableDecorator::acquire() noexcept
{
OTableDescriptor_BASE::acquire();
}
-void SAL_CALL ODBTableDecorator::release() throw()
+void SAL_CALL ODBTableDecorator::release() noexcept
{
OTableDescriptor_BASE::release();
}
void SAL_CALL ODBTableDecorator::setName( const OUString& /*aName*/ )
{
- throwFunctionNotSupportedRuntimeException( "XNamed::setName", *this );
+ throwFunctionNotSupportedRuntimeException( u"XNamed::setName"_ustr, *this );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx
index c52c4885c757..efbbd8b412df 100644
--- a/dbaccess/source/core/api/View.cxx
+++ b/dbaccess/source/core/api/View.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -52,7 +52,7 @@ namespace dbaccess
try
{
Reference<XMultiServiceFactory> xFac(_rxConnection,UNO_QUERY_THROW);
- m_xViewAccess.set(xFac->createInstance(lcl_getServiceNameForSetting(_rxConnection,"ViewAccessServiceName")),UNO_QUERY);
+ m_xViewAccess.set(xFac->createInstance(lcl_getServiceNameForSetting(_rxConnection,u"ViewAccessServiceName"_ustr)),UNO_QUERY);
}
catch(const Exception& )
{
@@ -85,13 +85,9 @@ namespace dbaccess
std::vector<Type> aOwnTypes;
aOwnTypes.reserve(aTypes.getLength());
- const Type* pIter = aTypes.getConstArray();
- const Type* pEnd = pIter + aTypes.getLength();
- for(;pIter != pEnd ;++pIter)
- {
- if( *pIter != aAlterType || m_xViewAccess.is() )
- aOwnTypes.push_back(*pIter);
- }
+ for (auto& type : aTypes)
+ if (m_xViewAccess || type != aAlterType)
+ aOwnTypes.push_back(type);
return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/dbaccess/source/core/api/WrappedResultSet.cxx b/dbaccess/source/core/api/WrappedResultSet.cxx
index a0999e5f32aa..a4ad9f363cae 100644
--- a/dbaccess/source/core/api/WrappedResultSet.cxx
+++ b/dbaccess/source/core/api/WrappedResultSet.cxx
@@ -23,12 +23,8 @@
using namespace dbaccess;
using namespace ::connectivity;
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 ::com::sun::star::lang;
-using namespace ::osl;
void WrappedResultSet::construct(const Reference< XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter)
{
@@ -49,7 +45,7 @@ Any WrappedResultSet::getBookmark()
{
return m_xRowLocate->getBookmark( );
}
- return makeAny(m_xDriverSet->getRow());
+ return Any(m_xDriverSet->getRow());
}
bool WrappedResultSet::moveToBookmark( const Any& bookmark )
@@ -122,56 +118,56 @@ void WrappedResultSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate
break;
case DataType::CHAR:
case DataType::VARCHAR:
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIGINT:
if ( _rValue.isSigned() )
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
else
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIT:
case DataType::BOOLEAN:
- _xParameter->updateBoolean(nPos,static_cast<bool>(_rValue));
+ _xParameter->updateBoolean(nPos,_rValue.getBool());
break;
case DataType::TINYINT:
if ( _rValue.isSigned() )
- _xParameter->updateByte(nPos,_rValue);
+ _xParameter->updateByte(nPos,_rValue.getInt8());
else
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
break;
case DataType::SMALLINT:
if ( _rValue.isSigned() )
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
else
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
break;
case DataType::INTEGER:
if ( _rValue.isSigned() )
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
else
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
break;
case DataType::FLOAT:
- _xParameter->updateFloat(nPos,_rValue);
+ _xParameter->updateFloat(nPos,_rValue.getFloat());
break;
case DataType::DOUBLE:
case DataType::REAL:
- _xParameter->updateDouble(nPos,_rValue);
+ _xParameter->updateDouble(nPos,_rValue.getDouble());
break;
case DataType::DATE:
- _xParameter->updateDate(nPos,_rValue);
+ _xParameter->updateDate(nPos,_rValue.getDate());
break;
case DataType::TIME:
- _xParameter->updateTime(nPos,_rValue);
+ _xParameter->updateTime(nPos,_rValue.getTime());
break;
case DataType::TIMESTAMP:
- _xParameter->updateTimestamp(nPos,_rValue);
+ _xParameter->updateTimestamp(nPos,_rValue.getDateTime());
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- _xParameter->updateBytes(nPos,_rValue);
+ _xParameter->updateBytes(nPos,_rValue.getSequence());
break;
case DataType::BLOB:
case DataType::CLOB:
diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx
index 8f0b07953605..58b2d704102a 100644
--- a/dbaccess/source/core/api/WrappedResultSet.hxx
+++ b/dbaccess/source/core/api/WrappedResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_WRAPPEDRESULTSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_WRAPPEDRESULTSET_HXX
+#pragma once
#include "CacheSet.hxx"
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -57,6 +56,5 @@ namespace dbaccess
virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_WRAPPEDRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/callablestatement.cxx b/dbaccess/source/core/api/callablestatement.cxx
index cfddeac19139..c03fe0aab96e 100644
--- a/dbaccess/source/core/api/callablestatement.cxx
+++ b/dbaccess/source/core/api/callablestatement.cxx
@@ -24,10 +24,7 @@
using namespace dbaccess;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::cppu;
using namespace ::osl;
@@ -58,12 +55,12 @@ Any OCallableStatement::queryInterface( const Type & rType )
return aIface;
}
-void OCallableStatement::acquire() throw ()
+void OCallableStatement::acquire() noexcept
{
OPreparedStatement::acquire();
}
-void OCallableStatement::release() throw ()
+void OCallableStatement::release() noexcept
{
OPreparedStatement::release();
}
@@ -71,7 +68,7 @@ void OCallableStatement::release() throw ()
// XServiceInfo
OUString OCallableStatement::getImplementationName( )
{
- return "com.sun.star.sdb.OCallableStatement";
+ return u"com.sun.star.sdb.OCallableStatement"_ustr;
}
Sequence< OUString > OCallableStatement::getSupportedServiceNames( )
@@ -84,7 +81,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerOutParameter( parameterIndex, sqlType, typeName );
}
@@ -92,7 +89,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerNumericOutParameter( parameterIndex, sqlType, scale );
}
@@ -101,7 +98,7 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet
sal_Bool SAL_CALL OCallableStatement::wasNull( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->wasNull();
}
@@ -109,7 +106,7 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( )
OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getString( columnIndex );
}
@@ -117,7 +114,7 @@ OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBoolean( columnIndex );
}
@@ -125,7 +122,7 @@ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getByte( columnIndex );
}
@@ -133,63 +130,63 @@ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getShort( columnIndex );
}
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getInt( columnIndex );
}
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getLong( columnIndex );
}
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getFloat( columnIndex );
}
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDouble( columnIndex );
}
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBytes( columnIndex );
}
css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDate( columnIndex );
}
css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTime( columnIndex );
}
css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTimestamp( columnIndex );
}
@@ -197,7 +194,7 @@ css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnI
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBinaryStream( columnIndex );
}
@@ -205,7 +202,7 @@ Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream(
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getCharacterStream( columnIndex );
}
@@ -213,7 +210,7 @@ Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStre
Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& typeMap )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getObject( columnIndex, typeMap );
}
@@ -221,28 +218,28 @@ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Referen
Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getRef( columnIndex );
}
Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBlob( columnIndex );
}
Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getClob( columnIndex );
}
Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getArray( columnIndex );
}
diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx
index 5bc70affbce0..b51dc53bc11b 100644
--- a/dbaccess/source/core/api/column.cxx
+++ b/dbaccess/source/core/api/column.cxx
@@ -29,24 +29,20 @@
#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
#include <comphelper/uno3.hxx>
#include <connectivity/TTableHelper.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
#include <osl/diagnose.h>
using namespace dbaccess;
using namespace connectivity;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -81,7 +77,7 @@ IMPLEMENT_FORWARD_XINTERFACE2( OColumn, OColumnBase, ::comphelper::OPropertyCont
// css::lang::XServiceInfo
OUString OColumn::getImplementationName( )
{
- return "com.sun.star.sdb.OColumn";
+ return u"com.sun.star.sdb.OColumn"_ustr;
}
sal_Bool OColumn::supportsService( const OUString& _rServiceName )
@@ -147,7 +143,7 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent,
}
OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
- const css::uno::Reference< css::container::XNameAccess >& _rxDrvColumns,
+ css::uno::Reference< css::container::XNameAccess > _xDrvColumns,
bool _bCaseSensitive,const std::vector< OUString> &_rVector,
IColumnFactory* _pColFactory,
::connectivity::sdbcx::IRefreshableColumns* _pRefresh,
@@ -156,7 +152,7 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
bool _bUseHardRef)
: OColumns_BASE(_rParent,_bCaseSensitive,_rMutex,_rVector,_bUseHardRef)
,m_pMediator(nullptr)
- ,m_xDrvColumns(_rxDrvColumns)
+ ,m_xDrvColumns(std::move(_xDrvColumns))
,m_pColFactoryImpl(_pColFactory)
,m_pRefreshColumns(_pRefresh)
,m_bInitialized(false)
@@ -172,7 +168,7 @@ OColumns::~OColumns()
// XServiceInfo
OUString OColumns::getImplementationName( )
{
- return "com.sun.star.sdb.OColumns";
+ return u"com.sun.star.sdb.OColumns"_ustr;
}
sal_Bool OColumns::supportsService( const OUString& _rServiceName )
@@ -189,7 +185,7 @@ void OColumns::append( const OUString& _rName, OColumn* _pColumn )
{
MutexGuard aGuard(m_rMutex);
- OSL_ENSURE( _pColumn, "OColumns::append: invalid column!" );
+ assert(_pColumn && "OColumns::append: invalid column!");
OSL_ENSURE( !m_pElements->exists( _rName ),"OColumns::append: Column already exists");
_pColumn->m_sName = _rName;
@@ -219,22 +215,21 @@ void OColumns::impl_refresh()
m_pRefreshColumns->refreshColumns();
}
-connectivity::sdbcx::ObjectType OColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OColumns::createObject(const OUString& _rName)
{
OSL_ENSURE(m_pColFactoryImpl, "OColumns::createObject: no column factory!");
- connectivity::sdbcx::ObjectType xRet;
+ rtl::Reference< OColumn > xRet;
if ( m_pColFactoryImpl )
{
xRet = m_pColFactoryImpl->createColumn(_rName);
- Reference<XChild> xChild(xRet,UNO_QUERY);
+ Reference<XChild> xChild(cppu::getXWeak(xRet.get()),UNO_QUERY);
if ( xChild.is() )
xChild->setParent(static_cast<XChild*>(static_cast<TXChild*>(this)));
}
- Reference<XPropertySet> xDest(xRet,UNO_QUERY);
- if ( m_pMediator && xDest.is() )
- m_pMediator->notifyElementCreated(_rName,xDest);
+ if ( m_pMediator && xRet.is() )
+ m_pMediator->notifyElementCreated(_rName, Reference<XPropertySet>(xRet));
return xRet;
}
@@ -283,21 +278,18 @@ Sequence< Type > SAL_CALL OColumns::getTypes( )
{
bool bAppendFound = false,bDropFound = false;
- sal_Int32 nSize = 0;
+ sal_Int32 nSize;
Type aAppendType = cppu::UnoType<XAppend>::get();
Type aDropType = cppu::UnoType<XDrop>::get();
if(m_xDrvColumns.is())
{
Reference<XTypeProvider> xTypes(m_xDrvColumns,UNO_QUERY);
- Sequence< Type > aTypes(xTypes->getTypes());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for (;pBegin != pEnd ; ++pBegin)
+ for (auto& type : xTypes->getTypes())
{
- if(aAppendType == *pBegin)
+ if (aAppendType == type)
bAppendFound = true;
- else if(aDropType == *pBegin)
+ else if (aDropType == type)
bDropFound = true;
}
nSize = (bDropFound ? (bAppendFound ? 0 : 1) : (bAppendFound ? 1 : 2));
@@ -315,25 +307,25 @@ Sequence< Type > SAL_CALL OColumns::getTypes( )
}
Sequence< Type > aTypes(::comphelper::concatSequences(OColumns_BASE::getTypes(),TXChild::getTypes()));
Sequence< Type > aRet(aTypes.getLength() - nSize);
+ auto* pRet = aRet.getArray();
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(sal_Int32 i=0;pBegin != pEnd ;++pBegin)
+ sal_Int32 i = 0;
+ for (auto& type : aTypes)
{
- if(*pBegin != aAppendType && *pBegin != aDropType)
- aRet.getArray()[i++] = *pBegin;
- else if(bDropFound && *pBegin == aDropType)
- aRet.getArray()[i++] = *pBegin;
- else if(bAppendFound && *pBegin == aAppendType)
- aRet.getArray()[i++] = *pBegin;
+ if (type != aAppendType && type != aDropType)
+ pRet[i++] = type;
+ else if (bDropFound && type == aDropType)
+ pRet[i++] = type;
+ else if (bAppendFound && type == aAppendType)
+ pRet[i++] = type;
}
return aRet;
}
// XAppend
-sdbcx::ObjectType OColumns::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OColumns::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- sdbcx::ObjectType xReturn;
+ css::uno::Reference< css::beans::XPropertySet > xReturn;
Reference< XAppend > xAppend( m_xDrvColumns, UNO_QUERY );
if ( xAppend.is() )
diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx
index 3f62a5a691fe..505e0d36b98f 100644
--- a/dbaccess/source/core/api/columnsettings.cxx
+++ b/dbaccess/source/core/api/columnsettings.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -121,14 +121,14 @@ namespace dbaccess
};
const PropertyDescriptor aProps[] =
{
- { OUString(PROPERTY_ALIGN), PROPERTY_ID_ALIGN },
- { OUString(PROPERTY_NUMBERFORMAT), PROPERTY_ID_NUMBERFORMAT },
- { OUString(PROPERTY_RELATIVEPOSITION), PROPERTY_ID_RELATIVEPOSITION },
- { OUString(PROPERTY_WIDTH), PROPERTY_ID_WIDTH },
- { OUString(PROPERTY_HELPTEXT), PROPERTY_ID_HELPTEXT },
- { OUString(PROPERTY_CONTROLDEFAULT), PROPERTY_ID_CONTROLDEFAULT },
- { OUString(PROPERTY_CONTROLMODEL), PROPERTY_ID_CONTROLMODEL },
- { OUString(PROPERTY_HIDDEN), PROPERTY_ID_HIDDEN }
+ { PROPERTY_ALIGN, PROPERTY_ID_ALIGN },
+ { PROPERTY_NUMBERFORMAT, PROPERTY_ID_NUMBERFORMAT },
+ { PROPERTY_RELATIVEPOSITION, PROPERTY_ID_RELATIVEPOSITION },
+ { PROPERTY_WIDTH, PROPERTY_ID_WIDTH },
+ { PROPERTY_HELPTEXT, PROPERTY_ID_HELPTEXT },
+ { PROPERTY_CONTROLDEFAULT, PROPERTY_ID_CONTROLDEFAULT },
+ { PROPERTY_CONTROLMODEL, PROPERTY_ID_CONTROLMODEL },
+ { PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN }
};
for (const auto & aProp : aProps)
diff --git a/dbaccess/source/core/api/datacolumn.cxx b/dbaccess/source/core/api/datacolumn.cxx
index c597a40649bf..041cbf5f4f03 100644
--- a/dbaccess/source/core/api/datacolumn.cxx
+++ b/dbaccess/source/core/api/datacolumn.cxx
@@ -25,12 +25,9 @@
using namespace dbaccess;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::osl;
-using namespace ::comphelper;
using namespace ::cppu;
@@ -78,7 +75,7 @@ Any SAL_CALL ODataColumn::queryInterface( const Type & _rType )
// XServiceInfo
OUString ODataColumn::getImplementationName( )
{
- return "com.sun.star.sdb.ODataColumn";
+ return u"com.sun.star.sdb.ODataColumn"_ustr;
}
Sequence< OUString > ODataColumn::getSupportedServiceNames( )
diff --git a/dbaccess/source/core/api/datacolumn.hxx b/dbaccess/source/core/api/datacolumn.hxx
index fa40e0765cc1..46512d94559c 100644
--- a/dbaccess/source/core/api/datacolumn.hxx
+++ b/dbaccess/source/core/api/datacolumn.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_DATACOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_DATACOLUMN_HXX
+#pragma once
#include <com/sun/star/sdbc/XRowUpdate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -52,8 +51,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override { OResultColumn::acquire(); }
- virtual void SAL_CALL release() throw() override { OResultColumn::release(); }
+ virtual void SAL_CALL acquire() noexcept override { OResultColumn::acquire(); }
+ virtual void SAL_CALL release() noexcept override { OResultColumn::release(); }
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -105,6 +104,4 @@ namespace dbaccess
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_DATACOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/datasettings.cxx b/dbaccess/source/core/api/datasettings.cxx
index 28167184442f..f810f8669917 100644
--- a/dbaccess/source/core/api/datasettings.cxx
+++ b/dbaccess/source/core/api/datasettings.cxx
@@ -27,7 +27,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::comphelper;
using namespace ::cppu;
@@ -95,7 +94,6 @@ void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem)
ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,bool _bQuery)
:OPropertyStateContainer(_rBHelper)
- ,ODataSettings_Base()
,m_bQuery(_bQuery)
{
}
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 84d1197bda20..49aa4c39e48c 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -19,8 +19,8 @@
#include <bitset>
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <definitioncolumn.hxx>
#include <sdbcoretools.hxx>
@@ -30,13 +30,13 @@
#include <comphelper/property.hxx>
#include <connectivity/dbtools.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::cppu;
using namespace ::comphelper;
@@ -84,12 +84,12 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptor )
// css::lang::XServiceInfo
OUString OTableColumnDescriptor::getImplementationName( )
{
- return "com.sun.star.sdb.OTableColumnDescriptor";
+ return u"com.sun.star.sdb.OTableColumnDescriptor"_ustr;
}
Sequence< OUString > OTableColumnDescriptor::getSupportedServiceNames( )
{
- return { m_bActAsDescriptor? OUString(SERVICE_SDBCX_COLUMNDESCRIPTOR) : OUString(SERVICE_SDBCX_COLUMN),
+ return { m_bActAsDescriptor? SERVICE_SDBCX_COLUMNDESCRIPTOR : SERVICE_SDBCX_COLUMN,
SERVICE_SDB_COLUMNSETTINGS };
}
@@ -141,7 +141,7 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumn )
OUString OTableColumn::getImplementationName( )
{
- return "com.sun.star.sdb.OTableColumn";
+ return u"com.sun.star.sdb.OTableColumn"_ustr;
}
::cppu::IPropertyArrayHelper& SAL_CALL OTableColumn::getInfoHelper()
@@ -156,9 +156,9 @@ OUString OTableColumn::getImplementationName( )
// OQueryColumn
-OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection, const OUString &i_sLabel )
+OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection, OUString i_sLabel )
:OTableColumnDescriptor( false /* do not act as descriptor */ )
- ,m_sLabel(i_sLabel)
+ ,m_sLabel(std::move(i_sLabel))
{
const sal_Int32 nPropAttr = PropertyAttribute::READONLY;
registerProperty( PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, nPropAttr, &m_sCatalogName, cppu::UnoType<decltype(m_sCatalogName)>::get() );
@@ -169,35 +169,35 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_TYPENAME ) >>= m_aTypeName) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_TYPENAME);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_TYPENAME);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= m_nIsNullable) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_ISNULLABLE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISNULLABLE);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_PRECISION ) >>= m_nPrecision) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_PRECISION);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_PRECISION);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_SCALE ) >>= m_nScale) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_SCALE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_SCALE);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_TYPE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_TYPE);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_ISAUTOINCREMENT);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISAUTOINCREMENT);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_ISCURRENCY);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISCURRENCY);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_NAME);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_NAME);
m_bRowVersion = false;
Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW );
if ( xPSI->hasPropertyByName( PROPERTY_DEFAULTVALUE ) )
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_DEFAULTVALUE ) >>= m_aDefaultValue) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_DEFAULTVALUE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_DEFAULTVALUE);
// copy some optional properties from the parser column
struct PropertyDescriptor
@@ -207,10 +207,10 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co
};
const PropertyDescriptor aProps[] =
{
- { OUString(PROPERTY_CATALOGNAME), PROPERTY_ID_CATALOGNAME },
- { OUString(PROPERTY_SCHEMANAME), PROPERTY_ID_SCHEMANAME },
- { OUString(PROPERTY_TABLENAME), PROPERTY_ID_TABLENAME },
- { OUString(PROPERTY_REALNAME), PROPERTY_ID_REALNAME }
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME },
+ { PROPERTY_REALNAME, PROPERTY_ID_REALNAME }
};
for (const auto & aProp : aProps)
{
@@ -243,11 +243,11 @@ Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const
// respective properties
OUString sCatalog, sSchema, sTable;
if( ! (getPropertyValue( PROPERTY_CATALOGNAME ) >>= sCatalog) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_CATALOGNAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_CATALOGNAME);
if( ! (getPropertyValue( PROPERTY_SCHEMANAME ) >>= sSchema) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_SCHEMANAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_SCHEMANAME);
if( ! (getPropertyValue( PROPERTY_TABLENAME ) >>= sTable) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_TABLENAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_TABLENAME);
if ( sCatalog.isEmpty() && sSchema.isEmpty() && sTable.isEmpty() )
return nullptr;
@@ -265,7 +265,7 @@ Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const
OUString sColumn;
if( ! (getPropertyValue( PROPERTY_REALNAME ) >>= sColumn) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_REALNAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_REALNAME);
if ( !xColumns->hasByName( sColumn ) )
return nullptr;
@@ -282,7 +282,7 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( OQueryColumn )
OUString SAL_CALL OQueryColumn::getImplementationName( )
{
- return "org.openoffice.comp.dbaccess.OQueryColumn";
+ return u"org.openoffice.comp.dbaccess.OQueryColumn"_ustr;
}
::cppu::IPropertyArrayHelper& SAL_CALL OQueryColumn::getInfoHelper()
@@ -428,7 +428,7 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptorWrapper )
// css::lang::XServiceInfo
OUString OTableColumnDescriptorWrapper::getImplementationName( )
{
- return "com.sun.star.sdb.OTableColumnDescriptorWrapper";
+ return u"com.sun.star.sdb.OTableColumnDescriptorWrapper"_ustr;
}
Sequence< OUString > OTableColumnDescriptorWrapper::getSupportedServiceNames( )
@@ -444,50 +444,52 @@ Sequence< OUString > OTableColumnDescriptorWrapper::getSupportedServiceNames( )
// Which optional properties are contained?
const sal_Int32 nHaveOptionally (std::bitset<7>(nId).count());
- BEGIN_PROPERTY_SEQUENCE( nHaveAlways + nHaveOptionally )
+ css::uno::Sequence< css::beans::Property> aDescriptor(nHaveAlways + nHaveOptionally);
+ css::beans::Property* pDesc = aDescriptor.getArray();
+ sal_Int32 nPos = 0;
- DECL_PROP0_BOOL( ISAUTOINCREMENT );
- DECL_PROP0_BOOL( ISCURRENCY );
- DECL_PROP0( ISNULLABLE, sal_Int32 );
- DECL_PROP0( PRECISION, sal_Int32 );
- DECL_PROP0( SCALE, sal_Int32 );
- DECL_PROP0( TYPE, sal_Int32 );
- DECL_PROP0( TYPENAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString >::get(), 0);
if ( nId & HAS_AUTOINCREMENT_CREATION )
{
- DECL_PROP1( AUTOINCREMENTCREATION, OUString, MAYBEVOID );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_AUTOINCREMENTCREATION, PROPERTY_ID_AUTOINCREMENTCREATION, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID );
}
if ( nId & HAS_DEFAULTVALUE )
{
- DECL_PROP0( DEFAULTVALUE, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_DESCRIPTION )
{
- DECL_PROP0( DESCRIPTION, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_ROWVERSION )
{
- DECL_PROP0_BOOL( ISROWVERSION );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), 0);
}
if ( nId & HAS_CATALOGNAME )
{
- DECL_PROP0( CATALOGNAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_SCHEMANAME )
{
- DECL_PROP0( SCHEMANAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_TABLENAME )
{
- DECL_PROP0( TABLENAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString >::get(), 0);
}
- END_PROPERTY_SEQUENCE()
+ OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?");
if ( !m_bIsDescriptor )
{
- for ( auto & prop : aDescriptor )
+ for ( auto & prop : asNonConstRange(aDescriptor) )
{
prop.Attributes |= PropertyAttribute::READONLY;
}
@@ -559,16 +561,16 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
}
// OTableColumnWrapper
-OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefintion,
+OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefinition,
const bool _bPureWrap )
:OTableColumnDescriptorWrapper( rCol, _bPureWrap, false )
{
osl_atomic_increment( &m_refCount );
- if ( _xColDefintion.is() )
+ if ( _xColDefinition.is() )
{
try
{
- ::comphelper::copyProperties( _xColDefintion, this );
+ ::comphelper::copyProperties( _xColDefinition, this );
}
catch( const Exception& )
{
@@ -586,7 +588,7 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnWrapper )
OUString OTableColumnWrapper::getImplementationName( )
{
- return "com.sun.star.sdb.OTableColumnWrapper";
+ return u"com.sun.star.sdb.OTableColumnWrapper"_ustr;
}
Sequence< OUString > OTableColumnWrapper::getSupportedServiceNames( )
diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx
index d65ea616d8c7..7688d23a363c 100644
--- a/dbaccess/source/core/api/preparedstatement.cxx
+++ b/dbaccess/source/core/api/preparedstatement.cxx
@@ -18,7 +18,6 @@
*/
-#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
@@ -28,13 +27,14 @@
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <preparedstatement.hxx>
+#include <strings.hxx>
#include "resultcolumn.hxx"
#include "resultset.hxx"
-#include <tools/diagnose_ex.h>
+#include <connection.hxx>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::cppu;
@@ -42,7 +42,7 @@ using namespace ::osl;
using namespace dbaccess;
-OPreparedStatement::OPreparedStatement(const Reference< XConnection > & _xConn,
+OPreparedStatement::OPreparedStatement(const rtl::Reference< OConnection > & _xConn,
const Reference< XInterface > & _xStatement)
:OStatementBase(_xConn, _xStatement)
{
@@ -93,12 +93,12 @@ Any OPreparedStatement::queryInterface( const Type & rType )
return aIface;
}
-void OPreparedStatement::acquire() throw ()
+void OPreparedStatement::acquire() noexcept
{
OStatementBase::acquire();
}
-void OPreparedStatement::release() throw ()
+void OPreparedStatement::release() noexcept
{
OStatementBase::release();
}
@@ -106,7 +106,7 @@ void OPreparedStatement::release() throw ()
// XServiceInfo
OUString OPreparedStatement::getImplementationName( )
{
- return "com.sun.star.sdb.OPreparedStatement";
+ return u"com.sun.star.sdb.OPreparedStatement"_ustr;
}
sal_Bool OPreparedStatement::supportsService( const OUString& _rServiceName )
@@ -116,7 +116,7 @@ sal_Bool OPreparedStatement::supportsService( const OUString& _rServiceName )
Sequence< OUString > OPreparedStatement::getSupportedServiceNames( )
{
- return { SERVICE_SDBC_PREPAREDSTATEMENT, SERVICE_SDB_PREPAREDSTATMENT };
+ return { SERVICE_SDBC_PREPAREDSTATEMENT, SERVICE_SDB_PREPAREDSTATEMENT };
}
// OComponentHelper
@@ -134,7 +134,7 @@ void OPreparedStatement::disposing()
Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// do we have to populate the columns
if (!m_pColumns->isInitialized())
@@ -151,14 +151,14 @@ Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
{
// retrieve the name of the column
OUString aName = xMetaData->getColumnName(i + 1);
- OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
+ rtl::Reference<OResultColumn> pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
// don't silently assume that the name is unique - preparedStatement implementations
// are allowed to return duplicate names, but we are required to have
// unique column names
if ( m_pColumns->hasByName( aName ) )
aName = ::dbtools::createUniqueName( m_pColumns.get(), aName );
- m_pColumns->append(aName, pColumn);
+ m_pColumns->append(aName, pColumn.get());
}
}
catch (const SQLException& )
@@ -174,7 +174,7 @@ Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
Reference< XResultSetMetaData > OPreparedStatement::getMetaData()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XResultSetMetaDataSupplier >( m_xAggregateAsSet, UNO_QUERY_THROW )->getMetaData();
}
@@ -182,18 +182,18 @@ Reference< XResultSetMetaData > OPreparedStatement::getMetaData()
Reference< XResultSet > OPreparedStatement::executeQuery()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
- Reference< XResultSet > xResultSet;
+ rtl::Reference< OResultSet > xResultSet;
Reference< XResultSet > xDrvResultSet = Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeQuery();
if (xDrvResultSet.is())
{
xResultSet = new OResultSet(xDrvResultSet, *this, m_pColumns->isCaseSensitive());
// keep the resultset weak
- m_aResultSet = xResultSet;
+ m_xWeakResultSet = xResultSet.get();
}
return xResultSet;
}
@@ -201,7 +201,7 @@ Reference< XResultSet > OPreparedStatement::executeQuery()
sal_Int32 OPreparedStatement::executeUpdate()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -211,7 +211,7 @@ sal_Int32 OPreparedStatement::executeUpdate()
sal_Bool OPreparedStatement::execute()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -220,14 +220,14 @@ sal_Bool OPreparedStatement::execute()
Reference< XConnection > OPreparedStatement::getConnection()
{
- return Reference< XConnection > (m_xParent, UNO_QUERY);
+ return m_xParent.get();
}
// XParameters
void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setNull(parameterIndex, sqlType);
}
@@ -235,7 +235,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObjectNull(parameterIndex, sqlType, typeName);
}
@@ -243,7 +243,7 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I
void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBoolean(parameterIndex, x);
}
@@ -251,7 +251,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setByte(parameterIndex, x);
}
@@ -259,7 +259,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x
void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setShort(parameterIndex, x);
}
@@ -267,7 +267,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setInt(parameterIndex, x);
}
@@ -275,7 +275,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setLong(parameterIndex, x);
}
@@ -283,7 +283,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x
void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setFloat(parameterIndex, x);
}
@@ -291,7 +291,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setDouble(parameterIndex, x);
}
@@ -299,7 +299,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setString(parameterIndex, x);
}
@@ -307,7 +307,7 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUS
void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBytes(parameterIndex, x);
}
@@ -315,7 +315,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const css::util::Date& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setDate(parameterIndex, x);
}
@@ -323,7 +323,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const css::
void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::util::Time& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setTime(parameterIndex, x);
}
@@ -331,7 +331,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::
void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setTimestamp(parameterIndex, x);
}
@@ -339,7 +339,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< css::io::XInputStream >& x, sal_Int32 length )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBinaryStream(parameterIndex, x, length);
}
@@ -347,7 +347,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< css::io::XInputStream >& x, sal_Int32 length )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setCharacterStream(parameterIndex, x, length);
}
@@ -355,7 +355,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex,
void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObject(parameterIndex, x);
}
@@ -363,7 +363,7 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any
void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
}
@@ -371,7 +371,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setRef(parameterIndex, x);
}
@@ -379,7 +379,7 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere
void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBlob(parameterIndex, x);
}
@@ -387,7 +387,7 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setClob(parameterIndex, x);
}
@@ -395,7 +395,7 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setArray(parameterIndex, x);
}
@@ -403,7 +403,7 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe
void SAL_CALL OPreparedStatement::clearParameters( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->clearParameters();
}
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index 051c11148075..8d50eacde1ff 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -25,9 +25,9 @@
#include "HelperCollections.hxx"
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -40,6 +40,7 @@
#include <definitioncolumn.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <ContainerMediator.hxx>
using namespace dbaccess;
@@ -48,7 +49,6 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::comphelper;
@@ -105,7 +105,15 @@ css::uno::Sequence<sal_Int8> OQuery::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(OQuery,OQueryDescriptor_Base,ODataSettings,OContentHelper);
+css::uno::Sequence< css::uno::Type > OQuery::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OQueryDescriptor_Base::getTypes( ),
+ ODataSettings::getTypes( ),
+ OContentHelper::getTypes( )
+ );
+}
+
IMPLEMENT_FORWARD_XINTERFACE3( OQuery,OContentHelper,OQueryDescriptor_Base,ODataSettings)
void OQuery::rebuildColumns()
@@ -173,11 +181,10 @@ void OQuery::rebuildColumns()
Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( rName ),UNO_QUERY);
xCommandColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
}
- OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, sLabel);
- Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW );
- xChild->setParent( *this );
+ rtl::Reference<OQueryColumn> pColumn = new OQueryColumn( xSource, m_xConnection, sLabel);
+ pColumn->setParent( *this );
- implAppendColumn( rName, pColumn );
+ implAppendColumn( rName, pColumn.get() );
Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW );
if ( m_pColumnMediator.is() )
m_pColumnMediator->notifyElementCreated( rName, xDest );
@@ -205,7 +212,23 @@ void OQuery::rebuildColumns()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, "com.sun.star.sdb.QueryDefinition")
+OUString SAL_CALL OQuery::getImplementationName()
+ {
+ return u"com.sun.star.sdb.dbaccess.OQuery"_ustr;
+ }
+sal_Bool SAL_CALL OQuery::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OQuery::getSupportedServiceNames( )
+{
+ return { SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, u"com.sun.star.sdb.QueryDefinition"_ustr };
+}
// css::beans::XPropertyChangeListener
void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource )
@@ -309,7 +332,7 @@ Reference< XPropertySetInfo > SAL_CALL OQuery::getPropertySetInfo( )
return new ::cppu::OPropertyArrayHelper(aProps);
}
-OColumn* OQuery::createColumn(const OUString& /*_rName*/) const
+rtl::Reference<OColumn> OQuery::createColumn(const OUString& /*_rName*/) const
{
return nullptr;
}
@@ -351,7 +374,7 @@ void OQuery::registerProperties()
OUString OQuery::determineContentType() const
{
- return "application/vnd.org.openoffice.DatabaseQuery";
+ return u"application/vnd.org.openoffice.DatabaseQuery"_ustr;
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/api/query.hxx b/dbaccess/source/core/api/query.hxx
index 536b2d2208c7..fefcb94b47e7 100644
--- a/dbaccess/source/core/api/query.hxx
+++ b/dbaccess/source/core/api/query.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
+#pragma once
#include "querydescriptor.hxx"
#include <cppuhelper/implbase3.hxx>
@@ -132,7 +131,7 @@ public:
protected:
virtual void SAL_CALL disposing() override;
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual void rebuildColumns( ) override;
@@ -145,6 +144,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/querycomposer.cxx b/dbaccess/source/core/api/querycomposer.cxx
index 043b0c083a17..d39bd24e5f4a 100644
--- a/dbaccess/source/core/api/querycomposer.cxx
+++ b/dbaccess/source/core/api/querycomposer.cxx
@@ -17,15 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnSearch.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <unotools/configmgr.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#include <querycomposer.hxx>
+#include <strings.hxx>
#include <composertools.hxx>
#include <algorithm>
@@ -41,7 +40,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::cppu;
using namespace ::osl;
-using namespace ::utl;
OQueryComposer::OQueryComposer(const Reference< XConnection>& _xConnection)
@@ -86,7 +84,7 @@ Any SAL_CALL OQueryComposer::queryInterface( const Type & rType )
// XServiceInfo
OUString OQueryComposer::getImplementationName( )
{
- return "com.sun.star.sdb.dbaccess.OQueryComposer";
+ return u"com.sun.star.sdb.dbaccess.OQueryComposer"_ustr;
}
sal_Bool OQueryComposer::supportsService( const OUString& _rServiceName )
@@ -250,12 +248,12 @@ Reference< XIndexAccess > SAL_CALL OQueryComposer::getParameters( )
return Reference<XParametersSupplier>(m_xComposer,UNO_QUERY_THROW)->getParameters();
}
-void SAL_CALL OQueryComposer::acquire() throw()
+void SAL_CALL OQueryComposer::acquire() noexcept
{
OSubComponent::acquire();
}
-void SAL_CALL OQueryComposer::release() throw()
+void SAL_CALL OQueryComposer::release() noexcept
{
OSubComponent::release();
}
diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx
index 27ecf51ef5c1..2b615a878468 100644
--- a/dbaccess/source/core/api/querycontainer.cxx
+++ b/dbaccess/source/core/api/querycontainer.cxx
@@ -19,6 +19,7 @@
#include <querycontainer.hxx>
#include "query.hxx"
+#include <strings.hxx>
#include <objectnameapproval.hxx>
#include <veto.hxx>
@@ -43,7 +44,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::osl;
@@ -78,13 +78,10 @@ void OQueryContainer::init()
// fill my structures
ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
- Sequence< OUString > sDefinitionNames = m_xCommandDefinitions->getElementNames();
- const OUString* pDefinitionName = sDefinitionNames.getConstArray();
- const OUString* pEnd = pDefinitionName + sDefinitionNames.getLength();
- for ( ; pDefinitionName != pEnd; ++pDefinitionName )
+ for (auto& definitionName : m_xCommandDefinitions->getElementNames())
{
- rDefinitions.insert( *pDefinitionName, TContentPtr() );
- m_aDocuments.push_back(m_aDocumentMap.emplace( *pDefinitionName,Documents::mapped_type()).first);
+ rDefinitions.insert(definitionName, TContentPtr());
+ m_aDocuments.push_back(m_aDocumentMap.emplace(definitionName, Documents::mapped_type()).first);
}
setElementApproval( std::make_shared<ObjectNameApproval>( m_xConnection, ObjectNameApproval::TypeQuery ) );
@@ -131,7 +128,23 @@ void OQueryContainer::disposing()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO2(OQueryContainer, "com.sun.star.sdb.dbaccess.OQueryContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDB_QUERIES)
+OUString SAL_CALL OQueryContainer::getImplementationName()
+ {
+ return u"com.sun.star.sdb.dbaccess.OQueryContainer"_ustr;
+ }
+sal_Bool SAL_CALL OQueryContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OQueryContainer::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_CONTAINER, SERVICE_SDB_QUERIES };
+}
// XDataDescriptorFactory
Reference< XPropertySet > SAL_CALL OQueryContainer::createDataDescriptor( )
@@ -179,7 +192,7 @@ void SAL_CALL OQueryContainer::appendByDescriptor( const Reference< XPropertySet
{
m_eDoingCurrently = AggregateAction::Inserting;
OAutoActionReset aAutoReset(*this);
- m_xCommandDefinitions->insertByName(sNewObjectName, makeAny(xCommandDefinitionPart));
+ m_xCommandDefinitions->insertByName(sNewObjectName, Any(xCommandDefinitionPart));
}
implAppend( sNewObjectName, xNewObject );
@@ -244,7 +257,7 @@ void SAL_CALL OQueryContainer::elementInserted( const css::container::ContainerE
// insert an own new element
xNewElement = implCreateWrapper(sElementName);
}
- insertByName(sElementName,makeAny(xNewElement));
+ insertByName(sElementName,Any(xNewElement));
}
void SAL_CALL OQueryContainer::elementRemoved( const css::container::ContainerEvent& _rEvent )
@@ -253,7 +266,7 @@ void SAL_CALL OQueryContainer::elementRemoved( const css::container::ContainerEv
_rEvent.Accessor >>= sAccessor;
{
OSL_ENSURE(!sAccessor.isEmpty(), "OQueryContainer::elementRemoved : invalid name !");
- OSL_ENSURE(m_aDocumentMap.find(sAccessor) != m_aDocumentMap.end(), "OQueryContainer::elementRemoved : oops... we're inconsistent with our master container !");
+ OSL_ENSURE(m_aDocumentMap.contains(sAccessor), "OQueryContainer::elementRemoved : oops... we're inconsistent with our master container !");
if ( sAccessor.isEmpty() || !hasByName(sAccessor) )
return;
}
@@ -269,14 +282,14 @@ void SAL_CALL OQueryContainer::elementReplaced( const css::container::ContainerE
{
MutexGuard aGuard(m_aMutex);
OSL_ENSURE(!sAccessor.isEmpty(), "OQueryContainer::elementReplaced : invalid name !");
- OSL_ENSURE(m_aDocumentMap.find(sAccessor) != m_aDocumentMap.end(), "OQueryContainer::elementReplaced : oops... we're inconsistent with our master container !");
+ OSL_ENSURE(m_aDocumentMap.contains(sAccessor), "OQueryContainer::elementReplaced : oops... we're inconsistent with our master container !");
if (sAccessor.isEmpty() || !hasByName(sAccessor))
return;
xNewElement = implCreateWrapper(sAccessor);
}
- replaceByName(sAccessor,makeAny(xNewElement));
+ replaceByName(sAccessor,Any(xNewElement));
}
Reference< XVeto > SAL_CALL OQueryContainer::approveInsertElement( const ContainerEvent& Event )
@@ -285,7 +298,7 @@ Reference< XVeto > SAL_CALL OQueryContainer::approveInsertElement( const Contain
OSL_VERIFY( Event.Accessor >>= sName );
Reference< XContent > xElement( Event.Element, UNO_QUERY_THROW );
- Reference< XVeto > xReturn;
+ rtl::Reference< Veto > xReturn;
try
{
getElementApproval()->approveElement( sName );
@@ -332,7 +345,7 @@ void SAL_CALL OQueryContainer::disposing( const css::lang::EventObject& _rSource
OUString OQueryContainer::determineContentType() const
{
- return "application/vnd.org.openoffice.DatabaseQueryContainer";
+ return u"application/vnd.org.openoffice.DatabaseQueryContainer"_ustr;
}
Reference< XContent > OQueryContainer::implCreateWrapper(const OUString& _rName)
@@ -344,7 +357,7 @@ Reference< XContent > OQueryContainer::implCreateWrapper(const OUString& _rName)
Reference< XContent > OQueryContainer::implCreateWrapper(const Reference< XContent >& _rxCommandDesc)
{
Reference<XNameContainer> xContainer(_rxCommandDesc,UNO_QUERY);
- Reference< XContent > xReturn;
+ rtl::Reference< OContentHelper > xReturn;
if ( xContainer .is() )
{
xReturn = create( xContainer, m_xConnection, m_aContext, m_pWarnings ).
@@ -352,7 +365,7 @@ Reference< XContent > OQueryContainer::implCreateWrapper(const Reference< XConte
}
else
{
- OQuery* pNewObject = new OQuery( Reference< XPropertySet >( _rxCommandDesc, UNO_QUERY ), m_xConnection, m_aContext );
+ rtl::Reference<OQuery> pNewObject = new OQuery( Reference< XPropertySet >( _rxCommandDesc, UNO_QUERY ), m_xConnection, m_aContext );
xReturn = pNewObject;
pNewObject->setWarningsContainer( m_pWarnings );
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index c52febb5db6c..aa1d9b8f931b 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -18,19 +18,14 @@
*/
#include "querydescriptor.hxx"
-#include <apitools.hxx>
#include <stringconstants.hxx>
-#include <comphelper/servicehelper.hxx>
+#include <strings.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::osl;
using namespace ::cppu;
@@ -64,7 +59,14 @@ css::uno::Sequence<sal_Int8> OQueryDescriptor::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES2(OQueryDescriptor,OQueryDescriptor_Base,ODataSettings);
+css::uno::Sequence< css::uno::Type > OQueryDescriptor::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OQueryDescriptor_Base::getTypes( ),
+ ODataSettings::getTypes( )
+ );
+}
+
IMPLEMENT_FORWARD_XINTERFACE3( OQueryDescriptor,OWeakObject,OQueryDescriptor_Base,ODataSettings)
void OQueryDescriptor::registerProperties()
@@ -138,25 +140,6 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base()
m_pColumns->disposing();
}
-sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
-{
- if (isUnoTunnelId<OQueryDescriptor_Base>(_rIdentifier))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
-css::uno::Sequence<sal_Int8> OQueryDescriptor_Base::getUnoTunnelId()
-{
- static cppu::OImplementationId aId;
- return aId.getImplementationId();
-}
-
-css::uno::Sequence<sal_Int8> OQueryDescriptor_Base::getImplementationId()
-{
- return css::uno::Sequence<sal_Int8>();
-}
-
void OQueryDescriptor_Base::setColumnsOutOfDate( bool _bOutOfDate )
{
m_bColumnsOutOfDate = _bOutOfDate;
@@ -208,7 +191,7 @@ Reference< XNameAccess > SAL_CALL OQueryDescriptor_Base::getColumns( )
OUString SAL_CALL OQueryDescriptor_Base::getImplementationName( )
{
- return "com.sun.star.sdb.OQueryDescriptor";
+ return u"com.sun.star.sdb.OQueryDescriptor"_ustr;
}
sal_Bool SAL_CALL OQueryDescriptor_Base::supportsService( const OUString& _rServiceName )
@@ -255,7 +238,7 @@ void OQueryDescriptor_Base::refreshColumns()
rebuildColumns();
}
-OColumn* OQueryDescriptor_Base::createColumn( const OUString& /*_rName*/ ) const
+rtl::Reference<OColumn> OQueryDescriptor_Base::createColumn( const OUString& /*_rName*/ ) const
{
// creating a column/descriptor for a query/descriptor does not make sense at all
return nullptr;
diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx
index 077792906126..181b8e4d436d 100644
--- a/dbaccess/source/core/api/querydescriptor.hxx
+++ b/dbaccess/source/core/api/querydescriptor.hxx
@@ -17,16 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_QUERYDESCRIPTOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_QUERYDESCRIPTOR_HXX
+#pragma once
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <comphelper/proparrhlp.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <apitools.hxx>
#include <column.hxx>
@@ -39,9 +37,8 @@ namespace dbaccess
{
// OQueryDescriptor_Base - a query descriptor (as the name suggests :)
-typedef ::cppu::ImplHelper3<
+typedef ::cppu::ImplHelper2<
css::sdbcx::XColumnsSupplier,
- css::lang::XUnoTunnel,
css::lang::XServiceInfo > OQueryDescriptor_BASE;
class OQueryDescriptor_Base
@@ -76,12 +73,6 @@ public:
// css::sdbcx::XColumnsSupplier
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
-// css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
-
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
@@ -90,7 +81,7 @@ public:
protected:
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -141,6 +132,4 @@ public:
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_QUERYDESCRIPTOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx
index afb2e3f574b5..6d76c4eedea6 100644
--- a/dbaccess/source/core/api/resultcolumn.cxx
+++ b/dbaccess/source/core/api/resultcolumn.cxx
@@ -18,19 +18,18 @@
*/
#include "resultcolumn.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -67,7 +66,7 @@ void OResultColumn::impl_determineIsRowVersion_nothrow()
try
{
Reference< XResultSet > xVersionColumns = m_xDBMetaData->getVersionColumns(
- makeAny( sCatalog ), sSchema, sTable );
+ Any( sCatalog ), sSchema, sTable );
if ( xVersionColumns.is() ) // allowed to be NULL
{
Reference< XRow > xResultRow( xVersionColumns, UNO_QUERY_THROW );
@@ -79,6 +78,8 @@ void OResultColumn::impl_determineIsRowVersion_nothrow()
break;
}
}
+ Reference< XCloseable > xResultCloseable( xVersionColumns, UNO_QUERY_THROW );
+ xResultCloseable->close();
}
}
catch(const SQLException&)
@@ -104,7 +105,7 @@ Sequence< sal_Int8 > OResultColumn::getImplementationId()
// XServiceInfo
OUString OResultColumn::getImplementationName( )
{
- return "com.sun.star.sdb.OResultColumn";
+ return u"com.sun.star.sdb.OResultColumn"_ustr;
}
Sequence< OUString > OResultColumn::getSupportedServiceNames( )
@@ -124,29 +125,32 @@ void OResultColumn::disposing()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* OResultColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(21)
- DECL_PROP1(CATALOGNAME, OUString, READONLY);
- DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCASESENSITIVE, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1_BOOL(ISDEFINITELYWRITABLE, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISREADONLY, READONLY);
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- DECL_PROP1_BOOL(ISSEARCHABLE, READONLY);
- DECL_PROP1_BOOL(ISSIGNED, READONLY);
- DECL_PROP1_BOOL(ISWRITABLE, READONLY);
- DECL_PROP1(LABEL, OUString, READONLY);
- DECL_PROP1(NAME, OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(SCHEMANAME, OUString, READONLY);
- DECL_PROP1(SERVICENAME, OUString, READONLY);
- DECL_PROP1(TABLENAME, OUString, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, OUString, READONLY);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_DISPLAYSIZE, PROPERTY_ID_DISPLAYSIZE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCASESENSITIVE, PROPERTY_ID_ISCASESENSITIVE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISDEFINITELYWRITABLE, PROPERTY_ID_ISDEFINITELYWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSEARCHABLE, PROPERTY_ID_ISSEARCHABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSIGNED, PROPERTY_ID_ISSIGNED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISWRITABLE, PROPERTY_ID_ISWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LABEL, PROPERTY_ID_LABEL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_NAME, PROPERTY_ID_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SERVICENAME, PROPERTY_ID_SERVICENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY }
+ }
+ };
}
// cppu::OPropertySetHelper
diff --git a/dbaccess/source/core/api/resultcolumn.hxx b/dbaccess/source/core/api/resultcolumn.hxx
index f5b150eaa1d6..53803bac8c8f 100644
--- a/dbaccess/source/core/api/resultcolumn.hxx
+++ b/dbaccess/source/core/api/resultcolumn.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTCOLUMN_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -84,6 +83,5 @@ namespace dbaccess
using ::cppu::OPropertySetHelper::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTCOLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx
index ee93aa42ac53..20840d3682d3 100644
--- a/dbaccess/source/core/api/resultset.cxx
+++ b/dbaccess/source/core/api/resultset.cxx
@@ -20,14 +20,15 @@
#include "resultset.hxx"
#include <sal/log.hxx>
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/types.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "datacolumn.hxx"
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
@@ -119,12 +120,12 @@ Any OResultSet::queryInterface( const Type & rType )
return aIface;
}
-void OResultSet::acquire() throw ()
+void OResultSet::acquire() noexcept
{
OResultSetBase::acquire();
}
-void OResultSet::release() throw ()
+void OResultSet::release() noexcept
{
OResultSetBase::release();
}
@@ -163,7 +164,7 @@ void OResultSet::close()
// XServiceInfo
OUString OResultSet::getImplementationName( )
{
- return "com.sun.star.sdb.OResultSet";
+ return u"com.sun.star.sdb.OResultSet"_ustr;
}
sal_Bool OResultSet::supportsService( const OUString& _rServiceName )
@@ -185,14 +186,17 @@ Reference< XPropertySetInfo > OResultSet::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(6)
- DECL_PROP1(CURSORNAME, OUString, READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
- DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
- DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ { PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY }
+ }
+ };
}
// cppu::OPropertySetHelper
@@ -330,7 +334,7 @@ Reference< css::container::XNameAccess > OResultSet::getColumns()
{
// retrieve the name of the column
OUString sName = xMetaData->getColumnName(i + 1);
- ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
+ rtl::Reference<ODataColumn> pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
// don't silently assume that the name is unique - result set implementations
// are allowed to return duplicate names, but we are required to have
@@ -338,7 +342,7 @@ Reference< css::container::XNameAccess > OResultSet::getColumns()
if ( m_pColumns->hasByName( sName ) )
sName = ::dbtools::createUniqueName( m_pColumns.get(), sName );
- m_pColumns->append( sName, pColumn );
+ m_pColumns->append( sName, pColumn.get() );
}
}
catch ( const SQLException& )
@@ -978,13 +982,13 @@ void OResultSet::checkReadOnly() const
if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
|| !m_xDelegatorResultSetUpdate.is()
)
- throwSQLException( "The result set is read-only.", StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+ throwSQLException( u"The result set is read-only."_ustr, StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
}
void OResultSet::checkBookmarkable() const
{
if ( !m_bIsBookmarkable )
- throwSQLException( "The result set does not have bookmark support.", StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+ throwSQLException( u"The result set does not have bookmark support."_ustr, StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/resultset.hxx b/dbaccess/source/core/api/resultset.hxx
index 34f13a14d8bf..b2da0f2483e5 100644
--- a/dbaccess/source/core/api/resultset.hxx
+++ b/dbaccess/source/core/api/resultset.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTSET_HXX
+#pragma once
#include <column.hxx>
#include <connectivity/warningscontainer.hxx>
@@ -87,8 +86,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -218,6 +217,5 @@ namespace dbaccess
using ::cppu::OPropertySetHelper::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx
index 812d91c64a47..0334802ab244 100644
--- a/dbaccess/source/core/api/statement.cxx
+++ b/dbaccess/source/core/api/statement.cxx
@@ -20,6 +20,8 @@
#include <statement.hxx>
#include "resultset.hxx"
#include <stringconstants.hxx>
+#include <strings.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <cppuhelper/queryinterface.hxx>
@@ -27,8 +29,9 @@
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/property.hxx>
#include <comphelper/types.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <connectivity/dbexception.hxx>
+#include <connection.hxx>
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
@@ -41,10 +44,11 @@ using namespace dbaccess;
using namespace dbtools;
-OStatementBase::OStatementBase(const Reference< XConnection > & _xConn,
+OStatementBase::OStatementBase(const rtl::Reference< OConnection > & _xConn,
const Reference< XInterface > & _xStatement)
- :OSubComponent(m_aMutex, _xConn)
- ,OPropertySetHelper(OComponentHelper::rBHelper)
+ :WeakComponentImplHelper(m_aMutex)
+ ,OPropertySetHelper(WeakComponentImplHelper::rBHelper)
+ ,m_xParent(_xConn.get())
,m_bUseBookmarks( false )
,m_bEscapeProcessing( true )
@@ -66,7 +70,7 @@ Sequence< Type > OStatementBase::getTypes()
cppu::UnoType<XCloseable>::get(),
cppu::UnoType<XMultipleResults>::get(),
cppu::UnoType<css::util::XCancellable>::get(),
- OSubComponent::getTypes() );
+ ::cppu::WeakComponentImplHelper<>::getTypes() );
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( xGRes.is() )
aTypes = OTypeCollection(cppu::UnoType<XGeneratedResultSet>::get(),aTypes.getTypes());
@@ -80,7 +84,7 @@ Sequence< Type > OStatementBase::getTypes()
// css::uno::XInterface
Any OStatementBase::queryInterface( const Type & rType )
{
- Any aIface = OSubComponent::queryInterface( rType );
+ Any aIface = ::cppu::WeakComponentImplHelper<>::queryInterface( rType );
if (!aIface.hasValue())
{
aIface = ::cppu::queryInterface(
@@ -106,23 +110,22 @@ Any OStatementBase::queryInterface( const Type & rType )
return aIface;
}
-void OStatementBase::acquire() throw ()
+void OStatementBase::acquire() noexcept
{
- OSubComponent::acquire();
+ ::cppu::WeakComponentImplHelper<>::acquire();
}
-void OStatementBase::release() throw ()
+void OStatementBase::release() noexcept
{
- OSubComponent::release();
+ ::cppu::WeakComponentImplHelper<>::release();
}
void OStatementBase::disposeResultSet()
{
// free the cursor if alive
- Reference< XComponent > xComp(m_aResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_aResultSet = nullptr;
+ if (auto xRes = m_xWeakResultSet.get())
+ xRes->dispose();
+ m_xWeakResultSet.clear();
}
// OComponentHelper
@@ -150,11 +153,14 @@ void OStatementBase::disposing()
catch(RuntimeException& )
{// don't care for anymore
}
+ catch (SQLException&)
+ {// don't care for anymore
+ }
}
m_xAggregateAsSet = nullptr;
// free the parent at last
- OSubComponent::disposing();
+ ::cppu::WeakComponentImplHelper<>::disposing();
}
// XCloseable
@@ -162,7 +168,7 @@ void OStatementBase::close()
{
{
MutexGuard aGuard( m_aMutex );
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
}
dispose();
}
@@ -176,18 +182,21 @@ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* OStatementBase::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(10)
- DECL_PROP0(CURSORNAME, OUString);
- DECL_PROP0_BOOL(ESCAPE_PROCESSING);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE, sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT, sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY, sal_Int32);
- DECL_PROP0(RESULTSETTYPE, sal_Int32);
- DECL_PROP0_BOOL(USEBOOKMARKS);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ { PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0 },
+ { PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, cppu::UnoType<bool>::get(), 0 },
+ { PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_MAXFIELDSIZE, PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_MAXROWS, PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_QUERYTIMEOUT, PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_USEBOOKMARKS, PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0 }
+ }
+ };
}
// cppu::OPropertySetHelper
@@ -220,7 +229,7 @@ sal_Bool OStatementBase::convertFastPropertyValue(Any & rConvertedValue, Any & r
Any aCurrentValue = m_xAggregateAsSet->getPropertyValue( sPropName );
if ( aCurrentValue != rValue )
{
- rOldValue = aCurrentValue;
+ rOldValue = std::move(aCurrentValue);
rConvertedValue = rValue;
bModified = true;
}
@@ -288,7 +297,7 @@ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
Any OStatementBase::getWarnings()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY_THROW)->getWarnings();
}
@@ -296,7 +305,7 @@ Any OStatementBase::getWarnings()
void OStatementBase::clearWarnings()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY_THROW)->clearWarnings();
}
@@ -315,7 +324,7 @@ void OStatementBase::cancel()
Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -328,7 +337,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -341,7 +350,7 @@ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
sal_Bool SAL_CALL OStatementBase::getMoreResults( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -358,7 +367,7 @@ sal_Bool SAL_CALL OStatementBase::getMoreResults( )
void SAL_CALL OStatementBase::addBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -371,7 +380,7 @@ void SAL_CALL OStatementBase::addBatch( )
void SAL_CALL OStatementBase::clearBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -384,7 +393,7 @@ void SAL_CALL OStatementBase::clearBatch( )
Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -400,7 +409,7 @@ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( xGRes.is() )
@@ -411,7 +420,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( )
// OStatement
-OStatement::OStatement( const Reference< XConnection >& _xConn, const Reference< XInterface > & _xStatement )
+OStatement::OStatement( const rtl::Reference< OConnection >& _xConn, const Reference< XInterface > & _xStatement )
:OStatementBase( _xConn, _xStatement )
,m_bAttemptedComposerCreation( false )
{
@@ -424,7 +433,7 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( OStatement, OStatementBase, OStatement_IFACE )
// XServiceInfo
OUString OStatement::getImplementationName( )
{
- return "com.sun.star.sdb.OStatement";
+ return u"com.sun.star.sdb.OStatement"_ustr;
}
sal_Bool OStatement::supportsService( const OUString& _rServiceName )
@@ -441,10 +450,10 @@ Sequence< OUString > OStatement::getSupportedServiceNames( )
Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
- Reference< XResultSet > xResultSet;
+ rtl::Reference< OResultSet > xResultSet;
OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) );
@@ -458,7 +467,7 @@ Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
xResultSet = new OResultSet( xInnerResultSet, *this, bCaseSensitive );
// keep the resultset weak
- m_aResultSet = xResultSet;
+ m_xWeakResultSet = xResultSet.get();
}
return xResultSet;
@@ -467,7 +476,7 @@ Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
sal_Int32 OStatement::executeUpdate( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -478,7 +487,7 @@ sal_Int32 OStatement::executeUpdate( const OUString& _rSQL )
sal_Bool OStatement::execute( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -489,7 +498,7 @@ sal_Bool OStatement::execute( const OUString& _rSQL )
void OStatement::addBatch( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -503,7 +512,7 @@ void OStatement::addBatch( const OUString& _rSQL )
void OStatement::clearBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
if (!xMeta.is() || !xMeta->supportsBatchUpdates())
@@ -515,7 +524,7 @@ void OStatement::clearBatch( )
Sequence< sal_Int32 > OStatement::executeBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
if (!xMeta.is() || !xMeta->supportsBatchUpdates())
@@ -526,7 +535,7 @@ Sequence< sal_Int32 > OStatement::executeBatch( )
Reference< XConnection > OStatement::getConnection()
{
- return Reference< XConnection >( m_xParent, UNO_QUERY );
+ return m_xParent.get();
}
void SAL_CALL OStatement::disposing()
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index d9b8f4484f5e..8bee907134f2 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -17,20 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <apitools.hxx>
#include <table.hxx>
#include <definitioncolumn.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include "CIndexes.hxx"
#include <osl/diagnose.h>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/servicehelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdb/tools/XTableRename.hpp>
#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
@@ -42,7 +39,6 @@
using namespace dbaccess;
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
@@ -85,10 +81,8 @@ ODBTable::~ODBTable()
{
}
-OColumn* ODBTable::createColumn(const OUString& _rName) const
+rtl::Reference<OColumn> ODBTable::createColumn(const OUString& _rName) const
{
- OColumn* pReturn = nullptr;
-
Reference<XPropertySet> xProp;
if ( m_xDriverColumns.is() && m_xDriverColumns->hasByName(_rName) )
{
@@ -97,15 +91,13 @@ OColumn* ODBTable::createColumn(const OUString& _rName) const
else
{
OColumns* pColumns = static_cast<OColumns*>(m_xColumns.get());
- xProp.set(pColumns->createBaseObject(_rName),UNO_QUERY);
+ xProp = pColumns->createBaseObject(_rName);
}
- Reference<XPropertySet> xColumnDefintion;
+ Reference<XPropertySet> xColumnDefinition;
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
- xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
-
- return pReturn;
+ xColumnDefinition.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
+ return new OTableColumnWrapper( xProp, xColumnDefinition, false );
}
void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ )
@@ -216,7 +208,7 @@ void ODBTable::construct()
describeProperties(aProps);
if(!_nId)
{
- for(Property & prop : aProps)
+ for(Property & prop : asNonConstRange(aProps))
{
if (prop.Name == PROPERTY_CATALOGNAME)
prop.Attributes = PropertyAttribute::READONLY;
@@ -238,7 +230,24 @@ void ODBTable::construct()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE)
+OUString SAL_CALL ODBTable::getImplementationName()
+ {
+ return u"com.sun.star.sdb.dbaccess.ODBTable"_ustr;
+ }
+sal_Bool SAL_CALL ODBTable::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL ODBTable::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_TABLE };
+}
+
Any SAL_CALL ODBTable::queryInterface( const Type & rType )
{
@@ -258,12 +267,10 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( )
std::vector<Type> aOwnTypes;
aOwnTypes.reserve(aTypes.getLength());
- const Type* pIter = aTypes.getConstArray();
- const Type* pEnd = pIter + aTypes.getLength();
- for(;pIter != pEnd ;++pIter)
+ for (auto& type : aTypes)
{
- if( (*pIter != aRenameType || getRenameService().is()) && (*pIter != aAlterType || getAlterService().is()))
- aOwnTypes.push_back(*pIter);
+ if( (type != aRenameType || getRenameService().is()) && (type != aAlterType || getAlterService().is()))
+ aOwnTypes.push_back(type);
}
return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
@@ -298,24 +305,6 @@ void SAL_CALL ODBTable::alterColumnByName( const OUString& _rName, const Referen
m_xColumns->refresh();
}
-sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId )
-{
- sal_Int64 nRet(0);
- if (isUnoTunnelId<ODBTable>(rId))
- nRet = reinterpret_cast<sal_Int64>(this);
- else
- nRet = OTable_Base::getSomething(rId);
-
- return nRet;
-}
-
-Sequence< sal_Int8 > ODBTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId s_Id;
-
- return s_Id.getImplementationId();
-}
-
Reference< XPropertySet > ODBTable::createColumnDescriptor()
{
return new OTableColumnDescriptor( true );
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index bc32774fd891..841fc46d46b3 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -17,14 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <apitools.hxx>
#include <tablecontainer.hxx>
#include <table.hxx>
-#include <sal/log.hxx>
#include <comphelper/property.hxx>
#include <comphelper/processfactory.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
@@ -41,7 +40,7 @@
#include <sdbcoretools.hxx>
#include <ContainerMediator.hxx>
#include <objectnameapproval.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace dbaccess;
using namespace dbtools;
@@ -52,7 +51,6 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -63,26 +61,22 @@ namespace
bool lcl_isPropertySetDefaulted(const Sequence< OUString>& _aNames,const Reference<XPropertySet>& _xProp)
{
Reference<XPropertyState> xState(_xProp,UNO_QUERY);
- if ( xState.is() )
+ if ( !xState )
+ return false;
+ for (auto& name : _aNames)
{
- const OUString* pIter = _aNames.getConstArray();
- const OUString* pEnd = pIter + _aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ try
{
- try
- {
- PropertyState aState = xState->getPropertyState(*pIter);
- if ( aState != PropertyState_DEFAULT_VALUE )
- break;
- }
- catch(const Exception&)
- {
- SAL_WARN("dbaccess", "lcl_isPropertySetDefaulted: Exception caught!" );
- }
+ PropertyState aState = xState->getPropertyState(name);
+ if ( aState != PropertyState_DEFAULT_VALUE )
+ return false;
+ }
+ catch(const Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("dbaccess", "" );
}
- return ( pIter == pEnd );
}
- return false;
+ return true;
}
}
@@ -124,11 +118,28 @@ OUString OTableContainer::getTableTypeRestriction() const
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES)
+OUString SAL_CALL OTableContainer::getImplementationName()
+ {
+ return u"com.sun.star.sdb.dbaccess.OTableContainer"_ustr;
+ }
+sal_Bool SAL_CALL OTableContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OTableContainer::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES };
+}
+
namespace
{
-void lcl_createDefintionObject(const OUString& _rName
+void lcl_createDefinitionObject(const OUString& _rName
,const Reference< XNameContainer >& _xTableDefinitions
,Reference<XPropertySet>& _xTableDefinition
,Reference<XNameAccess>& _xColumnDefinitions)
@@ -142,7 +153,7 @@ void lcl_createDefintionObject(const OUString& _rName
{
// set as folder
_xTableDefinition = TableDefinition::createWithName( ::comphelper::getProcessComponentContext(), _rName );
- _xTableDefinitions->insertByName(_rName,makeAny(_xTableDefinition));
+ _xTableDefinitions->insertByName(_rName,Any(_xTableDefinition));
}
Reference<XColumnsSupplier> xColumnsSupplier(_xTableDefinition,UNO_QUERY);
if ( xColumnsSupplier.is() )
@@ -151,22 +162,22 @@ void lcl_createDefintionObject(const OUString& _rName
}
-connectivity::sdbcx::ObjectType OTableContainer::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OTableContainer::createObject(const OUString& _rName)
{
Reference<XColumnsSupplier > xSup;
if(m_xMasterContainer.is() && m_xMasterContainer->hasByName(_rName))
xSup.set(m_xMasterContainer->getByName(_rName),UNO_QUERY);
- connectivity::sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if ( m_xMetaData.is() )
{
Reference<XPropertySet> xTableDefinition;
Reference<XNameAccess> xColumnDefinitions;
- lcl_createDefintionObject(_rName,m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
+ lcl_createDefinitionObject(_rName,m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
if ( xSup.is() )
{
- ODBTableDecorator* pTable = new ODBTableDecorator( m_xConnection, xSup, ::dbtools::getNumberFormats( m_xConnection ) ,xColumnDefinitions);
+ rtl::Reference<ODBTableDecorator> pTable = new ODBTableDecorator( m_xConnection, xSup, ::dbtools::getNumberFormats( m_xConnection ) ,xColumnDefinitions);
xRet = pTable;
pTable->construct();
}
@@ -199,7 +210,7 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const OUString& _r
}
}
::comphelper::disposeComponent(xRes);
- ODBTable* pTable = new ODBTable(this
+ rtl::Reference<ODBTable> pTable = new ODBTable(this
,m_xConnection
,sCatalog
,sSchema
@@ -210,13 +221,13 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const OUString& _r
xRet = pTable;
pTable->construct();
}
- Reference<XPropertySet> xDest(xRet,UNO_QUERY);
+ Reference<XPropertySet> xDest(xRet);
if ( xTableDefinition.is() )
::comphelper::copyProperties(xTableDefinition,xDest);
if ( !m_pTableMediator.is() )
m_pTableMediator = new OContainerMediator(
- this, m_xTableDefinitions.get() );
+ this, m_xTableDefinitions );
if ( m_pTableMediator.is() )
m_pTableMediator->notifyElementCreated(_rName,xDest);
}
@@ -235,13 +246,13 @@ Reference< XPropertySet > OTableContainer::createDescriptor()
if ( xDataFactory.is() && m_xMetaData.is() )
{
xMasterColumnsSup.set( xDataFactory->createDataDescriptor(), UNO_QUERY );
- ODBTableDecorator* pTable = new ODBTableDecorator( m_xConnection, xMasterColumnsSup, ::dbtools::getNumberFormats( m_xConnection ) ,nullptr);
+ rtl::Reference<ODBTableDecorator> pTable = new ODBTableDecorator( m_xConnection, xMasterColumnsSup, ::dbtools::getNumberFormats( m_xConnection ) ,nullptr);
xRet = pTable;
pTable->construct();
}
else
{
- ODBTable* pTable = new ODBTable(this, m_xConnection);
+ rtl::Reference<ODBTable> pTable = new ODBTable(this, m_xConnection);
xRet = pTable;
pTable->construct();
}
@@ -249,7 +260,7 @@ Reference< XPropertySet > OTableContainer::createDescriptor()
}
// XAppend
-ObjectType OTableContainer::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OTableContainer::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
// append the new table with a create stmt
OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME));
@@ -288,7 +299,7 @@ ObjectType OTableContainer::appendObject( const OUString& _rForName, const Refer
Reference<XPropertySet> xTableDefinition;
Reference<XNameAccess> xColumnDefinitions;
- lcl_createDefintionObject(getNameForObject(descriptor),m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
+ lcl_createDefinitionObject(getNameForObject(descriptor),m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
Reference<XColumnsSupplier> xSup(descriptor,UNO_QUERY);
Reference<XDataDescriptorFactory> xFac(xColumnDefinitions,UNO_QUERY);
Reference<XAppend> xAppend(xColumnDefinitions,UNO_QUERY);
@@ -299,14 +310,11 @@ ObjectType OTableContainer::appendObject( const OUString& _rForName, const Refer
if ( xNames.is() )
{
Reference<XPropertySet> xProp = xFac->createDataDescriptor();
- Sequence< OUString> aSeq = xNames->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& name : xNames->getElementNames())
{
- if ( !xColumnDefinitions->hasByName(*pIter) )
+ if (!xColumnDefinitions->hasByName(name))
{
- Reference<XPropertySet> xColumn(xNames->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xColumn(xNames->getByName(name), UNO_QUERY);
if ( !OColumnSettings::hasDefaultSettings( xColumn ) )
{
::comphelper::copyProperties( xColumn, xProp );
@@ -335,12 +343,13 @@ void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
xDrop->dropByName(_sElementName);
else
{
- OUString sCatalog,sSchema,sTable,sComposedName;
+ OUString sComposedName;
bool bIsView = false;
- Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
+ Reference<XPropertySet> xTable(getObject(_nPos));
if ( xTable.is() && m_xMetaData.is() )
{
+ OUString sSchema,sCatalog,sTable;
if (m_xMetaData->supportsCatalogsInTableDefinitions())
xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
if (m_xMetaData->supportsSchemasInTableDefinitions())
@@ -357,7 +366,7 @@ void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
if(sComposedName.isEmpty())
::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this)));
- OUString aSql("DROP ");
+ OUString aSql(u"DROP "_ustr);
if ( bIsView ) // here we have a view
aSql += "VIEW ";
@@ -390,10 +399,10 @@ void SAL_CALL OTableContainer::elementInserted( const ContainerEvent& Event )
{
if(!m_xMasterContainer.is() || m_xMasterContainer->hasByName(sName))
{
- ObjectType xName = createObject(sName);
+ css::uno::Reference< css::beans::XPropertySet > xName = createObject(sName);
insertElement(sName,xName);
// and notify our listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(sName), makeAny(xName), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(sName), Any(xName), Any());
m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
}
diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx
index 690df713923d..82b3dacbcbf0 100644
--- a/dbaccess/source/core/api/viewcontainer.cxx
+++ b/dbaccess/source/core/api/viewcontainer.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <apitools.hxx>
+#include <strings.hxx>
#include <viewcontainer.hxx>
#include <View.hxx>
@@ -34,9 +34,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
@@ -61,11 +59,28 @@ OViewContainer::~OViewContainer()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO2(OViewContainer, "com.sun.star.sdb.dbaccess.OViewContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES)
+OUString SAL_CALL OViewContainer::getImplementationName()
+ {
+ return u"com.sun.star.sdb.dbaccess.OViewContainer"_ustr;
+ }
+sal_Bool SAL_CALL OViewContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OViewContainer::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES };
+}
+
-ObjectType OViewContainer::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OViewContainer::createObject(const OUString& _rName)
{
- ObjectType xProp;
+ css::uno::Reference< css::beans::XPropertySet > xProp;
if ( m_xMasterContainer.is() && m_xMasterContainer->hasByName(_rName) )
xProp.set(m_xMasterContainer->getByName(_rName),UNO_QUERY);
@@ -104,7 +119,7 @@ Reference< XPropertySet > OViewContainer::createDescriptor()
}
// XAppend
-ObjectType OViewContainer::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OViewContainer::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
// append the new table with a create stmt
OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME));
@@ -154,11 +169,12 @@ void OViewContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
xDrop->dropByName(_sElementName);
else
{
- OUString sCatalog,sSchema,sTable,sComposedName;
+ OUString sComposedName;
- Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
+ Reference<XPropertySet> xTable(getObject(_nPos));
if ( xTable.is() )
{
+ OUString sCatalog,sSchema,sTable;
xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
@@ -230,7 +246,7 @@ void SAL_CALL OViewContainer::elementReplaced( const ContainerEvent& /*Event*/ )
OUString OViewContainer::getTableTypeRestriction() const
{
// no restriction at all (other than the ones provided externally)
- return "VIEW";
+ return u"VIEW"_ustr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index a6110bdb2dab..6eff582b72e2 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
@@ -18,18 +18,16 @@
*/
#include "ComponentDefinition.hxx"
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/property.hxx>
#include <comphelper/propertysequence.hxx>
#include <definitioncolumn.hxx>
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;
@@ -142,17 +140,24 @@ css::uno::Sequence<sal_Int8> OComponentDefinition::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(OComponentDefinition,ODataSettings,OContentHelper,OComponentDefinition_BASE);
+css::uno::Sequence< css::uno::Type > OComponentDefinition::getTypes()
+{
+ return ::comphelper::concatSequences(
+ ODataSettings::getTypes( ),
+ OContentHelper::getTypes( ),
+ OComponentDefinition_BASE::getTypes( )
+ );
+}
IMPLEMENT_FORWARD_XINTERFACE3( OComponentDefinition,OContentHelper,ODataSettings,OComponentDefinition_BASE)
OUString SAL_CALL OComponentDefinition::getImplementationName()
{
- return "com.sun.star.comp.dba.OComponentDefinition";
+ return u"com.sun.star.comp.dba.OComponentDefinition"_ustr;
}
Sequence< OUString > SAL_CALL OComponentDefinition::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.TableDefinition", "com.sun.star.ucb.Content" };
+ return { u"com.sun.star.sdb.TableDefinition"_ustr, u"com.sun.star.ucb.Content"_ustr };
}
void SAL_CALL OComponentDefinition::disposing()
@@ -187,8 +192,8 @@ Reference< XPropertySetInfo > SAL_CALL OComponentDefinition::getPropertySetInfo(
OUString OComponentDefinition::determineContentType() const
{
return m_bTable
- ? OUString( "application/vnd.org.openoffice.DatabaseTable" )
- : OUString( "application/vnd.org.openoffice.DatabaseCommandDefinition" );
+ ? u"application/vnd.org.openoffice.DatabaseTable"_ustr
+ : u"application/vnd.org.openoffice.DatabaseCommandDefinition"_ustr;
}
Reference< XNameAccess> OComponentDefinition::getColumns()
@@ -213,13 +218,13 @@ Reference< XNameAccess> OComponentDefinition::getColumns()
return m_pColumns.get();
}
-OColumn* OComponentDefinition::createColumn(const OUString& _rName) const
+rtl::Reference<OColumn> OComponentDefinition::createColumn(const OUString& _rName) const
{
const OComponentDefinition_Impl& rDefinition( getDefinition() );
OComponentDefinition_Impl::const_iterator aFind = rDefinition.find( _rName );
if ( aFind != rDefinition.end() )
{
- aFind->second->addPropertyChangeListener(OUString(),m_xColumnPropertyListener.get());
+ aFind->second->addPropertyChangeListener(OUString(),m_xColumnPropertyListener);
return new OTableColumnWrapper( aFind->second, aFind->second, true );
}
OSL_FAIL( "OComponentDefinition::createColumn: is this a valid case?" );
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
index 8753d51c47e5..4c10a5354b30 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
+#pragma once
#include <commandbase.hxx>
#include <com/sun/star/sdbcx/XRename.hpp>
@@ -134,7 +133,7 @@ public:
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -157,6 +156,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 7ad1d22ba2f4..f3460b38c174 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -31,14 +31,13 @@
#include <com/sun/star/container/ElementExistException.hpp>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/contentidentifier.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <apitools.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <sdbcoretools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <map>
+#include <utility>
namespace dbaccess
{
@@ -48,8 +47,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
using namespace ::cppu;
@@ -64,13 +61,13 @@ OContentHelper_Impl::~OContentHelper_Impl()
OContentHelper::OContentHelper(const Reference< XComponentContext >& _xORB
,const Reference< XInterface >& _xParentContainer
- ,const TContentPtr& _pImpl)
+ ,TContentPtr _pImpl)
: OContentHelper_COMPBASE(m_aMutex)
,m_aContentListeners(m_aMutex)
,m_aPropertyChangeListeners(m_aMutex)
,m_xParentContainer( _xParentContainer )
,m_aContext( _xORB )
- ,m_pImpl(_pImpl)
+ ,m_pImpl(std::move(_pImpl))
,m_nCommandId(0)
{
}
@@ -86,14 +83,25 @@ void SAL_CALL OContentHelper::disposing()
m_xParentContainer = nullptr;
}
-IMPLEMENT_SERVICE_INFO1(OContentHelper,"com.sun.star.comp.sdb.Content","com.sun.star.ucb.Content");
+OUString SAL_CALL OContentHelper::getImplementationName()
+ {
+ return u"com.sun.star.comp.sdb.Content"_ustr;
+ }
+sal_Bool SAL_CALL OContentHelper::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
-css::uno::Sequence<sal_Int8> OContentHelper::getUnoTunnelId()
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OContentHelper::getSupportedServiceNames()
{
- static cppu::OImplementationId aId;
- return aId.getImplementationId();
+ return { u"com.sun.star.ucb.Content"_ustr };
}
+
css::uno::Sequence<sal_Int8> OContentHelper::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
@@ -122,7 +130,7 @@ OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer
xProp->getPropertyValue( PROPERTY_NAME ) >>= sName;
OUString sPrevious = aHierarchicalName.makeStringAndClear();
- aHierarchicalName.append( sName ).append( "/" ).append( sPrevious );
+ aHierarchicalName.append( sName + "/" + sPrevious );
}
}
OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() );
@@ -177,7 +185,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -195,7 +203,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -207,7 +215,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
{
OSL_FAIL( "No properties!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -233,7 +241,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
OSL_FAIL( "Content::execute - unsupported command!" );
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedCommandException(
+ Any( UnsupportedCommandException(
OUString(),
static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
@@ -251,44 +259,32 @@ void SAL_CALL OContentHelper::abort( sal_Int32 /*CommandId*/ )
void SAL_CALL OContentHelper::addPropertiesChangeListener( const Sequence< OUString >& PropertyNames, const Reference< XPropertiesChangeListener >& Listener )
{
::osl::MutexGuard aGuard(m_aMutex);
- sal_Int32 nCount = PropertyNames.getLength();
- if ( !nCount )
+ if (!PropertyNames.hasElements())
{
// Note: An empty sequence means a listener for "all" properties.
m_aPropertyChangeListeners.addInterface(OUString(), Listener );
}
else
{
- const OUString* pSeq = PropertyNames.getConstArray();
-
- for ( sal_Int32 n = 0; n < nCount; ++n )
- {
- const OUString& rName = pSeq[ n ];
+ for (auto& rName : PropertyNames)
if ( !rName.isEmpty() )
m_aPropertyChangeListeners.addInterface(rName, Listener );
- }
}
}
void SAL_CALL OContentHelper::removePropertiesChangeListener( const Sequence< OUString >& PropertyNames, const Reference< XPropertiesChangeListener >& Listener )
{
::osl::MutexGuard aGuard(m_aMutex);
- sal_Int32 nCount = PropertyNames.getLength();
- if ( !nCount )
+ if (!PropertyNames.hasElements())
{
// Note: An empty sequence means a listener for "all" properties.
m_aPropertyChangeListeners.removeInterface( OUString(), Listener );
}
else
{
- const OUString* pSeq = PropertyNames.getConstArray();
-
- for ( sal_Int32 n = 0; n < nCount; ++n )
- {
- const OUString& rName = pSeq[ n ];
+ for (auto& rName : PropertyNames)
if ( !rName.isEmpty() )
m_aPropertyChangeListeners.removeInterface( rName, Listener );
- }
}
}
@@ -306,12 +302,10 @@ void SAL_CALL OContentHelper::removeProperty( const OUString& /*Name*/ )
// XInitialization
void SAL_CALL OContentHelper::initialize( const Sequence< Any >& _aArguments )
{
- const Any* pBegin = _aArguments.getConstArray();
- const Any* pEnd = pBegin + _aArguments.getLength();
- PropertyValue aValue;
- for(;pBegin != pEnd;++pBegin)
+ for (auto& arg : _aArguments)
{
- *pBegin >>= aValue;
+ PropertyValue aValue;
+ arg >>= aValue;
if ( aValue.Name == "Parent" )
{
m_xParentContainer.set(aValue.Value,UNO_QUERY);
@@ -332,6 +326,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
Sequence< Any > aRet( rValues.getLength() );
+ auto aRetRange = asNonConstRange(aRet);
Sequence< PropertyChangeEvent > aChanges( rValues.getLength() );
sal_Int32 nChanged = 0;
@@ -340,17 +335,14 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
aEvent.Further = false;
aEvent.PropertyHandle = -1;
- const PropertyValue* pValues = rValues.getConstArray();
- sal_Int32 nCount = rValues.getLength();
-
- for ( sal_Int32 n = 0; n < nCount; ++n )
+ for (sal_Int32 n = 0; n < rValues.getLength(); ++n)
{
- const PropertyValue& rValue = pValues[ n ];
+ const PropertyValue& rValue = rValues[n];
if ( rValue.Name == "ContentType" || rValue.Name == "IsDocument" || rValue.Name == "IsFolder" )
{
// Read-only property!
- aRet[ n ] <<= IllegalAccessException("Property is read-only!",
+ aRetRange[ n ] <<= IllegalAccessException(u"Property is read-only!"_ustr,
static_cast< cppu::OWeakObject * >( this ) );
}
else if ( rValue.Name == "Title" )
@@ -374,7 +366,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
}
catch( const Exception& )
{
- OSL_FAIL( "OContentHelper::setPropertyValues('Title'): caught an exception while renaming!" );
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OContentHelper::setPropertyValues('Title'): caught an exception while renaming!" );
}
}
else
@@ -384,14 +376,14 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
}
else
{
- aRet[ n ] <<= IllegalTypeException("Property value has wrong type!",
+ aRetRange[ n ] <<= IllegalTypeException(u"Property value has wrong type!"_ustr,
static_cast< cppu::OWeakObject * >( this ) );
}
}
else
{
- aRet[ n ] <<= Exception("No property set for storing the value!",
+ aRetRange[ n ] <<= Exception(u"No property set for storing the value!"_ustr,
static_cast< cppu::OWeakObject * >( this ) );
}
}
@@ -414,14 +406,10 @@ Reference< XRow > OContentHelper::getPropertyValues( const Sequence< Property >&
rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( m_aContext );
- sal_Int32 nCount = rProperties.getLength();
- if ( nCount )
+ if (rProperties.hasElements())
{
- const Property* pProps = rProperties.getConstArray();
- for ( sal_Int32 n = 0; n < nCount; ++n )
+ for (auto& rProp : rProperties)
{
- const Property& rProp = pProps[ n ];
-
// Process Core properties.
if ( rProp.Name == "ContentType" )
@@ -448,24 +436,24 @@ Reference< XRow > OContentHelper::getPropertyValues( const Sequence< Property >&
{
// Append all Core Properties.
xRow->appendString (
- Property( "ContentType", -1,
+ Property( u"ContentType"_ustr, -1,
cppu::UnoType<OUString>::get(),
PropertyAttribute::BOUND
| PropertyAttribute::READONLY ),
getContentType() );
xRow->appendString (
- Property( "Title", -1,
+ Property( u"Title"_ustr, -1,
cppu::UnoType<OUString>::get(),
PropertyAttribute::BOUND ),
m_pImpl->m_aProps.aTitle );
xRow->appendBoolean(
- Property( "IsDocument", -1,
+ Property( u"IsDocument"_ustr, -1,
cppu::UnoType<bool>::get(),
PropertyAttribute::BOUND
| PropertyAttribute::READONLY ),
m_pImpl->m_aProps.bIsDocument );
xRow->appendBoolean(
- Property( "IsFolder", -1,
+ Property( u"IsFolder"_ustr, -1,
cppu::UnoType<bool>::get(),
PropertyAttribute::BOUND
| PropertyAttribute::READONLY ),
@@ -474,7 +462,7 @@ Reference< XRow > OContentHelper::getPropertyValues( const Sequence< Property >&
// @@@ Append other properties supported directly.
}
- return Reference< XRow >( xRow.get() );
+ return xRow;
}
void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent >& evt ) const
@@ -485,38 +473,27 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
return;
// First, notify listeners interested in changes of every property.
- OInterfaceContainerHelper* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
+ comphelper::OInterfaceContainerHelper3<XPropertiesChangeListener>* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
if ( pAllPropsContainer )
- {
- OInterfaceIteratorHelper aIter( *pAllPropsContainer );
- while ( aIter.hasMoreElements() )
- {
- // Propagate event.
- Reference< XPropertiesChangeListener > xListener( aIter.next(), UNO_QUERY );
- if ( xListener.is() )
- xListener->propertiesChange( evt );
- }
- }
+ pAllPropsContainer->notifyEach( &XPropertiesChangeListener::propertiesChange, evt );
typedef std::map< XPropertiesChangeListener*, Sequence< PropertyChangeEvent > > PropertiesEventListenerMap;
PropertiesEventListenerMap aListeners;
- const PropertyChangeEvent* propertyChangeEvent = evt.getConstArray();
-
- for ( sal_Int32 n = 0; n < nCount; ++n, ++propertyChangeEvent )
+ for (sal_Int32 n = 0; n < nCount; ++n)
{
- const PropertyChangeEvent& rEvent = *propertyChangeEvent;
+ const PropertyChangeEvent& rEvent = evt[n];
const OUString& rName = rEvent.PropertyName;
- OInterfaceContainerHelper* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
+ comphelper::OInterfaceContainerHelper3<XPropertiesChangeListener>* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
if ( pPropsContainer )
{
- OInterfaceIteratorHelper aIter( *pPropsContainer );
+ comphelper::OInterfaceIteratorHelper3 aIter( *pPropsContainer );
while ( aIter.hasMoreElements() )
{
Sequence< PropertyChangeEvent >* propertyEvents;
- XPropertiesChangeListener* pListener = static_cast< XPropertiesChangeListener * >( aIter.next() );
+ XPropertiesChangeListener* pListener = aIter.next().get();
PropertiesEventListenerMap::iterator it = aListeners.find( pListener );
if ( it == aListeners.end() )
{
@@ -527,7 +504,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
else
propertyEvents = &(*it).second;
- (*propertyEvents)[n] = rEvent;
+ asNonConstRange(*propertyEvents)[n] = rEvent;
}
}
}
@@ -543,15 +520,6 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
}
}
-// css::lang::XUnoTunnel
-sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId )
-{
- if (isUnoTunnelId<OContentHelper>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
Reference< XInterface > SAL_CALL OContentHelper::getParent( )
{
::osl::MutexGuard aGuard(m_aMutex);
@@ -571,14 +539,14 @@ void OContentHelper::impl_rename_throw(const OUString& _sNewName,bool _bNotify )
return;
try
{
- Sequence< PropertyChangeEvent > aChanges( 1 );
-
- aChanges[0].Source = static_cast< cppu::OWeakObject * >( this );
- aChanges[0].Further = false;
- aChanges[0].PropertyName = PROPERTY_NAME;
- aChanges[0].PropertyHandle = PROPERTY_ID_NAME;
- aChanges[0].OldValue <<= m_pImpl->m_aProps.aTitle;
- aChanges[0].NewValue <<= _sNewName;
+ Sequence<PropertyChangeEvent> aChanges{
+ { /* Source */ static_cast<cppu::OWeakObject*>(this),
+ /* PropertyName */ PROPERTY_NAME,
+ /* Further */ false,
+ /* PropertyHandle */ PROPERTY_ID_NAME,
+ /* OldValue */ Any(m_pImpl->m_aProps.aTitle),
+ /* NewValue */ Any(_sNewName) }
+ };
aGuard.clear();
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index e54712ff9ae5..be5c10737131 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -43,13 +43,12 @@
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/documentinfo.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/types.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/signaturestate.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/file.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
@@ -59,11 +58,11 @@
#include <i18nlangtag/languagetag.hxx>
#include <algorithm>
+#include <utility>
using namespace css;
using namespace ::com::sun::star::document;
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::uno;
@@ -72,9 +71,7 @@ using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::view;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::script;
using namespace ::cppu;
@@ -234,7 +231,7 @@ void DocumentStorageAccess::commitStorages()
{
for (auto const& exposedStorage : m_aExposedStorages)
{
- tools::stor::commitStorageIfWriteable( exposedStorage.second );
+ dbaccesstools::commitStorageIfWriteable( exposedStorage.second );
}
}
catch(const WrappedTargetException&)
@@ -252,9 +249,9 @@ bool DocumentStorageAccess::commitEmbeddedStorage( bool _bPreventRootCommits )
bool bSuccess = false;
try
{
- NamedStorages::const_iterator pos = m_aExposedStorages.find( "database" );
+ NamedStorages::const_iterator pos = m_aExposedStorages.find( u"database"_ustr );
if ( pos != m_aExposedStorages.end() )
- bSuccess = tools::stor::commitStorageIfWriteable( pos->second );
+ bSuccess = dbaccesstools::commitStorageIfWriteable( pos->second );
}
catch( Exception& )
{
@@ -318,7 +315,7 @@ void SAL_CALL DocumentStorageAccess::commited( const css::lang::EventObject& aEv
Reference< XStorage > xStorage( aEvent.Source, UNO_QUERY );
// check if this is the dedicated "database" sub storage
- NamedStorages::const_iterator pos = m_aExposedStorages.find( "database" );
+ NamedStorages::const_iterator pos = m_aExposedStorages.find( u"database"_ustr );
if ( ( pos != m_aExposedStorages.end() )
&& ( pos->second == xStorage )
)
@@ -354,14 +351,11 @@ void SAL_CALL DocumentStorageAccess::disposing( const css::lang::EventObject& So
// ODatabaseModelImpl
ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _rxContext, ODatabaseContext& _rDBContext )
- :m_xModel()
- ,m_xDataSource()
- ,m_aContainer(4)
+ :m_aContainer()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_rDBContext( _rDBContext )
,m_refCount(0)
- ,m_aEmbeddedMacros()
,m_bModificationLock( false )
,m_bDocumentInitialized( false )
,m_nScriptingSignatureState(SignatureState::UNKNOWN)
@@ -373,34 +367,30 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r
,m_bModified(false)
,m_bDocumentReadOnly(false)
,m_bMacroCallsSeenWhileLoading(false)
- ,m_pSharedConnectionManager(nullptr)
+ ,m_bAskPassword(false)
,m_nControllerLockCount(0)
{
// some kind of default
m_sConnectURL = "jdbc:";
- m_aTableFilter.realloc(1);
- m_aTableFilter[0] = "%";
+ m_aTableFilter = { u"%"_ustr };
impl_construct_nothrow();
}
ODatabaseModelImpl::ODatabaseModelImpl(
- const OUString& _rRegistrationName,
+ OUString _sRegistrationName,
const Reference< XComponentContext >& _rxContext,
ODatabaseContext& _rDBContext
)
- :m_xModel()
- ,m_xDataSource()
- ,m_aContainer(4)
+ :m_aContainer()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_rDBContext( _rDBContext )
,m_refCount(0)
- ,m_aEmbeddedMacros()
,m_bModificationLock( false )
,m_bDocumentInitialized( false )
,m_nScriptingSignatureState(SignatureState::UNKNOWN)
,m_aContext( _rxContext )
- ,m_sName(_rRegistrationName)
+ ,m_sName(std::move(_sRegistrationName))
,m_nLoginTimeout(0)
,m_bReadOnly(false)
,m_bPasswordRequired(false)
@@ -408,7 +398,7 @@ ODatabaseModelImpl::ODatabaseModelImpl(
,m_bModified(false)
,m_bDocumentReadOnly(false)
,m_bMacroCallsSeenWhileLoading(false)
- ,m_pSharedConnectionManager(nullptr)
+ ,m_bAskPassword(false)
,m_nControllerLockCount(0)
{
impl_construct_nothrow();
@@ -438,25 +428,22 @@ void ODatabaseModelImpl::impl_construct_nothrow()
// insert the default settings
Reference< XPropertyContainer > xContainer( m_xSettings, UNO_QUERY_THROW );
Reference< XSet > xSettingsSet( m_xSettings, UNO_QUERY_THROW );
- const AsciiPropertyValue* pSettings = getDefaultDataSourceSettings();
- for ( ; pSettings->AsciiName; ++pSettings )
+ for (auto& setting : getDefaultDataSourceSettings())
{
- if ( !pSettings->DefaultValue.hasValue() )
+ if (!setting.DefaultValue.hasValue())
{
- Property aProperty(
- OUString::createFromAscii( pSettings->AsciiName ),
+ Property aProperty(setting.Name,
-1,
- pSettings->ValueType,
+ setting.ValueType,
PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID
);
- xSettingsSet->insert( makeAny( aProperty ) );
+ xSettingsSet->insert( Any( aProperty ) );
}
else
{
- xContainer->addProperty(
- OUString::createFromAscii( pSettings->AsciiName ),
+ xContainer->addProperty(setting.Name,
PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT,
- pSettings->DefaultValue
+ setting.DefaultValue
);
}
}
@@ -472,17 +459,17 @@ namespace
{
OUString lcl_getContainerStorageName_throw( ODatabaseModelImpl::ObjectType _eType )
{
- const char* pAsciiName( nullptr );
+ OUString sName;
switch ( _eType )
{
- case ODatabaseModelImpl::E_FORM: pAsciiName = "forms"; break;
- case ODatabaseModelImpl::E_REPORT: pAsciiName = "reports"; break;
- case ODatabaseModelImpl::E_QUERY: pAsciiName = "queries"; break;
- case ODatabaseModelImpl::E_TABLE: pAsciiName = "tables"; break;
+ case ODatabaseModelImpl::ObjectType::Form: sName = u"forms"_ustr; break;
+ case ODatabaseModelImpl::ObjectType::Report: sName = u"reports"_ustr; break;
+ case ODatabaseModelImpl::ObjectType::Query: sName = u"queries"_ustr; break;
+ case ODatabaseModelImpl::ObjectType::Table: sName = u"tables"_ustr; break;
default:
throw RuntimeException();
}
- return OUString::createFromAscii( pAsciiName );
+ return sName;
}
bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const Reference< XStorage >& _rxContainerStorage )
@@ -568,8 +555,8 @@ bool ODatabaseModelImpl::objectHasMacros( const Reference< XStorage >& _rxContai
void ODatabaseModelImpl::reset()
{
m_bReadOnly = false;
- std::vector< TContentPtr > aEmptyContainers( 4 );
- m_aContainer.swap( aEmptyContainers );
+ for (auto & i : m_aContainer)
+ i.reset();
if ( m_pStorageAccess.is() )
{
@@ -631,7 +618,6 @@ void ODatabaseModelImpl::clearConnections()
}
}
- m_pSharedConnectionManager = nullptr;
m_xSharedConnectionManager = nullptr;
}
@@ -640,25 +626,34 @@ void ODatabaseModelImpl::dispose()
// dispose the data source and the model
try
{
- Reference< XDataSource > xDS( m_xDataSource );
- ::comphelper::disposeComponent( xDS );
+ rtl::Reference< ODatabaseSource > xDS( m_xDataSource );
+ if (xDS)
+ {
+ xDS->dispose();
+ m_xDataSource.clear();
+ }
- Reference< XModel > xModel( m_xModel );
- ::comphelper::disposeComponent( xModel );
+ rtl::Reference< ODatabaseDocument > xModel( m_xModel );
+ if (xModel)
+ {
+ xModel->dispose();
+ m_xModel.clear();
+ }
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xDataSource = WeakReference<XDataSource>();
- m_xModel = WeakReference< XModel >();
+ m_xDataSource.clear();
+ m_xModel.clear();
for (auto const& elem : m_aContainer)
{
if ( elem )
elem->m_pDataSource = nullptr;
}
- m_aContainer.clear();
+ for (auto & i : m_aContainer)
+ i.reset();
clearConnections();
@@ -711,9 +706,9 @@ void ODatabaseModelImpl::setResource( const OUString& i_rDocumentURL, const Sequ
::comphelper::NamedValueCollection aMediaDescriptor( _rArgs );
#if OSL_DEBUG_LEVEL > 0
- if ( aMediaDescriptor.has( "SalvagedFile" ) )
+ if ( aMediaDescriptor.has( u"SalvagedFile"_ustr ) )
{
- OUString sSalvagedFile( aMediaDescriptor.getOrDefault( "SalvagedFile", OUString() ) );
+ OUString sSalvagedFile( aMediaDescriptor.getOrDefault( u"SalvagedFile"_ustr, OUString() ) );
// If SalvagedFile is an empty string, this indicates "the document is being recovered, but i_rDocumentURL already
// is the real document URL, not the temporary document location"
if ( sSalvagedFile.isEmpty() )
@@ -731,12 +726,12 @@ void ODatabaseModelImpl::setResource( const OUString& i_rDocumentURL, const Sequ
::comphelper::NamedValueCollection ODatabaseModelImpl::stripLoadArguments( const ::comphelper::NamedValueCollection& _rArguments )
{
- OSL_ENSURE( !_rArguments.has( "Model" ), "ODatabaseModelImpl::stripLoadArguments: this is suspicious (1)!" );
- OSL_ENSURE( !_rArguments.has( "ViewName" ), "ODatabaseModelImpl::stripLoadArguments: this is suspicious (2)!" );
+ OSL_ENSURE( !_rArguments.has( u"Model"_ustr ), "ODatabaseModelImpl::stripLoadArguments: this is suspicious (1)!" );
+ OSL_ENSURE( !_rArguments.has( u"ViewName"_ustr ), "ODatabaseModelImpl::stripLoadArguments: this is suspicious (2)!" );
::comphelper::NamedValueCollection aMutableArgs( _rArguments );
- aMutableArgs.remove( "Model" );
- aMutableArgs.remove( "ViewName" );
+ aMutableArgs.remove( u"Model"_ustr );
+ aMutableArgs.remove( u"ViewName"_ustr );
return aMutableArgs;
}
@@ -763,9 +758,9 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage()
if ( !m_xDocumentStorage.is() )
{
Reference< XSingleServiceFactory> xStorageFactory = StorageFactory::create( m_aContext );
- Any aSource = m_aMediaDescriptor.get( "Stream" );
+ Any aSource = m_aMediaDescriptor.get( u"Stream"_ustr );
if ( !aSource.hasValue() )
- aSource = m_aMediaDescriptor.get( "InputStream" );
+ aSource = m_aMediaDescriptor.get( u"InputStream"_ustr );
if ( !aSource.hasValue() && !m_sDocFileLocation.isEmpty() )
aSource <<= m_sDocFileLocation;
// TODO: shouldn't we also check URL?
@@ -774,9 +769,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage()
if ( aSource.hasValue() )
{
- Sequence< Any > aStorageCreationArgs(2);
- aStorageCreationArgs[0] = aSource;
- aStorageCreationArgs[1] <<= ElementModes::READWRITE;
+ Sequence< Any > aStorageCreationArgs{ aSource, Any(ElementModes::READWRITE) };
Reference< XStorage > xDocumentStorage;
OUString sURL;
@@ -791,7 +784,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage()
catch( const Exception& )
{
m_bDocumentReadOnly = true;
- aStorageCreationArgs[1] <<= ElementModes::READ;
+ aStorageCreationArgs.getArray()[1] <<= ElementModes::READ;
try
{
xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW );
@@ -844,7 +837,7 @@ bool ODatabaseModelImpl::commitEmbeddedStorage( bool _bPreventRootCommits )
bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference< XStorage >& _rxStorage )
{
bool bTryToPreserveScriptSignature = false;
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
OUString sTmpFileUrl = aTempFile.GetURL();
SignatureState aSignatureState = getScriptingSignatureState();
@@ -860,13 +853,13 @@ bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference<
// For that, we need a temporary copy of the original file.
osl::File::RC rc = osl::File::copy(sLocation, sTmpFileUrl);
if (rc != osl::FileBase::E_None)
- throw uno::RuntimeException("Could not create temp file");
+ throw uno::RuntimeException(u"Could not create temp file"_ustr);
}
bool bSuccess = false;
try
{
- bSuccess = tools::stor::commitStorageIfWriteable( _rxStorage );
+ bSuccess = dbaccesstools::commitStorageIfWriteable( _rxStorage );
}
catch( const Exception& )
{
@@ -894,11 +887,11 @@ bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference<
if (!xReadOrig.is())
throw uno::RuntimeException("Could not read " + sTmpFileUrl);
uno::Reference<embed::XStorage> xMetaInf
- = xReadOrig->openStorageElement("META-INF", embed::ElementModes::READ);
+ = xReadOrig->openStorageElement(u"META-INF"_ustr, embed::ElementModes::READ);
uno::Reference<embed::XStorage> xTargetMetaInf
- = _rxStorage->openStorageElement("META-INF", embed::ElementModes::READWRITE);
- if (xMetaInf.is() && xTargetMetaInf.is())
+ = _rxStorage->openStorageElement(u"META-INF"_ustr, embed::ElementModes::READWRITE);
+ if (xMetaInf.is() && xTargetMetaInf.is() && xMetaInf->hasByName(aScriptSignName))
{
xMetaInf->copyElementTo(aScriptSignName, xTargetMetaInf, aScriptSignName);
@@ -945,7 +938,7 @@ void ODatabaseModelImpl::setModified( bool _bModified )
try
{
- Reference< XModifiable > xModi( m_xModel.get(), UNO_QUERY );
+ rtl::Reference< ODatabaseDocument > xModi( m_xModel );
if ( xModi.is() )
xModi->setModified( _bModified );
else
@@ -959,35 +952,35 @@ void ODatabaseModelImpl::setModified( bool _bModified )
Reference<XDataSource> ODatabaseModelImpl::getOrCreateDataSource()
{
- Reference<XDataSource> xDs = m_xDataSource;
+ rtl::Reference<ODatabaseSource> xDs = m_xDataSource;
if ( !xDs.is() )
{
xDs = new ODatabaseSource(this);
- m_xDataSource = xDs;
+ m_xDataSource = xDs.get();
}
return xDs;
}
-Reference< XModel> ODatabaseModelImpl::getModel_noCreate() const
+rtl::Reference<ODatabaseDocument> ODatabaseModelImpl::getModel_noCreate() const
{
- return m_xModel;
+ return m_xModel.get();
}
-Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership()
+rtl::Reference< ODatabaseDocument > ODatabaseModelImpl::createNewModel_deliverOwnership()
{
- Reference< XModel > xModel( m_xModel );
+ rtl::Reference< ODatabaseDocument > xModel( m_xModel );
OSL_PRECOND( !xModel.is(), "ODatabaseModelImpl::createNewModel_deliverOwnership: not to be called if there already is a model!" );
if ( !xModel.is() )
{
bool bHadModelBefore = m_bDocumentInitialized;
xModel = ODatabaseDocument::createDatabaseDocument( this, ODatabaseDocument::FactoryAccess() );
- m_xModel = xModel;
+ m_xModel = xModel.get();
try
{
Reference< XGlobalEventBroadcaster > xModelCollection = theGlobalEventBroadcaster::get( m_aContext );
- xModelCollection->insert( makeAny( xModel ) );
+ xModelCollection->insert( Any( Reference< XModel >(xModel) ) );
}
catch( const Exception& )
{
@@ -1038,82 +1031,80 @@ Reference< XStorage > ODatabaseModelImpl::getStorage( const ObjectType _eType )
css::embed::ElementModes::READWRITE );
}
-const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
+// static
+std::span<const DefaultPropertyValue> ODatabaseModelImpl::getDefaultDataSourceSettings()
{
- static const AsciiPropertyValue aKnownSettings[] =
+ static const DefaultPropertyValue aKnownSettings[] =
{
// known JDBC settings
- AsciiPropertyValue( "JavaDriverClass", makeAny( OUString() ) ),
- AsciiPropertyValue( "JavaDriverClassPath", makeAny( OUString() ) ),
- AsciiPropertyValue( "IgnoreCurrency", makeAny( false ) ),
+ { u"JavaDriverClass"_ustr, Any( OUString() ) },
+ { u"JavaDriverClassPath"_ustr, Any( OUString() ) },
+ { u"IgnoreCurrency"_ustr, Any( false ) },
// known settings for file-based drivers
- AsciiPropertyValue( "Extension", makeAny( OUString() ) ),
- AsciiPropertyValue( "CharSet", makeAny( OUString() ) ),
- AsciiPropertyValue( "HeaderLine", makeAny( true ) ),
- AsciiPropertyValue( "FieldDelimiter", makeAny( OUString( "," ) ) ),
- AsciiPropertyValue( "StringDelimiter", makeAny( OUString( "\"" ) ) ),
- AsciiPropertyValue( "DecimalDelimiter", makeAny( OUString( "." ) ) ),
- AsciiPropertyValue( "ThousandDelimiter", makeAny( OUString() ) ),
- AsciiPropertyValue( "ShowDeleted", makeAny( false ) ),
+ { u"Extension"_ustr, Any( OUString() ) },
+ { u"CharSet"_ustr, Any( OUString() ) },
+ { u"HeaderLine"_ustr, Any( true ) },
+ { u"FieldDelimiter"_ustr, Any( u","_ustr ) },
+ { u"StringDelimiter"_ustr, Any( u"\""_ustr ) },
+ { u"DecimalDelimiter"_ustr, Any( u"."_ustr ) },
+ { u"ThousandDelimiter"_ustr, Any( OUString() ) },
+ { u"ShowDeleted"_ustr, Any( false ) },
// known ODBC settings
- AsciiPropertyValue( "SystemDriverSettings", makeAny( OUString() ) ),
- AsciiPropertyValue( "UseCatalog", makeAny( false ) ),
- AsciiPropertyValue( "TypeInfoSettings", makeAny( Sequence< Any >()) ),
+ { u"SystemDriverSettings"_ustr, Any( OUString() ) },
+ { u"UseCatalog"_ustr, Any( false ) },
+ { u"TypeInfoSettings"_ustr, Any( Sequence< Any >()) },
// settings related to auto increment handling
- AsciiPropertyValue( "AutoIncrementCreation", makeAny( OUString() ) ),
- AsciiPropertyValue( "AutoRetrievingStatement", makeAny( OUString() ) ),
- AsciiPropertyValue( "IsAutoRetrievingEnabled", makeAny( false ) ),
+ { u"AutoIncrementCreation"_ustr, Any( OUString() ) },
+ { u"AutoRetrievingStatement"_ustr, Any( OUString() ) },
+ { u"IsAutoRetrievingEnabled"_ustr, Any( false ) },
// known LDAP driver settings
- AsciiPropertyValue( "HostName", makeAny( OUString() ) ),
- AsciiPropertyValue( "PortNumber", makeAny( sal_Int32(389) ) ),
- AsciiPropertyValue( "BaseDN", makeAny( OUString() ) ),
- AsciiPropertyValue( "MaxRowCount", makeAny( sal_Int32(100) ) ),
+ { u"HostName"_ustr, Any( OUString() ) },
+ { u"PortNumber"_ustr, Any( sal_Int32(389) ) },
+ { u"BaseDN"_ustr, Any( OUString() ) },
+ { u"MaxRowCount"_ustr, Any( sal_Int32(100) ) },
// known MySQLNative driver settings
- AsciiPropertyValue( "LocalSocket", makeAny( OUString() ) ),
- AsciiPropertyValue( "NamedPipe", makeAny( OUString() ) ),
+ { u"LocalSocket"_ustr, Any( OUString() ) },
+ { u"NamedPipe"_ustr, Any( OUString() ) },
// misc known driver settings
- AsciiPropertyValue( "ParameterNameSubstitution", makeAny( false ) ),
- AsciiPropertyValue( "AddIndexAppendix", makeAny( true ) ),
- AsciiPropertyValue( "IgnoreDriverPrivileges", makeAny( true ) ),
- AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< OUString >::get() ),
- AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< OUString >::get() ),
- AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
- AsciiPropertyValue( "ShowColumnDescription", makeAny( false ) ),
+ { u"ParameterNameSubstitution"_ustr, Any( false ) },
+ { u"AddIndexAppendix"_ustr, Any( true ) },
+ { u"IgnoreDriverPrivileges"_ustr, Any( true ) },
+ { u"ImplicitCatalogRestriction"_ustr, ::cppu::UnoType< OUString >::get() },
+ { u"ImplicitSchemaRestriction"_ustr, ::cppu::UnoType< OUString >::get() },
+ { u"PrimaryKeySupport"_ustr, ::cppu::UnoType< sal_Bool >::get() },
+ { u"ShowColumnDescription"_ustr, Any( false ) },
// known SDB level settings
- AsciiPropertyValue( "NoNameLengthLimit", makeAny( false ) ),
- AsciiPropertyValue( "AppendTableAliasName", makeAny( false ) ),
- AsciiPropertyValue( "GenerateASBeforeCorrelationName", makeAny( false ) ),
- AsciiPropertyValue( "ColumnAliasInOrderBy", makeAny( true ) ),
- AsciiPropertyValue( "EnableSQL92Check", makeAny( false ) ),
- AsciiPropertyValue( "BooleanComparisonMode", makeAny( BooleanComparisonMode::EQUAL_INTEGER ) ),
- AsciiPropertyValue( "TableTypeFilterMode", makeAny( sal_Int32(3) ) ),
- AsciiPropertyValue( "RespectDriverResultSetType", makeAny( false ) ),
- AsciiPropertyValue( "UseSchemaInSelect", makeAny( true ) ),
- AsciiPropertyValue( "UseCatalogInSelect", makeAny( true ) ),
- AsciiPropertyValue( "EnableOuterJoinEscape", makeAny( true ) ),
- AsciiPropertyValue( "PreferDosLikeLineEnds", makeAny( false ) ),
- AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( true ) ),
- AsciiPropertyValue( "EscapeDateTime", makeAny( true ) ),
+ { u"NoNameLengthLimit"_ustr, Any( false ) },
+ { u"AppendTableAliasName"_ustr, Any( false ) },
+ { u"GenerateASBeforeCorrelationName"_ustr, Any( false ) },
+ { u"ColumnAliasInOrderBy"_ustr, Any( true ) },
+ { u"EnableSQL92Check"_ustr, Any( false ) },
+ { u"BooleanComparisonMode"_ustr, Any( BooleanComparisonMode::EQUAL_INTEGER ) },
+ { u"TableTypeFilterMode"_ustr, Any( sal_Int32(3) ) },
+ { u"RespectDriverResultSetType"_ustr, Any( false ) },
+ { u"UseSchemaInSelect"_ustr, Any( true ) },
+ { u"UseCatalogInSelect"_ustr, Any( true ) },
+ { u"EnableOuterJoinEscape"_ustr, Any( true ) },
+ { u"PreferDosLikeLineEnds"_ustr, Any( false ) },
+ { u"FormsCheckRequiredFields"_ustr, Any( true ) },
+ { u"EscapeDateTime"_ustr, Any( true ) },
// known services to handle database tasks
- AsciiPropertyValue( "TableAlterationServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "TableRenameServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "ViewAlterationServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "ViewAccessServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "CommandDefinitions", makeAny( OUString() ) ),
- AsciiPropertyValue( "Forms", makeAny( OUString() ) ),
- AsciiPropertyValue( "Reports", makeAny( OUString() ) ),
- AsciiPropertyValue( "KeyAlterationServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "IndexAlterationServiceName", makeAny( OUString() ) ),
-
- AsciiPropertyValue()
+ { u"TableAlterationServiceName"_ustr, Any( OUString() ) },
+ { u"TableRenameServiceName"_ustr, Any( OUString() ) },
+ { u"ViewAlterationServiceName"_ustr, Any( OUString() ) },
+ { u"ViewAccessServiceName"_ustr, Any( OUString() ) },
+ { u"CommandDefinitions"_ustr, Any( OUString() ) },
+ { u"Forms"_ustr, Any( OUString() ) },
+ { u"Reports"_ustr, Any( OUString() ) },
+ { u"KeyAlterationServiceName"_ustr, Any( OUString() ) },
+ { u"IndexAlterationServiceName"_ustr, Any( OUString() ) },
};
return aKnownSettings;
}
TContentPtr& ODatabaseModelImpl::getObjectContainer( ObjectType _eType )
{
- OSL_PRECOND( _eType >= E_FORM && _eType <= E_TABLE, "ODatabaseModelImpl::getObjectContainer: illegal index!" );
TContentPtr& rContentPtr = m_aContainer[ _eType ];
if ( !rContentPtr )
@@ -1133,8 +1124,10 @@ bool ODatabaseModelImpl::adjustMacroMode_AutoReject()
bool ODatabaseModelImpl::checkMacrosOnLoading()
{
Reference< XInteractionHandler > xInteraction;
- xInteraction = m_aMediaDescriptor.getOrDefault( "InteractionHandler", xInteraction );
- return m_aMacroMode.checkMacrosOnLoading( xInteraction );
+ xInteraction = m_aMediaDescriptor.getOrDefault( u"InteractionHandler"_ustr, xInteraction );
+ const bool bHasMacros = m_aMacroMode.hasMacros();
+ // Since Base does not support document signatures, we always assume that the content signature is valid.
+ return m_aMacroMode.checkMacrosOnLoading(xInteraction, true /*HasValidContentSignature*/, bHasMacros);
}
void ODatabaseModelImpl::resetMacroExecutionMode()
@@ -1148,7 +1141,9 @@ Reference< XStorageBasedLibraryContainer > ODatabaseModelImpl::getLibraryContain
if ( rxContainer.is() )
return rxContainer;
- Reference< XStorageBasedDocument > xDocument( getModel_noCreate(), UNO_QUERY_THROW );
+ rtl::Reference< ODatabaseDocument > xDocument( getModel_noCreate() );
+ if (!xDocument)
+ throw uno::RuntimeException();
// this is only to be called if there already exists a document model - in fact, it is
// to be called by the document model only
@@ -1170,7 +1165,7 @@ Reference< XStorageBasedLibraryContainer > ODatabaseModelImpl::getLibraryContain
{
throw WrappedTargetRuntimeException(
OUString(),
- xDocument,
+ cppu::getXWeak(xDocument.get()),
::cppu::getCaughtException()
);
}
@@ -1205,7 +1200,7 @@ namespace
if ( xModify.is() && !_bListen && _inout_rListener.is() )
{
- xModify->removeModifyListener( _inout_rListener.get() );
+ xModify->removeModifyListener( _inout_rListener );
}
if ( _inout_rListener.is() )
@@ -1217,7 +1212,7 @@ namespace
if ( xModify.is() && _bListen )
{
_inout_rListener = new ::sfx2::DocumentStorageModifyListener( _rDocument, _rMutex );
- xModify->addModifyListener( _inout_rListener.get() );
+ xModify->addModifyListener( _inout_rListener );
}
}
}
@@ -1252,7 +1247,7 @@ Reference< XStorage > const & ODatabaseModelImpl::impl_switchToStorage_throw( co
lcl_rebaseScriptStorage_throw( m_xBasicLibraries, m_xDocumentStorage.getTyped() );
lcl_rebaseScriptStorage_throw( m_xDialogLibraries, m_xDocumentStorage.getTyped() );
- m_bReadOnly = !tools::stor::storageIsWritable_nothrow( m_xDocumentStorage.getTyped() );
+ m_bReadOnly = !dbaccesstools::storageIsWritable_nothrow( m_xDocumentStorage.getTyped() );
// TODO: our data source, if it exists, must broadcast the change of its ReadOnly property
return m_xDocumentStorage.getTyped();
@@ -1301,7 +1296,7 @@ sal_Int16 ODatabaseModelImpl::getCurrentMacroExecMode() const
sal_Int16 nCurrentMode = MacroExecMode::NEVER_EXECUTE;
try
{
- nCurrentMode = m_aMediaDescriptor.getOrDefault( "MacroExecutionMode", nCurrentMode );
+ nCurrentMode = m_aMediaDescriptor.getOrDefault( u"MacroExecutionMode"_ustr, nCurrentMode );
}
catch( const Exception& )
{
@@ -1312,7 +1307,7 @@ sal_Int16 ODatabaseModelImpl::getCurrentMacroExecMode() const
void ODatabaseModelImpl::setCurrentMacroExecMode( sal_uInt16 nMacroMode )
{
- m_aMediaDescriptor.put( "MacroExecutionMode", nMacroMode );
+ m_aMediaDescriptor.put( u"MacroExecutionMode"_ustr, nMacroMode );
}
OUString ODatabaseModelImpl::getDocumentLocation() const
@@ -1332,17 +1327,17 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros()
{
if ( ::sfx2::DocumentMacroMode::storageHasMacros( getOrCreateRootStorage() ) )
{
- m_aEmbeddedMacros = eDocumentWideMacros;
+ m_aEmbeddedMacros = EmbeddedMacros::DocumentWide;
}
- else if ( lcl_hasObjectsWithMacros_nothrow( *this, E_FORM )
- || lcl_hasObjectsWithMacros_nothrow( *this, E_REPORT )
+ else if ( lcl_hasObjectsWithMacros_nothrow( *this, ObjectType::Form )
+ || lcl_hasObjectsWithMacros_nothrow( *this, ObjectType::Report )
)
{
- m_aEmbeddedMacros = eSubDocumentMacros;
+ m_aEmbeddedMacros = EmbeddedMacros::SubDocument;
}
else
{
- m_aEmbeddedMacros = eNoMacros;
+ m_aEmbeddedMacros = EmbeddedMacros::NONE;
}
}
return *m_aEmbeddedMacros;
@@ -1351,7 +1346,7 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros()
bool ODatabaseModelImpl::documentStorageHasMacros() const
{
const_cast< ODatabaseModelImpl* >( this )->determineEmbeddedMacros();
- return ( *m_aEmbeddedMacros != eNoMacros );
+ return ( *m_aEmbeddedMacros != EmbeddedMacros::NONE );
}
bool ODatabaseModelImpl::macroCallsSeenWhileLoading() const
@@ -1361,7 +1356,7 @@ bool ODatabaseModelImpl::macroCallsSeenWhileLoading() const
Reference< XEmbeddedScripts > ODatabaseModelImpl::getEmbeddedDocumentScripts() const
{
- return Reference< XEmbeddedScripts >( getModel_noCreate(), UNO_QUERY );
+ return getModel_noCreate();
}
SignatureState ODatabaseModelImpl::getScriptingSignatureState()
@@ -1369,7 +1364,8 @@ SignatureState ODatabaseModelImpl::getScriptingSignatureState()
return m_nScriptingSignatureState;
}
-bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor)
+bool ODatabaseModelImpl::hasTrustedScriptingSignature(
+ const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction)
{
bool bResult = false;
@@ -1401,20 +1397,15 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor)
});
}
- if (!bResult && bAllowUIToAddAuthor)
+ if (!bResult && _rxInteraction)
{
- Reference<XInteractionHandler> xInteraction;
- xInteraction = m_aMediaDescriptor.getOrDefault("InteractionHandler", xInteraction);
- if (xInteraction.is())
- {
- task::DocumentMacroConfirmationRequest aRequest;
- aRequest.DocumentURL = m_sDocFileLocation;
- aRequest.DocumentStorage = xStorage;
- aRequest.DocumentSignatureInformation = aInfo;
- aRequest.DocumentVersion = aODFVersion;
- aRequest.Classification = task::InteractionClassification_QUERY;
- bResult = SfxMedium::CallApproveHandler(xInteraction, uno::makeAny(aRequest), true);
- }
+ task::DocumentMacroConfirmationRequest aRequest;
+ aRequest.DocumentURL = m_sDocFileLocation;
+ aRequest.DocumentStorage = std::move(xStorage);
+ aRequest.DocumentSignatureInformation = std::move(aInfo);
+ aRequest.DocumentVersion = aODFVersion;
+ aRequest.Classification = task::InteractionClassification_QUERY;
+ bResult = SfxMedium::CallApproveHandler(_rxInteraction, uno::Any(aRequest), true);
}
}
catch (uno::Exception&)
@@ -1429,8 +1420,8 @@ void ODatabaseModelImpl::storageIsModified()
setModified( true );
}
-ModelDependentComponent::ModelDependentComponent( const ::rtl::Reference< ODatabaseModelImpl >& _model )
- :m_pImpl( _model )
+ModelDependentComponent::ModelDependentComponent( ::rtl::Reference< ODatabaseModelImpl > _model )
+ :m_pImpl(std::move( _model ))
{
}
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.cxx b/dbaccess/source/core/dataaccess/SharedConnection.cxx
index 93bd17ff71af..1e6156202bd7 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.cxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx
@@ -18,140 +18,126 @@
*/
#include "SharedConnection.hxx"
-#include <comphelper/uno3.hxx>
namespace dbaccess
{
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace connectivity;
-OSharedConnection::OSharedConnection(Reference< XAggregation >& _rxProxyConnection)
- : OSharedConnection_BASE(m_aMutex)
+OSharedConnection::OSharedConnection(Reference<XAggregation>& _rxProxyConnection)
{
- setDelegation(_rxProxyConnection,m_refCount);
+ setDelegation(_rxProxyConnection);
}
-OSharedConnection::~OSharedConnection()
-{
-}
+OSharedConnection::~OSharedConnection() {}
-void SAL_CALL OSharedConnection::disposing()
+Reference<XStatement> SAL_CALL OSharedConnection::createStatement()
{
- OSharedConnection_BASE::disposing();
- OConnectionWrapper::disposing();
-}
-
-Reference< XStatement > SAL_CALL OSharedConnection::createStatement( )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->createStatement();
}
-Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareStatement( const OUString& sql )
+Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareStatement(const OUString& sql)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->prepareStatement(sql);
}
-Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareCall( const OUString& sql )
+Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareCall(const OUString& sql)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->prepareCall(sql);
}
-OUString SAL_CALL OSharedConnection::nativeSQL( const OUString& sql )
+OUString SAL_CALL OSharedConnection::nativeSQL(const OUString& sql)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->nativeSQL(sql);
}
-sal_Bool SAL_CALL OSharedConnection::getAutoCommit( )
+sal_Bool SAL_CALL OSharedConnection::getAutoCommit()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getAutoCommit();
}
-void SAL_CALL OSharedConnection::commit( )
+void SAL_CALL OSharedConnection::commit()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
m_xConnection->commit();
}
-void SAL_CALL OSharedConnection::rollback( )
+void SAL_CALL OSharedConnection::rollback()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
m_xConnection->rollback();
}
-sal_Bool SAL_CALL OSharedConnection::isClosed( )
+sal_Bool SAL_CALL OSharedConnection::isClosed()
{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !m_xConnection.is() )
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (!m_xConnection.is())
return true;
return m_xConnection->isClosed();
}
-Reference< XDatabaseMetaData > SAL_CALL OSharedConnection::getMetaData( )
+Reference<XDatabaseMetaData> SAL_CALL OSharedConnection::getMetaData()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
-
return m_xConnection->getMetaData();
}
-sal_Bool SAL_CALL OSharedConnection::isReadOnly( )
+sal_Bool SAL_CALL OSharedConnection::isReadOnly()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->isReadOnly();
}
-OUString SAL_CALL OSharedConnection::getCatalog( )
+OUString SAL_CALL OSharedConnection::getCatalog()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getCatalog();
}
-sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation( )
+sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getTransactionIsolation();
}
-Reference< css::container::XNameAccess > SAL_CALL OSharedConnection::getTypeMap( )
+Reference<css::container::XNameAccess> SAL_CALL OSharedConnection::getTypeMap()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getTypeMap();
}
-IMPLEMENT_GET_IMPLEMENTATION_ID( OSharedConnection )
-
-} // namespace dbaccess
+} // namespace dbaccess
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.hxx b/dbaccess/source/core/dataaccess/SharedConnection.hxx
index 6121d3d37532..0eb93f02eac8 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.hxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.hxx
@@ -16,16 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_SHAREDCONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_SHAREDCONNECTION_HXX
+#pragma once
#include <connectivity/ConnectionWrapper.hxx>
#include <connectivity/CommonTools.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
-#include <comphelper/sequence.hxx>
namespace dbaccess
{
@@ -33,40 +29,17 @@ namespace dbaccess
// All methods will be forwarded with exception of the set methods, which are not allowed
// to be called on shared connections. Instances of this class will be created when the
// datasource is asked for not isolated connection.
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XConnection
+ typedef ::cppu::ImplInheritanceHelper<connectivity::OConnectionWrapper,
+ css::sdbc::XConnection
> OSharedConnection_BASE;
- typedef ::connectivity::OConnectionWrapper OSharedConnection_BASE2;
- class OSharedConnection : public ::cppu::BaseMutex
- , public OSharedConnection_BASE
- , public OSharedConnection_BASE2
+ class OSharedConnection : public OSharedConnection_BASE
{
protected:
- virtual void SAL_CALL disposing() override;
virtual ~OSharedConnection() override;
public:
explicit OSharedConnection(css::uno::Reference< css::uno::XAggregation >& _rxProxyConnection);
- virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
-
- virtual void SAL_CALL acquire() throw() override { OSharedConnection_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { OSharedConnection_BASE::release(); }
- virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override
- {
- return ::comphelper::concatSequences(
- OSharedConnection_BASE::getTypes(),
- OSharedConnection_BASE2::getTypes()
- );
- }
-
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override
- {
- css::uno::Any aReturn = OSharedConnection_BASE::queryInterface(_rType);
- if ( !aReturn.hasValue() )
- aReturn = OSharedConnection_BASE2::queryInterface(_rType);
- return aReturn;
- }
-
// XCloseable
virtual void SAL_CALL close( ) override
{
@@ -80,23 +53,23 @@ namespace dbaccess
// XConnection
virtual void SAL_CALL setAutoCommit( sal_Bool /*autoCommit*/ ) override
{
- throw css::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,css::uno::Any());
+ throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
}
virtual void SAL_CALL setReadOnly( sal_Bool /*readOnly*/ ) override
{
- throw css::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,css::uno::Any());
+ throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
}
virtual void SAL_CALL setCatalog( const OUString& /*catalog*/ ) override
{
- throw css::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,css::uno::Any());
+ throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
}
virtual void SAL_CALL setTransactionIsolation( sal_Int32 /*level*/ ) override
{
- throw css::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,css::uno::Any());
+ throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
}
virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& /*typeMap*/ ) override
{
- throw css::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,css::uno::Any());
+ throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
}
// XConnection
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
@@ -116,6 +89,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_SHAREDCONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
index 647aaf557f97..3d0657e26603 100644
--- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
@@ -19,6 +19,7 @@
#include <bookmarkcontainer.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <comphelper/enumhelper.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -45,12 +46,12 @@ OBookmarkContainer::OBookmarkContainer(OWeakObject& _rParent, Mutex& _rMutex)
}
-void SAL_CALL OBookmarkContainer::acquire( ) throw()
+void SAL_CALL OBookmarkContainer::acquire( ) noexcept
{
m_rParent.acquire();
}
-void SAL_CALL OBookmarkContainer::release( ) throw()
+void SAL_CALL OBookmarkContainer::release( ) noexcept
{
m_rParent.release();
}
@@ -62,7 +63,7 @@ OBookmarkContainer::~OBookmarkContainer()
// XServiceInfo
OUString SAL_CALL OBookmarkContainer::getImplementationName( )
{
- return "com.sun.star.comp.dba.OBookmarkContainer";
+ return u"com.sun.star.comp.dba.OBookmarkContainer"_ustr;
}
sal_Bool SAL_CALL OBookmarkContainer::supportsService( const OUString& _rServiceName )
@@ -72,7 +73,7 @@ sal_Bool SAL_CALL OBookmarkContainer::supportsService( const OUString& _rService
Sequence< OUString > SAL_CALL OBookmarkContainer::getSupportedServiceNames( )
{
- return { "com.sun.star.sdb.DefinitionContainer" };
+ return { u"com.sun.star.sdb.DefinitionContainer"_ustr };
}
// XNameContainer
@@ -96,10 +97,8 @@ void SAL_CALL OBookmarkContainer::insertByName( const OUString& _rName, const An
// notify the listeners
if (m_aContainerListeners.getLength())
{
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), Any());
- OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent);
+ ContainerEvent aEvent(*this, Any(_rName), Any(sNewLink), Any());
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
}
@@ -126,10 +125,8 @@ void SAL_CALL OBookmarkContainer::removeByName( const OUString& _rName )
// notify the listeners
if (m_aContainerListeners.getLength())
{
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sOldBookmark), Any());
- OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementRemoved(aEvent);
+ ContainerEvent aEvent(*this, Any(_rName), Any(sOldBookmark), Any());
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
}
}
@@ -161,10 +158,8 @@ void SAL_CALL OBookmarkContainer::replaceByName( const OUString& _rName, const A
aGuard.clear();
if (m_aContainerListeners.getLength())
{
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), makeAny(sOldLink));
- OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementReplaced(aEvent);
+ ContainerEvent aEvent(*this, Any(_rName), Any(sNewLink), Any(sOldLink));
+ m_aContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvent );
}
}
@@ -185,7 +180,6 @@ void SAL_CALL OBookmarkContainer::removeContainerListener( const Reference< XCon
// XElementAccess
Type SAL_CALL OBookmarkContainer::getElementType( )
{
- MutexGuard aGuard(m_rMutex);
return ::cppu::UnoType<OUString>::get();
}
@@ -213,10 +207,10 @@ Any SAL_CALL OBookmarkContainer::getByIndex( sal_Int32 _nIndex )
{
MutexGuard aGuard(m_rMutex);
- if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aBookmarksIndexed.size())))
+ if ((_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= m_aBookmarksIndexed.size()))
throw IndexOutOfBoundsException();
- return makeAny(m_aBookmarksIndexed[_nIndex]->second);
+ return Any(m_aBookmarksIndexed[_nIndex]->second);
}
Any SAL_CALL OBookmarkContainer::getByName( const OUString& _rName )
@@ -226,7 +220,7 @@ Any SAL_CALL OBookmarkContainer::getByName( const OUString& _rName )
if (!checkExistence(_rName))
throw NoSuchElementException();
- return makeAny(m_aBookmarks[_rName]);
+ return Any(m_aBookmarks[_rName]);
}
Sequence< OUString > SAL_CALL OBookmarkContainer::getElementNames( )
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx
index 55087272b992..9f426f4651a6 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx
@@ -24,11 +24,7 @@
#include <com/sun/star/sdb/CommandDefinition.hpp>
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::ucb;
-using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -52,7 +48,13 @@ OCommandContainer::~OCommandContainer()
}
IMPLEMENT_FORWARD_XINTERFACE2( OCommandContainer,ODefinitionContainer,OCommandContainer_BASE)
-IMPLEMENT_GETTYPES2(OCommandContainer,ODefinitionContainer,OCommandContainer_BASE);
+css::uno::Sequence< css::uno::Type > OCommandContainer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ ODefinitionContainer::getTypes( ),
+ OCommandContainer_BASE::getTypes( )
+ );
+}
css::uno::Sequence<sal_Int8> OCommandContainer::getImplementationId()
{
@@ -86,7 +88,7 @@ Reference< XInterface > SAL_CALL OCommandContainer::createInstance( )
OUString OCommandContainer::determineContentType() const
{
- return "application/vnd.org.openoffice.DatabaseCommandDefinitionContainer";
+ return u"application/vnd.org.openoffice.DatabaseCommandDefinitionContainer"_ustr;
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.hxx b/dbaccess/source/core/dataaccess/commandcontainer.hxx
index d0a1deca85dd..3ea36f64808b 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.hxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDCONTAINER_HXX
+#pragma once
#include <definitioncontainer.hxx>
@@ -70,6 +69,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index 41ce139a8dc1..6dfe5056e7ab 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.cxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx
@@ -18,16 +18,14 @@
*/
#include "commanddefinition.hxx"
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <com/sun/star/container/ElementExistException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
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;
@@ -81,21 +79,42 @@ css::uno::Sequence<sal_Int8> OCommandDefinition::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinition);
+css::uno::Sequence< css::uno::Type > OCommandDefinition::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OCommandDefinition_Base::getTypes( ),
+ OComponentDefinition::getTypes( )
+ );
+}
IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OCommandDefinition::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& OCommandDefinition::getInfoHelper()
+{
+ return *OCommandDefinition_PROP::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* OCommandDefinition::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
OUString SAL_CALL OCommandDefinition::getImplementationName()
{
- return "com.sun.star.comp.dba.OCommandDefinition";
+ return u"com.sun.star.comp.dba.OCommandDefinition"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL OCommandDefinition::getSupportedServiceNames()
{
return {
- "com.sun.star.sdb.QueryDefinition",
- "com.sun.star.sdb.CommandDefinition",
- "com.sun.star.ucb.Content"
+ u"com.sun.star.sdb.QueryDefinition"_ustr,
+ u"com.sun.star.sdb.CommandDefinition"_ustr,
+ u"com.sun.star.ucb.Content"_ustr
};
}
@@ -105,9 +124,9 @@ void SAL_CALL OCommandDefinition::rename( const OUString& newName )
{
sal_Int32 nHandle = PROPERTY_ID_NAME;
osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex);
- Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
+ Any aOld(m_pImpl->m_aProps.aTitle);
aGuard.clear();
- Any aNew = makeAny(newName);
+ Any aNew(newName);
fire(&nHandle, &aNew, &aOld, 1, true );
m_pImpl->m_aProps.aTitle = newName;
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx
index 112a0eaa2b7c..ed348a8899b8 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.hxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
+#pragma once
#include <commandbase.hxx>
#include <apitools.hxx>
@@ -123,6 +122,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 2754a2c7d56e..61d4f1bc7ebf 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -21,9 +21,10 @@
#include <iterator>
-#include "connection.hxx"
+#include <connection.hxx>
#include "datasource.hxx"
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <statement.hxx>
#include <preparedstatement.hxx>
@@ -38,7 +39,7 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
@@ -46,7 +47,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::sdbc;
@@ -70,7 +70,7 @@ namespace dbaccess
// XServiceInfo
OUString OConnection::getImplementationName( )
{
- return "com.sun.star.comp.dbaccess.Connection";
+ return u"com.sun.star.comp.dbaccess.Connection"_ustr;
}
sal_Bool OConnection::supportsService( const OUString& _rServiceName )
@@ -86,7 +86,7 @@ Sequence< OUString > OConnection::getSupportedServiceNames( )
{
sal_Int32 nLen = aSupported.getLength();
aSupported.realloc( nLen + 1 );
- aSupported[ nLen ] = SERVICE_SDB_CONNECTION;
+ aSupported.getArray()[ nLen ] = SERVICE_SDB_CONNECTION;
}
return aSupported;
@@ -111,7 +111,7 @@ Reference< XStatement > OConnection::createStatement()
MutexGuard aGuard(m_aMutex);
checkDisposed();
- Reference< XStatement > xStatement;
+ rtl::Reference< OStatement > xStatement;
Reference< XStatement > xMasterStatement = m_xMasterConnection->createStatement();
if ( xMasterStatement.is() )
{
@@ -127,7 +127,7 @@ Reference< XPreparedStatement > OConnection::prepareStatement(const OUString& s
checkDisposed();
// TODO convert the SQL to SQL the driver understands
- Reference< XPreparedStatement > xStatement;
+ rtl::Reference< OPreparedStatement > xStatement;
Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareStatement(sql);
if ( xMasterStatement.is() )
{
@@ -142,7 +142,7 @@ Reference< XPreparedStatement > OConnection::prepareCall(const OUString& sql)
MutexGuard aGuard(m_aMutex);
checkDisposed();
- Reference< XPreparedStatement > xStatement;
+ rtl::Reference< OCallableStatement > xStatement;
Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareCall(sql);
if ( xMasterStatement.is() )
{
@@ -255,10 +255,7 @@ void OConnection::setTypeMap(const Reference< XNameAccess > & typeMap)
OConnection::OConnection(ODatabaseSource& _rDB
, Reference< XConnection > const & _rxMaster
, const Reference< XComponentContext >& _rxORB)
- :OSubComponent(m_aMutex, static_cast< OWeakObject* >(&_rDB))
- // as the queries reroute their refcounting to us, this m_aMutex is okey. If the queries
- // container would do its own refcounting, it would have to acquire m_pMutex
- // same for tables
+ :m_xParent(&_rDB)
,m_aTableFilter(_rDB.m_pImpl->m_aTableFilter)
,m_aTableTypeFilter(_rDB.m_pImpl->m_aTableTypeFilter)
,m_aContext( _rxORB )
@@ -274,8 +271,8 @@ OConnection::OConnection(ODatabaseSource& _rDB
try
{
Reference< XProxyFactory > xProxyFactory = ProxyFactory::create( m_aContext );
- Reference<XAggregation> xAgg = xProxyFactory->createProxy(_rxMaster.get());
- setDelegation(xAgg,m_refCount);
+ Reference<XAggregation> xAgg = xProxyFactory->createProxy(_rxMaster);
+ setDelegation(xAgg);
OSL_ENSURE(m_xConnection.is(), "OConnection::OConnection : invalid master connection !");
}
catch(const Exception&)
@@ -318,6 +315,19 @@ OConnection::OConnection(ODatabaseSource& _rDB
break;
}
}
+ Reference<XCloseable> xCloseable(xRes, UNO_QUERY);
+ if (xCloseable.is())
+ xCloseable->close();
+ }
+ // tdf#130564: getTableTypes retrieves only the table types of the current database and not all the possible table types
+ // provided by the DBMS. JDBC would need a new function, something like "supportsViews()"
+ // do the same for MySQL/MariaDB since we're on it
+ OUString strDbProductName = xMeta->getDatabaseProductName();
+ if (!m_bSupportsViews && xMeta->getURL().startsWith("sdbc:odbc:") &&
+ (strDbProductName == "PostgreSQL" || strDbProductName == "MySQL")
+ )
+ {
+ m_bSupportsViews = true;
}
// some dbs don't support this type so we should ask if a XViewsSupplier is supported
if(!m_bSupportsViews)
@@ -388,9 +398,7 @@ Sequence< Type > OConnection::getTypes()
{
TypeBag aNormalizedTypes;
- lcl_copyTypes( aNormalizedTypes, OSubComponent::getTypes() );
lcl_copyTypes( aNormalizedTypes, OConnection_Base::getTypes() );
- lcl_copyTypes( aNormalizedTypes, ::connectivity::OConnectionWrapper::getTypes() );
if ( !m_bSupportsViews )
aNormalizedTypes.erase( cppu::UnoType<XViewsSupplier>::get() );
@@ -402,11 +410,6 @@ Sequence< Type > OConnection::getTypes()
return comphelper::containerToSequence(aNormalizedTypes);
}
-Sequence< sal_Int8 > OConnection::getImplementationId()
-{
- return css::uno::Sequence<sal_Int8>();
-}
-
// css::uno::XInterface
Any OConnection::queryInterface( const Type & rType )
{
@@ -416,39 +419,19 @@ Any OConnection::queryInterface( const Type & rType )
return Any();
else if ( !m_bSupportsGroups && rType.equals( cppu::UnoType<XGroupsSupplier>::get() ) )
return Any();
- Any aReturn = OSubComponent::queryInterface( rType );
- if (!aReturn.hasValue())
- {
- aReturn = OConnection_Base::queryInterface( rType );
- if (!aReturn.hasValue())
- aReturn = OConnectionWrapper::queryInterface( rType );
- }
- return aReturn;
-}
-
-void OConnection::acquire() throw ()
-{
- // include this one when you want to see who calls it (call graph)
- OSubComponent::acquire();
-}
-
-void OConnection::release() throw ()
-{
- // include this one when you want to see who calls it (call graph)
- OSubComponent::release();
+ return OConnection_Base::queryInterface( rType );
}
-// OSubComponent
+// OConnection_Base
void OConnection::disposing()
{
MutexGuard aGuard(m_aMutex);
- OSubComponent::disposing();
- OConnectionWrapper::disposing();
+ OConnection_Base::disposing();
for (auto const& statement : m_aStatements)
{
- Reference<XComponent> xComp(statement.get(),UNO_QUERY);
+ rtl::Reference<OStatementBase> xComp(statement.get());
::comphelper::disposeComponent(xComp);
}
m_aStatements.clear();
@@ -485,7 +468,7 @@ Reference< XInterface > OConnection::getParent()
{
MutexGuard aGuard(m_aMutex);
checkDisposed();
- return m_xParent;
+ return static_cast<OWeakObject*>(m_xParent.get().get());
}
void OConnection::setParent(const Reference< XInterface > & /*Parent*/)
@@ -628,9 +611,8 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s
TSupportServices::const_iterator aFind = m_aSupportServices.find(_sServiceSpecifier);
if ( aFind == m_aSupportServices.end() )
{
- Sequence<Any> aArgs(1);
Reference<XConnection> xMy(this);
- aArgs[0] <<= NamedValue("ActiveConnection",makeAny(xMy));
+ Sequence<Any> aArgs{ Any(NamedValue(u"ActiveConnection"_ustr,Any(xMy))) };
aFind = m_aSupportServices.emplace(
_sServiceSpecifier,
m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sServiceSpecifier, aArgs, m_aContext)
@@ -750,7 +732,7 @@ void OConnection::impl_checkTableQueryNames_nothrow()
try
{
Reference< XNameAccess > xTables( getTables() );
- Sequence< OUString > aTableNames( xTables->getElementNames() );
+ const Sequence< OUString > aTableNames( xTables->getElementNames() );
std::set< OUString > aSortedTableNames( aTableNames.begin(), aTableNames.end() );
Reference< XNameAccess > xQueries( getQueries() );
@@ -758,7 +740,7 @@ void OConnection::impl_checkTableQueryNames_nothrow()
for ( auto const & queryName : aQueryNames )
{
- if ( aSortedTableNames.find( queryName ) != aSortedTableNames.end() )
+ if ( aSortedTableNames.contains(queryName) )
{
OUString sConflictWarning( DBA_RES( RID_STR_CONFLICTING_NAMES ) );
m_aWarnings.appendWarning( sConflictWarning, "01SB0", *this );
diff --git a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
index d35d6ac00e55..ae099dfb1bed 100644
--- a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
+++ b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
@@ -35,7 +35,6 @@
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <rtl/ref.hxx>
namespace
{
@@ -112,48 +111,29 @@ namespace
// </properties>
};
-#define REGISTER_PROPERTY( propname, member ) \
- registerProperty( PROPERTY_##propname, PROPERTY_ID_##propname, PropertyAttribute::BOUND, &member, cppu::UnoType<decltype(member)>::get() )
-
DataAccessDescriptor::DataAccessDescriptor()
- :DataAccessDescriptor_MutexBase()
- ,DataAccessDescriptor_TypeBase()
- ,DataAccessDescriptor_PropertyBase( m_aBHelper )
- ,m_sDataSourceName()
- ,m_sDatabaseLocation()
- ,m_sConnectionResource()
- ,m_aConnectionInfo()
- ,m_xActiveConnection()
- ,m_sCommand()
+ :DataAccessDescriptor_PropertyBase( m_aBHelper )
,m_nCommandType( CommandType::COMMAND )
- ,m_sFilter()
- ,m_sOrder()
- ,m_sHavingClause()
- ,m_sGroupBy()
,m_bEscapeProcessing( true )
- ,m_xResultSet()
- ,m_aSelection()
,m_bBookmarkSelection( true )
- ,m_sColumnName()
- ,m_xColumn()
{
- REGISTER_PROPERTY( DATASOURCENAME, m_sDataSourceName );
- REGISTER_PROPERTY( DATABASE_LOCATION, m_sDatabaseLocation );
- REGISTER_PROPERTY( CONNECTION_RESOURCE, m_sConnectionResource );
- REGISTER_PROPERTY( CONNECTION_INFO, m_aConnectionInfo );
- REGISTER_PROPERTY( ACTIVE_CONNECTION, m_xActiveConnection );
- REGISTER_PROPERTY( COMMAND, m_sCommand );
- REGISTER_PROPERTY( COMMAND_TYPE, m_nCommandType );
- REGISTER_PROPERTY( FILTER, m_sFilter );
- REGISTER_PROPERTY( ORDER, m_sOrder );
- REGISTER_PROPERTY( HAVING_CLAUSE, m_sHavingClause );
- REGISTER_PROPERTY( GROUP_BY, m_sGroupBy );
- REGISTER_PROPERTY( ESCAPE_PROCESSING, m_bEscapeProcessing );
- REGISTER_PROPERTY( RESULT_SET, m_xResultSet );
- REGISTER_PROPERTY( SELECTION, m_aSelection );
- REGISTER_PROPERTY( BOOKMARK_SELECTION, m_bBookmarkSelection );
- REGISTER_PROPERTY( COLUMN_NAME, m_sColumnName );
- REGISTER_PROPERTY( COLUMN, m_xColumn );
+ registerProperty(PROPERTY_DATASOURCENAME, PROPERTY_ID_DATASOURCENAME, PropertyAttribute::BOUND, &m_sDataSourceName , cppu::UnoType<decltype(m_sDataSourceName )>::get());
+ registerProperty(PROPERTY_DATABASE_LOCATION, PROPERTY_ID_DATABASE_LOCATION, PropertyAttribute::BOUND, &m_sDatabaseLocation , cppu::UnoType<decltype(m_sDatabaseLocation )>::get());
+ registerProperty(PROPERTY_CONNECTION_RESOURCE, PROPERTY_ID_CONNECTION_RESOURCE, PropertyAttribute::BOUND, &m_sConnectionResource , cppu::UnoType<decltype(m_sConnectionResource )>::get());
+ registerProperty(PROPERTY_CONNECTION_INFO, PROPERTY_ID_CONNECTION_INFO, PropertyAttribute::BOUND, &m_aConnectionInfo , cppu::UnoType<decltype(m_aConnectionInfo )>::get());
+ registerProperty(PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::BOUND, &m_xActiveConnection , cppu::UnoType<decltype(m_xActiveConnection )>::get());
+ registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND, &m_sCommand , cppu::UnoType<decltype(m_sCommand )>::get());
+ registerProperty(PROPERTY_COMMAND_TYPE, PROPERTY_ID_COMMAND_TYPE, PropertyAttribute::BOUND, &m_nCommandType , cppu::UnoType<decltype(m_nCommandType )>::get());
+ registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND, &m_sFilter , cppu::UnoType<decltype(m_sFilter )>::get());
+ registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND, &m_sOrder , cppu::UnoType<decltype(m_sOrder )>::get());
+ registerProperty(PROPERTY_HAVING_CLAUSE, PROPERTY_ID_HAVING_CLAUSE, PropertyAttribute::BOUND, &m_sHavingClause , cppu::UnoType<decltype(m_sHavingClause )>::get());
+ registerProperty(PROPERTY_GROUP_BY, PROPERTY_ID_GROUP_BY, PropertyAttribute::BOUND, &m_sGroupBy , cppu::UnoType<decltype(m_sGroupBy )>::get());
+ registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND, &m_bEscapeProcessing , cppu::UnoType<decltype(m_bEscapeProcessing )>::get());
+ registerProperty(PROPERTY_RESULT_SET, PROPERTY_ID_RESULT_SET, PropertyAttribute::BOUND, &m_xResultSet , cppu::UnoType<decltype(m_xResultSet )>::get());
+ registerProperty(PROPERTY_SELECTION, PROPERTY_ID_SELECTION, PropertyAttribute::BOUND, &m_aSelection , cppu::UnoType<decltype(m_aSelection )>::get());
+ registerProperty(PROPERTY_BOOKMARK_SELECTION, PROPERTY_ID_BOOKMARK_SELECTION, PropertyAttribute::BOUND, &m_bBookmarkSelection , cppu::UnoType<decltype(m_bBookmarkSelection )>::get());
+ registerProperty(PROPERTY_COLUMN_NAME, PROPERTY_ID_COLUMN_NAME, PropertyAttribute::BOUND, &m_sColumnName , cppu::UnoType<decltype(m_sColumnName )>::get());
+ registerProperty(PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::BOUND, &m_xColumn , cppu::UnoType<decltype(m_xColumn )>::get());
}
DataAccessDescriptor::~DataAccessDescriptor()
@@ -166,7 +146,7 @@ namespace
OUString SAL_CALL DataAccessDescriptor::getImplementationName()
{
- return "com.sun.star.comp.dba.DataAccessDescriptor";
+ return u"com.sun.star.comp.dba.DataAccessDescriptor"_ustr;
}
sal_Bool SAL_CALL DataAccessDescriptor::supportsService( const OUString& rServiceName )
@@ -176,7 +156,7 @@ namespace
Sequence< OUString > SAL_CALL DataAccessDescriptor::getSupportedServiceNames( )
{
- return { "com.sun.star.sdb.DataAccessDescriptor" };
+ return { u"com.sun.star.sdb.DataAccessDescriptor"_ustr };
}
Reference< XPropertySetInfo > SAL_CALL DataAccessDescriptor::getPropertySetInfo()
@@ -218,7 +198,7 @@ namespace
OUString SAL_CALL DataAccessDescriptorFactory::getImplementationName()
{
- return "com.sun.star.comp.dba.DataAccessDescriptorFactory";
+ return u"com.sun.star.comp.dba.DataAccessDescriptorFactory"_ustr;
}
sal_Bool SAL_CALL DataAccessDescriptorFactory::supportsService( const OUString& rServiceName )
@@ -228,7 +208,7 @@ namespace
Sequence< OUString > SAL_CALL DataAccessDescriptorFactory::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.DataAccessDescriptorFactory" };
+ return { u"com.sun.star.sdb.DataAccessDescriptorFactory"_ustr };
}
Reference< XPropertySet > SAL_CALL DataAccessDescriptorFactory::createDataAccessDescriptor( )
@@ -236,18 +216,6 @@ namespace
return new DataAccessDescriptor();
}
-struct Instance {
- explicit Instance():
- instance(new DataAccessDescriptorFactory())
- {}
-
- rtl::Reference<cppu::OWeakObject> instance;
-};
-
-struct Singleton:
- public rtl::Static<Instance, Singleton>
-{};
-
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
@@ -255,7 +223,7 @@ com_sun_star_comp_dba_DataAccessDescriptorFactory(
css::uno::XComponentContext *,
css::uno::Sequence<css::uno::Any> const &)
{
- return cppu::acquire(Singleton::get().instance.get());
+ return cppu::acquire(new DataAccessDescriptorFactory());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index c7ddce73b48a..8b4f815f3414 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -20,10 +20,12 @@
#include <config_features.h>
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <databasecontext.hxx>
#include "databaseregistrations.hxx"
#include "datasource.hxx"
+#include "databasedocument.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -32,10 +34,7 @@
#include <com/sun/star/frame/TerminationVetoException.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/registry/InvalidRegistryException.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/task/InteractionClassification.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
@@ -43,23 +42,22 @@
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/util/CloseVetoException.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
#include <basic/basmgr.hxx>
#include <comphelper/enumhelper.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/weak.hxx>
#include <rtl/uri.hxx>
#include <sal/log.hxx>
#include <svl/filenotation.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
+#include <rtl/ref.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <vector>
@@ -72,7 +70,6 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::registry;
using namespace ::com::sun::star;
using namespace ::cppu;
using namespace ::osl;
@@ -137,14 +134,11 @@ namespace dbaccess
{
try
{
- const Reference< XModel2 > xMod( pCopy->getModel_noCreate(),
- UNO_QUERY_THROW );
+ const rtl::Reference< ODatabaseDocument > xMod( pCopy->getModel_noCreate() );
+ if (!xMod)
+ throw uno::RuntimeException();
if( !xMod->getControllers()->hasMoreElements() )
- {
- Reference< util::XCloseable > xClose( xMod,
- UNO_QUERY_THROW );
- xClose->close( false );
- }
+ xMod->close( false );
}
catch( const CloseVetoException& )
{
@@ -175,12 +169,7 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon
#endif
osl_atomic_increment( &m_refCount );
- {
- m_xDBRegistrationAggregate.set( createDataSourceRegistrations( m_aContext ), UNO_SET_THROW );
- m_xDatabaseRegistrations.set( m_xDBRegistrationAggregate, UNO_QUERY_THROW );
-
- m_xDBRegistrationAggregate->setDelegator( *this );
- }
+ m_xDatabaseRegistrations = createDataSourceRegistrations( m_aContext );
osl_atomic_decrement( &m_refCount );
}
@@ -191,31 +180,13 @@ ODatabaseContext::~ODatabaseContext()
#endif
m_xDatabaseDocumentLoader.clear();
- m_xDBRegistrationAggregate->setDelegator( nullptr );
- m_xDBRegistrationAggregate.clear();
m_xDatabaseRegistrations.clear();
}
-// Helper
-OUString ODatabaseContext::getImplementationName_static()
-{
- return "com.sun.star.comp.dba.ODatabaseContext";
-}
-
-Reference< XInterface > ODatabaseContext::Create(const Reference< XComponentContext >& _rxContext)
-{
- return *( new ODatabaseContext( _rxContext ) );
-}
-
-Sequence< OUString > ODatabaseContext::getSupportedServiceNames_static()
-{
- return { "com.sun.star.sdb.DatabaseContext" };
-}
-
// XServiceInfo
OUString ODatabaseContext::getImplementationName( )
{
- return getImplementationName_static();
+ return u"com.sun.star.comp.dba.ODatabaseContext"_ustr;
}
sal_Bool ODatabaseContext::supportsService( const OUString& _rServiceName )
@@ -225,7 +196,7 @@ sal_Bool ODatabaseContext::supportsService( const OUString& _rServiceName )
Sequence< OUString > ODatabaseContext::getSupportedServiceNames( )
{
- return getSupportedServiceNames_static();
+ return { u"com.sun.star.sdb.DatabaseContext"_ustr };
}
Reference< XInterface > ODatabaseContext::impl_createNewDataSource()
@@ -233,7 +204,7 @@ Reference< XInterface > ODatabaseContext::impl_createNewDataSource()
::rtl::Reference pImpl( new ODatabaseModelImpl( m_aContext, *this ) );
Reference< XDataSource > xDataSource( pImpl->getOrCreateDataSource() );
- return xDataSource.get();
+ return xDataSource;
}
Reference< XInterface > SAL_CALL ODatabaseContext::createInstance( )
@@ -328,10 +299,11 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
OUString sErrorMessage( DBA_RES( RID_STR_FILE_DOES_NOT_EXIST ) );
::svt::OFileNotation aTransformer( _sURL );
- SQLException aError;
- aError.Message = sErrorMessage.replaceAll( "$file$", aTransformer.get( ::svt::OFileNotation::N_SYSTEM ) );
+ SQLException aError(sErrorMessage.replaceAll(
+ "$file$", aTransformer.get(::svt::OFileNotation::N_SYSTEM)),
+ {}, {}, 0, {});
- throw WrappedTargetException( _sURL, *this, makeAny( aError ) );
+ throw WrappedTargetException( _sURL, *this, Any( aError ) );
}
throw WrappedTargetException( _sURL, *this, ::cppu::getCaughtException() );
}
@@ -351,9 +323,9 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
Reference< XLoadable > xLoad( xModel, UNO_QUERY_THROW );
::comphelper::NamedValueCollection aArgs;
- aArgs.put( "URL", _sURL );
- aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
- aArgs.put( "InteractionHandler", task::InteractionHandler::createWithParent(m_aContext, nullptr) );
+ aArgs.put( u"URL"_ustr, _sURL );
+ aArgs.put( u"MacroExecutionMode"_ustr, MacroExecMode::USE_CONFIG );
+ aArgs.put( u"InteractionHandler"_ustr, task::InteractionHandler::createWithParent(m_aContext, nullptr) );
if (bEmbeddedDataSource)
{
// In this case the host contains the real path, and the path is the embedded stream name.
@@ -367,7 +339,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
if (auth.isEmpty() == decAuth.isEmpty()) {
// Decoding of auth to UTF-8 succeeded:
OUString sBaseURI = decAuth + uri->getPath();
- aArgs.put("BaseURI", sBaseURI);
+ aArgs.put(u"BaseURI"_ustr, sBaseURI);
} else {
SAL_WARN(
"dbaccess.core",
@@ -388,7 +360,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
setTransientProperties( _sURL, *pModelImpl );
- return pModelImpl->getOrCreateDataSource().get();
+ return pModelImpl->getOrCreateDataSource();
}
void ODatabaseContext::appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel)
@@ -454,7 +426,7 @@ void ODatabaseContext::registerObject(const OUString& _rName, const Reference< X
}
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rName), makeAny(_rxObject), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rName), Any(_rxObject), Any());
m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
@@ -473,16 +445,23 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl
if (xSetInfo.is())
aProperties = xSetInfo->getProperties();
- for ( const Property& rProperty : std::as_const(aProperties) )
+ for (const Property& rProperty : aProperties)
{
if ( ( ( rProperty.Attributes & PropertyAttribute::TRANSIENT) != 0 )
&& ( ( rProperty.Attributes & PropertyAttribute::READONLY) == 0 )
)
{
- // found such a property
- aRememberProps.put( rProperty.Name, xSource->getPropertyValue( rProperty.Name ) );
+ // If the connection was opened by a user other than the one registered in the
+ // data source, the password will not be stored and always requested. See tdf#167960
+ if (rProperty.Name != "Password" || !_rModelImpl.m_bAskPassword)
+ {
+ // found such a property
+ aRememberProps.put( rProperty.Name, xSource->getPropertyValue( rProperty.Name ) );
+ }
}
}
+ // We don't need him anymore, we only come here once for a datasource.
+ _rModelImpl.m_bAskPassword = false;
}
catch ( const Exception& )
{
@@ -491,7 +470,7 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl
// additionally, remember the "failed password", which is not available as property
// #i86178#
- aRememberProps.put( "AuthFailedPassword", _rModelImpl.m_sFailedPassword );
+ aRememberProps.put( u"AuthFailedPassword"_ustr, _rModelImpl.m_sFailedPassword );
OUString sDocumentURL( _rModelImpl.getURL() );
if ( m_aDatabaseObjects.find( sDocumentURL ) != m_aDatabaseObjects.end() )
@@ -542,7 +521,7 @@ void ODatabaseContext::revokeObject(const OUString& _rName)
m_aDatabaseObjects.erase( aExistent );
// notify our container listeners
- ContainerEvent aEvent( *this, makeAny( _rName ), Any(), Any() );
+ ContainerEvent aEvent( *this, Any( _rName ), Any(), Any() );
aGuard.clear();
m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
}
@@ -625,7 +604,7 @@ Any ODatabaseContext::getByName(const OUString& _rName)
{
Reference< XInterface > xExistent = getObject( _rName );
if ( xExistent.is() )
- return makeAny( xExistent );
+ return Any( xExistent );
// see whether this is a registered name
OUString sURL;
@@ -642,7 +621,7 @@ Any ODatabaseContext::getByName(const OUString& _rName)
if ( !xExistent.is() )
// try to load this as URL
xExistent = loadObjectFromURL( _rName, sURL );
- return makeAny( xExistent );
+ return Any( xExistent );
}
catch (const NoSuchElementException&)
{ // let these exceptions through
@@ -721,21 +700,6 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons
m_aDatabaseObjects.erase( oldPos );
}
-sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId )
-{
- if (isUnoTunnelId<ODatabaseContext>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
-Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForDocument, BasicManager& _rBasicManager )
{
#if !HAVE_FEATURE_SCRIPTING
@@ -754,10 +718,18 @@ void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForD
// ... whose BasicManager has just been created, then add the global DatabaseDocument variable to its scope.
if ( xDatabaseDocument.is() )
- _rBasicManager.SetGlobalUNOConstant( "ThisDatabaseDocument", makeAny( xDatabaseDocument ) );
+ _rBasicManager.SetGlobalUNOConstant( u"ThisDatabaseDocument"_ustr, Any( xDatabaseDocument ) );
#endif
}
} // namespace dbaccess
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_dba_ODatabaseContext_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+{
+ return cppu::acquire(new dbaccess::ODatabaseContext(context));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 4eac4796982b..b1e561c0d789 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -23,9 +23,13 @@
#include "documenteventexecutor.hxx"
#include <databasecontext.hxx>
#include "documentcontainer.hxx"
+#include "commandcontainer.hxx"
#include <sdbcoretools.hxx>
+#include <strings.hxx>
#include <recovery/dbdocrecovery.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -40,8 +44,6 @@
#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/script/provider/theMasterScriptProviderFactory.hpp>
-#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
@@ -49,7 +51,6 @@
#include <com/sun/star/ui/UIConfigurationManager.hpp>
#include <com/sun/star/util/CloseVetoException.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
@@ -62,7 +63,6 @@
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/numberedcollection.hxx>
#include <comphelper/storagehelper.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/propertysetinfo.hxx>
#include <comphelper/types.hxx>
@@ -72,9 +72,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <framework/titlehelper.hxx>
#include <unotools/saveopt.hxx>
-#include <unotools/tempfile.hxx>
-#include <tools/diagnose_ex.h>
-#include <osl/file.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/GraphicObject.hxx>
@@ -125,7 +123,7 @@ bool ViewMonitor::onSetCurrentController( const Reference< XController >& _rxCon
// notify the respective events
if ( bLoadFinished )
- m_rEventNotifier.notifyDocumentEventAsync( m_bIsNewDocument ? "OnNew" : "OnLoad" );
+ m_rEventNotifier.notifyDocumentEventAsync( m_bIsNewDocument ? u"OnNew"_ustr : u"OnLoad"_ustr, nullptr, Any() );
return bLoadFinished;
}
@@ -150,7 +148,8 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>&
{
impl_reparent_nothrow( m_xForms );
impl_reparent_nothrow( m_xReports );
- impl_reparent_nothrow( m_pImpl->m_xTableDefinitions );
+ if (auto xTableDef = m_pImpl->m_xTableDefinitions.get())
+ xTableDef->setParent(*this);
impl_reparent_nothrow( m_pImpl->m_xCommandDefinitions );
m_pEventExecutor = new DocumentEventExecutor( m_pImpl->m_aContext, this );
@@ -198,39 +197,24 @@ Any SAL_CALL ODatabaseDocument::queryInterface( const Type& _rType )
)
return Any();
- Any aReturn = ODatabaseDocument_OfficeDocument::queryInterface(_rType);
- if (!aReturn.hasValue())
- aReturn = ODatabaseDocument_Title::queryInterface(_rType);
- return aReturn;
-}
-
-void SAL_CALL ODatabaseDocument::acquire( ) throw ()
-{
- ODatabaseDocument_OfficeDocument::acquire();
-}
-
-void SAL_CALL ODatabaseDocument::release( ) throw ()
-{
- ODatabaseDocument_OfficeDocument::release();
+ return ODatabaseDocument_OfficeDocument::queryInterface(_rType);
}
Sequence< Type > SAL_CALL ODatabaseDocument::getTypes( )
{
- Sequence< Type > aTypes = ::comphelper::concatSequences(
- ODatabaseDocument_OfficeDocument::getTypes(),
- ODatabaseDocument_Title::getTypes()
- );
+ Sequence< Type > aTypes = ODatabaseDocument_OfficeDocument::getTypes();
// strip XEmbeddedScripts and XScriptInvocationContext if we have any form/report
// which already contains macros. In this case, the database document itself is not
// allowed to contain macros, too.
if ( !m_bAllowDocumentScripting )
{
- auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
+ auto [begin, end] = asNonConstRange(aTypes);
+ auto newEnd = std::remove_if( begin, end,
[](const Type& t)
{ return t == cppu::UnoType<XEmbeddedScripts>::get() ||
t == cppu::UnoType<XScriptInvocationContext>::get();} );
- aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
+ aTypes.realloc( std::distance(begin, newEnd) );
}
return aTypes;
@@ -247,7 +231,7 @@ namespace
Reference< XStatusIndicator > lcl_extractStatusIndicator( const ::comphelper::NamedValueCollection& _rArguments )
{
Reference< XStatusIndicator > xStatusIndicator;
- return _rArguments.getOrDefault( "StatusIndicator", xStatusIndicator );
+ return _rArguments.getOrDefault( u"StatusIndicator"_ustr, xStatusIndicator );
}
void lcl_triggerStatusIndicator_throw( const ::comphelper::NamedValueCollection& _rArguments, DocumentGuard& _rGuard, const bool _bStart )
@@ -280,7 +264,7 @@ namespace
sal_Int32 nLength = _rCallArgs.getLength();
_rCallArgs.realloc( nLength + 1 );
- _rCallArgs[ nLength ] <<= xStatusIndicator;
+ _rCallArgs.getArray()[ nLength ] <<= xStatusIndicator;
}
void lcl_extractAndStartStatusIndicator( const ::comphelper::NamedValueCollection& _rArguments, Reference< XStatusIndicator >& _rxStatusIndicator,
@@ -296,7 +280,7 @@ namespace
sal_Int32 nLength = _rCallArgs.getLength();
_rCallArgs.realloc( nLength + 1 );
- _rCallArgs[ nLength ] <<= _rxStatusIndicator;
+ _rCallArgs.getArray()[ nLength ] <<= _rxStatusIndicator;
}
catch( const Exception& )
{
@@ -306,17 +290,17 @@ namespace
Sequence< PropertyValue > lcl_appendFileNameToDescriptor( const ::comphelper::NamedValueCollection& _rDescriptor, const OUString& _rURL )
{
+ if ( _rURL.isEmpty() )
+ return _rDescriptor.getPropertyValues();
+
::comphelper::NamedValueCollection aMutableDescriptor( _rDescriptor );
- if ( !_rURL.isEmpty() )
- {
- aMutableDescriptor.put( "FileName", _rURL );
- aMutableDescriptor.put( "URL", _rURL );
- }
+ aMutableDescriptor.put( u"FileName"_ustr, _rURL );
+ aMutableDescriptor.put( u"URL"_ustr, _rURL );
return aMutableDescriptor.getPropertyValues();
}
}
-const char sPictures[] = "Pictures";
+constexpr OUString sPictures = u"Pictures"_ustr;
// base documents seem to have a different behaviour to other documents, the
// root storage contents at least seem to be re-used over different saves, thus if there is a
@@ -345,7 +329,7 @@ const char sPictures[] = "Pictures";
static void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibraryContainer >& xDlgCont, const Reference< XStorage >& xStorage, const Reference< XModel >& rxModel, const Reference<XComponentContext >& rxContext )
{
const Sequence< OUString > sLibraries = xDlgCont->getElementNames();
- Reference< XStorage > xTmpPic = xStorage->openStorageElement( "tempPictures", ElementModes::READWRITE );
+ Reference< XStorage > xTmpPic = xStorage->openStorageElement( u"tempPictures"_ustr, ElementModes::READWRITE );
std::vector<uno::Reference<graphic::XGraphic>> vxGraphicList;
for ( OUString const & sLibrary : sLibraries )
@@ -431,12 +415,11 @@ namespace
/** property map for import/export info set */
comphelper::PropertyMapEntry const aExportInfoMap[] =
{
- { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
- { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
- { OUString("UsePrettyPrinting"), 0, ::cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString("TargetStorage"), 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString("StreamRelPath"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- { OUString(), 0, css::uno::Type(), 0, 0 }
+ { u"BaseURI"_ustr, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { u"StreamName"_ustr, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { u"UsePrettyPrinting"_ustr, 0, ::cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
+ { u"TargetStorage"_ustr, 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
+ { u"StreamRelPath"_ustr, 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
};
}
@@ -448,19 +431,19 @@ void ODatabaseDocument::impl_import_nolck_throw( const Reference< XComponentCont
lcl_extractAndStartStatusIndicator( _rResource, xStatusIndicator, aFilterCreationArgs );
uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
- OUString sBaseURI = _rResource.getOrDefault("BaseURI", OUString());
+ OUString sBaseURI = _rResource.getOrDefault(u"BaseURI"_ustr, OUString());
if (sBaseURI.isEmpty())
- sBaseURI = _rResource.getOrDefault("URL",OUString());
+ sBaseURI = _rResource.getOrDefault(u"URL"_ustr,OUString());
assert(!sBaseURI.isEmpty()); // needed for relative URLs
- xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sBaseURI));
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
+ xInfoSet->setPropertyValue(u"BaseURI"_ustr, uno::Any(sBaseURI));
+ xInfoSet->setPropertyValue(u"StreamName"_ustr, uno::Any(u"content.xml"_ustr));
const sal_Int32 nCount = aFilterCreationArgs.getLength();
aFilterCreationArgs.realloc(nCount + 1);
- aFilterCreationArgs[nCount] <<= xInfoSet;
+ aFilterCreationArgs.getArray()[nCount] <<= xInfoSet;
Reference< XImporter > xImporter(
- _rContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, _rContext),
+ _rContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.comp.sdb.DBFilter"_ustr, aFilterCreationArgs, _rContext),
UNO_QUERY_THROW );
Reference< XComponent > xComponent( _rxTargetComponent, UNO_QUERY_THROW );
@@ -497,12 +480,12 @@ void SAL_CALL ODatabaseDocument::initNew( )
impl_setInitialized();
- m_aEventNotifier.notifyDocumentEventAsync( "OnTitleChanged" );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnTitleChanged"_ustr, nullptr, Any() );
impl_setModified_nothrow( false, aGuard );
// <- SYNCHRONIZED
- m_aEventNotifier.notifyDocumentEvent( "OnCreate" );
+ m_aEventNotifier.notifyDocumentEvent( u"OnCreate"_ustr, nullptr, Any() );
impl_notifyStorageChange_nolck_nothrow( xTempStor );
}
@@ -515,19 +498,19 @@ void SAL_CALL ODatabaseDocument::load( const Sequence< PropertyValue >& Argument
impl_reset_nothrow();
::comphelper::NamedValueCollection aResource( Arguments );
- if ( aResource.has( "FileName" ) && !aResource.has( "URL" ) )
+ if ( aResource.has( u"FileName"_ustr ) && !aResource.has( u"URL"_ustr ) )
// FileName is the compatibility name for URL, so we might have clients passing
// a FileName only. However, some of our code works with the URL only, so ensure
// we have one.
- aResource.put( "URL", aResource.get( "FileName" ) );
- if ( aResource.has( "URL" ) && !aResource.has( "FileName" ) )
+ aResource.put( u"URL"_ustr, aResource.get( u"FileName"_ustr ) );
+ if ( aResource.has( u"URL"_ustr ) && !aResource.has( u"FileName"_ustr ) )
// similar ... just in case there is legacy code which expects a FileName only
- aResource.put( "FileName", aResource.get( "URL" ) );
+ aResource.put( u"FileName"_ustr, aResource.get( u"URL"_ustr ) );
// now that somebody (perhaps) told us a macro execution mode, remember it as
// ImposedMacroExecMode
m_pImpl->setImposedMacroExecMode(
- aResource.getOrDefault( "MacroExecutionMode", m_pImpl->getImposedMacroExecMode() ) );
+ aResource.getOrDefault( u"MacroExecutionMode"_ustr, m_pImpl->getImposedMacroExecMode() ) );
impl_setInitializing();
try
@@ -635,7 +618,7 @@ void SAL_CALL ODatabaseDocument::storeToRecoveryFile( const OUString& i_TargetLo
aDocRecovery.saveModifiedSubComponents( xTargetStorage, m_aControllers );
// commit the root storage
- tools::stor::commitStorageIfWriteable( xTargetStorage );
+ dbaccesstools::commitStorageIfWriteable( xTargetStorage );
}
catch( const IOException& )
{
@@ -670,8 +653,8 @@ void SAL_CALL ODatabaseDocument::recoverFromFile( const OUString& i_SourceLocati
// our load implementation expects the SalvagedFile and URL to be in the media descriptor
::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor );
- aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile );
- aMediaDescriptor.put( "URL", i_SourceLocation );
+ aMediaDescriptor.put( u"SalvagedFile"_ustr, i_SalvagedFile );
+ aMediaDescriptor.put( u"URL"_ustr, i_SourceLocation );
aGuard.clear(); // (load has an own guarding scheme)
load( aMediaDescriptor.getPropertyValues() );
@@ -748,12 +731,12 @@ bool ODatabaseDocument::impl_attachResource( const OUString& i_rLogicalDocumentU
// for
// we do not support macro signatures, so we can ignore that request
- aArgs.remove("BreakMacroSignature");
+ aArgs.remove(u"BreakMacroSignature"_ustr);
bool bMacroEventRead = false;
- if ((aArgs.get( "MacroEventRead" ) >>= bMacroEventRead) && bMacroEventRead)
+ if ((aArgs.get( u"MacroEventRead"_ustr ) >>= bMacroEventRead) && bMacroEventRead)
m_pImpl->m_bMacroCallsSeenWhileLoading = true;
- aArgs.remove( "MacroEventRead" );
+ aArgs.remove( u"MacroEventRead"_ustr );
if (aArgs.empty())
return false;
@@ -776,11 +759,11 @@ bool ODatabaseDocument::impl_attachResource( const OUString& i_rLogicalDocumentU
// determine whether the document as a whole, or sub documents, have macros. Especially the latter
// controls the availability of our XEmbeddedScripts and XScriptInvocationContext interfaces, and we
// should know this before anybody actually uses the object.
- m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros );
+ m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::EmbeddedMacros::SubDocument );
_rDocGuard.clear();
// <- SYNCHRONIZED
- m_aEventNotifier.notifyDocumentEvent( "OnLoadFinished" );
+ m_aEventNotifier.notifyDocumentEvent( u"OnLoadFinished"_ustr, nullptr, Any() );
}
return true;
@@ -798,6 +781,15 @@ Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getArgs( )
return m_pImpl->getMediaDescriptor().getPropertyValues();
}
+Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getArgs2( const ::css::uno::Sequence< ::rtl::OUString >& requestedArgs )
+{
+ DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit );
+ std::vector<PropertyValue> aRet;
+ for (const auto & rArgName : requestedArgs)
+ aRet.push_back(PropertyValue(rArgName, 0, m_pImpl->getMediaDescriptor().get(rArgName), PropertyState_DIRECT_VALUE));
+ return comphelper::containerToSequence(aRet);
+}
+
void SAL_CALL ODatabaseDocument::setArgs(const Sequence<beans::PropertyValue>& /* aArgs */)
{
throw NoSupportException();
@@ -816,7 +808,7 @@ void SAL_CALL ODatabaseDocument::connectController( const Reference< XController
m_aControllers.push_back( _xController );
- m_aEventNotifier.notifyDocumentEventAsync( "OnViewCreated", Reference< XController2 >( _xController, UNO_QUERY ) );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnViewCreated"_ustr, Reference< XController2 >( _xController, UNO_QUERY ), Any() );
bool bFirstControllerEver = m_aViewMonitor.onControllerConnected( _xController );
if ( !bFirstControllerEver )
@@ -853,9 +845,9 @@ void SAL_CALL ODatabaseDocument::disconnectController( const Reference< XControl
// <- SYNCHRONIZED
if ( bNotifyViewClosed )
- m_aEventNotifier.notifyDocumentEvent( "OnViewClosed", Reference< XController2 >( _xController, UNO_QUERY ) );
+ m_aEventNotifier.notifyDocumentEvent( u"OnViewClosed"_ustr, Reference< XController2 >( _xController, UNO_QUERY ), Any() );
- if ( !(bLastControllerGone && !bIsClosing) )
+ if ( !bLastControllerGone || bIsClosing )
return;
// if this was the last view, close the document as a whole
@@ -909,9 +901,9 @@ void SAL_CALL ODatabaseDocument::setCurrentController( const Reference< XControl
// check if there are sub components to recover from our document storage
bool bAttemptRecovery = m_bHasBeenRecovered;
- if ( !bAttemptRecovery && m_pImpl->getMediaDescriptor().has( "ForceRecovery" ) )
+ if ( !bAttemptRecovery && m_pImpl->getMediaDescriptor().has( u"ForceRecovery"_ustr ) )
// do not use getOrDefault, it will throw for invalid types, which is not desired here
- m_pImpl->getMediaDescriptor().get( "ForceRecovery" ) >>= bAttemptRecovery;
+ m_pImpl->getMediaDescriptor().get( u"ForceRecovery"_ustr ) >>= bAttemptRecovery;
if ( !bAttemptRecovery )
return;
@@ -992,17 +984,17 @@ void SAL_CALL ODatabaseDocument::store( )
// allowed to leave
throw;
}
- impl_throwIOExceptionCausedBySave_throw( aError, OUString() );
+ impl_throwIOExceptionCausedBySave_throw( aError, {} );
}
}
-void ODatabaseDocument::impl_throwIOExceptionCausedBySave_throw( const Any& i_rError, const OUString& i_rTargetURL ) const
+void ODatabaseDocument::impl_throwIOExceptionCausedBySave_throw( const Any& i_rError, std::u16string_view i_rTargetURL ) const
{
OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, i_rError );
sErrorMessage = ResourceManager::loadString(
RID_STR_ERROR_WHILE_SAVING,
- "$location$", i_rTargetURL,
- "$message$", sErrorMessage
+ u"$location$", i_rTargetURL,
+ u"$message$", sErrorMessage
);
throw IOException( sErrorMessage, *const_cast< ODatabaseDocument* >( this ) );
}
@@ -1021,7 +1013,7 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph
if ( !bIsInitializationProcess )
{
_rGuard.clear();
- m_aEventNotifier.notifyDocumentEvent( _eType == SAVE ? "OnSave" : "OnSaveAs", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEvent( _eType == SAVE ? u"OnSave"_ustr : u"OnSaveAs"_ustr, nullptr, Any( _rURL ) );
_rGuard.reset();
}
@@ -1081,13 +1073,13 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph
catch( const IOException& )
{
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? u"OnSaveFailed"_ustr : u"OnSaveAsFailed"_ustr, nullptr, Any( _rURL ) );
throw;
}
catch( const RuntimeException& )
{
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? u"OnSaveFailed"_ustr : u"OnSaveAsFailed"_ustr, nullptr, Any( _rURL ) );
throw;
}
catch( const Exception& )
@@ -1096,14 +1088,14 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph
// notify the failure
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? u"OnSaveFailed"_ustr : u"OnSaveAsFailed"_ustr, nullptr, Any( _rURL ) );
impl_throwIOExceptionCausedBySave_throw( aError, _rURL );
}
// notify the document event
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveDone" : "OnSaveAsDone", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? u"OnSaveDone"_ustr : u"OnSaveAsDone"_ustr, nullptr, Any( _rURL ) );
// reset our "modified" flag, and clear the guard
impl_setModified_nothrow( false, _rGuard );
@@ -1123,9 +1115,7 @@ Reference< XStorage > ODatabaseDocument::impl_createStorageFor_throw( const OUSt
{
xTruncate->truncate();
}
- Sequence<Any> aParam(2);
- aParam[0] <<= xStream;
- aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE;
+ Sequence<Any> aParam{ Any(xStream), Any(ElementModes::READWRITE | ElementModes::TRUNCATE) };
Reference< XSingleServiceFactory > xStorageFactory( m_pImpl->createStorageFactory(), UNO_SET_THROW );
return Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aParam ), UNO_QUERY_THROW );
@@ -1136,12 +1126,12 @@ css::uno::Reference<css::embed::XStorage> ODatabaseDocument::impl_GetStorageOrCr
{
// Try to get the storage from arguments, then create storage for target URL
uno::Reference<embed::XStorage> xTargetStorage;
- _rArguments.get("TargetStorage") >>= xTargetStorage;
+ _rArguments.get(u"TargetStorage"_ustr) >>= xTargetStorage;
if (!xTargetStorage.is())
xTargetStorage = impl_createStorageFor_throw(_rURL);
// In case we got a StreamRelPath, then xTargetStorage should reference that sub-storage.
- OUString sStreamRelPath = _rArguments.getOrDefault("StreamRelPath", OUString());
+ OUString sStreamRelPath = _rArguments.getOrDefault(u"StreamRelPath"_ustr, OUString());
if (!sStreamRelPath.isEmpty())
xTargetStorage
= xTargetStorage->openStorageElement(sStreamRelPath, embed::ElementModes::READWRITE);
@@ -1179,7 +1169,7 @@ void SAL_CALL ODatabaseDocument::storeAsURL( const OUString& _rURL, const Sequen
// an up-to-date result, as the call is delegated to our TitleHelper instance, which itself
// updates its title only if it gets the OnSaveAsDone event (which was sent asynchronously
// by impl_storeAs_throw). So, we simply notify always, and also asynchronously
- m_aEventNotifier.notifyDocumentEventAsync( "OnTitleChanged" );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnTitleChanged"_ustr, nullptr, Any() );
}
catch( const Exception& )
{
@@ -1194,7 +1184,7 @@ void SAL_CALL ODatabaseDocument::storeAsURL( const OUString& _rURL, const Sequen
// <- SYNCHRONIZED
if ( bImplicitInitialization )
- m_aEventNotifier.notifyDocumentEvent( "OnCreate" );
+ m_aEventNotifier.notifyDocumentEvent( u"OnCreate"_ustr, nullptr, Any() );
}
void ODatabaseDocument::impl_storeToStorage_throw( const Reference< XStorage >& _rxTargetStorage, const Sequence< PropertyValue >& _rMediaDescriptor,
@@ -1245,7 +1235,7 @@ void SAL_CALL ODatabaseDocument::storeToURL( const OUString& _rURL, const Sequen
{
aGuard.clear();
- m_aEventNotifier.notifyDocumentEvent( "OnSaveTo", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEvent( u"OnSaveTo"_ustr, nullptr, Any( _rURL ) );
aGuard.reset();
}
@@ -1264,7 +1254,7 @@ void SAL_CALL ODatabaseDocument::storeToURL( const OUString& _rURL, const Sequen
catch( const Exception& )
{
Any aError = ::cppu::getCaughtException();
- m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToFailed", nullptr, aError );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnSaveToFailed"_ustr, nullptr, aError );
if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() )
|| aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() )
@@ -1277,7 +1267,7 @@ void SAL_CALL ODatabaseDocument::storeToURL( const OUString& _rURL, const Sequen
impl_throwIOExceptionCausedBySave_throw( aError, _rURL );
}
- m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToDone", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnSaveToDone"_ustr, nullptr, Any( _rURL ) );
}
// XModifyBroadcaster
@@ -1319,7 +1309,7 @@ void ODatabaseDocument::impl_setModified_nothrow( bool _bModified, DocumentGuard
if ( bModifiedChanged )
{
m_pImpl->m_bModified = _bModified;
- m_aEventNotifier.notifyDocumentEventAsync( "OnModifyChanged" );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnModifyChanged"_ustr, nullptr, Any() );
}
_rGuard.clear();
// <- SYNCHRONIZED
@@ -1405,12 +1395,23 @@ void ODatabaseDocument::clearObjectContainer( WeakReference< XNameAccess >& _rxC
_rxContainer.clear();
}
+void ODatabaseDocument::clearObjectContainer( unotools::WeakReference< OCommandContainer >& _rxContainer)
+{
+ rtl::Reference< OCommandContainer > xContainer = _rxContainer;
+ if ( xContainer.is() )
+ {
+ xContainer->dispose();
+ xContainer->setParent( nullptr );
+ }
+ _rxContainer.clear();
+}
+
Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType _eType )
{
- if ( ( _eType != ODatabaseModelImpl::E_FORM ) && ( _eType != ODatabaseModelImpl::E_REPORT ) )
+ if ( ( _eType != ODatabaseModelImpl::ObjectType::Form ) && ( _eType != ODatabaseModelImpl::ObjectType::Report ) )
throw IllegalArgumentException();
- bool bFormsContainer = _eType == ODatabaseModelImpl::E_FORM;
+ bool bFormsContainer = _eType == ODatabaseModelImpl::ObjectType::Form;
WeakReference< XNameAccess >& rContainerRef( bFormsContainer ? m_xForms : m_xReports );
Reference< XNameAccess > xContainer = rContainerRef;
@@ -1418,14 +1419,13 @@ Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODa
{
Any aValue;
css::uno::Reference< css::uno::XInterface > xMy(*this);
- if ( dbtools::getDataSourceSetting(xMy,bFormsContainer ? "Forms" : "Reports",aValue) )
+ if (dbtools::getDataSourceSetting(xMy, bFormsContainer ? u"Forms"_ustr : u"Reports"_ustr, aValue))
{
OUString sSupportService;
aValue >>= sSupportService;
if ( !sSupportService.isEmpty() )
{
- Sequence<Any> aArgs(1);
- aArgs[0] <<= NamedValue("DatabaseDocument",makeAny(xMy));
+ Sequence<Any> aArgs{ Any(NamedValue(u"DatabaseDocument"_ustr,Any(xMy))) };
xContainer.set(
m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext),
UNO_QUERY);
@@ -1502,17 +1502,17 @@ void SAL_CALL ODatabaseDocument::close(sal_Bool bDeliverOwnership)
{
// allow listeners to veto
lang::EventObject aEvent( *this );
- m_aCloseListener.forEach< XCloseListener >(
+ m_aCloseListener.forEach(
[&aEvent, &bDeliverOwnership] (uno::Reference<XCloseListener> const& xListener) {
return xListener->queryClosing(aEvent, bDeliverOwnership);
});
// notify that we're going to unload
- m_aEventNotifier.notifyDocumentEvent( "OnPrepareUnload" );
+ m_aEventNotifier.notifyDocumentEvent( u"OnPrepareUnload"_ustr, nullptr, Any() );
impl_closeControllerFrames_nolck_throw( bDeliverOwnership );
- m_aCloseListener.notifyEach( &XCloseListener::notifyClosing, const_cast<const lang::EventObject&>(aEvent) );
+ m_aCloseListener.notifyEach(&XCloseListener::notifyClosing, aEvent);
dispose();
}
@@ -1544,24 +1544,20 @@ void SAL_CALL ODatabaseDocument::removeCloseListener( const Reference< css::util
Reference< XNameAccess > SAL_CALL ODatabaseDocument::getFormDocuments( )
{
DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit );
- return impl_getDocumentContainer_throw( ODatabaseModelImpl::E_FORM );
+ return impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType::Form );
}
Reference< XNameAccess > SAL_CALL ODatabaseDocument::getReportDocuments( )
{
DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit );
- return impl_getDocumentContainer_throw( ODatabaseModelImpl::E_REPORT );
+ return impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType::Report );
}
-void ODatabaseDocument::WriteThroughComponent( const Reference< XComponent >& xComponent, const char* pStreamName,
- const char* pServiceName, const Sequence< Any >& _rArguments, const Sequence< PropertyValue >& rMediaDesc,
+void ODatabaseDocument::WriteThroughComponent( const Reference< XComponent >& xComponent, const OUString& sStreamName,
+ const OUString & rServiceName, const Sequence< Any >& _rArguments, const Sequence< PropertyValue >& rMediaDesc,
const Reference<XStorage>& _xStorageToSaveTo ) const
{
- OSL_ENSURE( pStreamName, "Need stream name!" );
- OSL_ENSURE( pServiceName, "Need service name!" );
-
// open stream
- OUString sStreamName = OUString::createFromAscii( pStreamName );
Reference< XStream > xStream = _xStorageToSaveTo->openStreamElement( sStreamName, ElementModes::READWRITE | ElementModes::TRUNCATE );
if ( !xStream.is() )
return;
@@ -1576,20 +1572,19 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XComponent >& xC
xSeek->seek(0);
Reference< XPropertySet > xStreamProp( xOutputStream, UNO_QUERY_THROW );
- xStreamProp->setPropertyValue( INFO_MEDIATYPE, makeAny( OUString( "text/xml" ) ) );
- xStreamProp->setPropertyValue( "Compressed", makeAny( true ) );
+ xStreamProp->setPropertyValue( INFO_MEDIATYPE, Any( u"text/xml"_ustr ) );
+ xStreamProp->setPropertyValue( u"Compressed"_ustr, Any( true ) );
// write the stuff
- WriteThroughComponent( xOutputStream, xComponent, pServiceName, _rArguments, rMediaDesc );
+ WriteThroughComponent( xOutputStream, xComponent, rServiceName, _rArguments, rMediaDesc );
}
void ODatabaseDocument::WriteThroughComponent( const Reference< XOutputStream >& xOutputStream,
- const Reference< XComponent >& xComponent, const char* pServiceName, const Sequence< Any >& _rArguments,
+ const Reference< XComponent >& xComponent, const OUString& rServiceName, const Sequence< Any >& _rArguments,
const Sequence< PropertyValue >& rMediaDesc ) const
{
OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" );
OSL_ENSURE( xComponent.is(), "Need component!" );
- OSL_ENSURE( nullptr != pServiceName, "Need component name!" );
// get component
Reference< XWriter > xSaxWriter = xml::sax::Writer::create( m_pImpl->m_aContext );
@@ -1599,12 +1594,13 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XOutputStream >&
// prepare arguments (prepend doc handler to given arguments)
Sequence<Any> aArgs( 1 + _rArguments.getLength() );
- aArgs[0] <<= xSaxWriter;
+ auto pArgs = aArgs.getArray();
+ pArgs[0] <<= xSaxWriter;
for ( sal_Int32 i = 0; i < _rArguments.getLength(); ++i )
- aArgs[ i+1 ] = _rArguments[i];
+ pArgs[ i+1 ] = _rArguments[i];
// get filter component
- Reference< XExporter > xExporter( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(OUString::createFromAscii(pServiceName), aArgs, m_pImpl->m_aContext), UNO_QUERY_THROW );
+ Reference< XExporter > xExporter( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(rServiceName, aArgs, m_pImpl->m_aContext), UNO_QUERY_THROW );
// connect model and filter
xExporter->setSourceDocument( xComponent );
@@ -1622,22 +1618,21 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
- SvtSaveOptions aSaveOpt;
- xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(aSaveOpt.IsPrettyPrinting()));
- if ( aSaveOpt.IsSaveRelFSys() )
+ xInfoSet->setPropertyValue(u"UsePrettyPrinting"_ustr, uno::Any(officecfg::Office::Common::Save::Document::PrettyPrinting::get()));
+ if ( officecfg::Office::Common::Save::URL::FileSystem::get() )
{
- OUString sBaseURI = _rMediaDescriptor.getOrDefault("BaseURI", OUString());
+ OUString sBaseURI = _rMediaDescriptor.getOrDefault(u"BaseURI"_ustr, OUString());
if (sBaseURI.isEmpty())
- sBaseURI = _rMediaDescriptor.getOrDefault("URL",OUString());
- xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sBaseURI));
+ sBaseURI = _rMediaDescriptor.getOrDefault(u"URL"_ustr,OUString());
+ xInfoSet->setPropertyValue(u"BaseURI"_ustr, uno::Any(sBaseURI));
}
// Set TargetStorage, so it doesn't have to be re-constructed based on possibly empty URL.
- xInfoSet->setPropertyValue("TargetStorage", uno::makeAny(m_pImpl->getRootStorage()));
+ xInfoSet->setPropertyValue(u"TargetStorage"_ustr, uno::Any(m_pImpl->getRootStorage()));
// Set StreamRelPath, in case this document is an embedded one.
OUString sStreamRelPath;
- OUString sURL = _rMediaDescriptor.getOrDefault("URL", OUString());
+ OUString sURL = _rMediaDescriptor.getOrDefault(u"URL"_ustr, OUString());
if (sURL.startsWithIgnoreAsciiCase("vnd.sun.star.pkg:"))
{
// In this case the host contains the real path, and the path is the embedded stream name.
@@ -1647,21 +1642,25 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
sStreamRelPath = sStreamRelPath.copy(1);
}
if (!sStreamRelPath.isEmpty())
- xInfoSet->setPropertyValue("StreamRelPath", uno::makeAny(sStreamRelPath));
+ xInfoSet->setPropertyValue(u"StreamRelPath"_ustr, uno::Any(sStreamRelPath));
sal_Int32 nArgsLen = aDelegatorArguments.getLength();
aDelegatorArguments.realloc(nArgsLen+1);
- aDelegatorArguments[nArgsLen++] <<= xInfoSet;
+ aDelegatorArguments.getArray()[nArgsLen++] <<= xInfoSet;
Reference< XPropertySet > xProp( _rxTargetStorage, UNO_QUERY_THROW );
- xProp->setPropertyValue( INFO_MEDIATYPE, makeAny( OUString(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) ) );
+ xProp->setPropertyValue( INFO_MEDIATYPE, Any( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE ) );
OUString aVersion;
SvtSaveOptions::ODFSaneDefaultVersion const nDefVersion =
- aSaveOpt.GetODFSaneDefaultVersion();
+ GetODFSaneDefaultVersion();
// older versions can not have this property set,
// it exists only starting from ODF1.2
- if (nDefVersion >= SvtSaveOptions::ODFSVER_013)
+ if (nDefVersion >= SvtSaveOptions::ODFSVER_014)
+ {
+ aVersion = ODFVER_014_TEXT;
+ }
+ else if (nDefVersion >= SvtSaveOptions::ODFSVER_013)
{
aVersion = ODFVER_013_TEXT;
}
@@ -1674,7 +1673,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
{
try
{
- xProp->setPropertyValue("Version" , uno::makeAny(aVersion));
+ xProp->setPropertyValue(u"Version"_ustr , uno::Any(aVersion));
}
catch (const uno::Exception&)
{
@@ -1687,12 +1686,12 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
Sequence< PropertyValue > aMediaDescriptor;
_rMediaDescriptor >>= aMediaDescriptor;
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
- WriteThroughComponent( xComponent, "settings.xml", "com.sun.star.comp.sdb.XMLSettingsExporter",
+ xInfoSet->setPropertyValue(u"StreamName"_ustr, uno::Any(u"settings.xml"_ustr));
+ WriteThroughComponent( xComponent, u"settings.xml"_ustr, u"com.sun.star.comp.sdb.XMLSettingsExporter"_ustr,
aDelegatorArguments, aMediaDescriptor, _rxTargetStorage );
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
- WriteThroughComponent( xComponent, "content.xml", "com.sun.star.comp.sdb.DBExportFilter",
+ xInfoSet->setPropertyValue(u"StreamName"_ustr, uno::Any(u"content.xml"_ustr));
+ WriteThroughComponent( xComponent, u"content.xml"_ustr, u"com.sun.star.comp.sdb.DBExportFilter"_ustr,
aDelegatorArguments, aMediaDescriptor, _rxTargetStorage );
if ( _rxTargetStorage->hasByName ( sPictures ) )
@@ -1729,7 +1728,7 @@ Reference< XUIConfigurationManager2 > const & ODatabaseDocument::getUIConfigurat
{
m_xUIConfigurationManager = UIConfigurationManager::create( m_pImpl->m_aContext );
- OUString aUIConfigFolderName( "Configurations2" );
+ OUString aUIConfigFolderName( u"Configurations2"_ustr );
// First try to open with READWRITE and then READ
Reference< XStorage > xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READWRITE );
@@ -1740,7 +1739,7 @@ Reference< XUIConfigurationManager2 > const & ODatabaseDocument::getUIConfigurat
Any a = xPropSet->getPropertyValue( INFO_MEDIATYPE );
if ( !( a >>= aMediaType ) || aMediaType.isEmpty() )
{
- a <<= OUString("application/vnd.sun.xml.ui.configuration");
+ a <<= u"application/vnd.sun.xml.ui.configuration"_ustr;
xPropSet->setPropertyValue( INFO_MEDIATYPE, a );
}
}
@@ -1772,7 +1771,7 @@ void ODatabaseDocument::impl_notifyStorageChange_nolck_nothrow( const Reference<
{
Reference< XInterface > xMe( *this );
- m_aStorageListeners.forEach< XStorageChangeListener >(
+ m_aStorageListeners.forEach(
[&xMe, &xNewRootStorage] (uno::Reference<XStorageChangeListener> const& xListener) {
return xListener->notifyStorageChange(xMe, xNewRootStorage);
});
@@ -1788,7 +1787,7 @@ void ODatabaseDocument::disposing()
}
if ( impl_isInitialized() )
- m_aEventNotifier.notifyDocumentEvent( "OnUnload" );
+ m_aEventNotifier.notifyDocumentEvent( u"OnUnload"_ustr, nullptr, Any() );
Reference< XModel > xHoldAlive( this );
@@ -1848,7 +1847,7 @@ void ODatabaseDocument::disposing()
m_xModuleManager.clear();
{
- uno::Reference<uno::XInterface> xTitleInterface(m_xTitleHelper);
+ uno::Reference<uno::XInterface> xTitleInterface(cppu::getXWeak(m_xTitleHelper.get()));
aKeepAlive.push_back(xTitleInterface);
}
m_xTitleHelper.clear();
@@ -1864,6 +1863,11 @@ void ODatabaseDocument::disposing()
void SAL_CALL ODatabaseDocument::dispose( )
{
::cppu::WeakComponentImplHelperBase::dispose();
+ m_xTitleHelper.clear();
+ m_xModuleManager.clear();
+ m_pEventExecutor.clear();
+ m_xCurrentController.clear();
+ m_xUIConfigurationManager.clear();
}
void SAL_CALL ODatabaseDocument::addEventListener( const Reference< lang::XEventListener >& _xListener )
@@ -1879,12 +1883,12 @@ void SAL_CALL ODatabaseDocument::removeEventListener( const Reference< lang::XEv
// XServiceInfo
OUString ODatabaseDocument::getImplementationName()
{
- return "com.sun.star.comp.dba.ODatabaseDocument";
+ return u"com.sun.star.comp.dba.ODatabaseDocument"_ustr;
}
Sequence< OUString > ODatabaseDocument::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.OfficeDatabaseDocument", "com.sun.star.document.OfficeDocument" };
+ return { u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr, u"com.sun.star.document.OfficeDocument"_ustr };
}
sal_Bool ODatabaseDocument::supportsService( const OUString& _rServiceName )
@@ -1903,10 +1907,9 @@ namespace
/// Property map for embedded import info set.
comphelper::PropertyMapEntry const aEmbeddedImportInfoMap[] =
{
- {OUString("StreamRelPath"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString("StreamName"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString("SourceStorage"), 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString(), 0, css::uno::Type(), 0, 0}
+ {u"StreamRelPath"_ustr, 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
+ {u"StreamName"_ustr, 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
+ {u"SourceStorage"_ustr, 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
};
}
@@ -1915,15 +1918,13 @@ void SAL_CALL ODatabaseDocument::loadFromStorage(const Reference<XStorage>& xSto
DocumentGuard aGuard(*this, DocumentGuard::InitMethod);
uno::Reference<beans::XPropertySet> xInfoSet(comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aEmbeddedImportInfoMap)));
- comphelper::NamedValueCollection aDescriptor(rMediaDescriptor);
- xInfoSet->setPropertyValue("StreamRelPath", uno::makeAny(aDescriptor.getOrDefault("HierarchicalDocumentName", OUString())));
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
- xInfoSet->setPropertyValue("SourceStorage", uno::makeAny(xStorage));
+ xInfoSet->setPropertyValue(u"StreamRelPath"_ustr, uno::Any(comphelper::NamedValueCollection::getOrDefault(rMediaDescriptor, u"HierarchicalDocumentName", OUString())));
+ xInfoSet->setPropertyValue(u"StreamName"_ustr, uno::Any(u"content.xml"_ustr));
+ xInfoSet->setPropertyValue(u"SourceStorage"_ustr, uno::Any(xStorage));
- uno::Sequence<uno::Any> aFilterCreationArgs(1);
- aFilterCreationArgs[0] <<= xInfoSet;
+ uno::Sequence<uno::Any> aFilterCreationArgs{ Any(xInfoSet) };
- uno::Reference<document::XImporter> xImporter(m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, m_pImpl->m_aContext), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XImporter> xImporter(m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.comp.sdb.DBFilter"_ustr, aFilterCreationArgs, m_pImpl->m_aContext), uno::UNO_QUERY_THROW);
uno::Reference<lang::XComponent> xComponent(*this, uno::UNO_QUERY_THROW);
xImporter->setTargetDocument(xComponent);
@@ -1970,7 +1971,7 @@ void SAL_CALL ODatabaseDocument::addStorageChangeListener( const Reference< XSto
void SAL_CALL ODatabaseDocument::removeStorageChangeListener( const Reference< XStorageChangeListener >& Listener )
{
DocumentGuard aGuard(*this, DocumentGuard::DefaultMethod);
- m_aStorageListeners.addInterface( Listener );
+ m_aStorageListeners.removeInterface( Listener );
}
Reference< XStorageBasedLibraryContainer > SAL_CALL ODatabaseDocument::getBasicLibraries()
@@ -2034,7 +2035,7 @@ struct CreateAny
{
Any operator() (const Reference<XController>& lhs) const
{
- return makeAny(lhs);
+ return Any(lhs);
}
};
@@ -2057,7 +2058,7 @@ Sequence< OUString > SAL_CALL ODatabaseDocument::getAvailableViewControllerNames
Reference< XController2 > SAL_CALL ODatabaseDocument::createDefaultViewController( const Reference< XFrame >& Frame )
{
- return createViewController( "Default", Sequence< PropertyValue >(), Frame);
+ return createViewController( u"Default"_ustr, Sequence< PropertyValue >(), Frame);
}
Reference< XController2 > SAL_CALL ODatabaseDocument::createViewController( const OUString& ViewName, const Sequence< PropertyValue >& Arguments, const Reference< XFrame >& Frame )
@@ -2071,30 +2072,27 @@ Reference< XController2 > SAL_CALL ODatabaseDocument::createViewController( cons
aGuard.clear();
Reference< XController2 > xController(
- m_pImpl->m_aContext->getServiceManager()->createInstanceWithContext("org.openoffice.comp.dbu.OApplicationController", m_pImpl->m_aContext),
+ m_pImpl->m_aContext->getServiceManager()->createInstanceWithContext(u"org.openoffice.comp.dbu.OApplicationController"_ustr, m_pImpl->m_aContext),
UNO_QUERY_THROW );
::comphelper::NamedValueCollection aInitArgs( Arguments );
- aInitArgs.put( "Frame", Frame );
+ aInitArgs.put( u"Frame"_ustr, Frame );
if ( ViewName == "Preview" )
- aInitArgs.put( "Preview", true );
+ aInitArgs.put( u"Preview"_ustr, true );
Reference< XInitialization > xInitController( xController, UNO_QUERY_THROW );
xInitController->initialize( aInitArgs.getWrappedPropertyValues() );
return xController;
}
-Reference< XTitle > const & ODatabaseDocument::impl_getTitleHelper_throw()
+rtl::Reference< ::framework::TitleHelper > const & ODatabaseDocument::impl_getTitleHelper_throw()
{
if ( ! m_xTitleHelper.is ())
{
Reference< XUntitledNumbers > xDesktop(Desktop::create(m_pImpl->m_aContext), uno::UNO_QUERY_THROW);
Reference< frame::XModel > xThis (getThis(), uno::UNO_QUERY_THROW);
- ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(m_pImpl->m_aContext);
- m_xTitleHelper.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
- pHelper->setOwner (xThis );
- pHelper->connectWithUntitledNumbers (xDesktop);
+ m_xTitleHelper = new ::framework::TitleHelper(m_pImpl->m_aContext, xThis, xDesktop);
}
return m_xTitleHelper;
@@ -2106,23 +2104,17 @@ uno::Reference< frame::XUntitledNumbers > ODatabaseDocument::impl_getUntitledHel
m_xModuleManager.set( ModuleManager::create(m_pImpl->m_aContext) );
OUString sModuleId;
- try
- {
- sModuleId = m_xModuleManager->identify( _xComponent );
- }
- catch(const uno::Exception&)
- {
- }
+ if (_xComponent.is())
+ sModuleId = m_xModuleManager->identify(_xComponent);
+
uno::Reference< frame::XUntitledNumbers > xNumberedControllers;
TNumberedController::const_iterator aFind = m_aNumberedControllers.find(sModuleId);
if ( aFind == m_aNumberedControllers.end() )
{
- uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
- ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection();
- xNumberedControllers.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
-
- pHelper->setOwner (xThis);
+ rtl::Reference<::comphelper::NumberedCollection> pHelper = new ::comphelper::NumberedCollection();
+ xNumberedControllers = pHelper;
+ pHelper->setOwner(uno::Reference< frame::XModel >(this));
m_aNumberedControllers.emplace( sModuleId,xNumberedControllers );
}
@@ -2146,7 +2138,7 @@ void SAL_CALL ODatabaseDocument::setTitle( const OUString& sTitle )
// SYNCHRONIZED ->
DocumentGuard aGuard(*this, DocumentGuard::DefaultMethod);
impl_getTitleHelper_throw()->setTitle( sTitle );
- m_aEventNotifier.notifyDocumentEventAsync( "OnTitleChanged" );
+ m_aEventNotifier.notifyDocumentEventAsync( u"OnTitleChanged"_ustr, nullptr, Any() );
// <- SYNCHRONIZED
}
@@ -2156,7 +2148,7 @@ void SAL_CALL ODatabaseDocument::addTitleChangeListener( const uno::Reference< f
// SYNCHRONIZED ->
DocumentGuard aGuard(*this, DocumentGuard::DefaultMethod);
- uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster( impl_getTitleHelper_throw(), uno::UNO_QUERY_THROW );
+ rtl::Reference< ::framework::TitleHelper > xBroadcaster( impl_getTitleHelper_throw() );
xBroadcaster->addTitleChangeListener( xListener );
}
@@ -2166,7 +2158,7 @@ void SAL_CALL ODatabaseDocument::removeTitleChangeListener( const uno::Reference
// SYNCHRONIZED ->
DocumentGuard aGuard(*this, DocumentGuard::DefaultMethod);
- uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster( impl_getTitleHelper_throw(), uno::UNO_QUERY_THROW );
+ rtl::Reference< ::framework::TitleHelper > xBroadcaster( impl_getTitleHelper_throw() );
xBroadcaster->removeTitleChangeListener( xListener );
}
@@ -2203,16 +2195,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_dba_ODatabaseDocument(css::uno::XComponentContext* context,
css::uno::Sequence<css::uno::Any> const &)
{
- Reference<XUnoTunnel> xDBContextTunnel(DatabaseContext::create(context), UNO_QUERY_THROW);
- dbaccess::ODatabaseContext* pContext = reinterpret_cast<dbaccess::ODatabaseContext*>(
- xDBContextTunnel->getSomething(
- dbaccess::ODatabaseContext::getUnoTunnelId()));
+ Reference<XInterface> xDBContextTunnel(DatabaseContext::create(context), UNO_QUERY_THROW);
+ rtl::Reference<dbaccess::ODatabaseContext> pContext
+ = dynamic_cast<dbaccess::ODatabaseContext*>(xDBContextTunnel.get());
+ assert(pContext);
rtl::Reference pImpl(
new dbaccess::ODatabaseModelImpl(context, *pContext));
- css::uno::Reference<XInterface> inst(pImpl->createNewModel_deliverOwnership());
+ rtl::Reference<dbaccess::ODatabaseDocument> inst(pImpl->createNewModel_deliverOwnership());
inst->acquire();
- return inst.get();
+ return cppu::getXWeak(inst.get());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx
index 8adb30c541a1..46d86d278dc9 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.hxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.hxx
@@ -16,11 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEDOCUMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEDOCUMENT_HXX
+#pragma once
#include <sal/config.h>
+#include <atomic>
#include <map>
#include <memory>
@@ -29,7 +29,7 @@
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
#include <com/sun/star/frame/DoubleInitializationException.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
+#include <com/sun/star/frame/XModel3.hpp>
#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
@@ -58,6 +58,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/implbase3.hxx>
#include <rtl/ref.hxx>
@@ -65,6 +66,7 @@
namespace comphelper {
class NamedValueCollection;
}
+namespace framework { class TitleHelper; }
namespace dbaccess
{
@@ -72,6 +74,7 @@ namespace dbaccess
class DocumentEvents;
class DocumentEventExecutor;
class DocumentGuard;
+class OCommandContainer;
typedef std::vector< css::uno::Reference< css::frame::XController > > Controllers;
@@ -131,7 +134,7 @@ private:
};
// ODatabaseDocument
-typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel2
+typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel3
, css::util::XModifiable
, css::frame::XStorable
, css::document::XEventBroadcaster
@@ -148,16 +151,13 @@ typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel2
, css::document::XEventsSupplier
, css::frame::XLoadable
, css::document::XDocumentRecovery
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ , css::frame::XUntitledNumbers
> ODatabaseDocument_OfficeDocument;
-typedef ::cppu::ImplHelper3< css::frame::XTitle
- , css::frame::XTitleChangeBroadcaster
- , css::frame::XUntitledNumbers
- > ODatabaseDocument_Title;
-
class ODatabaseDocument :public ModelDependentComponent // ModelDependentComponent must be first!
,public ODatabaseDocument_OfficeDocument
- ,public ODatabaseDocument_Title
{
enum InitState
{
@@ -169,9 +169,9 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
typedef std::map< OUString, css::uno::Reference< css::frame::XUntitledNumbers > > TNumberedController;
css::uno::Reference< css::ui::XUIConfigurationManager2> m_xUIConfigurationManager;
- ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aCloseListener;
- ::comphelper::OInterfaceContainerHelper2 m_aStorageListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XCloseListener> m_aCloseListener;
+ ::comphelper::OInterfaceContainerHelper3<css::document::XStorageChangeListener> m_aStorageListeners;
std::unique_ptr<DocumentEvents> m_pEventContainer;
::rtl::Reference< DocumentEventExecutor > m_pEventExecutor;
@@ -187,7 +187,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
/** @short such module manager is used to classify new opened documents. */
css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager;
- css::uno::Reference< css::frame::XTitle > m_xTitleHelper;
+ rtl::Reference< ::framework::TitleHelper > m_xTitleHelper;
TNumberedController m_aNumberedControllers;
/** true if and only if the DatabaseDocument's "initNew" or "load" have been called (or, well,
@@ -195,7 +195,8 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
*/
InitState m_eInitState;
bool m_bClosing;
- bool m_bAllowDocumentScripting;
+ /// Using atomic because locking around accessing this will lead to deadlock in queryInterface
+ std::atomic<bool> m_bAllowDocumentScripting;
bool m_bHasBeenRecovered;
/// If XModel::attachResource() was called to inform us that the document is embedded into another one.
bool m_bEmbedded;
@@ -236,8 +237,8 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
/// write a single XML stream into the package
void WriteThroughComponent(
const css::uno::Reference< css::lang::XComponent > & xComponent, /// the component we export
- const char* pStreamName, /// the stream name
- const char* pServiceName, /// service name of the component
+ const OUString& rStreamName, /// the stream name
+ const OUString& rServiceName, /// service name of the component
const css::uno::Sequence< css::uno::Any> & rArguments, /// the argument (XInitialization)
const css::uno::Sequence< css::beans::PropertyValue> & rMediaDesc,/// output descriptor
const css::uno::Reference< css::embed::XStorage >& _xStorageToSaveTo
@@ -248,7 +249,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
void WriteThroughComponent(
const css::uno::Reference< css::io::XOutputStream >& xOutputStream,
const css::uno::Reference< css::lang::XComponent >& xComponent,
- const char* pServiceName,
+ const OUString& rServiceName,
const css::uno::Sequence< css::uno::Any >& rArguments,
const css::uno::Sequence< css::beans::PropertyValue> & rMediaDesc
) const;
@@ -269,7 +270,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
// ModelDependentComponent overridables
virtual css::uno::Reference< css::uno::XInterface > getThis() const override;
- css::uno::Reference< css::frame::XTitle > const & impl_getTitleHelper_throw();
+ rtl::Reference< ::framework::TitleHelper> const & impl_getTitleHelper_throw();
css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper_throw(
const css::uno::Reference< css::uno::XInterface >& _xComponent = css::uno::Reference< css::uno::XInterface >());
@@ -287,7 +288,7 @@ protected:
public:
struct FactoryAccess { friend class ODatabaseModelImpl; private: FactoryAccess() { } };
- static ODatabaseDocument* createDatabaseDocument( const ::rtl::Reference<ODatabaseModelImpl>& _pImpl, FactoryAccess /*accessControl*/ )
+ static rtl::Reference<ODatabaseDocument> createDatabaseDocument( const ::rtl::Reference<ODatabaseModelImpl>& _pImpl, FactoryAccess /*accessControl*/ )
{
return new ODatabaseDocument( _pImpl );
}
@@ -299,8 +300,6 @@ public:
// XInterface
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
- virtual void SAL_CALL acquire( ) throw () override;
- virtual void SAL_CALL release( ) throw () override;
// XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -331,6 +330,9 @@ public:
virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController( const OUString& ViewName, const css::uno::Sequence< css::beans::PropertyValue >& Arguments, const css::uno::Reference< css::frame::XFrame >& Frame ) override ;
virtual void SAL_CALL setArgs(const css::uno::Sequence<css::beans::PropertyValue>& aArgs) override;
+ // XModel3
+ virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL getArgs2( const ::css::uno::Sequence< ::rtl::OUString >& requestedArgs ) override;
+
// XStorable
virtual sal_Bool SAL_CALL hasLocation( ) override ;
virtual OUString SAL_CALL getLocation( ) override ;
@@ -438,6 +440,8 @@ public:
*/
static void clearObjectContainer(
css::uno::WeakReference< css::container::XNameAccess >& _rxContainer);
+ static void clearObjectContainer(
+ unotools::WeakReference< OCommandContainer >& _rxContainer);
/** checks whether the component is already initialized, throws a NotInitializedException if not
*/
@@ -626,7 +630,7 @@ private:
*/
void impl_throwIOExceptionCausedBySave_throw(
const css::uno::Any& i_rError,
- const OUString& i_rTargetURL
+ std::u16string_view i_rTargetURL
) const;
};
@@ -746,6 +750,5 @@ private:
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEDOCUMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
index c147f99ec694..4c9c80de2e1a 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
@@ -23,11 +23,10 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/container/ElementExistException.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
-#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <cppuhelper/implbase.hxx>
#include <osl/diagnose.h>
#include <unotools/pathoptions.hxx>
#include <tools/urlobj.hxx>
@@ -39,7 +38,7 @@ namespace dbaccess
{
using ::com::sun::star::uno::Reference;
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::uno::XComponentContext;
using ::com::sun::star::container::NoSuchElementException;
@@ -49,26 +48,14 @@ namespace dbaccess
using ::com::sun::star::sdb::XDatabaseRegistrations;
using ::com::sun::star::sdb::XDatabaseRegistrationsListener;
using ::com::sun::star::sdb::DatabaseRegistrationEvent;
- using ::com::sun::star::uno::XAggregation;
- static OUString getConfigurationRootPath()
- {
- return "org.openoffice.Office.DataAccess/RegisteredNames";
- }
-
- static OUString getLocationNodeName()
- {
- return "Location";
- }
-
- static OUString getNameNodeName()
- {
- return "Name";
- }
+ constexpr OUString CONF_ROOT_PATH = u"org.openoffice.Office.DataAccess/RegisteredNames"_ustr;
+ constexpr OUString LOCATION = u"Location"_ustr;
+ constexpr OUString NAME = u"Name"_ustr;
// DatabaseRegistrations - declaration
- typedef ::cppu::WeakAggImplHelper1 < XDatabaseRegistrations
- > DatabaseRegistrations_Base;
+ typedef ::cppu::WeakImplHelper< XDatabaseRegistrations
+ > DatabaseRegistrations_Base;
namespace {
@@ -94,13 +81,13 @@ namespace dbaccess
private:
void
- impl_checkValidName_common(const OUString& _rName);
+ impl_checkValidName_common(std::u16string_view _rName);
::utl::OConfigurationNode
impl_checkValidName_throw_must_exist(const OUString& _rName);
::utl::OConfigurationNode
impl_checkValidName_throw_must_not_exist(const OUString& _rName);
- void impl_checkValidLocation_throw( const OUString& _rLocation );
+ void impl_checkValidLocation_throw( std::u16string_view _rLocation );
/** retrieves the configuration node whose "Name" sub node has the given value
@@ -131,12 +118,12 @@ namespace dbaccess
::utl::OConfigurationNode
- impl_getNodeForName_nothrow(const OUString& _rName);
+ impl_getNodeForName_nothrow(std::u16string_view _rName);
private:
Reference<XComponentContext> m_aContext;
::utl::OConfigurationTreeRoot m_aConfigurationRoot;
- ::comphelper::OInterfaceContainerHelper2 m_aRegistrationListeners;
+ ::comphelper::OInterfaceContainerHelper3<XDatabaseRegistrationsListener> m_aRegistrationListeners;
};
}
@@ -144,18 +131,17 @@ namespace dbaccess
// DatabaseRegistrations - implementation
DatabaseRegistrations::DatabaseRegistrations( const Reference<XComponentContext> & _rxContext )
:m_aContext( _rxContext )
- ,m_aConfigurationRoot()
,m_aRegistrationListeners( m_aMutex )
{
m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext(
- m_aContext, getConfigurationRootPath() );
+ m_aContext, CONF_ROOT_PATH );
}
DatabaseRegistrations::~DatabaseRegistrations()
{
}
- ::utl::OConfigurationNode DatabaseRegistrations::impl_getNodeForName_nothrow( const OUString& _rName )
+ ::utl::OConfigurationNode DatabaseRegistrations::impl_getNodeForName_nothrow( std::u16string_view _rName )
{
const Sequence< OUString > aNames( m_aConfigurationRoot.getNodeNames() );
for ( auto const & nodeName : aNames )
@@ -163,7 +149,7 @@ namespace dbaccess
::utl::OConfigurationNode aNodeForName = m_aConfigurationRoot.openNode( nodeName );
OUString sTestName;
- OSL_VERIFY( aNodeForName.getNodeValue( getNameNodeName() ) >>= sTestName );
+ OSL_VERIFY( aNodeForName.getNodeValue( NAME ) >>= sTestName );
if ( sTestName == _rName )
return aNodeForName;
}
@@ -197,16 +183,16 @@ namespace dbaccess
}
::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) );
- aNewNode.setNodeValue( getNameNodeName(), makeAny( _rName ) );
+ aNewNode.setNodeValue( NAME, Any( _rName ) );
return aNewNode;
}
- void DatabaseRegistrations::impl_checkValidName_common(const OUString& _rName)
+ void DatabaseRegistrations::impl_checkValidName_common(std::u16string_view _rName)
{
if ( !m_aConfigurationRoot.isValid() )
throw RuntimeException( OUString(), *this );
- if ( _rName.isEmpty() )
+ if ( _rName.empty() )
throw IllegalArgumentException( OUString(), *this, 1 );
}
@@ -222,9 +208,9 @@ namespace dbaccess
return impl_getNodeForName_throw_must_not_exist(_rName);
}
- void DatabaseRegistrations::impl_checkValidLocation_throw( const OUString& _rLocation )
+ void DatabaseRegistrations::impl_checkValidLocation_throw( std::u16string_view _rLocation )
{
- if ( _rLocation.isEmpty() )
+ if ( _rLocation.empty() )
throw IllegalArgumentException( OUString(), *this, 2 );
INetURLObject aURL( _rLocation );
@@ -252,7 +238,7 @@ namespace dbaccess
for ( auto const & name : aProgrammaticNames )
{
::utl::OConfigurationNode aRegistrationNode = m_aConfigurationRoot.openNode( name );
- OSL_VERIFY( aRegistrationNode.getNodeValue( getNameNodeName() ) >>= *pDisplayName );
+ OSL_VERIFY( aRegistrationNode.getNodeValue( NAME ) >>= *pDisplayName );
++pDisplayName;
}
@@ -266,7 +252,7 @@ namespace dbaccess
::utl::OConfigurationNode aNodeForName = impl_checkValidName_throw_must_exist(Name);
OUString sLocation;
- OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation );
+ OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation );
sLocation = SvtPathOptions().SubstituteVariable( sLocation );
return sLocation;
@@ -281,7 +267,7 @@ namespace dbaccess
::utl::OConfigurationNode aDataSourceRegistration = impl_checkValidName_throw_must_not_exist(Name);
// register
- aDataSourceRegistration.setNodeValue( getLocationNodeName(), makeAny( Location ) );
+ aDataSourceRegistration.setNodeValue( LOCATION, Any( Location ) );
m_aConfigurationRoot.commit();
// notify
@@ -299,7 +285,7 @@ namespace dbaccess
// obtain properties for notification
OUString sLocation;
- OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation );
+ OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation );
// revoke
if ( aNodeForName.isReadonly()
@@ -328,10 +314,10 @@ namespace dbaccess
// obtain properties for notification
OUString sOldLocation;
- OSL_VERIFY( aDataSourceRegistration.getNodeValue( getLocationNodeName() ) >>= sOldLocation );
+ OSL_VERIFY( aDataSourceRegistration.getNodeValue( LOCATION ) >>= sOldLocation );
// change
- aDataSourceRegistration.setNodeValue( getLocationNodeName(), makeAny( NewLocation ) );
+ aDataSourceRegistration.setNodeValue( LOCATION, Any( NewLocation ) );
m_aConfigurationRoot.commit();
// notify
@@ -360,7 +346,7 @@ namespace dbaccess
}
// DatabaseRegistrations - factory
- Reference< XAggregation > createDataSourceRegistrations( const Reference<XComponentContext> & _rxContext )
+ Reference< XDatabaseRegistrations > createDataSourceRegistrations( const Reference<XComponentContext> & _rxContext )
{
return new DatabaseRegistrations( _rxContext );
}
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.hxx b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
index 5e6680cc3f13..f6bdd8cdcf52 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.hxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
@@ -17,20 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEREGISTRATIONS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEREGISTRATIONS_HXX
+#pragma once
-#include <com/sun/star/uno/XAggregation.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
namespace dbaccess
{
-
- css::uno::Reference< css::uno::XAggregation >
- createDataSourceRegistrations( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
+css::uno::Reference<css::sdb::XDatabaseRegistrations>
+createDataSourceRegistrations(const css::uno::Reference<css::uno::XComponentContext>& _rxContext);
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEREGISTRATIONS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 002d01b21bb2..b1aa595cd8d9 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -22,7 +22,8 @@
#include <stringconstants.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
-#include "connection.hxx"
+#include <strings.hxx>
+#include <connection.hxx>
#include "SharedConnection.hxx"
#include "databasedocument.hxx"
#include <OAuthenticationContinuation.hxx>
@@ -34,7 +35,6 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/reflection/ProxyFactory.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
@@ -54,14 +54,13 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <tools/diagnose_ex.h>
+#include <officecfg/Office/Common.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/environment.hxx>
#include <osl/diagnose.h>
-#include <osl/process.h>
#include <sal/log.hxx>
-#include <svtools/miscopt.hxx>
#include <tools/urlobj.hxx>
#include <unotools/sharedunocomponent.hxx>
-#include <rtl/digest.h>
#include <algorithm>
#include <iterator>
@@ -180,7 +179,7 @@ void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source )
}
OAuthenticationContinuation::OAuthenticationContinuation()
- :m_bRemberPassword(true), // TODO: a meaningful default
+ :m_bRememberPassword(true), // TODO: a meaningful default
m_bCanSetUserName(true)
{
}
@@ -219,14 +218,13 @@ void SAL_CALL OAuthenticationContinuation::setPassword( const OUString& _rPasswo
Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberPasswordModes( RememberAuthentication& _reDefault )
{
- Sequence< RememberAuthentication > aReturn(1);
- _reDefault = aReturn[0] = RememberAuthentication_SESSION;
- return aReturn;
+ _reDefault = RememberAuthentication_SESSION;
+ return { _reDefault };
}
void SAL_CALL OAuthenticationContinuation::setRememberPassword( RememberAuthentication _eRemember )
{
- m_bRemberPassword = (RememberAuthentication_NO != _eRemember);
+ m_bRememberPassword = (RememberAuthentication_NO != _eRemember);
}
sal_Bool SAL_CALL OAuthenticationContinuation::canSetAccount( )
@@ -241,10 +239,8 @@ void SAL_CALL OAuthenticationContinuation::setAccount( const OUString& )
Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberAccountModes( RememberAuthentication& _reDefault )
{
- Sequence < RememberAuthentication > aReturn(1);
- aReturn[0] = RememberAuthentication_NO;
_reDefault = RememberAuthentication_NO;
- return aReturn;
+ return { RememberAuthentication_NO };
}
void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentication /*Remember*/ )
@@ -252,69 +248,6 @@ void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentic
SAL_WARN("dbaccess","OAuthenticationContinuation::setRememberAccount: not supported!");
}
-namespace {
-
-/** The class OSharedConnectionManager implements a structure to share connections.
- It owns the master connections which will be disposed when the last connection proxy is gone.
-*/
-// need to hold the digest
-struct TDigestHolder
-{
- sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1];
- TDigestHolder()
- {
- m_pBuffer[0] = 0;
- }
-
-};
-
-}
-
-class OSharedConnectionManager : public ::cppu::WeakImplHelper< XEventListener >
-{
-
- // contains the currently used master connections
- struct TConnectionHolder
- {
- Reference< XConnection > xMasterConnection;
- oslInterlockedCount nALiveCount;
- };
-
- // the less-compare functor, used for the stl::map
- struct TDigestLess
- {
- bool operator() (const TDigestHolder& x, const TDigestHolder& y) const
- {
- sal_uInt32 i;
- for(i=0;i < RTL_DIGEST_LENGTH_SHA1 && (x.m_pBuffer[i] >= y.m_pBuffer[i]); ++i)
- ;
- return i < RTL_DIGEST_LENGTH_SHA1;
- }
- };
-
- typedef std::map< TDigestHolder,TConnectionHolder,TDigestLess> TConnectionMap; // holds the master connections
- typedef std::map< Reference< XConnection >,TConnectionMap::iterator> TSharedConnectionMap;// holds the shared connections
-
- ::osl::Mutex m_aMutex;
- TConnectionMap m_aConnections; // remember the master connection in conjunction with the digest
- TSharedConnectionMap m_aSharedConnection; // the shared connections with conjunction with an iterator into the connections map
- Reference< XProxyFactory > m_xProxyFactory;
-
-protected:
- virtual ~OSharedConnectionManager() override;
-
-public:
- explicit OSharedConnectionManager(const Reference< XComponentContext >& _rxContext);
-
- void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
- Reference<XConnection> getConnection( const OUString& url,
- const OUString& user,
- const OUString& password,
- const Sequence< PropertyValue >& _aInfo,
- ODatabaseSource* _pDataSource);
- void addEventListener(const Reference<XConnection>& _rxConnection, TConnectionMap::iterator const & _rIter);
-};
-
OSharedConnectionManager::OSharedConnectionManager(const Reference< XComponentContext >& _rxContext)
{
m_xProxyFactory.set( ProxyFactory::create( _rxContext ) );
@@ -352,10 +285,11 @@ Reference<XConnection> OSharedConnectionManager::getConnection( const OUString&
Sequence< PropertyValue > aInfoCopy(_aInfo);
sal_Int32 nPos = aInfoCopy.getLength();
aInfoCopy.realloc( nPos + 2 );
- aInfoCopy[nPos].Name = "TableFilter";
- aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter;
- aInfoCopy[nPos].Name = "TableTypeFilter";
- aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter;
+ auto pInfoCopy = aInfoCopy.getArray();
+ pInfoCopy[nPos].Name = "TableFilter";
+ pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter;
+ pInfoCopy[nPos].Name = "TableTypeFilter";
+ pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter;
OUString sUser = user;
OUString sPassword = password;
@@ -378,10 +312,10 @@ Reference<XConnection> OSharedConnectionManager::getConnection( const OUString&
aIter = m_aConnections.emplace(nId,aHolder).first;
}
- Reference<XConnection> xRet;
+ rtl::Reference<OSharedConnection> xRet;
if ( aIter->second.xMasterConnection.is() )
{
- Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(aIter->second.xMasterConnection.get());
+ Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(cppu::getXWeak(aIter->second.xMasterConnection.get()));
xRet = new OSharedConnection(xConProxy);
m_aSharedConnection.emplace(xRet,aIter);
addEventListener(xRet,aIter);
@@ -401,43 +335,29 @@ void OSharedConnectionManager::addEventListener(const Reference<XConnection>& _r
namespace
{
Sequence< PropertyValue > lcl_filterDriverProperties( const Reference< XDriver >& _xDriver, const OUString& _sUrl,
- const Sequence< PropertyValue >& _rDataSourceSettings, const AsciiPropertyValue* _pKnownSettings )
+ const Sequence< PropertyValue >& _rDataSourceSettings )
{
if ( _xDriver.is() )
{
Sequence< DriverPropertyInfo > aDriverInfo(_xDriver->getPropertyInfo(_sUrl,_rDataSourceSettings));
- const PropertyValue* pDataSourceSetting = _rDataSourceSettings.getConstArray();
- const PropertyValue* pEnd = pDataSourceSetting + _rDataSourceSettings.getLength();
-
std::vector< PropertyValue > aRet;
- for ( ; pDataSourceSetting != pEnd ; ++pDataSourceSetting )
+ for (auto& dataSourceSetting : _rDataSourceSettings)
{
- bool bAllowSetting = false;
- const AsciiPropertyValue* pSetting = _pKnownSettings;
- for ( ; pSetting->AsciiName; ++pSetting )
- {
- if ( pDataSourceSetting->Name.equalsAscii( pSetting->AsciiName ) )
- { // the particular data source setting is known
-
- const DriverPropertyInfo* pAllowedDriverSetting = aDriverInfo.getConstArray();
- const DriverPropertyInfo* pDriverSettingsEnd = pAllowedDriverSetting + aDriverInfo.getLength();
- for ( ; pAllowedDriverSetting != pDriverSettingsEnd; ++pAllowedDriverSetting )
- {
- if ( pAllowedDriverSetting->Name.equalsAscii( pSetting->AsciiName ) )
- { // the driver also allows this setting
- bAllowSetting = true;
- break;
- }
- }
- break;
- }
- }
- if ( bAllowSetting || !pSetting->AsciiName )
+ auto knownSettings = dbaccess::ODatabaseModelImpl::getDefaultDataSourceSettings();
+ bool isSettingKnown = std::any_of(knownSettings.begin(), knownSettings.end(),
+ [name = dataSourceSetting.Name](auto& setting)
+ { return name == setting.Name; });
+ // Allow if the particular data source setting is unknown or allowed by the driver
+ bool bAllowSetting = !isSettingKnown
+ || std::any_of(aDriverInfo.begin(), aDriverInfo.end(),
+ [name = dataSourceSetting.Name](auto& setting)
+ { return name == setting.Name; });
+ if (bAllowSetting)
{ // if the driver allows this particular setting, or if the setting is completely unknown,
// we pass it to the driver
- aRet.push_back( *pDataSourceSetting );
+ aRet.push_back(dataSourceSetting);
}
}
if ( !aRet.empty() )
@@ -531,12 +451,12 @@ Any ODatabaseSource::queryInterface( const Type & rType )
return aIface;
}
-void ODatabaseSource::acquire() throw ()
+void ODatabaseSource::acquire() noexcept
{
ODatabaseSource_Base::acquire();
}
-void ODatabaseSource::release() throw ()
+void ODatabaseSource::release() noexcept
{
ODatabaseSource_Base::release();
}
@@ -550,12 +470,12 @@ void SAL_CALL ODatabaseSource::disposing( const css::lang::EventObject& Source )
// XServiceInfo
OUString ODatabaseSource::getImplementationName( )
{
- return "com.sun.star.comp.dba.ODatabaseSource";
+ return u"com.sun.star.comp.dba.ODatabaseSource"_ustr;
}
Sequence< OUString > ODatabaseSource::getSupportedServiceNames( )
{
- return { SERVICE_SDB_DATASOURCE, "com.sun.star.sdb.DocumentDataSource" };
+ return { SERVICE_SDB_DATASOURCE, u"com.sun.star.sdb.DocumentDataSource"_ustr };
}
sal_Bool ODatabaseSource::supportsService( const OUString& _rServiceName )
@@ -583,7 +503,7 @@ weld::Window* ODatabaseModelImpl::GetFrameWeld()
if (m_xDialogParent.is())
return Application::GetFrameWeld(m_xDialogParent);
- Reference<XModel> xModel = getModel_noCreate();
+ rtl::Reference<ODatabaseDocument> xModel = getModel_noCreate();
if (!xModel.is())
return nullptr;
Reference<XController> xController(xModel->getCurrentController());
@@ -605,36 +525,31 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
#if ENABLE_FIREBIRD_SDBC
bool bIgnoreMigration = false;
bool bNeedMigration = false;
- Reference< XModel > xModel = m_pImpl->getModel_noCreate();
+ rtl::Reference< ODatabaseDocument > xModel = m_pImpl->getModel_noCreate();
if ( xModel)
{
//See ODbTypeWizDialogSetup::SaveDatabaseDocument
- ::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- aArgs.get("IgnoreFirebirdMigration") >>= bIgnoreMigration;
+ ::comphelper::NamedValueCollection::get(xModel->getArgs(), u"IgnoreFirebirdMigration") >>= bIgnoreMigration;
}
else
{
//ignore when we don't have a model. E.g. Mailmerge, data sources, fields...
bIgnoreMigration = true;
}
- SvtMiscOptions aMiscOptions;
- if (!aMiscOptions.IsExperimentalMode())
+ if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
bIgnoreMigration = true;
if(!bIgnoreMigration && m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb")
{
Reference<XStorage> const xRootStorage = m_pImpl->getOrCreateRootStorage();
- OUString sMigrEnvVal;
- osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
- &sMigrEnvVal.pData);
- if(!sMigrEnvVal.isEmpty())
+ if (!o3tl::getEnvironment(u"DBACCESS_HSQL_MIGRATION"_ustr).isEmpty())
bNeedMigration = true;
else
{
Reference<XPropertySet> const xPropSet(xRootStorage, UNO_QUERY_THROW);
sal_Int32 nOpenMode(0);
- if ((xPropSet->getPropertyValue("OpenMode") >>= nOpenMode)
+ if ((xPropSet->getPropertyValue(u"OpenMode"_ustr) >>= nOpenMode)
&& (nOpenMode & css::embed::ElementModes::WRITE)
&& (!Application::IsHeadlessModeEnabled()))
{
@@ -645,7 +560,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if (bNeedMigration)
{
// back up content xml file if migration was successful
- constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml";
+ static constexpr OUString BACKUP_XML_NAME = u"content_before_migration.xml"_ustr;
try
{
if(xRootStorage->isStreamElement(BACKUP_XML_NAME))
@@ -655,7 +570,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
{
SAL_INFO("dbaccess", "No file content_before_migration.xml found" );
}
- xRootStorage->copyElementTo("content.xml", xRootStorage,
+ xRootStorage->copyElementTo(u"content.xml"_ustr, xRootStorage,
BACKUP_XML_NAME);
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
@@ -680,7 +595,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
sPwd = m_pImpl->m_aPassword;
}
- const char* pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED;
+ TranslateId pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED;
if (xManager.is())
{
sal_Int32 nAdditionalArgs(0);
@@ -688,17 +603,18 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if (!sPwd.isEmpty()) ++nAdditionalArgs;
Sequence< PropertyValue > aUserPwd(nAdditionalArgs);
+ auto aUserPwdRange = asNonConstRange(aUserPwd);
sal_Int32 nArgPos = 0;
if (!sUser.isEmpty())
{
- aUserPwd[ nArgPos ].Name = "user";
- aUserPwd[ nArgPos ].Value <<= sUser;
+ aUserPwdRange[ nArgPos ].Name = "user";
+ aUserPwdRange[ nArgPos ].Value <<= sUser;
++nArgPos;
}
if (!sPwd.isEmpty())
{
- aUserPwd[ nArgPos ].Name = "password";
- aUserPwd[ nArgPos ].Value <<= sPwd;
+ aUserPwdRange[ nArgPos ].Name = "password";
+ aUserPwdRange[ nArgPos ].Value <<= sPwd;
}
Reference< XDriver > xDriver;
try
@@ -725,24 +641,24 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
Sequence< PropertyValue > aDriverInfo = lcl_filterDriverProperties(
xDriver,
m_pImpl->m_sConnectURL,
- m_pImpl->m_xSettings->getPropertyValues(),
- dbaccess::ODatabaseModelImpl::getDefaultDataSourceSettings()
+ m_pImpl->m_xSettings->getPropertyValues()
);
if ( m_pImpl->isEmbeddedDatabase() )
{
sal_Int32 nCount = aDriverInfo.getLength();
aDriverInfo.realloc(nCount + 3 );
+ auto pDriverInfo = aDriverInfo.getArray();
- aDriverInfo[nCount].Name = "URL";
- aDriverInfo[nCount++].Value <<= m_pImpl->getURL();
+ pDriverInfo[nCount].Name = "URL";
+ pDriverInfo[nCount++].Value <<= m_pImpl->getURL();
- aDriverInfo[nCount].Name = "Storage";
+ pDriverInfo[nCount].Name = "Storage";
Reference< css::document::XDocumentSubStorageSupplier> xDocSup( m_pImpl->getDocumentSubStorageSupplier() );
- aDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE);
+ pDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage(u"database"_ustr,ElementModes::READWRITE);
- aDriverInfo[nCount].Name = "Document";
- aDriverInfo[nCount++].Value <<= getDatabaseDocument();
+ pDriverInfo[nCount].Name = "Document";
+ pDriverInfo[nCount++].Value <<= getDatabaseDocument();
}
if (nAdditionalArgs)
xReturn = xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo));
@@ -767,11 +683,11 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
OUString sMessage = DBA_RES(pExceptionMessageId)
.replaceAll("$name$", m_pImpl->m_sConnectURL);
- SQLContext aContext;
- aContext.Message = DBA_RES(RID_STR_CONNECTION_REQUEST).
- replaceFirst("$name$", m_pImpl->m_sConnectURL);
+ SQLContext aContext(
+ DBA_RES(RID_STR_CONNECTION_REQUEST).replaceFirst("$name$", m_pImpl->m_sConnectURL),
+ {}, {}, 0, {}, {});
- throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) );
+ throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), Any( aContext ) );
}
#if ENABLE_FIREBIRD_SDBC
@@ -780,7 +696,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
Reference< css::document::XDocumentSubStorageSupplier> xDocSup(
m_pImpl->getDocumentSubStorageSupplier() );
dbahsql::HsqlImporter importer(xReturn,
- xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE) );
+ xDocSup->getDocumentSubStorage(u"database"_ustr,ElementModes::READWRITE) );
importer.importHsqlDatabase(m_pImpl->GetFrameWeld());
}
#endif
@@ -797,21 +713,26 @@ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* ODatabaseSource::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(13)
- DECL_PROP1(INFO, Sequence< PropertyValue >, BOUND);
- DECL_PROP1_BOOL(ISPASSWORDREQUIRED, BOUND);
- DECL_PROP1_BOOL(ISREADONLY, READONLY);
- DECL_PROP1(LAYOUTINFORMATION, Sequence< PropertyValue >, BOUND);
- DECL_PROP1(NAME, OUString, READONLY);
- DECL_PROP2_IFACE(NUMBERFORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT);
- DECL_PROP1(PASSWORD, OUString, TRANSIENT);
- DECL_PROP2_IFACE(SETTINGS, XPropertySet, BOUND, READONLY);
- DECL_PROP1_BOOL(SUPPRESSVERSIONCL, BOUND);
- DECL_PROP1(TABLEFILTER, Sequence< OUString >,BOUND);
- DECL_PROP1(TABLETYPEFILTER, Sequence< OUString >,BOUND);
- DECL_PROP1(URL, OUString, BOUND);
- DECL_PROP1(USER, OUString, BOUND);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ // a change here means a change should also been done in OApplicationController::disposing()
+ { PROPERTY_INFO, PROPERTY_ID_INFO, cppu::UnoType<Sequence< PropertyValue >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISPASSWORDREQUIRED, PROPERTY_ID_ISPASSWORDREQUIRED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, cppu::UnoType<Sequence< PropertyValue >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_NAME, PROPERTY_ID_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_NUMBERFORMATSSUPPLIER, PROPERTY_ID_NUMBERFORMATSSUPPLIER, cppu::UnoType<XNumberFormatsSupplier>::get(),
+ css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::TRANSIENT },
+ { PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::TRANSIENT },
+ { PROPERTY_SETTINGS, PROPERTY_ID_SETTINGS, cppu::UnoType<XPropertySet>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SUPPRESSVERSIONCL, PROPERTY_ID_SUPPRESSVERSIONCL, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_TABLEFILTER, PROPERTY_ID_TABLEFILTER, cppu::UnoType<Sequence< OUString >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_TABLETYPEFILTER, PROPERTY_ID_TABLETYPEFILTER, cppu::UnoType<Sequence< OUString >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_URL, PROPERTY_ID_URL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_USER, PROPERTY_ID_USER, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND }
+ }
+ };
}
// cppu::OPropertySetHelper
@@ -822,73 +743,59 @@ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo()
sal_Bool ODatabaseSource::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue )
{
- bool bModified(false);
if ( m_pImpl.is() )
{
switch (nHandle)
{
case PROPERTY_ID_TABLEFILTER:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aTableFilter);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aTableFilter);
case PROPERTY_ID_TABLETYPEFILTER:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aTableTypeFilter);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aTableTypeFilter);
case PROPERTY_ID_USER:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_sUser);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_sUser);
case PROPERTY_ID_PASSWORD:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aPassword);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aPassword);
case PROPERTY_ID_ISPASSWORDREQUIRED:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_bPasswordRequired);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_bPasswordRequired);
case PROPERTY_ID_SUPPRESSVERSIONCL:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_bSuppressVersionColumns);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_bSuppressVersionColumns);
case PROPERTY_ID_LAYOUTINFORMATION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aLayoutInformation);
- break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_aLayoutInformation);
case PROPERTY_ID_URL:
- {
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_sConnectURL);
- } break;
+ return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_pImpl->m_sConnectURL);
case PROPERTY_ID_INFO:
{
Sequence<PropertyValue> aValues;
if (!(rValue >>= aValues))
throw IllegalArgumentException();
- for ( auto const & checkName : std::as_const(aValues) )
+ for (auto const& checkName : aValues)
{
if ( checkName.Name.isEmpty() )
throw IllegalArgumentException();
}
Sequence< PropertyValue > aSettings = m_pImpl->m_xSettings->getPropertyValues();
- bModified = aSettings.getLength() != aValues.getLength();
- if ( !bModified )
- {
- const PropertyValue* pInfoIter = aSettings.getConstArray();
- const PropertyValue* checkValue = aValues.getConstArray();
- for ( ;!bModified && checkValue != aValues.end() ; ++checkValue,++pInfoIter)
- {
- bModified = checkValue->Name != pInfoIter->Name;
- if ( !bModified )
- {
- bModified = checkValue->Value != pInfoIter->Value;
- }
- }
- }
rConvertedValue = rValue;
rOldValue <<= aSettings;
+
+ if (aSettings.getLength() != aValues.getLength())
+ return true;
+
+ for (sal_Int32 i = 0; i < aSettings.getLength(); ++i)
+ {
+ if (aValues[i].Name != aSettings[i].Name
+ || aValues[i].Value != aSettings[i].Value)
+ return true;
+ }
}
break;
default:
SAL_WARN("dbaccess", "ODatabaseSource::convertFastPropertyValue: unknown or readonly Property!" );
}
}
- return bModified;
+ return false;
}
namespace
@@ -1050,13 +957,15 @@ void ODatabaseSource::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) con
// transform them so that only property values which fulfill certain
// criteria survive
Sequence< PropertyValue > aNonDefaultOrUserDefined( aValues.getLength() );
+ auto [begin, end] = asNonConstRange(aValues);
+ auto pCopyStart = aNonDefaultOrUserDefined.getArray();
const PropertyValue* pCopyEnd = std::remove_copy_if(
- aValues.begin(),
- aValues.end(),
- aNonDefaultOrUserDefined.getArray(),
+ begin,
+ end,
+ pCopyStart,
IsDefaultAndNotRemoveable( aPropertyAttributes )
);
- aNonDefaultOrUserDefined.realloc( pCopyEnd - aNonDefaultOrUserDefined.getArray() );
+ aNonDefaultOrUserDefined.realloc( pCopyEnd - pCopyStart );
rValue <<= aNonDefaultOrUserDefined;
}
catch( const Exception& )
@@ -1138,8 +1047,8 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
// build an interaction request
// two continuations (Ok and Cancel)
- OInteractionAbort* pAbort = new OInteractionAbort;
- OAuthenticationContinuation* pAuthenticate = new OAuthenticationContinuation;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
+ rtl::Reference<OAuthenticationContinuation> pAuthenticate = new OAuthenticationContinuation;
// the name which should be referred in the login dialog
OUString sServerName( m_pImpl->m_sName );
@@ -1154,8 +1063,7 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
aRequest.HasUserName = aRequest.HasPassword = true;
aRequest.UserName = m_pImpl->m_sUser;
aRequest.Password = m_pImpl->m_sFailedPassword.isEmpty() ? m_pImpl->m_aPassword : m_pImpl->m_sFailedPassword;
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pRequest->addContinuation(pAbort);
pRequest->addContinuation(pAuthenticate);
@@ -1163,7 +1071,7 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
// handle the request
try
{
- _rxHandler->handle(xRequest);
+ _rxHandler->handle(pRequest);
}
catch(Exception&)
{
@@ -1174,12 +1082,18 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
return Reference< XConnection >();
// get the result
- sUser = m_pImpl->m_sUser = pAuthenticate->getUser();
- sPassword = pAuthenticate->getPassword();
+ sUser = pAuthenticate->getUser();
+ if (sUser != m_pImpl->m_sUser)
+ {
+ m_pImpl->m_sUser = sUser;
+ m_pImpl->m_bAskPassword = true;
+ }
+
+ sPassword = pAuthenticate->getPassword();
if (pAuthenticate->getRememberPassword())
{
- m_pImpl->m_aPassword = pAuthenticate->getPassword();
+ m_pImpl->m_aPassword = sPassword;
bNewPasswordGiven = true;
}
m_pImpl->m_sFailedPassword.clear();
@@ -1203,18 +1117,16 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
}
}
-Reference< XConnection > ODatabaseSource::buildIsolatedConnection(const OUString& user, const OUString& password)
+rtl::Reference< OConnection > ODatabaseSource::buildIsolatedConnection(const OUString& user, const OUString& password)
{
- Reference< XConnection > xConn;
Reference< XConnection > xSdbcConn = buildLowLevelConnection(user, password);
OSL_ENSURE( xSdbcConn.is(), "ODatabaseSource::buildIsolatedConnection: invalid return value of buildLowLevelConnection!" );
// buildLowLevelConnection is expected to always succeed
- if ( xSdbcConn.is() )
- {
- // build a connection server and return it (no stubs)
- xConn = new OConnection(*this, xSdbcConn, m_pImpl->m_aContext);
- }
- return xConn;
+ if ( !xSdbcConn.is() )
+ return nullptr;
+
+ // build a connection server and return it (no stubs)
+ return new OConnection(*this, xSdbcConn, m_pImpl->m_aContext);
}
Reference< XConnection > ODatabaseSource::getConnection(const OUString& user, const OUString& password,bool _bIsolated)
@@ -1230,10 +1142,9 @@ Reference< XConnection > ODatabaseSource::getConnection(const OUString& user, co
{ // create a new proxy for the connection
if ( !m_pImpl->m_xSharedConnectionManager.is() )
{
- m_pImpl->m_pSharedConnectionManager = new OSharedConnectionManager( m_pImpl->m_aContext );
- m_pImpl->m_xSharedConnectionManager = m_pImpl->m_pSharedConnectionManager;
+ m_pImpl->m_xSharedConnectionManager = new OSharedConnectionManager( m_pImpl->m_aContext );
}
- xConn = m_pImpl->m_pSharedConnectionManager->getConnection(
+ xConn = m_pImpl->m_xSharedConnectionManager->getConnection(
m_pImpl->m_sConnectURL, user, password, m_pImpl->m_xSettings->getPropertyValues(), this );
}
@@ -1264,20 +1175,19 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( )
{
Any aValue;
css::uno::Reference< css::uno::XInterface > xMy(*this);
- if ( dbtools::getDataSourceSetting(xMy,"CommandDefinitions",aValue) )
+ if (dbtools::getDataSourceSetting(xMy, u"CommandDefinitions"_ustr, aValue))
{
OUString sSupportService;
aValue >>= sSupportService;
if ( !sSupportService.isEmpty() )
{
- Sequence<Any> aArgs(1);
- aArgs[0] <<= NamedValue("DataSource",makeAny(xMy));
+ Sequence<Any> aArgs{ Any(NamedValue(u"DataSource"_ustr,Any(xMy))) };
xContainer.set( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext), UNO_QUERY);
}
}
if ( !xContainer.is() )
{
- TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::E_QUERY ) );
+ TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::ObjectType::Query ) );
xContainer = new OCommandContainer( m_pImpl->m_aContext, *this, rContainerData, false );
}
m_pImpl->m_xCommandDefinitions = xContainer;
@@ -1290,12 +1200,12 @@ Reference< XNameAccess > ODatabaseSource::getTables()
{
ModelMethodGuard aGuard( *this );
- Reference< XNameAccess > xContainer = m_pImpl->m_xTableDefinitions;
+ rtl::Reference< OCommandContainer > xContainer = m_pImpl->m_xTableDefinitions;
if ( !xContainer.is() )
{
- TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::E_TABLE ) );
+ TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::ObjectType::Table ) );
xContainer = new OCommandContainer( m_pImpl->m_aContext, *this, rContainerData, true );
- m_pImpl->m_xTableDefinitions = xContainer;
+ m_pImpl->m_xTableDefinitions = xContainer.get();
}
return xContainer;
}
@@ -1396,18 +1306,18 @@ Reference< XOfficeDatabaseDocument > SAL_CALL ODatabaseSource::getDatabaseDocume
{
ModelMethodGuard aGuard( *this );
- Reference< XModel > xModel( m_pImpl->getModel_noCreate() );
+ rtl::Reference< ODatabaseDocument > xModel( m_pImpl->getModel_noCreate() );
if ( !xModel.is() )
xModel = m_pImpl->createNewModel_deliverOwnership();
- return Reference< XOfficeDatabaseDocument >( xModel, UNO_QUERY_THROW );
+ return Reference< XOfficeDatabaseDocument >( static_cast<cppu::OWeakObject*>(xModel.get()), UNO_QUERY_THROW );
}
void SAL_CALL ODatabaseSource::initialize( css::uno::Sequence< css::uno::Any > const & rArguments)
{
::comphelper::NamedValueCollection aProperties( rArguments );
- if (aProperties.has("ParentWindow"))
- aProperties.get("ParentWindow") >>= m_pImpl->m_xDialogParent;
+ if (aProperties.has(u"ParentWindow"_ustr))
+ aProperties.get(u"ParentWindow"_ustr) >>= m_pImpl->m_xDialogParent;
}
Reference< XInterface > ODatabaseSource::getThis() const
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index b9d8e8bbf407..2a70c943a3f2 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATASOURCE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATASOURCE_HXX
+#pragma once
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -31,6 +30,7 @@
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <cppuhelper/propshlp.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/proparrhlp.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/compbase.hxx>
@@ -55,6 +55,7 @@ namespace dbaccess
{
class OSharedConnectionManager;
+class OConnection;
// ODatabaseSource
typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo
@@ -84,7 +85,7 @@ private:
using ODatabaseSource_Base::rBHelper;
// note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire!
OBookmarkContainer m_Bookmarks;
- ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XFlushListener> m_aFlushListeners;
private:
virtual ~ODatabaseSource() override;
@@ -122,8 +123,8 @@ public:
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw( ) override;
- virtual void SAL_CALL release() throw( ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -200,7 +201,7 @@ private:
const OUString& _rUid, const OUString& _rPwd
);
- css::uno::Reference< css::sdbc::XConnection > buildIsolatedConnection(
+ rtl::Reference< OConnection > buildIsolatedConnection(
const OUString& user, const OUString& password
);
@@ -217,6 +218,4 @@ protected:
} // namespace dbaccess
-#endif // _DBA_COREDATAACCESS_DATALINK_HXX_
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index dd099c81fa05..91e36d2a925d 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -18,11 +18,12 @@
*/
#include <definitioncontainer.hxx>
-#include <apitools.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <comphelper/enumhelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -30,9 +31,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdb/ErrorCondition.hpp>
-#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
#include <rtl/ref.hxx>
using namespace ::com::sun::star::uno;
@@ -135,7 +134,14 @@ ODefinitionContainer::~ODefinitionContainer()
}
IMPLEMENT_FORWARD_XINTERFACE2( ODefinitionContainer,OContentHelper,ODefinitionContainer_Base)
-IMPLEMENT_GETTYPES2(ODefinitionContainer,OContentHelper,ODefinitionContainer_Base);
+css::uno::Sequence< css::uno::Type > ODefinitionContainer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OContentHelper::getTypes( ),
+ ODefinitionContainer_Base::getTypes( )
+ );
+}
+
css::uno::Sequence<sal_Int8> ODefinitionContainer::getImplementationId()
{
@@ -145,12 +151,12 @@ css::uno::Sequence<sal_Int8> ODefinitionContainer::getImplementationId()
// XServiceInfo
OUString SAL_CALL ODefinitionContainer::getImplementationName( )
{
- return "com.sun.star.sdb.ODefinitionContainer";
+ return u"com.sun.star.sdb.ODefinitionContainer"_ustr;
}
Sequence< OUString > SAL_CALL ODefinitionContainer::getSupportedServiceNames( )
{
- return { "com.sun.star.sdb.DefinitionContainer", "com.sun.star.ucb.Content" };
+ return { u"com.sun.star.sdb.DefinitionContainer"_ustr, u"com.sun.star.ucb.Content"_ustr };
}
// XNameContainer
@@ -265,7 +271,7 @@ namespace
if ( eVetoDetails >>= aWrappedError )
throw aWrappedError;
- throw WrappedTargetException( xVeto->getReason(), Listener.get(), eVetoDetails );
+ throw WrappedTargetException( xVeto->getReason(), Listener, eVetoDetails );
}
};
}
@@ -280,7 +286,7 @@ void ODefinitionContainer::notifyByName( ResettableMutexGuard& _rGuard, const OU
if ( !rContainer.getLength() )
return;
- ContainerEvent aEvent( *this, makeAny( _rName ), makeAny( _xNewElement ), makeAny( _xOldElement ) );
+ ContainerEvent aEvent( *this, Any( _rName ), Any( _xNewElement ), Any( _xOldElement ) );
_rGuard.clear();
switch ( _eOperation )
@@ -366,7 +372,7 @@ Any SAL_CALL ODefinitionContainer::getByIndex( sal_Int32 _nIndex )
{
MutexGuard aGuard(m_aMutex);
- if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aDocuments.size())))
+ if ((_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= m_aDocuments.size()))
throw IndexOutOfBoundsException();
Documents::iterator aPos = m_aDocuments[_nIndex];
@@ -379,14 +385,14 @@ Any SAL_CALL ODefinitionContainer::getByIndex( sal_Int32 _nIndex )
// and update the name-access map
}
- return makeAny(xProp);
+ return Any(xProp);
}
Any SAL_CALL ODefinitionContainer::getByName( const OUString& _rName )
{
MutexGuard aGuard(m_aMutex);
- return makeAny( implGetByName( _rName, true ) );
+ return Any( implGetByName( _rName, true ) );
}
Reference< XContent > ODefinitionContainer::implGetByName(const OUString& _rName, bool _bReadIfNecessary)
@@ -526,7 +532,7 @@ void ODefinitionContainer::implAppend(const OUString& _rName, const Reference< X
// #i44786#
lcl_ensureName( _rxNewObject, _rName );
- ::rtl::Reference< OContentHelper > pContent = comphelper::getUnoTunnelImplementation<OContentHelper>( _rxNewObject );
+ ::rtl::Reference< OContentHelper > pContent = dynamic_cast<OContentHelper*>( _rxNewObject.get() );
if ( pContent.is() )
{
TContentPtr pImpl = pContent->getImpl();
@@ -585,7 +591,7 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
DBA_RES( RID_STR_NAME_ALREADY_USED ),
*this );
- ::rtl::Reference< OContentHelper > pContent( comphelper::getUnoTunnelImplementation<OContentHelper>( _rxObject ) );
+ ::rtl::Reference< OContentHelper > pContent( dynamic_cast<OContentHelper*>( _rxObject.get() ) );
if ( !pContent.is() )
throw IllegalArgumentException(
DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),
@@ -601,10 +607,11 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
// XPropertyChangeListener
void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt )
{
- MutexGuard aGuard(m_aMutex);
- if( !(evt.PropertyName == PROPERTY_NAME || evt.PropertyName == "Title") )
+ if( evt.PropertyName != PROPERTY_NAME && evt.PropertyName != "Title" )
return;
+ MutexGuard aGuard(m_aMutex);
+
m_bInPropertyChange = true;
try
{
@@ -662,7 +669,7 @@ void ODefinitionContainer::removeObjectListener(const Reference< XContent >& _xN
bool ODefinitionContainer::checkExistence(const OUString& _rName)
{
- return m_aDocumentMap.find(_rName) != m_aDocumentMap.end();
+ return m_aDocumentMap.contains(_rName);
}
}
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 9d88d27222f5..217ae7f4391f 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -34,13 +34,14 @@
#include <connectivity/sqlerror.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/propertysequence.hxx>
-#include <comphelper/servicehelper.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -50,7 +51,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::io;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -115,14 +115,47 @@ css::uno::Sequence<sal_Int8> ODocumentContainer::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(ODocumentContainer,ODefinitionContainer,OPropertyStateContainer,ODocumentContainer_Base);
-IMPLEMENT_SERVICE_INFO_IMPLNAME(ODocumentContainer, "com.sun.star.comp.dba.ODocumentContainer");
-IMPLEMENT_SERVICE_INFO_SUPPORTS(ODocumentContainer);
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(ODocumentContainer)
+css::uno::Sequence< css::uno::Type > ODocumentContainer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ ODefinitionContainer::getTypes( ),
+ OPropertyStateContainer::getTypes( ),
+ ODocumentContainer_Base::getTypes( )
+ );
+}
+OUString SAL_CALL ODocumentContainer::getImplementationName()
+ {
+ return u"com.sun.star.comp.dba.ODocumentContainer"_ustr;
+ };
+sal_Bool SAL_CALL ODocumentContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ };
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODocumentContainer::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& ODocumentContainer::getInfoHelper()
+{
+ return *ODocumentContainer::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* ODocumentContainer::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
Sequence< OUString > SAL_CALL ODocumentContainer::getSupportedServiceNames( )
{
- return { m_bFormsContainer ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION) };
+ return { m_bFormsContainer ? SERVICE_NAME_FORM_COLLECTION : SERVICE_NAME_REPORT_COLLECTION };
}
OUString ODocumentContainer::determineContentType() const
@@ -181,10 +214,10 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
lcl_extractAndRemove( aArgs, PROPERTY_ACTIVE_CONNECTION, xConnection );
lcl_extractAndRemove( aArgs, PROPERTY_AS_TEMPLATE, bAsTemplate );
lcl_extractAndRemove( aArgs, INFO_MEDIATYPE, sMediaType );
- lcl_extractAndRemove( aArgs, "DocumentServiceName" , sDocServiceName );
+ lcl_extractAndRemove( aArgs, u"DocumentServiceName"_ustr , sDocServiceName );
// ClassID has two allowed types, so a special treatment here
- Any aClassIDArg = aArgs.get( "ClassID" );
+ Any aClassIDArg = aArgs.get( u"ClassID"_ustr );
if ( aClassIDArg.hasValue() )
{
if ( !( aClassIDArg >>= aClassID ) )
@@ -201,7 +234,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
OUString sClassIDString = ::comphelper::MimeConfigurationHelper::GetStringClassIDRepresentation( aClassID );
(void)sClassIDString;
#endif
- aArgs.remove( "ClassID" );
+ aArgs.remove( u"ClassID"_ustr );
}
// Everything which now is still present in the arguments is passed to the embedded object
const Sequence< PropertyValue > aCreationArgs( aArgs.getPropertyValues() );
@@ -218,9 +251,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
const bool bNeedClassID = !aClassID.hasElements() && sURL.isEmpty() ;
if ( xCopyFrom.is() )
{
- Sequence<Any> aIni(2);
- aIni[0] <<= getContainerStorage();
- aIni[1] <<= sPersistentName;
+ Sequence<Any> aIni{ Any(getContainerStorage()), Any(sPersistentName) };
Command aCommand;
aCommand.Name = "copyTo";
aCommand.Argument <<= aIni;
@@ -245,7 +276,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
::comphelper::MimeConfigurationHelper aConfigHelper( m_aContext );
const Sequence< NamedValue > aProps( aConfigHelper.GetObjectPropsByDocumentName( sDocServiceName ) );
const ::comphelper::NamedValueCollection aMediaTypeProps( aProps );
- aClassID = aMediaTypeProps.getOrDefault( "ClassID", Sequence< sal_Int8 >() );
+ aClassID = aMediaTypeProps.getOrDefault( u"ClassID"_ustr, Sequence< sal_Int8 >() );
}
}
}
@@ -279,8 +310,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
if ( !sURL.isEmpty() )
{
- Sequence<Any> aIni(2);
- aIni[0] <<= sURL;
+ Sequence<Any> aIni{ Any(sURL) };
Command aCommand;
aCommand.Name = "insert";
aCommand.Argument <<= aIni;
@@ -293,14 +323,12 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
}
else if ( ServiceSpecifier == SERVICE_NAME_FORM_COLLECTION || SERVICE_NAME_REPORT_COLLECTION == ServiceSpecifier )
{
- const Any* pBegin = _aArguments.getConstArray();
- const Any* pEnd = pBegin + _aArguments.getLength();
- PropertyValue aValue;
OUString sName;
Reference<XNameAccess> xCopyFrom;
- for(;pBegin != pEnd;++pBegin)
+ for (auto& arg : _aArguments)
{
- *pBegin >>= aValue;
+ PropertyValue aValue;
+ arg >>= aValue;
if ( aValue.Name == PROPERTY_NAME)
{
aValue.Value >>= sName;
@@ -328,21 +356,18 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
// copy children
if ( xCopyFrom.is() )
{
- Sequence< OUString> aSeq = xCopyFrom->getElementNames();
- const OUString* elements = aSeq.getConstArray();
- const OUString* elementsEnd = elements + aSeq.getLength();
Reference<XContent> xObjectToCopy;
Reference<XMultiServiceFactory> xORB(xContent,UNO_QUERY);
OSL_ENSURE(xORB.is(),"No service factory given");
if ( xORB.is() )
{
- for(;elements != elementsEnd;++elements)
+ for (auto& element : xCopyFrom->getElementNames())
{
- xCopyFrom->getByName(*elements) >>= xObjectToCopy;
+ xCopyFrom->getByName(element) >>= xObjectToCopy;
Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
- {"Name", Any(*elements)}, // set as folder
+ {"Name", Any(element)}, // set as folder
{"Parent", Any(xContent)},
{PROPERTY_EMBEDDEDOBJECT, Any(xObjectToCopy)},
}));
@@ -361,7 +386,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
Reference<XContent > xNew(xORB->createInstanceWithArguments(sServiceName,aArguments),UNO_QUERY);
Reference<XNameContainer> xNameContainer(xContent,UNO_QUERY);
if ( xNameContainer.is() )
- xNameContainer->insertByName(*elements,makeAny(xNew));
+ xNameContainer->insertByName(element, Any(xNew));
}
}
}
@@ -372,11 +397,12 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
Sequence< OUString > SAL_CALL ODocumentContainer::getAvailableServiceNames( )
{
- Sequence< OUString > aSe(3);
- aSe[0] = SERVICE_SDB_DOCUMENTDEFINITION;
- aSe[1] = SERVICE_NAME_FORM_COLLECTION;
- aSe[2] = SERVICE_NAME_REPORT_COLLECTION;
- return aSe;
+ return
+ {
+ SERVICE_SDB_DOCUMENTDEFINITION,
+ SERVICE_NAME_FORM_COLLECTION,
+ SERVICE_NAME_REPORT_COLLECTION
+ };
}
Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 CommandId, const Reference< XCommandEnvironment >& Environment )
@@ -390,7 +416,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -412,12 +438,12 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
aOpenCommand,
Environment );
aRet <<= xSet;
- }
+ }
else
{
// Unsupported.
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedOpenModeException(
+ Any( UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
sal_Int16( aOpenCommand.Mode ) ) ),
@@ -434,7 +460,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -445,11 +471,8 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
else if ( aCommand.Name == "delete" )
{
// delete
- Sequence< OUString> aSeq = getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
- removeByName(*pIter);
+ for (auto& name : getElementNames())
+ removeByName(name);
dispose();
}
@@ -460,10 +483,10 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
namespace
{
- bool lcl_queryContent(const OUString& _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName)
+ bool lcl_queryContent(std::u16string_view _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName)
{
sal_Int32 nIndex = 0;
- OUString sName = _sName.getToken(0,'/',nIndex);
+ OUString sName( o3tl::getToken(_sName,0,'/',nIndex) );
bool bRet = _xNameContainer->hasByName(sName);
if ( bRet )
{
@@ -471,7 +494,7 @@ namespace
_rRet = _xNameContainer->getByName(_sSimpleName);
while ( nIndex != -1 && bRet )
{
- sName = _sName.getToken(0,'/',nIndex);
+ sName = o3tl::getToken(_sName,0,'/',nIndex);
_xNameContainer.set(_rRet,UNO_QUERY);
bRet = _xNameContainer.is();
if ( bRet )
@@ -518,12 +541,12 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const
Command aCommand;
::comphelper::NamedValueCollection aArgs( Arguments );
- aCommand.Name = aArgs.getOrDefault( "OpenMode", OUString("open") );
- aArgs.remove( "OpenMode" );
+ aCommand.Name = aArgs.getOrDefault( u"OpenMode"_ustr, u"open"_ustr );
+ aArgs.remove( u"OpenMode"_ustr );
OpenCommandArgument2 aOpenCommand;
aOpenCommand.Mode = OpenMode::DOCUMENT;
- aArgs.put( "OpenCommandArgument", aOpenCommand );
+ aArgs.put( u"OpenCommandArgument"_ustr, aOpenCommand );
aCommand.Argument <<= aArgs.getPropertyValues();
xComp.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY);
@@ -579,7 +602,7 @@ void SAL_CALL ODocumentContainer::insertByHierarchicalName( const OUString& _sNa
sal_Int32 index = sName.getLength();
OUString sMessage(
DBA_RES(RID_STR_NO_SUB_FOLDER).replaceFirst("$folder$",
- _sName.getToken(0,'/',index)));
+ o3tl::getToken(_sName, 0,'/',index)));
throw IllegalArgumentException( sMessage, *this, 1 );
}
@@ -635,7 +658,7 @@ OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const OUString& i
::rtl::Reference<OContentHelper> pContent;
try
{
- pContent = comphelper::getUnoTunnelImplementation<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
+ pContent = dynamic_cast<OContentHelper*>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ).get());
}
catch(const Exception&)
{
@@ -679,7 +702,7 @@ void SAL_CALL ODocumentContainer::revert( )
Reference< XStorage> ODocumentContainer::getContainerStorage() const
{
return m_pImpl->m_pDataSource
- ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
+ ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
: Reference< XStorage>();
}
@@ -718,8 +741,8 @@ void SAL_CALL ODocumentContainer::rename( const OUString& newName )
return;
sal_Int32 nHandle = PROPERTY_ID_NAME;
- Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
- Any aNew = makeAny(newName);
+ Any aOld(m_pImpl->m_aProps.aTitle);
+ Any aNew(newName);
aGuard.clear();
fire(&nHandle, &aNew, &aOld, 1, true );
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.hxx b/dbaccess/source/core/dataaccess/documentcontainer.hxx
index f704011f8025..d47709e80a33 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.hxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTCONTAINER_HXX
+#pragma once
#include <definitioncontainer.hxx>
#include <cppuhelper/implbase5.hxx>
@@ -135,6 +134,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 40fddc4dec36..9c3f4fe7a3b8 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -18,19 +18,22 @@
*/
#include "documentdefinition.hxx"
+#include "databasedocument.hxx"
#include <ModelImpl.hxx>
#include <stringconstants.hxx>
#include <sdbcoretools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
+#include <comphelper/compbase.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/types.hxx>
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -75,10 +78,10 @@
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionDisapprove.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
-#include <cppuhelper/compbase.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/mimeconfighelper.hxx>
@@ -144,22 +147,18 @@ namespace dbaccess
}
// OEmbedObjectHolder
- typedef ::cppu::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder;
+ typedef ::comphelper::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder;
- namespace {
-
- class OEmbedObjectHolder : public ::cppu::BaseMutex
- ,public TEmbedObjectHolder
+ class OEmbedObjectHolder : public TEmbedObjectHolder
{
Reference< XEmbeddedObject > m_xBroadCaster;
ODocumentDefinition* m_pDefinition;
bool m_bInStateChange;
protected:
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
public:
OEmbedObjectHolder(const Reference< XEmbeddedObject >& _xBroadCaster,ODocumentDefinition* _pDefinition)
- : TEmbedObjectHolder(m_aMutex)
- ,m_xBroadCaster(_xBroadCaster)
+ : m_xBroadCaster(_xBroadCaster)
,m_pDefinition(_pDefinition)
,m_bInStateChange(false)
{
@@ -176,9 +175,7 @@ namespace dbaccess
virtual void SAL_CALL disposing( const lang::EventObject& Source ) override;
};
- }
-
- void SAL_CALL OEmbedObjectHolder::disposing()
+ void OEmbedObjectHolder::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
if ( m_xBroadCaster.is() )
m_xBroadCaster->removeStateChangeListener(this);
@@ -373,7 +370,7 @@ OUString ODocumentDefinition::GetDocumentServiceFromMediaType( const OUString& _
OUString aEntryDocName;
if ( ( xObjConfig->getByName( classId ) >>= xObjectProps ) && xObjectProps.is()
- && ( xObjectProps->getByName("ObjectDocumentServiceName") >>= aEntryDocName )
+ && ( xObjectProps->getByName(u"ObjectDocumentServiceName"_ustr) >>= aEntryDocName )
&& aEntryDocName == sResult )
{
_rClassId = comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation(classId);
@@ -386,9 +383,9 @@ OUString ODocumentDefinition::GetDocumentServiceFromMediaType( const OUString& _
// alternative, shorter approach
const Sequence< NamedValue > aProps( aConfigHelper.GetObjectPropsByMediaType( _rMediaType ) );
const ::comphelper::NamedValueCollection aMediaTypeProps( aProps );
- const OUString sAlternativeResult = aMediaTypeProps.getOrDefault( "ObjectDocumentServiceName", OUString() );
+ const OUString sAlternativeResult = aMediaTypeProps.getOrDefault( u"ObjectDocumentServiceName"_ustr, OUString() );
OSL_ENSURE( sAlternativeResult == sResult, "ODocumentDefinition::GetDocumentServiceFromMediaType: failed, this approach is *not* equivalent (1)!" );
- const Sequence< sal_Int8 > aAlternativeClassID = aMediaTypeProps.getOrDefault( "ClassID", Sequence< sal_Int8 >() );
+ const Sequence< sal_Int8 > aAlternativeClassID = aMediaTypeProps.getOrDefault( u"ClassID"_ustr, Sequence< sal_Int8 >() );
OSL_ENSURE( aAlternativeClassID == _rClassId, "ODocumentDefinition::GetDocumentServiceFromMediaType: failed, this approach is *not* equivalent (2)!" );
#endif
}
@@ -463,7 +460,7 @@ void SAL_CALL ODocumentDefinition::disposing()
::comphelper::disposeComponent(m_xListener);
if ( m_bRemoveListener )
{
- Reference<util::XCloseable> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate(),UNO_QUERY);
+ rtl::Reference<ODatabaseDocument> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate());
if ( xCloseable.is() )
xCloseable->removeCloseListener(this);
}
@@ -474,21 +471,28 @@ css::uno::Sequence<sal_Int8> ODocumentDefinition::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base);
+css::uno::Sequence< css::uno::Type > ODocumentDefinition::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OContentHelper::getTypes( ),
+ OPropertyStateContainer::getTypes( ),
+ ODocumentDefinition_Base::getTypes( )
+ );
+}
IMPLEMENT_FORWARD_XINTERFACE3( ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base)
void ODocumentDefinition::registerProperties()
{
-#define REGISTER_PROPERTY( name, location ) \
- registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::READONLY, &location, cppu::UnoType<decltype(location)>::get() );
+ registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::CONSTRAINED | PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ &m_pImpl->m_aProps.aTitle, cppu::UnoType<decltype(m_pImpl->m_aProps.aTitle)>::get());
+
+ registerProperty(PROPERTY_AS_TEMPLATE, PROPERTY_ID_AS_TEMPLATE, PropertyAttribute::READONLY, &m_pImpl->m_aProps.bAsTemplate,
+ cppu::UnoType<decltype(m_pImpl->m_aProps.bAsTemplate)>::get());
-#define REGISTER_PROPERTY_BV( name, location ) \
- registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::CONSTRAINED | PropertyAttribute::BOUND | PropertyAttribute::READONLY, &location, cppu::UnoType<decltype(location)>::get() );
+ registerProperty(PROPERTY_PERSISTENT_NAME, PROPERTY_ID_PERSISTENT_NAME, PropertyAttribute::READONLY, &m_pImpl->m_aProps.sPersistentName,
+ cppu::UnoType<decltype(m_pImpl->m_aProps.sPersistentName)>::get());
- REGISTER_PROPERTY_BV( NAME, m_pImpl->m_aProps.aTitle );
- REGISTER_PROPERTY ( AS_TEMPLATE, m_pImpl->m_aProps.bAsTemplate );
- REGISTER_PROPERTY ( PERSISTENT_NAME, m_pImpl->m_aProps.sPersistentName );
- REGISTER_PROPERTY ( IS_FORM, m_bForm );
+ registerProperty(PROPERTY_IS_FORM, PROPERTY_ID_IS_FORM, PropertyAttribute::READONLY, &m_bForm, cppu::UnoType<decltype(m_bForm)>::get());
}
void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const
@@ -498,11 +502,8 @@ void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int3
OUString sPersistentPath;
if ( !m_pImpl->m_aProps.sPersistentName.isEmpty() )
{
- OUStringBuffer aBuffer;
- aBuffer.append( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) );
- aBuffer.append( '/' );
- aBuffer.append( m_pImpl->m_aProps.sPersistentName );
- sPersistentPath = aBuffer.makeStringAndClear();
+ sPersistentPath = ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
+ + "/" + m_pImpl->m_aProps.sPersistentName;
}
o_rValue <<= sPersistentPath;
return;
@@ -529,11 +530,10 @@ IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const
describeProperties( aProps );
// properties not maintained by our base class
- Sequence< Property > aManualProps( 1 );
- aManualProps[0].Name = PROPERTY_PERSISTENT_PATH;
- aManualProps[0].Handle = PROPERTY_ID_PERSISTENT_PATH;
- aManualProps[0].Type = ::cppu::UnoType<OUString>::get();
- aManualProps[0].Attributes = PropertyAttribute::READONLY;
+ Sequence< Property > aManualProps{ { /* Name */ PROPERTY_PERSISTENT_PATH,
+ /* Handle */ PROPERTY_ID_PERSISTENT_PATH,
+ /* Type */ ::cppu::UnoType<OUString>::get(),
+ /* Attributes */ PropertyAttribute::READONLY } };
return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) );
}
@@ -596,7 +596,7 @@ void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow( const bool i_bR
// ensure that we ourself are kept alive as long as the embedded object's frame is
// opened
- LifetimeCoupler::couple( *this, xFrame.get() );
+ LifetimeCoupler::couple( *this, xFrame );
// init the edit view
if ( m_bForm && m_bOpenInDesign && !i_bReactivated )
@@ -669,7 +669,7 @@ namespace
{
Reference< XPropertySet > xPropSet( xFrame, UNO_QUERY_THROW );
m_xLayoutManager.set(
- xPropSet->getPropertyValue( "LayoutManager" ),
+ xPropSet->getPropertyValue( u"LayoutManager"_ustr ),
UNO_QUERY_THROW );
m_xLayoutManager->lock();
@@ -715,14 +715,14 @@ void ODocumentDefinition::impl_initFormEditView( const Reference< XController >&
LayoutManagerLock aLockLayout( _rxController );
// setting of the visual properties
- xViewSettings->setPropertyValue("ShowRulers",makeAny(true));
- xViewSettings->setPropertyValue("ShowVertRuler",makeAny(true));
- xViewSettings->setPropertyValue("ShowHoriRuler",makeAny(true));
- xViewSettings->setPropertyValue("IsRasterVisible",makeAny(true));
- xViewSettings->setPropertyValue("IsSnapToRaster",makeAny(true));
- xViewSettings->setPropertyValue("ShowOnlineLayout",makeAny(true));
- xViewSettings->setPropertyValue("RasterSubdivisionX",makeAny(sal_Int32(5)));
- xViewSettings->setPropertyValue("RasterSubdivisionY",makeAny(sal_Int32(5)));
+ xViewSettings->setPropertyValue(u"ShowRulers"_ustr,Any(true));
+ xViewSettings->setPropertyValue(u"ShowVertRuler"_ustr,Any(true));
+ xViewSettings->setPropertyValue(u"ShowHoriRuler"_ustr,Any(true));
+ xViewSettings->setPropertyValue(u"IsRasterVisible"_ustr,Any(true));
+ xViewSettings->setPropertyValue(u"IsSnapToRaster"_ustr,Any(true));
+ xViewSettings->setPropertyValue(u"ShowOnlineLayout"_ustr,Any(true));
+ xViewSettings->setPropertyValue(u"RasterSubdivisionX"_ustr,Any(sal_Int32(5)));
+ xViewSettings->setPropertyValue(u"RasterSubdivisionY"_ustr,Any(sal_Int32(5)));
}
catch( const Exception& )
{
@@ -775,9 +775,9 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
// for the document, default to the interaction handler as used for loading the DB doc
// This might be overwritten below, when examining _rOpenArgument.
const ::comphelper::NamedValueCollection& aDBDocArgs( m_pImpl->m_pDataSource->getMediaDescriptor() );
- Reference< XInteractionHandler > xHandler( aDBDocArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
+ Reference< XInteractionHandler > xHandler( aDBDocArgs.getOrDefault( u"InteractionHandler"_ustr, Reference< XInteractionHandler >() ) );
if ( xHandler.is() )
- aDocumentArgs.put( "InteractionHandler", xHandler );
+ aDocumentArgs.put( u"InteractionHandler"_ustr, xHandler );
::std::optional< sal_Int16 > aDocumentMacroMode;
@@ -786,29 +786,27 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
Sequence< PropertyValue > aArguments;
if ( _rOpenArgument >>= aArguments )
{
- const PropertyValue* pIter = aArguments.getConstArray();
- const PropertyValue* pEnd = pIter + aArguments.getLength();
- for ( ;pIter != pEnd; ++pIter )
+ for (auto& arg : aArguments)
{
- if ( pIter->Name == PROPERTY_ACTIVE_CONNECTION )
+ if (arg.Name == PROPERTY_ACTIVE_CONNECTION)
{
- xConnection.set( pIter->Value, UNO_QUERY );
+ xConnection.set(arg.Value, UNO_QUERY);
continue;
}
- if ( lcl_extractOpenMode( pIter->Value, nOpenMode ) )
+ if (lcl_extractOpenMode(arg.Value, nOpenMode))
continue;
- if ( pIter->Name == "MacroExecutionMode" )
+ if (arg.Name == "MacroExecutionMode")
{
sal_Int16 nMacroExecMode( !aDocumentMacroMode ? MacroExecMode::USE_CONFIG : *aDocumentMacroMode );
- OSL_VERIFY( pIter->Value >>= nMacroExecMode );
+ OSL_VERIFY(arg.Value >>= nMacroExecMode);
aDocumentMacroMode = nMacroExecMode;
continue;
}
// unknown argument -> pass to the loaded document
- aDocumentArgs.put( pIter->Name, pIter->Value );
+ aDocumentArgs.put(arg.Name, arg.Value);
}
}
}
@@ -846,7 +844,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
// So, in such a case, and with 2. above, we would silently execute those macros,
// regardless of the global security settings - which would be a security issue, of
// course.
- if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eNoMacros )
+ if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::NONE )
{
// this is case 2. from above
// So, pass a USE_CONFIG to the to-be-loaded document. This means that
@@ -865,7 +863,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
aDocumentMacroMode = bExecuteDBDocMacros ? MacroExecMode::ALWAYS_EXECUTE_NO_WARN
: MacroExecMode::NEVER_EXECUTE;
}
- aDocumentArgs.put( "MacroExecutionMode", *aDocumentMacroMode );
+ aDocumentArgs.put( u"MacroExecutionMode"_ustr, *aDocumentMacroMode );
if ( ( nOpenMode == OpenMode::ALL )
|| ( nOpenMode == OpenMode::FOLDERS )
@@ -876,14 +874,14 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
{
// not supported
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedOpenModeException(
+ Any( UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
sal_Int16( nOpenMode ) ) ),
_rxEnvironment );
// Unreachable
OSL_FAIL( "unreachable" );
- }
+ }
OSL_ENSURE( !m_pImpl->m_aProps.sPersistentName.isEmpty(),
"ODocumentDefinition::onCommandOpenSomething: no persistent name - cannot load!" );
@@ -892,8 +890,8 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
// embedded objects themself do not support the hidden flag. We implement support for
// it by changing the STATE to RUNNING only, instead of ACTIVE.
- bool bOpenHidden = aDocumentArgs.getOrDefault( "Hidden", false );
- aDocumentArgs.remove( "Hidden" );
+ bool bOpenHidden = aDocumentArgs.getOrDefault( u"Hidden"_ustr, false );
+ aDocumentArgs.remove( u"Hidden"_ustr );
loadEmbeddedObject( xConnection, Sequence< sal_Int8 >(), aDocumentArgs.getPropertyValues(), false, !m_bOpenInDesign );
OSL_ENSURE( m_xEmbeddedObject.is(), "ODocumentDefinition::onCommandOpenSomething: what's this?" );
@@ -907,9 +905,9 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
if ( xModule.is() )
{
if ( m_bForm )
- xModule->setIdentifier( "com.sun.star.sdb.FormDesign" );
+ xModule->setIdentifier( u"com.sun.star.sdb.FormDesign"_ustr );
else if ( !xReportDefinition.is() )
- xModule->setIdentifier( "com.sun.star.text.TextDocument" );
+ xModule->setIdentifier( u"com.sun.star.text.TextDocument"_ustr );
updateDocumentTitle();
}
@@ -919,13 +917,13 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
{
// we are in ReadOnly mode
// we would like to open the Writer or Calc with the report direct, without design it.
- Reference< report::XReportEngine > xReportEngine( m_aContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.report.OReportEngineJFree", m_aContext), UNO_QUERY_THROW );
+ Reference< report::XReportEngine > xReportEngine( m_aContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.report.OReportEngineJFree"_ustr, m_aContext), UNO_QUERY_THROW );
xReportEngine->setReportDefinition(xReportDefinition);
xReportEngine->setActiveConnection(m_xLastKnownConnection);
if ( bOpenHidden )
- return makeAny( xReportEngine->createDocumentModel() );
- return makeAny( xReportEngine->createDocumentAlive( nullptr ) );
+ return Any( xReportEngine->createDocumentModel() );
+ return Any( xReportEngine->createDocumentAlive( nullptr ) );
}
if ( _bActivate && !bOpenHidden )
@@ -937,13 +935,13 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
else
{
// ensure that we ourself are kept alive as long as the document is open
- LifetimeCoupler::couple( *this, xModel.get() );
+ LifetimeCoupler::couple( *this, xModel );
}
if ( !m_bForm && m_pImpl->m_aProps.bAsTemplate && !m_bOpenInDesign )
ODocumentDefinition::fillReportData( m_aContext, getComponent(), xConnection );
- return makeAny( xModel );
+ return Any( xModel );
}
Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 CommandId, const Reference< XCommandEnvironment >& Environment )
@@ -990,7 +988,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
if ( !bIsAliveNewStyleReport )
{
impl_onActivateEmbeddedObject_nothrow( true );
- return makeAny( getComponent() );
+ return Any( getComponent() );
}
}
}
@@ -1011,7 +1009,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -1037,7 +1035,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
{
OSL_FAIL( "Wrong argument count!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -1108,7 +1106,7 @@ namespace
try
{
Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
- xFormProps->setPropertyValue( PROPERTY_DATASOURCENAME, makeAny( OUString() ) );
+ xFormProps->setPropertyValue( PROPERTY_DATASOURCENAME, Any( OUString() ) );
}
catch( const Exception& )
{
@@ -1154,7 +1152,7 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc
Sequence<OUString> aProps { PROPERTY_URL };
ucbhelper::cancelCommandExecution(
- makeAny( MissingPropertiesException(
+ Any( MissingPropertiesException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
aProps ) ),
@@ -1168,9 +1166,9 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc
if ( xStorage.is() )
{
Reference< XEmbeddedObjectCreator> xEmbedFactory = EmbeddedObjectCreator::create(m_aContext);
- Sequence<PropertyValue> aEmpty,aMediaDesc(1);
- aMediaDesc[0].Name = PROPERTY_URL;
- aMediaDesc[0].Value <<= _sURL;
+ Sequence<PropertyValue> aEmpty;
+ Sequence<PropertyValue> aMediaDesc{ comphelper::makePropertyValue(PROPERTY_URL,
+ _sURL) };
m_xEmbeddedObject.set(xEmbedFactory->createInstanceInitFromMediaDescriptor( xStorage
,m_pImpl->m_aProps.sPersistentName
,aMediaDesc
@@ -1224,11 +1222,10 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
aRequest.Content.set(m_xParentContainer,UNO_QUERY);
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
// two continuations allowed: OK and Cancel
- ODocumentSaveContinuation* pDocuSave = nullptr;
+ rtl::Reference<ODocumentSaveContinuation> pDocuSave;
if ( m_pImpl->m_aProps.aTitle.isEmpty() )
{
@@ -1237,21 +1234,21 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
if ( _bApprove )
{
- OInteraction< XInteractionApprove >* pApprove = new OInteraction< XInteractionApprove >;
+ rtl::Reference<OInteraction< XInteractionApprove >> pApprove = new OInteraction< XInteractionApprove >;
pRequest->addContinuation(pApprove);
}
- OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >;
+ rtl::Reference<OInteraction< XInteractionDisapprove >> pDisApprove = new OInteraction< XInteractionDisapprove >;
pRequest->addContinuation(pDisApprove);
- OInteractionAbort* pAbort = new OInteractionAbort;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
pRequest->addContinuation(pAbort);
Reference<XWindow> xDialogParent(rDialogParent, UNO_QUERY);
// create the handler, let it handle the request
Reference<XInteractionHandler2> xHandler(InteractionHandler::createWithParent(m_aContext, xDialogParent));
- xHandler->handle(xRequest);
+ xHandler->handle(pRequest);
if ( pAbort->wasSelected() )
return false;
@@ -1266,7 +1263,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
m_pImpl->m_aProps.aTitle = pDocuSave->getName();
Reference< XContent> xContent = this;
- xNC->insertByName(pDocuSave->getName(),makeAny(xContent));
+ xNC->insertByName(pDocuSave->getName(),Any(xContent));
updateDocumentTitle();
}
@@ -1282,7 +1279,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
catch(const Exception&)
{
- OSL_FAIL("ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
}
return true;
}
@@ -1311,20 +1308,19 @@ void ODocumentDefinition::saveAs()
aRequest.Name = m_pImpl->m_aProps.aTitle;
aRequest.Content.set(m_xParentContainer,UNO_QUERY);
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
// two continuations allowed: OK and Cancel
- ODocumentSaveContinuation* pDocuSave = new ODocumentSaveContinuation;
+ rtl::Reference<ODocumentSaveContinuation> pDocuSave = new ODocumentSaveContinuation;
pRequest->addContinuation(pDocuSave);
- OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >;
+ rtl::Reference<OInteraction< XInteractionDisapprove >> pDisApprove = new OInteraction< XInteractionDisapprove >;
pRequest->addContinuation(pDisApprove);
- OInteractionAbort* pAbort = new OInteractionAbort;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
pRequest->addContinuation(pAbort);
// create the handler, let it handle the request
Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) );
- xHandler->handle(xRequest);
+ xHandler->handle(pRequest);
if ( pAbort->wasSelected() )
return;
@@ -1342,7 +1338,7 @@ void ODocumentDefinition::saveAs()
{
Reference< XStorage> xStorage = getContainerStorage();
- OUString sPersistentName = ::dbtools::createUniqueName(xStorage,"Obj");
+ OUString sPersistentName = ::dbtools::createUniqueName(xStorage,u"Obj"_ustr);
xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName);
OUString sOldName = m_pImpl->m_aProps.aTitle;
@@ -1358,7 +1354,7 @@ void ODocumentDefinition::saveAs()
Reference< XMultiServiceFactory > xORB( m_xParentContainer, UNO_QUERY_THROW );
Reference< XInterface > xComponent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aArguments ) );
Reference< XNameContainer > xNameContainer( m_xParentContainer, UNO_QUERY_THROW );
- xNameContainer->insertByName( sOldName, makeAny( xComponent ) );
+ xNameContainer->insertByName( sOldName, Any( xComponent ) );
}
catch(const Exception&)
{
@@ -1376,7 +1372,7 @@ void ODocumentDefinition::saveAs()
}
catch(const Exception&)
{
- OSL_FAIL("ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
}
}
@@ -1384,25 +1380,25 @@ namespace
{
void lcl_putLoadArgs( ::comphelper::NamedValueCollection& _io_rArgs, const optional_bool& _bSuppressMacros, const optional_bool& _bReadOnly )
{
- if ( !!_bSuppressMacros )
+ if ( _bSuppressMacros.has_value() )
{
if ( *_bSuppressMacros )
{
// if we're to suppress macros, do exactly this
- _io_rArgs.put( "MacroExecutionMode", MacroExecMode::NEVER_EXECUTE );
+ _io_rArgs.put( u"MacroExecutionMode"_ustr, MacroExecMode::NEVER_EXECUTE );
}
else
{
// otherwise, put the setting only if not already present
- if ( !_io_rArgs.has( "MacroExecutionMode" ) )
+ if ( !_io_rArgs.has( u"MacroExecutionMode"_ustr ) )
{
- _io_rArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
+ _io_rArgs.put( u"MacroExecutionMode"_ustr, MacroExecMode::USE_CONFIG );
}
}
}
- if ( !!_bReadOnly )
- _io_rArgs.put( "ReadOnly", *_bReadOnly );
+ if ( _bReadOnly.has_value() )
+ _io_rArgs.put( u"ReadOnly"_ustr, *_bReadOnly );
}
}
@@ -1410,7 +1406,7 @@ namespace
{
Reference< XFrame > lcl_getDatabaseDocumentFrame( ODatabaseModelImpl const & _rImpl )
{
- Reference< XModel > xDatabaseDocumentModel( _rImpl.getModel_noCreate() );
+ rtl::Reference< ODatabaseDocument > xDatabaseDocumentModel( _rImpl.getModel_noCreate() );
Reference< XController > xDatabaseDocumentController;
if ( xDatabaseDocumentModel.is() )
@@ -1427,7 +1423,7 @@ namespace
bool ODocumentDefinition::objectSupportsEmbeddedScripts() const
{
bool bAllowDocumentMacros = !m_pImpl->m_pDataSource
- || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eSubDocumentMacros );
+ || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::SubDocument );
// if *any* of the objects of the database document already has macros, we
// continue to allow it to have them, until the user does a migration.
@@ -1446,16 +1442,14 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property
{
::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments );
- const char* const pObjectDescriptorArgs[] =
- {
- "RecoveryStorage"
- };
- for (const char* pObjectDescriptorArg : pObjectDescriptorArgs)
+ static const std::u16string_view sObjectDescriptorArgs[] = { u"RecoveryStorage" };
+ for (const auto& rObjectDescriptorArg : sObjectDescriptorArgs)
{
- if ( aOpenCommandArguments.has( pObjectDescriptorArg ) )
+ const OUString sObjectDescriptorArg(rObjectDescriptorArg);
+ if ( aOpenCommandArguments.has( sObjectDescriptorArg ) )
{
- o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArg, aOpenCommandArguments.get( pObjectDescriptorArg ) );
- aOpenCommandArguments.remove( pObjectDescriptorArg );
+ o_rEmbeddedObjectDescriptor.put( sObjectDescriptorArg, aOpenCommandArguments.get( sObjectDescriptorArg ) );
+ aOpenCommandArguments.remove( sObjectDescriptorArg );
}
}
@@ -1473,18 +1467,17 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
}
m_pInterceptor = new OInterceptor( this );
- Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor.get();
::comphelper::NamedValueCollection aEmbeddedDescriptor;
- aEmbeddedDescriptor.put( "OutplaceDispatchInterceptor", xInterceptor );
+ aEmbeddedDescriptor.put( u"OutplaceDispatchInterceptor"_ustr, Reference<XDispatchProviderInterceptor>(m_pInterceptor) );
::comphelper::NamedValueCollection aMediaDesc;
separateOpenCommandArguments( i_rOpenCommandArguments, aMediaDesc, aEmbeddedDescriptor );
// create the OutplaceFrameProperties, and put them into the descriptor of the embedded object
::comphelper::NamedValueCollection OutplaceFrameProperties;
- OutplaceFrameProperties.put( "TopWindow", true );
- OutplaceFrameProperties.put( "SupportPersistentWindowState", true );
+ OutplaceFrameProperties.put( u"TopWindow"_ustr, true );
+ OutplaceFrameProperties.put( u"SupportPersistentWindowState"_ustr, true );
Reference< XFrame > xParentFrame;
if ( m_pImpl->m_pDataSource )
@@ -1493,7 +1486,7 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
{ // i87957 we need a parent frame
Reference< XDesktop2 > xDesktop = Desktop::create( m_aContext );
xParentFrame.set( xDesktop, UNO_QUERY_THROW );
- Reference<util::XCloseable> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate(),UNO_QUERY);
+ rtl::Reference<ODatabaseDocument> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate());
if ( xCloseable.is() )
{
xCloseable->addCloseListener(this);
@@ -1502,15 +1495,15 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
}
OSL_ENSURE( xParentFrame.is(), "ODocumentDefinition::fillLoadArgs: no parent frame!" );
if ( xParentFrame.is() )
- OutplaceFrameProperties.put( "ParentFrame", xParentFrame );
+ OutplaceFrameProperties.put( u"ParentFrame"_ustr, xParentFrame );
- aEmbeddedDescriptor.put( "OutplaceFrameProperties", OutplaceFrameProperties.getNamedValues() );
+ aEmbeddedDescriptor.put( u"OutplaceFrameProperties"_ustr, OutplaceFrameProperties.getNamedValues() );
// tell the embedded object to have (or not have) script support
- aEmbeddedDescriptor.put( "EmbeddedScriptSupport", objectSupportsEmbeddedScripts() );
+ aEmbeddedDescriptor.put( u"EmbeddedScriptSupport"_ustr, objectSupportsEmbeddedScripts() );
// tell the embedded object to not participate in the document recovery game - the DB doc will handle it
- aEmbeddedDescriptor.put( "DocumentRecoverySupport", false );
+ aEmbeddedDescriptor.put( u"DocumentRecoverySupport"_ustr, false );
// pass the descriptor of the embedded object to the caller
aEmbeddedDescriptor >>= _out_rEmbeddedObjectDescriptor;
@@ -1518,15 +1511,15 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
// create the ComponentData, and put it into the document's media descriptor
{
::comphelper::NamedValueCollection aComponentData;
- aComponentData.put( "ActiveConnection", _xConnection );
- aComponentData.put( "ApplyFormDesignMode", !_bReadOnly );
- aMediaDesc.put( "ComponentData", aComponentData.getPropertyValues() );
+ aComponentData.put( u"ActiveConnection"_ustr, _xConnection );
+ aComponentData.put( u"ApplyFormDesignMode"_ustr, !_bReadOnly );
+ aMediaDesc.put( u"ComponentData"_ustr, aComponentData.getPropertyValues() );
}
if ( !m_pImpl->m_aProps.aTitle.isEmpty() )
- aMediaDesc.put( "DocumentTitle", m_pImpl->m_aProps.aTitle );
+ aMediaDesc.put( u"DocumentTitle"_ustr, m_pImpl->m_aProps.aTitle );
- aMediaDesc.put( "DocumentBaseURL", m_pImpl->m_pDataSource->getURL() );
+ aMediaDesc.put( u"DocumentBaseURL"_ustr, m_pImpl->m_pDataSource->getURL() );
// put the common load arguments into the document's media descriptor
lcl_putLoadArgs( aMediaDesc, optional_bool( _bSuppressMacros ), optional_bool( _bReadOnly ) );
@@ -1565,9 +1558,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName);
if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() )
{
- css::io::WrongFormatException aWFE;
- aWFE.Message = DBA_RES( RID_STR_MISSING_EXTENSION );
- throw aWFE;
+ throw css::io::WrongFormatException(DBA_RES(RID_STR_MISSING_EXTENSION));
}
}
if ( !aClassID.hasElements() )
@@ -1601,8 +1592,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
{
m_pClientHelper = new OEmbeddedClientHelper;
}
- Reference<XEmbeddedClient> xClient = m_pClientHelper.get();
- m_xEmbeddedObject->setClientSite(xClient);
+ m_xEmbeddedObject->setClientSite(m_pClientHelper);
m_xEmbeddedObject->changeState(EmbedStates::RUNNING);
if ( bSetSize )
{
@@ -1623,8 +1613,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
{
m_pClientHelper = new OEmbeddedClientHelper;
}
- Reference<XEmbeddedClient> xClient = m_pClientHelper.get();
- m_xEmbeddedObject->setClientSite(xClient);
+ m_xEmbeddedObject->setClientSite(m_pClientHelper);
Sequence< PropertyValue > aEmbeddedObjectDescriptor;
Sequence< PropertyValue > aLoadArgs( fillLoadArgs(
@@ -1779,7 +1768,7 @@ namespace
{
Reference< XDatabaseDocumentUI > xUI;
- Reference< XModel > xModel( _rModelImpl.getModel_noCreate() );
+ rtl::Reference< ODatabaseDocument > xModel( _rModelImpl.getModel_noCreate() );
if ( xModel.is() )
xUI.set( xModel->getCurrentController(), UNO_QUERY );
return xUI;
@@ -1896,11 +1885,7 @@ OUString SAL_CALL ODocumentDefinition::getHierarchicalName()
OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const OUString& i_rRelativeName )
{
- OUStringBuffer aBuffer;
- aBuffer.append( getHierarchicalName() );
- aBuffer.append( '/' );
- aBuffer.append( i_rRelativeName );
- return aBuffer.makeStringAndClear();
+ return getHierarchicalName() + "/" + i_rRelativeName;
}
void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName )
@@ -1931,7 +1916,7 @@ void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName )
Reference< XStorage> ODocumentDefinition::getContainerStorage() const
{
return m_pImpl->m_pDataSource
- ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
+ ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
: Reference< XStorage>();
}
@@ -2015,9 +2000,9 @@ void ODocumentDefinition::fillReportData( const Reference< XComponentContext >&
}));
try
{
- Reference< XJobExecutor > xExecuteable(
- _rContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.wizards.report.CallReportWizard", aArgs, _rContext), UNO_QUERY_THROW );
- xExecuteable->trigger( "fill" );
+ Reference< XJobExecutor > xExecutable(
+ _rContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.wizards.report.CallReportWizard"_ustr, aArgs, _rContext), UNO_QUERY_THROW );
+ xExecutable->trigger( u"fill"_ustr );
}
catch( const Exception& )
{
@@ -2036,12 +2021,12 @@ void ODocumentDefinition::updateDocumentTitle()
sName = DBA_RES( RID_STR_FORM );
else
sName = DBA_RES( RID_STR_REPORT );
- Reference< XUntitledNumbers > xUntitledProvider(m_pImpl->m_pDataSource->getModel_noCreate(), UNO_QUERY );
+ rtl::Reference< ODatabaseDocument > xUntitledProvider(m_pImpl->m_pDataSource->getModel_noCreate() );
if ( xUntitledProvider.is() )
sName += OUString::number( xUntitledProvider->leaseNumber(getComponent()) );
}
- Reference< XTitle > xDatabaseDocumentModel(m_pImpl->m_pDataSource->getModel_noCreate(),uno::UNO_QUERY);
+ rtl::Reference< ODatabaseDocument > xDatabaseDocumentModel(m_pImpl->m_pDataSource->getModel_noCreate());
if ( xDatabaseDocumentModel.is() )
sName = xDatabaseDocumentModel->getTitle() + " : " + sName;
}
@@ -2081,8 +2066,8 @@ void ODocumentDefinition::firePropertyChange( sal_Int32 i_nHandle, const Any& i_
NameChangeNotifier::NameChangeNotifier( ODocumentDefinition& i_rDocumentDefinition, const OUString& i_rNewName,
::osl::ResettableMutexGuard& i_rClearForNotify )
:m_rDocumentDefinition( i_rDocumentDefinition )
- ,m_aOldValue( makeAny( i_rDocumentDefinition.getCurrentName() ) )
- ,m_aNewValue( makeAny( i_rNewName ) )
+ ,m_aOldValue( Any( i_rDocumentDefinition.getCurrentName() ) )
+ ,m_aNewValue( Any( i_rNewName ) )
,m_rClearForNotify( i_rClearForNotify )
{
impl_fireEvent_throw( true );
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx
index 9910d61d8d02..b26ca698f412 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.hxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTDEFINITION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTDEFINITION_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -45,7 +44,7 @@ namespace comphelper
namespace dbaccess
{
-
+ class OEmbedObjectHolder;
class OInterceptor;
class OEmbeddedClientHelper;
// ODocumentDefinition - a database "document" which is simply a link to a real
@@ -64,7 +63,7 @@ class ODocumentDefinition
,public ODocumentDefinition_Base
{
css::uno::Reference< css::embed::XEmbeddedObject> m_xEmbeddedObject;
- css::uno::Reference< css::embed::XStateChangeListener > m_xListener;
+ rtl::Reference< OEmbedObjectHolder > m_xListener;
css::uno::Reference< css::sdbc::XConnection > m_xLastKnownConnection;
rtl::Reference<OInterceptor> m_pInterceptor;
@@ -208,7 +207,7 @@ private:
@throws css::uno::RuntimeException
*/
static void impl_removeFrameFromDesktop_throw(
- const css::uno::Reference< css::uno::XComponentContext >& _rContxt,
+ const css::uno::Reference< css::uno::XComponentContext >& _rContext,
const css::uno::Reference< css::frame::XFrame >& _rxFrame
);
@@ -354,6 +353,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTDEFINITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
index 3d16ee6ebb79..aebaf385e64b 100644
--- a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
+++ b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
@@ -18,6 +18,7 @@
*/
#include "documenteventexecutor.hxx"
+#include "databasedocument.hxx"
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -27,7 +28,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/weakref.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
namespace dbaccess
@@ -57,24 +58,14 @@ namespace dbaccess
using namespace ::com::sun::star;
- // DocumentEventExecutor_Data
- struct DocumentEventExecutor_Data
- {
- WeakReference< XEventsSupplier > xDocument;
- Reference< XURLTransformer > xURLTransformer;
-
- explicit DocumentEventExecutor_Data( const Reference< XEventsSupplier >& _rxDocument )
- :xDocument( _rxDocument )
- {
- }
- };
-
namespace
{
- void lcl_dispatchScriptURL_throw( DocumentEventExecutor_Data const & _rDocExecData,
+ void lcl_dispatchScriptURL_throw(
+ ::unotools::WeakReference< ODatabaseDocument > const & xWeakDocument,
+ css::uno::Reference< css::util::XURLTransformer > const & xURLTransformer,
const OUString& _rScriptURL, const DocumentEvent& _rTrigger )
{
- Reference< XModel > xDocument( _rDocExecData.xDocument.get(), UNO_QUERY_THROW );
+ rtl::Reference< ODatabaseDocument > xDocument( xWeakDocument.get() );
Reference< XController > xController( xDocument->getCurrentController() );
Reference< XDispatchProvider > xDispProv;
@@ -88,8 +79,8 @@ namespace dbaccess
URL aScriptURL;
aScriptURL.Complete = _rScriptURL;
- if ( _rDocExecData.xURLTransformer.is() )
- _rDocExecData.xURLTransformer->parseStrict( aScriptURL );
+ if ( xURLTransformer.is() )
+ xURLTransformer->parseStrict( aScriptURL );
// unfortunately, executing a script can trigger all kind of complex stuff, and unfortunately, not
// every component involved into this properly cares for thread safety. To be on the safe side,
@@ -112,20 +103,18 @@ namespace dbaccess
// DocumentEventExecutor
DocumentEventExecutor::DocumentEventExecutor( const Reference<XComponentContext> & _rContext,
- const Reference< XEventsSupplier >& _rxDocument )
- :m_pData( new DocumentEventExecutor_Data( _rxDocument ) )
+ const rtl::Reference< ODatabaseDocument >& _rxDocument )
+ :mxDocument( _rxDocument )
{
- Reference< XDocumentEventBroadcaster > xBroadcaster( _rxDocument, UNO_QUERY_THROW );
-
osl_atomic_increment( &m_refCount );
{
- xBroadcaster->addDocumentEventListener( this );
+ _rxDocument->addDocumentEventListener( this );
}
osl_atomic_decrement( &m_refCount );
try
{
- m_pData->xURLTransformer = URLTransformer::create(_rContext);
+ mxURLTransformer = URLTransformer::create(_rContext);
}
catch( const Exception& )
{
@@ -139,18 +128,16 @@ namespace dbaccess
void SAL_CALL DocumentEventExecutor::documentEventOccured( const DocumentEvent& Event )
{
- Reference< XEventsSupplier > xEventsSupplier( m_pData->xDocument.get(), UNO_QUERY );
- if ( !xEventsSupplier.is() )
+ rtl::Reference< ODatabaseDocument > xDocument( mxDocument.get() );
+ if ( !xDocument )
{
OSL_FAIL( "DocumentEventExecutor::documentEventOccurred: no document anymore, but still being notified?" );
return;
}
- Reference< XModel > xDocument( xEventsSupplier, UNO_QUERY_THROW );
-
try
{
- Reference< XNameAccess > xDocEvents( xEventsSupplier->getEvents(), UNO_SET_THROW );
+ Reference< XNameAccess > xDocEvents( xDocument->getEvents(), UNO_SET_THROW );
if ( !xDocEvents->hasByName( Event.EventName ) )
{
// this is worth an assertion: We are listener at the very same document which we just asked
@@ -162,10 +149,10 @@ namespace dbaccess
const ::comphelper::NamedValueCollection aScriptDescriptor( xDocEvents->getByName( Event.EventName ) );
OUString sEventType;
- bool bScriptAssigned = aScriptDescriptor.get_ensureType( "EventType", sEventType );
+ bool bScriptAssigned = aScriptDescriptor.get_ensureType( u"EventType"_ustr, sEventType );
OUString sScript;
- bScriptAssigned = bScriptAssigned && aScriptDescriptor.get_ensureType( "Script", sScript );
+ bScriptAssigned = bScriptAssigned && aScriptDescriptor.get_ensureType( u"Script"_ustr, sScript );
if ( !bScriptAssigned )
// no script is assigned to this event
@@ -179,7 +166,7 @@ namespace dbaccess
if ( bDispatchScriptURL && bNonEmptyScript )
{
- lcl_dispatchScriptURL_throw( *m_pData, sScript, Event );
+ lcl_dispatchScriptURL_throw( mxDocument, mxURLTransformer, sScript, Event );
}
}
catch( const RuntimeException& ) { throw; }
diff --git a/dbaccess/source/core/dataaccess/documenteventexecutor.hxx b/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
index 5246984ce97e..fd64a9d458cb 100644
--- a/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
+++ b/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
@@ -17,22 +17,20 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTEXECUTOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTEXECUTOR_HXX
+#pragma once
#include <com/sun/star/document/XDocumentEventListener.hpp>
-#include <com/sun/star/document/XEventsSupplier.hpp>
#include <cppuhelper/implbase.hxx>
-
-#include <memory>
+#include <unotools/weakref.hxx>
namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XURLTransformer; }
namespace dbaccess
{
+ class ODatabaseDocument;
- struct DocumentEventExecutor_Data;
// DocumentEventExecutor
typedef ::cppu::WeakImplHelper < css::document::XDocumentEventListener
> DocumentEventExecutor_Base;
@@ -41,7 +39,7 @@ namespace dbaccess
public:
DocumentEventExecutor(
const css::uno::Reference< css::uno::XComponentContext >& _rContext,
- const css::uno::Reference< css::document::XEventsSupplier >& _rxDocument );
+ const rtl::Reference< ODatabaseDocument >& _rxDocument );
protected:
virtual ~DocumentEventExecutor() override;
@@ -52,11 +50,10 @@ namespace dbaccess
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
private:
- std::unique_ptr< DocumentEventExecutor_Data > m_pData;
+ unotools::WeakReference< ODatabaseDocument > mxDocument;
+ css::uno::Reference< css::util::XURLTransformer > mxURLTransformer;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTEXECUTOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
index 16b46ad6ddf8..a5c678579253 100644
--- a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
+++ b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
@@ -22,9 +22,10 @@
#include <com/sun/star/frame/DoubleInitializationException.hpp>
#include <comphelper/asyncnotification.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/weak.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <vcl/svapp.hxx>
namespace dbaccess
{
@@ -39,9 +40,6 @@ namespace dbaccess
using namespace ::com::sun::star;
- // DocumentEventHolder
- typedef ::comphelper::EventHolder< DocumentEvent > DocumentEventHolder;
-
// DocumentEventNotifier_Impl
class DocumentEventNotifier_Impl : public ::comphelper::IEventProcessor
{
@@ -51,8 +49,8 @@ namespace dbaccess
bool m_bInitialized;
bool m_bDisposed;
std::shared_ptr<::comphelper::AsyncEventNotifierAutoJoin> m_pEventBroadcaster;
- ::comphelper::OInterfaceContainerHelper2 m_aLegacyEventListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aDocumentEventListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::document::XEventListener> m_aLegacyEventListeners;
+ ::comphelper::OInterfaceContainerHelper3<XDocumentEventListener> m_aDocumentEventListeners;
public:
DocumentEventNotifier_Impl( ::cppu::OWeakObject& _rBroadcasterDocument, ::osl::Mutex& _rMutex )
@@ -67,8 +65,8 @@ namespace dbaccess
}
// IEventProcessor
- virtual void SAL_CALL acquire() throw () override;
- virtual void SAL_CALL release() throw () override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
void addLegacyEventListener( const Reference< document::XEventListener >& Listener )
{
@@ -121,12 +119,12 @@ namespace dbaccess
void impl_notifyEventAsync_nothrow( const DocumentEvent& _rEvent );
};
- void SAL_CALL DocumentEventNotifier_Impl::acquire() throw ()
+ void SAL_CALL DocumentEventNotifier_Impl::acquire() noexcept
{
osl_atomic_increment( &m_refCount );
}
- void SAL_CALL DocumentEventNotifier_Impl::release() throw ()
+ void SAL_CALL DocumentEventNotifier_Impl::release() noexcept
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
delete this;
@@ -141,21 +139,24 @@ namespace dbaccess
{
m_pEventBroadcaster->removeEventsForProcessor( this );
m_pEventBroadcaster->terminate();
- //TODO: a protocol is missing how to join with the thread before
- // exit(3), to ensure the thread is no longer relying on any
- // infrastructure while that infrastructure is being shut down
- // in atexit handlers; simply calling join here leads to
- // deadlock, as this thread holds the solar mutex while the
- // other thread is typically blocked waiting for the solar mutex
- // For now, use newAutoJoinAsyncEventNotifier which is
- // better than nothing.
- m_pEventBroadcaster.reset();
}
+ auto xEventBroadcaster = std::exchange(m_pEventBroadcaster, {});
+
lang::EventObject aEvent( m_rDocument );
aGuard.clear();
// <-- SYNCHRONIZED
+ if (xEventBroadcaster)
+ {
+ comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex();
+ // unblock threads blocked on that so we can join
+ sal_uInt32 nLockCount = (rSolarMutex.IsCurrentThread()) ? rSolarMutex.release(true) : 0;
+ xEventBroadcaster->join();
+ if (nLockCount)
+ rSolarMutex.acquire(nLockCount);
+ xEventBroadcaster.reset();
+ }
m_aLegacyEventListeners.disposeAndClear( aEvent );
m_aDocumentEventListeners.disposeAndClear( aEvent );
@@ -214,7 +215,7 @@ namespace dbaccess
::comphelper::AsyncEventNotifierAutoJoin::launch(m_pEventBroadcaster);
}
}
- m_pEventBroadcaster->addEvent( new DocumentEventHolder( _rEvent ), this );
+ m_pEventBroadcaster->addEvent( new comphelper::DocumentEventHolder( _rEvent ), this );
}
void DocumentEventNotifier_Impl::processEvent( const ::comphelper::AnyEvent& _rEvent )
@@ -225,7 +226,7 @@ namespace dbaccess
if ( m_bDisposed )
return;
}
- const DocumentEventHolder& rEventHolder = dynamic_cast< const DocumentEventHolder& >( _rEvent );
+ const comphelper::DocumentEventHolder& rEventHolder = dynamic_cast< const comphelper::DocumentEventHolder& >( _rEvent );
impl_notifyEvent_nothrow( rEventHolder.getEventObject() );
}
diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.hxx b/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
index cc655268f8c1..347b3ea000d3 100644
--- a/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
+++ b/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
@@ -18,8 +18,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
+#pragma once
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/document/XDocumentEventListener.hpp>
@@ -88,44 +87,10 @@ namespace dbaccess
const css::uno::Any& Supplement
);
- /** notifies a document event to all registered listeners
-
- @precond
- the mutex is not locked
- @precond
- ->onDocumentInitialized has been called
- */
- void notifyDocumentEvent(
- const char* _pAsciiEventName,
- const css::uno::Reference< css::frame::XController2 >& _rxViewController = nullptr,
- const css::uno::Any& _rSupplement = css::uno::Any()
- )
- {
- notifyDocumentEvent( OUString::createFromAscii( _pAsciiEventName ), _rxViewController, _rSupplement );
- }
-
- /** notifies a document event to all registered listeners, asynchronously
-
- Note that no event is actually notified before you called ->onDocumentInitialized.
-
- @precond
- the mutex is locked
- */
- void notifyDocumentEventAsync(
- const char* _pAsciiEventName,
- const css::uno::Reference< css::frame::XController2 >& _rxViewController = nullptr,
- const css::uno::Any& _rSupplement = css::uno::Any()
- )
- {
- notifyDocumentEventAsync( OUString::createFromAscii( _pAsciiEventName ), _rxViewController, _rSupplement );
- }
-
private:
::rtl::Reference< DocumentEventNotifier_Impl > m_pImpl;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx
index d3c6a03ceeec..6482fe9564b3 100644
--- a/dbaccess/source/core/dataaccess/documentevents.cxx
+++ b/dbaccess/source/core/dataaccess/documentevents.cxx
@@ -35,77 +35,53 @@ namespace dbaccess
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
- // DocumentEvents_Data
- struct DocumentEvents_Data
- {
- ::cppu::OWeakObject& rParent;
- ::osl::Mutex& rMutex;
- DocumentEventsData& rEventsData;
-
- DocumentEvents_Data( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, DocumentEventsData& _rEventsData )
- :rParent( _rParent )
- ,rMutex( _rMutex )
- ,rEventsData( _rEventsData )
- {
- }
- DocumentEvents_Data(const DocumentEvents_Data&) = delete;
- const DocumentEvents_Data& operator=(const DocumentEvents_Data&) = delete;
- };
-
namespace {
// helper
struct DocumentEventData
{
- const char* pAsciiEventName;
+ OUString aAsciiEventName;
bool bNeedsSyncNotify;
};
- const DocumentEventData* lcl_getDocumentEventData()
- {
- static const DocumentEventData s_aData[] = {
- { "OnCreate", true },
- { "OnLoadFinished", true },
- { "OnNew", false }, // compatibility, see https://bz.apache.org/ooo/show_bug.cgi?id=46484
- { "OnLoad", false }, // compatibility, see https://bz.apache.org/ooo/show_bug.cgi?id=46484
- { "OnSaveAs", true },
- { "OnSaveAsDone", false },
- { "OnSaveAsFailed", false },
- { "OnSave", true },
- { "OnSaveDone", false },
- { "OnSaveFailed", false },
- { "OnSaveTo", true },
- { "OnSaveToDone", false },
- { "OnSaveToFailed", false },
- { "OnPrepareUnload", true },
- { "OnUnload", true },
- { "OnFocus", false },
- { "OnUnfocus", false },
- { "OnModifyChanged", false },
- { "OnViewCreated", false },
- { "OnPrepareViewClosing", true },
- { "OnViewClosed", false },
- { "OnTitleChanged", false },
- { "OnSubComponentOpened", false },
- { "OnSubComponentClosed", false },
- { nullptr, false }
- };
- return s_aData;
- }
+ constexpr DocumentEventData s_DocumentEventData[] {
+ { u"OnCreate"_ustr, true },
+ { u"OnLoadFinished"_ustr, true },
+ { u"OnNew"_ustr, false }, // compatibility, see https://bz.apache.org/ooo/show_bug.cgi?id=46484
+ { u"OnLoad"_ustr, false }, // compatibility, see https://bz.apache.org/ooo/show_bug.cgi?id=46484
+ { u"OnSaveAs"_ustr, true },
+ { u"OnSaveAsDone"_ustr, false },
+ { u"OnSaveAsFailed"_ustr, false },
+ { u"OnSave"_ustr, true },
+ { u"OnSaveDone"_ustr, false },
+ { u"OnSaveFailed"_ustr, false },
+ { u"OnSaveTo"_ustr, true },
+ { u"OnSaveToDone"_ustr, false },
+ { u"OnSaveToFailed"_ustr, false },
+ { u"OnPrepareUnload"_ustr, true },
+ { u"OnUnload"_ustr, true },
+ { u"OnFocus"_ustr, false },
+ { u"OnUnfocus"_ustr, false },
+ { u"OnModifyChanged"_ustr, false },
+ { u"OnViewCreated"_ustr, false },
+ { u"OnPrepareViewClosing"_ustr, true },
+ { u"OnViewClosed"_ustr, false },
+ { u"OnTitleChanged"_ustr, false },
+ { u"OnSubComponentOpened"_ustr, false },
+ { u"OnSubComponentClosed"_ustr, false },
+ };
}
// DocumentEvents
DocumentEvents::DocumentEvents( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, DocumentEventsData& _rEventsData )
- :m_pData( new DocumentEvents_Data( _rParent, _rMutex, _rEventsData ) )
+ :mrParent(_rParent), mrMutex(_rMutex), mrEventsData(_rEventsData)
{
- const DocumentEventData* pEventData = lcl_getDocumentEventData();
- while ( pEventData->pAsciiEventName )
+ for (const auto & rEventData : s_DocumentEventData)
{
- OUString sEventName = OUString::createFromAscii( pEventData->pAsciiEventName );
- DocumentEventsData::const_iterator existingPos = m_pData->rEventsData.find( sEventName );
- if ( existingPos == m_pData->rEventsData.end() )
- m_pData->rEventsData[ sEventName ] = Sequence< PropertyValue >();
- ++pEventData;
+ OUString sEventName = rEventData.aAsciiEventName;
+ DocumentEventsData::const_iterator existingPos = mrEventsData.find( sEventName );
+ if ( existingPos == mrEventsData.end() )
+ mrEventsData[ sEventName ] = Sequence< PropertyValue >();
}
}
@@ -113,24 +89,22 @@ namespace dbaccess
{
}
- void SAL_CALL DocumentEvents::acquire() throw()
+ void SAL_CALL DocumentEvents::acquire() noexcept
{
- m_pData->rParent.acquire();
+ mrParent.acquire();
}
- void SAL_CALL DocumentEvents::release() throw()
+ void SAL_CALL DocumentEvents::release() noexcept
{
- m_pData->rParent.release();
+ mrParent.release();
}
- bool DocumentEvents::needsSynchronousNotification( const OUString& _rEventName )
+ bool DocumentEvents::needsSynchronousNotification( std::u16string_view _rEventName )
{
- const DocumentEventData* pEventData = lcl_getDocumentEventData();
- while ( pEventData->pAsciiEventName )
+ for (const auto & rEventData : s_DocumentEventData)
{
- if ( _rEventName.equalsAscii( pEventData->pAsciiEventName ) )
- return pEventData->bNeedsSyncNotify;
- ++pEventData;
+ if ( _rEventName == rEventData.aAsciiEventName )
+ return rEventData.bNeedsSyncNotify;
}
// this is an unknown event ... assume async notification
@@ -139,10 +113,10 @@ namespace dbaccess
void SAL_CALL DocumentEvents::replaceByName( const OUString& Name, const Any& Element )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- DocumentEventsData::iterator elementPos = m_pData->rEventsData.find( Name );
- if ( elementPos == m_pData->rEventsData.end() )
+ DocumentEventsData::iterator elementPos = mrEventsData.find( Name );
+ if ( elementPos == mrEventsData.end() )
throw NoSuchElementException( Name, *this );
Sequence< PropertyValue > aEventDescriptor;
@@ -152,30 +126,30 @@ namespace dbaccess
// Weird enough, the event assignment UI has (well: had) the idea of using an empty "EventType"/"Script"
// to indicate the event descriptor should be reset, instead of just passing an empty event descriptor.
::comphelper::NamedValueCollection aCheck( aEventDescriptor );
- if ( aCheck.has( "EventType" ) )
+ if ( aCheck.has( u"EventType"_ustr ) )
{
- OUString sEventType = aCheck.getOrDefault( "EventType", OUString() );
+ OUString sEventType = aCheck.getOrDefault( u"EventType"_ustr, OUString() );
OSL_ENSURE( !sEventType.isEmpty(), "DocumentEvents::replaceByName: doing a reset via an empty EventType is weird!" );
if ( sEventType.isEmpty() )
aEventDescriptor.realloc( 0 );
}
- if ( aCheck.has( "Script" ) )
+ if ( aCheck.has( u"Script"_ustr ) )
{
- OUString sScript = aCheck.getOrDefault( "Script", OUString() );
+ OUString sScript = aCheck.getOrDefault( u"Script"_ustr, OUString() );
OSL_ENSURE( !sScript.isEmpty(), "DocumentEvents::replaceByName: doing a reset via an empty Script is weird!" );
if ( sScript.isEmpty() )
aEventDescriptor.realloc( 0 );
}
- elementPos->second = aEventDescriptor;
+ elementPos->second = std::move(aEventDescriptor);
}
Any SAL_CALL DocumentEvents::getByName( const OUString& Name )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- DocumentEventsData::const_iterator elementPos = m_pData->rEventsData.find( Name );
- if ( elementPos == m_pData->rEventsData.end() )
+ DocumentEventsData::const_iterator elementPos = mrEventsData.find( Name );
+ if ( elementPos == mrEventsData.end() )
throw NoSuchElementException( Name, *this );
Any aReturn;
@@ -187,16 +161,16 @@ namespace dbaccess
Sequence< OUString > SAL_CALL DocumentEvents::getElementNames( )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- return comphelper::mapKeysToSequence( m_pData->rEventsData );
+ return comphelper::mapKeysToSequence( mrEventsData );
}
sal_Bool SAL_CALL DocumentEvents::hasByName( const OUString& Name )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- return m_pData->rEventsData.find( Name ) != m_pData->rEventsData.end();
+ return mrEventsData.find( Name ) != mrEventsData.end();
}
Type SAL_CALL DocumentEvents::getElementType( )
@@ -206,8 +180,8 @@ namespace dbaccess
sal_Bool SAL_CALL DocumentEvents::hasElements( )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
- return !m_pData->rEventsData.empty();
+ ::osl::MutexGuard aGuard( mrMutex );
+ return !mrEventsData.empty();
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx
index 3b42df4ed6a1..174e6e5fb56c 100644
--- a/dbaccess/source/core/dataaccess/intercept.cxx
+++ b/dbaccess/source/core/dataaccess/intercept.cxx
@@ -20,7 +20,7 @@
#include "intercept.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <memory>
@@ -28,13 +28,11 @@ namespace dbaccess
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
using namespace ::comphelper;
using namespace ::cppu;
@@ -65,17 +63,14 @@ void OInterceptor::dispose()
OInterceptor::OInterceptor( ODocumentDefinition* _pContentHolder )
:m_pContentHolder( _pContentHolder )
- ,m_aInterceptedURL(7)
+ ,m_aInterceptedURL{ /* DISPATCH_SAVEAS */ u".uno:SaveAs"_ustr,
+ /* DISPATCH_SAVE */ u".uno:Save"_ustr,
+ /* DISPATCH_CLOSEDOC */ u".uno:CloseDoc"_ustr,
+ /* DISPATCH_CLOSEWIN */ u".uno:CloseWin"_ustr,
+ /* DISPATCH_CLOSEFRAME */ u".uno:CloseFrame"_ustr,
+ /* DISPATCH_RELOAD */ u".uno:Reload"_ustr }
{
-
OSL_ENSURE(DISPATCH_RELOAD < m_aInterceptedURL.getLength(),"Illegal size.");
-
- m_aInterceptedURL[DISPATCH_SAVEAS] = ".uno:SaveAs";
- m_aInterceptedURL[DISPATCH_SAVE] = ".uno:Save";
- m_aInterceptedURL[DISPATCH_CLOSEDOC] = ".uno:CloseDoc";
- m_aInterceptedURL[DISPATCH_CLOSEWIN] = ".uno:CloseWin";
- m_aInterceptedURL[DISPATCH_CLOSEFRAME] = ".uno:CloseFrame";
- m_aInterceptedURL[DISPATCH_RELOAD] = ".uno:Reload";
}
@@ -131,7 +126,7 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu
{
if ( aNewArgs[nInd].Name == "SaveTo" )
{
- aNewArgs[nInd].Value <<= true;
+ aNewArgs.getArray()[nInd].Value <<= true;
break;
}
nInd++;
@@ -140,11 +135,12 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu
if ( nInd == aNewArgs.getLength() )
{
aNewArgs.realloc( nInd + 1 );
- aNewArgs[nInd].Name = "SaveTo";
- aNewArgs[nInd].Value <<= true;
+ auto pNewArgs = aNewArgs.getArray();
+ pNewArgs[nInd].Name = "SaveTo";
+ pNewArgs[nInd].Value <<= true;
}
- Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(URL, "_self", 0 );
+ Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(URL, u"_self"_ustr, 0 );
if ( xDispatch.is() )
xDispatch->dispatch( URL, aNewArgs );
}
@@ -171,7 +167,7 @@ IMPL_LINK( OInterceptor, OnDispatch, void*, _pDispatcher, void )
{
if ( m_pContentHolder && m_pContentHolder->prepareClose() && m_xSlaveDispatchProvider.is() )
{
- Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(pHelper->aURL, "_self", 0 );
+ Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(pHelper->aURL, u"_self"_ustr, 0 );
if ( xDispatch.is() )
{
Reference< XInterface > xKeepContentHolderAlive( *m_pContentHolder );
@@ -203,14 +199,14 @@ void SAL_CALL OInterceptor::addStatusListener(
aStateEvent.FeatureDescriptor = "SaveCopyTo";
aStateEvent.IsEnabled = true;
aStateEvent.Requery = false;
- aStateEvent.State <<= OUString("($3)");
+ aStateEvent.State <<= u"($3)"_ustr;
Control->statusChanged(aStateEvent);
}
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_pStatCL)
- m_pStatCL.reset( new PropertyChangeListenerContainer(m_aMutex) );
+ m_pStatCL.reset( new StatusListenerContainer(m_aMutex) );
}
m_pStatCL->addInterface(URL.Complete,Control);
@@ -227,7 +223,7 @@ void SAL_CALL OInterceptor::addStatusListener(
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_pStatCL)
- m_pStatCL.reset( new PropertyChangeListenerContainer(m_aMutex) );
+ m_pStatCL.reset( new StatusListenerContainer(m_aMutex) );
}
m_pStatCL->addInterface(URL.Complete,Control);
@@ -251,7 +247,7 @@ void SAL_CALL OInterceptor::addStatusListener(
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_pStatCL)
- m_pStatCL.reset( new PropertyChangeListenerContainer(m_aMutex) );
+ m_pStatCL.reset( new StatusListenerContainer(m_aMutex) );
}
m_pStatCL->addInterface(URL.Complete,Control);
@@ -289,13 +285,9 @@ Sequence< OUString > SAL_CALL OInterceptor::getInterceptedURLs( )
Reference< XDispatch > SAL_CALL OInterceptor::queryDispatch( const URL& URL,const OUString& TargetFrameName,sal_Int32 SearchFlags )
{
osl::MutexGuard aGuard(m_aMutex);
- const OUString* pIter = m_aInterceptedURL.getConstArray();
- const OUString* pEnd = pIter + m_aInterceptedURL.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if ( URL.Complete == *pIter )
+ for (auto& interceptedUrl : m_aInterceptedURL)
+ if (URL.Complete == interceptedUrl)
return static_cast<XDispatch*>(this);
- }
if(m_xSlaveDispatchProvider.is())
return m_xSlaveDispatchProvider->queryDispatch(URL,TargetFrameName,SearchFlags);
@@ -305,22 +297,20 @@ Reference< XDispatch > SAL_CALL OInterceptor::queryDispatch( const URL& URL,cons
Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( const Sequence<DispatchDescriptor >& Requests )
{
- Sequence< Reference< XDispatch > > aRet;
osl::MutexGuard aGuard(m_aMutex);
- if(m_xSlaveDispatchProvider.is())
- aRet = m_xSlaveDispatchProvider->queryDispatches(Requests);
- else
- aRet.realloc(Requests.getLength());
+ typedef Sequence<Reference<XDispatch>> DispatchSeq;
+ DispatchSeq aRet = m_xSlaveDispatchProvider.is() ?
+ m_xSlaveDispatchProvider->queryDispatches(Requests) :
+ DispatchSeq(Requests.getLength());
+ auto aRetRange = asNonConstRange(aRet);
for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
{
- const OUString* pIter = m_aInterceptedURL.getConstArray();
- const OUString* pEnd = pIter + m_aInterceptedURL.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& interceptedUrl : m_aInterceptedURL)
{
- if ( Requests[i].FeatureURL.Complete == *pIter )
+ if (Requests[i].FeatureURL.Complete == interceptedUrl)
{
- aRet[i] = static_cast<XDispatch*>(this);
+ aRetRange[i] = static_cast<XDispatch*>(this);
break;
}
}
diff --git a/dbaccess/source/core/dataaccess/intercept.hxx b/dbaccess/source/core/dataaccess/intercept.hxx
index c7ddd3d217ab..7ce53752f19d 100644
--- a/dbaccess/source/core/dataaccess/intercept.hxx
+++ b/dbaccess/source/core/dataaccess/intercept.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_INTERCEPT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_INTERCEPT_HXX
+#pragma once
#include <osl/mutex.hxx>
#include <cppuhelper/implbase.hxx>
@@ -104,11 +103,11 @@ private:
css::uno::Sequence< OUString > m_aInterceptedURL;
- std::unique_ptr<PropertyChangeListenerContainer> m_pStatCL;
+ typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::frame::XStatusListener, OUString>
+ StatusListenerContainer;
+ std::unique_ptr<StatusListenerContainer> m_pStatCL;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_INTERCEPT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
index 52d6bd6a2b91..825c288883d2 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
@@ -19,80 +19,35 @@
#include <vector>
-#include <ucbhelper/contentidentifier.hxx>
-
#include "myucp_datasupplier.hxx"
#include <ContentHelper.hxx>
#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
-// @@@ Adjust namespace name.
using namespace dbaccess;
-// @@@ Adjust namespace name.
-namespace dbaccess
-{
-
-namespace {
-
-// struct ResultListEntry.
-struct ResultListEntry
-{
- OUString aId;
- Reference< XContentIdentifier > xId;
- ::rtl::Reference< OContentHelper > xContent;
- Reference< XRow > xRow;
- const ContentProperties& rData;
-
- explicit ResultListEntry(const ContentProperties& rEntry) : rData( rEntry ) {}
-};
-
-}
-
-// struct DataSupplier_Impl.
-struct DataSupplier_Impl
-{
- osl::Mutex m_aMutex;
- std::vector< std::unique_ptr<ResultListEntry> > m_aResults;
- rtl::Reference< ODocumentContainer > m_xContent;
- bool m_bCountFinal;
-
- explicit DataSupplier_Impl(const rtl::Reference< ODocumentContainer >& rContent)
- : m_xContent(rContent)
- , m_bCountFinal(false)
- {
- }
-};
-
-}
-
-// DataSupplier Implementation.
DataSupplier::DataSupplier( const rtl::Reference< ODocumentContainer >& rContent )
-: m_pImpl( new DataSupplier_Impl( rContent ) )
+: m_xContent( rContent )
{
-
}
DataSupplier::~DataSupplier()
{
-
}
-OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+OUString DataSupplier::queryContentIdentifierString( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
- OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
+ OUString aId = m_aResults[ nIndex ]->aId;
if ( !aId.isEmpty() )
{
// Already cached.
@@ -100,29 +55,29 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
}
}
- if ( getResult( nIndex ) )
+ if ( getResult( rResultSetGuard, nIndex ) )
{
- OUString aId = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+ OUString aId = m_xContent->getIdentifier()->getContentIdentifier();
if ( !aId.isEmpty() )
aId += "/";
- aId += m_pImpl->m_aResults[ nIndex ]->rData.aTitle;
+ aId += m_aResults[ nIndex ]->rData.aTitle;
- m_pImpl->m_aResults[ nIndex ]->aId = aId;
+ m_aResults[ nIndex ]->aId = aId;
return aId;
}
return OUString();
}
Reference< XContentIdentifier >
-DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+DataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
- Reference< XContentIdentifier > xId = m_pImpl->m_aResults[ nIndex ]->xId;
+ Reference< XContentIdentifier > xId = m_aResults[ nIndex ]->xId;
if ( xId.is() )
{
// Already cached.
@@ -130,24 +85,24 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
}
}
- OUString aId = queryContentIdentifierString( nIndex );
+ OUString aId = queryContentIdentifierString( rResultSetGuard, nIndex );
if ( !aId.isEmpty() )
{
Reference< XContentIdentifier > xId = new ::ucbhelper::ContentIdentifier( aId );
- m_pImpl->m_aResults[ nIndex ]->xId = xId;
+ m_aResults[ nIndex ]->xId = xId;
return xId;
}
return Reference< XContentIdentifier >();
}
Reference< XContent >
-DataSupplier::queryContent( sal_uInt32 _nIndex )
+DataSupplier::queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 _nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(_nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(_nIndex) < m_aResults.size() )
{
- Reference< XContent > xContent = m_pImpl->m_aResults[ _nIndex ]->xContent.get();
+ rtl::Reference< OContentHelper > xContent = m_aResults[ _nIndex ]->xContent;
if ( xContent.is() )
{
// Already cached.
@@ -155,7 +110,7 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
}
}
- Reference< XContentIdentifier > xId = queryContentIdentifier( _nIndex );
+ Reference< XContentIdentifier > xId = queryContentIdentifier( rResultSetGuard, _nIndex );
if ( xId.is() )
{
try
@@ -164,9 +119,9 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
OUString sName = xId->getContentIdentifier();
sName = sName.copy(sName.lastIndexOf('/')+1);
- m_pImpl->m_aResults[ _nIndex ]->xContent = m_pImpl->m_xContent->getContent(sName);
+ m_aResults[ _nIndex ]->xContent = m_xContent->getContent(sName);
- xContent = m_pImpl->m_aResults[ _nIndex ]->xContent.get();
+ xContent = m_aResults[ _nIndex ]->xContent.get();
return xContent;
}
@@ -177,11 +132,11 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
return Reference< XContent >();
}
-bool DataSupplier::getResult( sal_uInt32 nIndex )
+bool DataSupplier::getResult( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
{
- osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
// Result already present.
return true;
@@ -189,108 +144,99 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
// Result not (yet) present.
- if ( m_pImpl->m_bCountFinal )
+ if ( m_bCountFinal )
return false;
// Try to obtain result...
- sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_uInt32 nOldCount = m_aResults.size();
bool bFound = false;
- sal_uInt32 nPos = nOldCount;
// @@@ Obtain data and put it into result list...
- Sequence< OUString> aSeq = m_pImpl->m_xContent->getElementNames();
+ Sequence< OUString> aSeq = m_xContent->getElementNames();
if ( nIndex < sal::static_int_cast< sal_uInt32 >( aSeq.getLength() ) )
{
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(pIter = pIter + nPos;pIter != pEnd;++pIter,++nPos)
- {
- m_pImpl->m_aResults.emplace_back(
- new ResultListEntry( m_pImpl->m_xContent->getContent(*pIter)->getContentProperties() ) );
-
- if ( nPos == nIndex )
- {
- // Result obtained.
- bFound = true;
- break;
- }
- }
+ m_aResults.reserve(nIndex + 1);
+ const OUString* pEnd = aSeq.begin() + nIndex + 1;
+ for (const OUString* pIter = aSeq.begin() + nOldCount; pIter != pEnd; ++pIter)
+ m_aResults.emplace_back(
+ new ResultListEntry( m_xContent->getContent(*pIter)->getContentProperties() ) );
+
+ // Result obtained.
+ bFound = true;
}
if ( !bFound )
- m_pImpl->m_bCountFinal = true;
+ m_bCountFinal = true;
- rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
+ rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet();
if ( xResultSet.is() )
{
// Callbacks follow!
aGuard.clear();
- if ( static_cast<size_t>(nOldCount) < m_pImpl->m_aResults.size() )
- xResultSet->rowCountChanged(
- nOldCount, m_pImpl->m_aResults.size() );
+ if ( static_cast<size_t>(nOldCount) < m_aResults.size() )
+ xResultSet->rowCountChanged( rResultSetGuard, nOldCount, m_aResults.size() );
- if ( m_pImpl->m_bCountFinal )
- xResultSet->rowCountFinal();
+ if ( m_bCountFinal )
+ xResultSet->rowCountFinal(rResultSetGuard);
}
return bFound;
}
-sal_uInt32 DataSupplier::totalCount()
+sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& rResultSetGuard)
{
- osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
- if ( m_pImpl->m_bCountFinal )
- return m_pImpl->m_aResults.size();
+ if ( m_bCountFinal )
+ return m_aResults.size();
- sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_uInt32 nOldCount = m_aResults.size();
// @@@ Obtain data and put it into result list...
- Sequence< OUString> aSeq = m_pImpl->m_xContent->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
- m_pImpl->m_aResults.emplace_back(
- new ResultListEntry( m_pImpl->m_xContent->getContent(*pIter)->getContentProperties() ) );
+ Sequence< OUString> aSeq = m_xContent->getElementNames();
+ // FIXME: this adds everything from aSeq to m_aResults, unlike similar code in getResult,
+ // which skips nOldCount entries in aSeq - which is correct?
+ for (auto& name : aSeq)
+ m_aResults.emplace_back(
+ new ResultListEntry( m_xContent->getContent(name)->getContentProperties() ) );
- m_pImpl->m_bCountFinal = true;
+ m_bCountFinal = true;
- rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
+ rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet();
if ( xResultSet.is() )
{
// Callbacks follow!
aGuard.clear();
- if ( static_cast<size_t>(nOldCount) < m_pImpl->m_aResults.size() )
- xResultSet->rowCountChanged(
- nOldCount, m_pImpl->m_aResults.size() );
+ if ( static_cast<size_t>(nOldCount) < m_aResults.size() )
+ xResultSet->rowCountChanged( rResultSetGuard, nOldCount, m_aResults.size() );
- xResultSet->rowCountFinal();
+ xResultSet->rowCountFinal(rResultSetGuard);
}
- return m_pImpl->m_aResults.size();
+ return m_aResults.size();
}
sal_uInt32 DataSupplier::currentCount()
{
- return m_pImpl->m_aResults.size();
+ return m_aResults.size();
}
bool DataSupplier::isCountFinal()
{
- return m_pImpl->m_bCountFinal;
+ return m_bCountFinal;
}
Reference< XRow >
-DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
+DataSupplier::queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
- Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
+ Reference< XRow > xRow = m_aResults[ nIndex ]->xRow;
if ( xRow.is() )
{
// Already cached.
@@ -298,13 +244,13 @@ DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
}
}
- if ( getResult( nIndex ) )
+ if ( getResult( rResultSetGuard, nIndex ) )
{
- if ( !m_pImpl->m_aResults[ nIndex ]->xContent.is() )
- queryContent(nIndex);
+ if ( !m_aResults[ nIndex ]->xContent.is() )
+ queryContent(rResultSetGuard, nIndex);
- Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xContent->getPropertyValues(getResultSet()->getProperties());
- m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
+ Reference< XRow > xRow = m_aResults[ nIndex ]->xContent->getPropertyValues(getResultSet()->getProperties());
+ m_aResults[ nIndex ]->xRow = xRow;
return xRow;
}
@@ -313,10 +259,10 @@ DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
- m_pImpl->m_aResults[ nIndex ]->xRow.clear();
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
+ m_aResults[ nIndex ]->xRow.clear();
}
void DataSupplier::close()
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
index 8806371d1dbc..b9eecab2ddff 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
@@ -17,49 +17,64 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_DATASUPPLIER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_DATASUPPLIER_HXX
+#pragma once
#include <rtl/ref.hxx>
+#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/resultset.hxx>
#include "documentcontainer.hxx"
#include <memory>
-namespace dbaccess {
+namespace dbaccess
+{
+struct ResultListEntry
+{
+ OUString aId;
+ css::uno::Reference<css::ucb::XContentIdentifier> xId;
+ ::rtl::Reference<OContentHelper> xContent;
+ css::uno::Reference<css::sdbc::XRow> xRow;
+ const ContentProperties& rData;
-struct DataSupplier_Impl;
+ explicit ResultListEntry(const ContentProperties& rEntry)
+ : rData(rEntry)
+ {
+ }
+};
class DataSupplier : public ucbhelper::ResultSetDataSupplier
{
- std::unique_ptr<DataSupplier_Impl> m_pImpl;
+ osl::Mutex m_aMutex;
+ std::vector<std::unique_ptr<ResultListEntry>> m_aResults;
+ rtl::Reference<ODocumentContainer> m_xContent;
+ bool m_bCountFinal = false;
public:
- explicit DataSupplier( const rtl::Reference< ODocumentContainer >& rxContent );
+ explicit DataSupplier(const rtl::Reference<ODocumentContainer>& rxContent);
virtual ~DataSupplier() override;
- virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) override;
- virtual css::uno::Reference< css::ucb::XContentIdentifier >
- queryContentIdentifier( sal_uInt32 nIndex ) override;
- virtual css::uno::Reference< css::ucb::XContent >
- queryContent( sal_uInt32 nIndex ) override;
+ virtual OUString queryContentIdentifierString(std::unique_lock<std::mutex>& rResultSetGuard,
+ sal_uInt32 nIndex) override;
+ virtual css::uno::Reference<css::ucb::XContentIdentifier>
+ queryContentIdentifier(std::unique_lock<std::mutex>& rResultSetGuard,
+ sal_uInt32 nIndex) override;
+ virtual css::uno::Reference<css::ucb::XContent>
+ queryContent(std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex) override;
- virtual bool getResult( sal_uInt32 nIndex ) override;
+ virtual bool getResult(std::unique_lock<std::mutex>& rResultSetGuard,
+ sal_uInt32 nIndex) override;
- virtual sal_uInt32 totalCount() override;
+ virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& rResultSetGuard) override;
virtual sal_uInt32 currentCount() override;
virtual bool isCountFinal() override;
- virtual css::uno::Reference< css::sdbc::XRow >
- queryPropertyValues( sal_uInt32 nIndex ) override;
- virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
+ virtual css::uno::Reference<css::sdbc::XRow>
+ queryPropertyValues(std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex) override;
+ virtual void releasePropertyValues(sal_uInt32 nIndex) override;
virtual void close() override;
virtual void validate() override;
};
-
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_DATASUPPLIER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/myucp_resultset.cxx b/dbaccess/source/core/dataaccess/myucp_resultset.cxx
index 67c1ad7c8b4b..9ba383e0aa18 100644
--- a/dbaccess/source/core/dataaccess/myucp_resultset.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_resultset.cxx
@@ -26,14 +26,13 @@
*************************************************************************/
+#include <utility>
+
#include "myucp_datasupplier.hxx"
#include "myucp_resultset.hxx"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
@@ -42,11 +41,11 @@ using namespace dbaccess;
// DynamicResultSet Implementation.
DynamicResultSet::DynamicResultSet(
const Reference< XComponentContext >& rxContext,
- const rtl::Reference< ODocumentContainer >& rxContent,
+ rtl::Reference< ODocumentContainer > xContent,
const OpenCommandArgument2& rCommand,
const Reference< XCommandEnvironment >& rxEnv )
:ResultSetImplHelper( rxContext, rCommand )
- ,m_xContent(rxContent)
+ ,m_xContent(std::move(xContent))
,m_xEnv( rxEnv )
{
}
diff --git a/dbaccess/source/core/dataaccess/myucp_resultset.hxx b/dbaccess/source/core/dataaccess/myucp_resultset.hxx
index 6556ff76f572..220bdf0a70b7 100644
--- a/dbaccess/source/core/dataaccess/myucp_resultset.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_resultset.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_RESULTSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_RESULTSET_HXX
+#pragma once
#include <rtl/ref.hxx>
#include <ucbhelper/resultsethelper.hxx>
@@ -40,13 +39,11 @@ private:
public:
DynamicResultSet(
const css::uno::Reference< css::uno::XComponentContext >& rxContext,
- const rtl::Reference< ODocumentContainer >& rxContent,
+ rtl::Reference< ODocumentContainer > xContent,
const css::ucb::OpenCommandArgument2& rCommand,
const css::uno::Reference< css::ucb::XCommandEnvironment >& rxEnv );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_RESULTSET_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/ContainerMediator.hxx b/dbaccess/source/core/inc/ContainerMediator.hxx
index 8d1bf9d8d752..37bfc0ebac1a 100644
--- a/dbaccess/source/core/inc/ContainerMediator.hxx
+++ b/dbaccess/source/core/inc/ContainerMediator.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
+#pragma once
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -77,6 +76,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx
index 87686496a77d..d60521a4328d 100644
--- a/dbaccess/source/core/inc/ContentHelper.hxx
+++ b/dbaccess/source/core/inc/ContentHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTENTHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTENTHELPER_HXX
+#pragma once
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp>
@@ -26,11 +25,11 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
@@ -72,7 +71,7 @@ namespace dbaccess
typedef std::shared_ptr<OContentHelper_Impl> TContentPtr;
- typedef cppu::OMultiTypeInterfaceContainerHelperVar<OUString>
+ typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertiesChangeListener, OUString>
PropertyChangeListenerContainer;
typedef ::cppu::WeakComponentImplHelper< css::ucb::XContent
, css::ucb::XCommandProcessor
@@ -80,7 +79,6 @@ namespace dbaccess
, css::beans::XPropertiesChangeNotifier
, css::beans::XPropertyContainer
, css::lang::XInitialization
- , css::lang::XUnoTunnel
, css::container::XChild
, css::sdbcx::XRename
> OContentHelper_COMPBASE;
@@ -94,7 +92,7 @@ namespace dbaccess
void impl_rename_throw(const OUString& _sNewName,bool _bNotify = true);
protected:
- ::comphelper::OInterfaceContainerHelper2 m_aContentListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::ucb::XContentEventListener> m_aContentListeners;
PropertyChangeListenerContainer m_aPropertyChangeListeners;
css::uno::Reference< css::uno::XInterface >
m_xParentContainer;
@@ -122,7 +120,7 @@ namespace dbaccess
OContentHelper( const css::uno::Reference< css::uno::XComponentContext >& _xORB
,const css::uno::Reference< css::uno::XInterface >& _xParentContainer
- ,const TContentPtr& _pImpl
+ ,TContentPtr _pImpl
);
// css::lang::XTypeProvider
@@ -155,10 +153,6 @@ namespace dbaccess
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
// css::container::XChild
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
@@ -180,6 +174,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTENTHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
index 68c066412a20..8c2029634b8a 100644
--- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx
+++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASEDATAPROVIDER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASEDATAPROVIDER_HXX
+#pragma once
#include <sal/config.h>
@@ -52,20 +51,12 @@ class DatabaseDataProvider: private ::cppu::BaseMutex,
public:
explicit DatabaseDataProvider(css::uno::Reference< css::uno::XComponentContext > const & context);
- // css::lang::XServiceInfo - static methods
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_Static();
- static css::uno::Reference< css::uno::XInterface >
- Create(css::uno::Reference< css::uno::XComponentContext > const & context);
-
private:
// css::uno::XInterface:
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override;
- virtual void SAL_CALL acquire() throw () override
+ virtual void SAL_CALL acquire() noexcept override
{ TDatabaseDataProvider::acquire(); }
- virtual void SAL_CALL release() throw () override
+ virtual void SAL_CALL release() noexcept override
{ TDatabaseDataProvider::release(); }
// css::lang::XServiceInfo
@@ -82,7 +73,7 @@ private:
virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
createDataSequenceByValueArray(
- const OUString& aRole, const OUString & aRangeRepresentation) override;
+ const OUString& aRole, const OUString & aRangeRepresentation, const OUString& aRoleQualifier) override;
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override;
@@ -229,7 +220,7 @@ private:
::osl::MutexGuard aGuard(m_aMutex);
if ( _member != Value )
{
- prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
+ prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
_member = Value;
}
}
@@ -268,6 +259,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASEDATAPROVIDER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/FilteredContainer.hxx b/dbaccess/source/core/inc/FilteredContainer.hxx
index b07892731f3f..3ec2b1735bf3 100644
--- a/dbaccess/source/core/inc/FilteredContainer.hxx
+++ b/dbaccess/source/core/inc/FilteredContainer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -29,11 +28,6 @@
#include <connectivity/sdbcx/VCollection.hxx>
-namespace dbtools
-{
- class WarningsContainer;
-}
-
namespace dbaccess
{
class IRefreshListener;
@@ -63,7 +57,7 @@ namespace dbaccess
// ::connectivity::sdbcx::OCollection
virtual void impl_refresh() override;
- virtual OUString getNameForObject(const ::connectivity::sdbcx::ObjectType& _xObject) override;
+ virtual OUString getNameForObject(const ::css::uno::Reference< css::beans::XPropertySet >& _xObject) override;
/** tell the container to free all elements and all additional resources.<BR>
After using this method the object may be reconstructed by calling one of the <code>construct</code> methods.
@@ -134,6 +128,4 @@ namespace dbaccess
};
} // namespace
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/ModelImpl.hxx b/dbaccess/source/core/inc/ModelImpl.hxx
index c67e67d57905..c35a99ad508b 100644
--- a/dbaccess/source/core/inc/ModelImpl.hxx
+++ b/dbaccess/source/core/inc/ModelImpl.hxx
@@ -17,9 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_MODELIMPL_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_MODELIMPL_HXX
+#pragma once
+#include "connection.hxx"
#include "ContentHelper.hxx"
#include "documentevents.hxx"
@@ -27,57 +27,49 @@
#include <com/sun/star/beans/XPropertyBag.hpp>
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/reflection/XProxyFactory.hpp>
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/weakref.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/docmacromode.hxx>
#include <sfx2/docstoragemodifylistener.hxx>
#include <unotools/sharedunocomponent.hxx>
+#include <rtl/digest.h>
#include <rtl/ref.hxx>
+#include <o3tl/enumarray.hxx>
+#include <unotools/weakref.hxx>
-namespace comphelper
-{
- class NamedValueCollection;
-}
+#include <span>
namespace dbaccess
{
+class OCommandContainer;
typedef std::vector< css::uno::WeakReference< css::sdbc::XConnection > > OWeakConnectionArray;
-struct AsciiPropertyValue
+struct DefaultPropertyValue
{
- // note: the canonic member order would be AsciiName / DefaultValue, but
- // this crashes on unxlngi6.pro, since there's a bug which somehow results in
- // getDefaultDataSourceSettings returning corrupted Any instances then.
+ OUString Name;
css::uno::Any DefaultValue;
- const char* AsciiName;
const css::uno::Type& ValueType;
- AsciiPropertyValue()
- :DefaultValue( )
- ,AsciiName( nullptr )
- ,ValueType( ::cppu::UnoType<void>::get() )
- {
- }
-
- AsciiPropertyValue( const char* _pAsciiName, const css::uno::Any& _rDefaultValue )
- :DefaultValue( _rDefaultValue )
- ,AsciiName( _pAsciiName )
+ DefaultPropertyValue(const OUString& _aName, const css::uno::Any& _rDefaultValue)
+ :Name( _aName )
+ ,DefaultValue( _rDefaultValue )
,ValueType( _rDefaultValue.getValueType() )
{
OSL_ENSURE( ValueType.getTypeClass() != css::uno::TypeClass_VOID,
"AsciiPropertyValue::AsciiPropertyValue: NULL values not allowed here, use the other CTOR for this!" );
}
- AsciiPropertyValue( const char* _pAsciiName, const css::uno::Type& _rValeType )
- :DefaultValue()
- ,AsciiName( _pAsciiName )
+ DefaultPropertyValue(const OUString& _aName, const css::uno::Type& _rValeType)
+ :Name( _aName )
,ValueType( _rValeType )
{
OSL_ENSURE( ValueType.getTypeClass() != css::uno::TypeClass_VOID,
@@ -85,43 +77,104 @@ struct AsciiPropertyValue
}
};
-class ODatabaseContext;
-class OSharedConnectionManager;
-
// ODatabaseModelImpl
typedef ::utl::SharedUNOComponent< css::embed::XStorage > SharedStorage;
class ODatabaseContext;
class DocumentStorageAccess;
-class OSharedConnectionManager;
+class ODatabaseSource;
+class ODatabaseDocument;
+
+
+/** The class OSharedConnectionManager implements a structure to share connections.
+ It owns the master connections which will be disposed when the last connection proxy is gone.
+*/
+// need to hold the digest
+struct TDigestHolder
+{
+ sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1];
+ TDigestHolder()
+ {
+ m_pBuffer[0] = 0;
+ }
+
+};
+
+class OSharedConnectionManager : public ::cppu::WeakImplHelper< css::lang::XEventListener >
+{
+ // contains the currently used master connections
+ struct TConnectionHolder
+ {
+ rtl::Reference< OConnection > xMasterConnection;
+ oslInterlockedCount nALiveCount;
+ };
+
+ // the less-compare functor, used for the stl::map
+ struct TDigestLess
+ {
+ bool operator() (const TDigestHolder& x, const TDigestHolder& y) const
+ {
+ sal_uInt32 i;
+ for(i=0;i < RTL_DIGEST_LENGTH_SHA1 && (x.m_pBuffer[i] >= y.m_pBuffer[i]); ++i)
+ ;
+ return i < RTL_DIGEST_LENGTH_SHA1;
+ }
+ };
+
+ typedef std::map< TDigestHolder,TConnectionHolder,TDigestLess> TConnectionMap; // holds the master connections
+ typedef std::map< css::uno::Reference< css::sdbc::XConnection >,TConnectionMap::iterator> TSharedConnectionMap;// holds the shared connections
+
+ ::osl::Mutex m_aMutex;
+ TConnectionMap m_aConnections; // remember the master connection in conjunction with the digest
+ TSharedConnectionMap m_aSharedConnection; // the shared connections with conjunction with an iterator into the connections map
+ css::uno::Reference< css::reflection::XProxyFactory > m_xProxyFactory;
+
+protected:
+ virtual ~OSharedConnectionManager() override;
+
+public:
+ explicit OSharedConnectionManager(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ css::uno::Reference< css::sdbc::XConnection > getConnection( const OUString& url,
+ const OUString& user,
+ const OUString& password,
+ const css::uno::Sequence< css::beans::PropertyValue >& _aInfo,
+ ODatabaseSource* _pDataSource);
+ void addEventListener(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, TConnectionMap::iterator const & _rIter);
+};
+
+
class ODatabaseModelImpl :public ::sfx2::IMacroDocumentAccess
,public ::sfx2::IModifiableDocument
{
public:
- enum ObjectType
+
+ enum class ObjectType
{
- E_FORM = 0,
- E_REPORT = 1,
- E_QUERY = 2,
- E_TABLE = 3
+ Form = 0,
+ Report = 1,
+ Query = 2,
+ Table = 3,
+ LAST = Table
};
- enum EmbeddedMacros
+ enum class EmbeddedMacros
{
// the database document (storage) itself contains macros
- eDocumentWideMacros,
+ DocumentWide,
// there are sub document( storage)s containing macros
- eSubDocumentMacros,
+ SubDocument,
// there are no known macro( storage)s
- eNoMacros
+ NONE
};
private:
- css::uno::WeakReference< css::frame::XModel > m_xModel;
- css::uno::WeakReference< css::sdbc::XDataSource > m_xDataSource;
+ unotools::WeakReference< ODatabaseDocument > m_xModel;
+ unotools::WeakReference< ODatabaseSource > m_xDataSource;
rtl::Reference<DocumentStorageAccess> m_pStorageAccess;
- std::vector< TContentPtr > m_aContainer; // one for each ObjectType
+ o3tl::enumarray< ObjectType, TContentPtr > m_aContainer; // one for each ObjectType
::sfx2::DocumentMacroMode m_aMacroMode;
sal_Int16 m_nImposedMacroExecMode;
@@ -166,7 +219,7 @@ public:
public:
css::uno::WeakReference< css::container::XNameAccess > m_xCommandDefinitions;
- css::uno::WeakReference< css::container::XNameAccess > m_xTableDefinitions;
+ unotools::WeakReference< ::dbaccess::OCommandContainer > m_xTableDefinitions;
css::uno::Reference< css::util::XNumberFormatsSupplier >
m_xNumberFormatsSupplier;
@@ -184,13 +237,12 @@ public:
bool m_bModified : 1;
bool m_bDocumentReadOnly : 1;
bool m_bMacroCallsSeenWhileLoading : 1;
+ bool m_bAskPassword;
css::uno::Reference< css::beans::XPropertyBag >
m_xSettings;
css::uno::Sequence< OUString > m_aTableFilter;
css::uno::Sequence< OUString > m_aTableTypeFilter;
- OSharedConnectionManager* m_pSharedConnectionManager;
- css::uno::Reference< css::lang::XEventListener >
- m_xSharedConnectionManager;
+ rtl::Reference< OSharedConnectionManager > m_xSharedConnectionManager;
css::uno::Reference<css::awt::XWindow>
m_xDialogParent;
sal_uInt16 m_nControllerLockCount;
@@ -222,7 +274,7 @@ public:
virtual ~ODatabaseModelImpl();
ODatabaseModelImpl(
- const OUString& _rRegistrationName,
+ OUString _sRegistrationName,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
ODatabaseContext& _rDBContext
);
@@ -291,7 +343,7 @@ public:
/** returns the model, if there already exists one
*/
- css::uno::Reference< css::frame::XModel > getModel_noCreate() const;
+ rtl::Reference< ODatabaseDocument > getModel_noCreate() const;
/** returns a new ->ODatabaseDocument
@@ -301,7 +353,7 @@ public:
@seealso
getModel_noCreate
*/
- css::uno::Reference< css::frame::XModel > createNewModel_deliverOwnership();
+ rtl::Reference< ODatabaseDocument > createNewModel_deliverOwnership();
struct ResetModelAccess { friend class ODatabaseDocument; private: ResetModelAccess() { } };
@@ -324,7 +376,7 @@ public:
void release();
/// returns all known data source settings, including their default values
- static const AsciiPropertyValue* getDefaultDataSourceSettings();
+ static std::span<const DefaultPropertyValue> getDefaultDataSourceSettings();
/** retrieves the requested container of objects (forms/reports/tables/queries)
*/
@@ -378,7 +430,7 @@ public:
css::uno::Reference< css::script::XStorageBasedLibraryContainer >
getLibraryContainer( bool _bScript );
- /** lets our library containers store themself into the given root storage
+ /** lets our library containers store themselves into the given root storage
*/
void storeLibraryContainersTo( const css::uno::Reference< css::embed::XStorage >& _rxToRootStorage );
@@ -417,7 +469,8 @@ public:
virtual bool macroCallsSeenWhileLoading() const override;
virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override;
virtual SignatureState getScriptingSignatureState() override;
- virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
+ virtual bool hasTrustedScriptingSignature(
+ const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction) override;
// IModifiableDocument
virtual void storageIsModified() override;
@@ -452,7 +505,7 @@ protected:
::osl::Mutex m_aMutex; // only use this to init WeakComponentImplHelper
protected:
- explicit ModelDependentComponent( const ::rtl::Reference< ODatabaseModelImpl >& _model );
+ explicit ModelDependentComponent( ::rtl::Reference< ODatabaseModelImpl > _model );
virtual ~ModelDependentComponent();
/** returns the component itself
@@ -469,7 +522,7 @@ public:
void checkDisposed() const
{
if ( !m_pImpl.is() )
- throw css::lang::DisposedException( "Component is already disposed.", getThis() );
+ throw css::lang::DisposedException( u"Component is already disposed."_ustr, getThis() );
}
void lockModify()
@@ -540,6 +593,4 @@ public:
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/PropertyForward.hxx b/dbaccess/source/core/inc/PropertyForward.hxx
index 1b20e76e9c6f..daf31758d000 100644
--- a/dbaccess/source/core/inc/PropertyForward.hxx
+++ b/dbaccess/source/core/inc/PropertyForward.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_PROPERTYFORWARD_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_PROPERTYFORWARD_HXX
+#pragma once
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -50,7 +49,7 @@ namespace dbaccess
public:
OPropertyForward( const css::uno::Reference< css::beans::XPropertySet>& _xSource,
const css::uno::Reference< css::container::XNameAccess>& _xDestContainer,
- const OUString& _sName,
+ OUString _sName,
const std::vector< OUString >& _aPropertyList
);
@@ -67,6 +66,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_PROPERTYFORWARD_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/RefreshListener.hxx b/dbaccess/source/core/inc/RefreshListener.hxx
index 37c6ea511bc5..03836c308f2b 100644
--- a/dbaccess/source/core/inc/RefreshListener.hxx
+++ b/dbaccess/source/core/inc/RefreshListener.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_REFRESHLISTENER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_REFRESHLISTENER_HXX
+#pragma once
#include <com/sun/star/uno/Reference.h>
@@ -40,6 +39,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_REFRESHLISTENER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index be2f48fdb30d..fdde2d451d17 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_SINGLESELECTQUERYCOMPOSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_SINGLESELECTQUERYCOMPOSER_HXX
+#pragma once
#include <com/sun/star/sdb/XParametersSupplier.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
@@ -77,6 +76,7 @@ namespace dbaccess
typedef std::function<const ::connectivity::OSQLParseNode*(::connectivity::OSQLParseTreeIterator *)>
TGetParseNode;
::svxform::OSystemParseContext m_aParseContext;
+ ::svxform::ONeutralParseContext m_aNeutralContext;
::connectivity::OSQLParser m_aSqlParser;
::connectivity::OSQLParseTreeIterator m_aSqlIterator; // the iterator for the complete statement
::connectivity::OSQLParseTreeIterator m_aAdditiveIterator; // the iterator for the "additive statement" (means without the clauses of the elementary statement)
@@ -219,7 +219,10 @@ namespace dbaccess
// XServiceInfo
DECLARE_SERVICE_INFO();
- DECLARE_PROPERTYCONTAINER_DEFAULTS();
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+
// css::sdb::XSingleSelectQueryComposer
virtual OUString SAL_CALL getElementaryQuery() override;
@@ -257,6 +260,5 @@ namespace dbaccess
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getParameters( ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_SINGLESELECTQUERYCOMPOSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx
index f7bec41b9d28..289bfe5cd0bf 100644
--- a/dbaccess/source/core/inc/TableDeco.hxx
+++ b/dbaccess/source/core/inc/TableDeco.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
+#pragma once
#include <memory>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -62,8 +61,7 @@ namespace dbaccess
,public ODBTableDecorator_PROP
{
void fillPrivileges() const;
- protected:
- css::uno::Reference< css::container::XContainerListener > m_xColumnMediator;
+ rtl::Reference< OContainerMediator > m_xColumnMediator;
css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xTable;
css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions;
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
@@ -76,8 +74,9 @@ namespace dbaccess
// note: this thing uses the ref-count of "this", see OCollection::acquire()!
std::unique_ptr<::connectivity::sdbcx::OCollection> m_pColumns;
+ protected:
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -121,8 +120,8 @@ namespace dbaccess
//XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
@@ -146,7 +145,7 @@ namespace dbaccess
virtual void SAL_CALL setName( const OUString& aName ) override;
// css::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
// XColumnsSupplier
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
@@ -161,6 +160,5 @@ namespace dbaccess
using ODataSettings::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/View.hxx b/dbaccess/source/core/inc/View.hxx
index 93985e068a74..d3889ff56d00 100644
--- a/dbaccess/source/core/inc/View.hxx
+++ b/dbaccess/source/core/inc/View.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEW_HXX
+#pragma once
#include <connectivity/sdbcx/VView.hxx>
@@ -69,6 +68,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/bookmarkcontainer.hxx b/dbaccess/source/core/inc/bookmarkcontainer.hxx
index 10da82a6ced3..464192542499 100644
--- a/dbaccess/source/core/inc/bookmarkcontainer.hxx
+++ b/dbaccess/source/core/inc/bookmarkcontainer.hxx
@@ -17,15 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_BOOKMARKCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_BOOKMARKCONTAINER_HXX
+#pragma once
#include <sal/config.h>
#include <map>
#include <vector>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/container/XChild.hpp>
@@ -59,7 +58,7 @@ class OBookmarkContainer final
MapIteratorVector m_aBookmarksIndexed; // for index access to the
::cppu::OWeakObject& m_rParent; // for the ref counting
- ::comphelper::OInterfaceContainerHelper2
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener>
m_aContainerListeners;
::osl::Mutex& m_rMutex;
@@ -79,8 +78,8 @@ public:
virtual ~OBookmarkContainer() override;
// css::uno::XInterface
- virtual void SAL_CALL acquire( ) throw() override;
- virtual void SAL_CALL release( ) throw() override;
+ virtual void SAL_CALL acquire( ) noexcept override;
+ virtual void SAL_CALL release( ) noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -146,6 +145,4 @@ inline bool OBookmarkContainer::checkExistence(const OUString& _rName)
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/callablestatement.hxx b/dbaccess/source/core/inc/callablestatement.hxx
index 9ca89317c5d8..c5d7b94154d9 100644
--- a/dbaccess/source/core/inc/callablestatement.hxx
+++ b/dbaccess/source/core/inc/callablestatement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CALLABLESTATEMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CALLABLESTATEMENT_HXX
+#pragma once
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XOutParameters.hpp>
@@ -33,7 +32,7 @@ namespace dbaccess
public css::sdbc::XOutParameters
{
public:
- OCallableStatement(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
+ OCallableStatement(const rtl::Reference< OConnection > & _xConn,
const css::uno::Reference< css::uno::XInterface > & _xStatement)
:OPreparedStatement(_xConn, _xStatement){}
@@ -43,8 +42,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -77,6 +76,5 @@ namespace dbaccess
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CALLABLESTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/column.hxx b/dbaccess/source/core/inc/column.hxx
index 3744715c7d6f..9c3e1e0ad18b 100644
--- a/dbaccess/source/core/inc/column.hxx
+++ b/dbaccess/source/core/inc/column.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
+#pragma once
#include "columnsettings.hxx"
@@ -68,8 +67,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::beans::XPropertySet
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
@@ -98,7 +97,7 @@ namespace dbaccess
public:
/** creates an OColumn object which should represent the column with a given name
*/
- virtual OColumn*
+ virtual rtl::Reference<OColumn>
createColumn( const OUString& _rName ) const = 0;
/** creates a column descriptor object.
@@ -129,7 +128,6 @@ namespace dbaccess
{
OContainerMediator* m_pMediator;
- protected:
// comes from the driver can be null
css::uno::Reference< css::container::XNameAccess > m_xDrvColumns;
css::uno::WeakReference< css::uno::XInterface > m_xParent;
@@ -140,14 +138,15 @@ namespace dbaccess
bool m_bAddColumn : 1;
bool m_bDropColumn : 1;
+ protected:
virtual void impl_refresh() override;
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual connectivity::sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
public:
- connectivity::sdbcx::ObjectType createBaseObject(const OUString& _rName)
+ css::uno::Reference< css::beans::XPropertySet > createBaseObject(const OUString& _rName)
{
return OColumns_BASE::createObject(_rName);
}
@@ -179,7 +178,7 @@ namespace dbaccess
OColumns(
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
- const css::uno::Reference< css::container::XNameAccess >& _rxDrvColumns,
+ css::uno::Reference< css::container::XNameAccess > _xDrvColumns,
bool _bCaseSensitive,
const std::vector< OUString> &_rVector,
IColumnFactory* _pColFactory,
@@ -191,8 +190,8 @@ namespace dbaccess
//XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override { OColumns_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { OColumns_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { OColumns_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { OColumns_BASE::release(); }
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -214,6 +213,5 @@ namespace dbaccess
using OColumns_BASE::setParent;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/columnsettings.hxx b/dbaccess/source/core/inc/columnsettings.hxx
index 29a93effadf4..6b6c5d4c16ec 100644
--- a/dbaccess/source/core/inc/columnsettings.hxx
+++ b/dbaccess/source/core/inc/columnsettings.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMNSETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMNSETTINGS_HXX
+#pragma once
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -86,6 +85,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMNSETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/commandbase.hxx b/dbaccess/source/core/inc/commandbase.hxx
index 725e348760ef..1a0bd91d83d6 100644
--- a/dbaccess/source/core/inc/commandbase.hxx
+++ b/dbaccess/source/core/inc/commandbase.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COMMANDBASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COMMANDBASE_HXX
+#pragma once
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -48,6 +47,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COMMANDBASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/composertools.hxx b/dbaccess/source/core/inc/composertools.hxx
index d0bfdc3ff7d6..337064757300 100644
--- a/dbaccess/source/core/inc/composertools.hxx
+++ b/dbaccess/source/core/inc/composertools.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX
+#pragma once
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
@@ -119,6 +118,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/inc/connection.hxx
index e5537da68843..9756b07ed3f0 100644
--- a/dbaccess/source/core/dataaccess/connection.hxx
+++ b/dbaccess/source/core/inc/connection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_CONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_CONNECTION_HXX
+#pragma once
#include <sal/config.h>
@@ -25,11 +24,10 @@
#include <cstddef>
#include <map>
-#include <apitools.hxx>
-#include <querycontainer.hxx>
-#include <tablecontainer.hxx>
-#include <viewcontainer.hxx>
-#include <RefreshListener.hxx>
+#include "querycontainer.hxx"
+#include "tablecontainer.hxx"
+#include "viewcontainer.hxx"
+#include "RefreshListener.hxx"
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -45,15 +43,18 @@
#include <com/sun/star/sdb/application/XTableUIProvider.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <cppuhelper/implbase13.hxx>
#include <connectivity/ConnectionWrapper.hxx>
#include <connectivity/CommonTools.hxx>
#include <connectivity/warningscontainer.hxx>
+#include <unotools/weakref.hxx>
+
+class OStatementBase;
namespace dbaccess
{
-typedef cppu::ImplHelper13 < css::container::XChild
+typedef cppu::ImplInheritanceHelper< connectivity::OConnectionWrapper
+ , css::container::XChild
, css::sdbcx::XTablesSupplier
, css::sdbcx::XViewsSupplier
, css::sdbc::XConnection
@@ -70,17 +71,16 @@ typedef cppu::ImplHelper13 < css::container::XChild
class ODatabaseSource;
// OConnection
-class OConnection final :public ::cppu::BaseMutex
- ,public OSubComponent
- ,public ::connectivity::OConnectionWrapper
- ,public OConnection_Base
+class OConnection final :public OConnection_Base
,public IRefreshListener
{
+ unotools::WeakReference<ODatabaseSource> m_xParent;
css::uno::Reference< css::sdbcx::XTablesSupplier >
m_xMasterTables; // just to avoid the recreation of the catalog
- connectivity::OWeakRefArray m_aStatements;
- css::uno::Reference< css::container::XNameAccess >
- m_xQueries;
+ // contains OStatement and OPreparedStatement
+ std::vector<unotools::WeakReference<OStatementBase>>
+ m_aStatements;
+ rtl::Reference< OQueryContainer > m_xQueries;
connectivity::OWeakRefArray m_aComposers;
// the filter as set on the parent data link at construction of the connection
@@ -112,12 +112,9 @@ public:
// css::lang::XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
- virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw( ) override;
- virtual void SAL_CALL release() throw( ) override;
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -216,7 +213,7 @@ private:
if the implementation cannot be loaded
@postcond
- m_xConnectionTools is nol <NULL/>
+ m_xConnectionTools is not <NULL/>
*/
void impl_loadConnectionTools_throw();
@@ -227,6 +224,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_CONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/containerapprove.hxx b/dbaccess/source/core/inc/containerapprove.hxx
index d350470adac0..f780e224affd 100644
--- a/dbaccess/source/core/inc/containerapprove.hxx
+++ b/dbaccess/source/core/inc/containerapprove.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERAPPROVE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERAPPROVE_HXX
+#pragma once
#include <rtl/ustring.hxx>
@@ -55,6 +54,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERAPPROVE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/databasecontext.hxx b/dbaccess/source/core/inc/databasecontext.hxx
index 0c1848042b26..827295f1be23 100644
--- a/dbaccess/source/core/inc/databasecontext.hxx
+++ b/dbaccess/source/core/inc/databasecontext.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASECONTEXT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASECONTEXT_HXX
+#pragma once
#include <sal/config.h>
@@ -29,10 +28,8 @@
#include "ModelImpl.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/sdb/XDatabaseContext.hpp>
#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
-#include <com/sun/star/uno/XAggregation.hpp>
#if HAVE_FEATURE_SCRIPTING
#include <basic/basrdll.hxx>
@@ -41,22 +38,12 @@
#include <basic/basicmanagerrepository.hxx>
#include <cppuhelper/compbase.hxx>
-// needed for registration
-namespace com::sun::star {
- namespace lang
- {
- class XMultiServiceFactory;
- class IllegalArgumentException;
- }
-}
-
namespace dbaccess
{
class DatabaseDocumentLoader;
typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo
, css::sdb::XDatabaseContext
- , css::lang::XUnoTunnel
> DatabaseAccessContext_Base;
class ODatabaseContext :public DatabaseAccessContext_Base
@@ -85,13 +72,10 @@ private:
BasicDLL m_aBasicDLL;
#endif
-protected:
::osl::Mutex m_aMutex;
css::uno::Reference< css::uno::XComponentContext >
m_aContext;
- css::uno::Reference< css::uno::XAggregation >
- m_xDBRegistrationAggregate;
css::uno::Reference< css::sdb::XDatabaseRegistrations >
m_xDatabaseRegistrations;
@@ -106,7 +90,7 @@ protected:
// recreated afterwards. So it's our (the context's) responsibility to store the session-persistent
// properties.
- ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
rtl::Reference<DatabaseDocumentLoader> m_xDatabaseDocumentLoader;
public:
@@ -125,14 +109,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- // XServiceInfo - static methods
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_static();
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_static();
- static css::uno::Reference< css::uno::XInterface >
- Create(const css::uno::Reference< css::uno::XComponentContext >&);
-
// XElementAccess
virtual css::uno::Type SAL_CALL getElementType( ) override;
virtual sal_Bool SAL_CALL hasElements( ) override;
@@ -165,10 +141,6 @@ public:
virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl);
void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl);
void databaseDocumentURLChange(const OUString& _sOldName, const OUString& _sNewName);
@@ -186,6 +158,4 @@ private:
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/datasettings.hxx b/dbaccess/source/core/inc/datasettings.hxx
index 9b6a7f686434..8e24ebb714de 100644
--- a/dbaccess/source/core/inc/datasettings.hxx
+++ b/dbaccess/source/core/inc/datasettings.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DATASETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DATASETTINGS_HXX
+#pragma once
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <rtl/ustring.hxx>
@@ -75,6 +74,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DATASETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx
index 69d2c3c8490d..b4c0a5c081a6 100644
--- a/dbaccess/source/core/inc/definitioncolumn.hxx
+++ b/dbaccess/source/core/inc/definitioncolumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
+#pragma once
#include "column.hxx"
#include "columnsettings.hxx"
@@ -152,7 +151,7 @@ namespace dbaccess
OQueryColumn(
const css::uno::Reference< css::beans::XPropertySet>& _rxParserColumn,
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
- const OUString &i_sLabel
+ OUString i_sLabel
);
// XTypeProvider
@@ -273,7 +272,7 @@ namespace dbaccess
public:
OTableColumnWrapper( const css::uno::Reference< css::beans::XPropertySet >& rCol,
- const css::uno::Reference< css::beans::XPropertySet >& rColDefintion,
+ const css::uno::Reference< css::beans::XPropertySet >& rColDefinition,
const bool _bPureWrap );
// css::lang::XTypeProvider
@@ -288,6 +287,5 @@ namespace dbaccess
virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/definitioncontainer.hxx b/dbaccess/source/core/inc/definitioncontainer.hxx
index 98a4c3f140a3..33367a1d2fcc 100644
--- a/dbaccess/source/core/inc/definitioncontainer.hxx
+++ b/dbaccess/source/core/inc/definitioncontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -37,6 +36,7 @@
#include "ContentHelper.hxx"
#include "containerapprove.hxx"
#include <comphelper/uno3.hxx>
+#include <comphelper/interfacecontainer2.hxx>
namespace dbaccess
{
@@ -63,7 +63,7 @@ public:
void erase( const OUString& _rName ) { m_aDefinitions.erase( _rName ); }
void erase( const TContentPtr& _pDefinition );
- void insert( const OUString& _rName, TContentPtr _pDefinition )
+ void insert( const OUString& _rName, const TContentPtr& _pDefinition )
{
m_aDefinitions.emplace( _rName, _pDefinition );
}
@@ -130,7 +130,7 @@ protected:
with a new one), this new element must pass our own internal approval, plus the approval
given here.
*/
- void setElementApproval( PContainerApprove _pElementApproval ) { m_pElementApproval = _pElementApproval; }
+ void setElementApproval(const PContainerApprove& _pElementApproval ) { m_pElementApproval = _pElementApproval; }
const PContainerApprove& getElementApproval() const { return m_pElementApproval; }
protected:
@@ -320,6 +320,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/documentevents.hxx b/dbaccess/source/core/inc/documentevents.hxx
index 9a04074a3c68..224fc407d2fe 100644
--- a/dbaccess/source/core/inc/documentevents.hxx
+++ b/dbaccess/source/core/inc/documentevents.hxx
@@ -17,15 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DOCUMENTEVENTS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DOCUMENTEVENTS_HXX
+#pragma once
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/implbase.hxx>
-#include <memory>
#include <map>
namespace dbaccess
@@ -34,9 +32,6 @@ namespace dbaccess
typedef std::map< OUString, css::uno::Sequence< css::beans::PropertyValue > >
DocumentEventsData;
- // DocumentEvents
- struct DocumentEvents_Data;
-
typedef ::cppu::WeakImplHelper< css::container::XNameReplace
> DocumentEvents_Base;
@@ -49,11 +44,11 @@ namespace dbaccess
DocumentEvents(const DocumentEvents&) = delete;
const DocumentEvents& operator=(const DocumentEvents&) = delete;
- static bool needsSynchronousNotification( const OUString& _rEventName );
+ static bool needsSynchronousNotification( std::u16string_view _rEventName );
// XInterface
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
@@ -68,11 +63,11 @@ namespace dbaccess
virtual sal_Bool SAL_CALL hasElements( ) override;
private:
- std::unique_ptr< DocumentEvents_Data > m_pData;
+ ::cppu::OWeakObject& mrParent;
+ ::osl::Mutex& mrMutex;
+ DocumentEventsData& mrEventsData;
};
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/migrwarndlg.hxx b/dbaccess/source/core/inc/migrwarndlg.hxx
index e01c2b9f0099..24bacf300101 100644
--- a/dbaccess/source/core/inc/migrwarndlg.hxx
+++ b/dbaccess/source/core/inc/migrwarndlg.hxx
@@ -6,8 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -22,6 +21,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/objectnameapproval.hxx b/dbaccess/source/core/inc/objectnameapproval.hxx
index 6e0ce4577b03..6aa3e9c2b464 100644
--- a/dbaccess/source/core/inc/objectnameapproval.hxx
+++ b/dbaccess/source/core/inc/objectnameapproval.hxx
@@ -17,19 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECTNAMEAPPROVAL_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECTNAMEAPPROVAL_HXX
+#pragma once
-#include <memory>
#include "containerapprove.hxx"
-
+#include <cppuhelper/weakref.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
namespace dbaccess
{
// ObjectNameApproval
- struct ObjectNameApproval_Impl;
/** implementation of the IContainerApprove interface which approves
elements for insertion into a query or tables container.
@@ -41,7 +38,8 @@ namespace dbaccess
*/
class ObjectNameApproval : public IContainerApprove
{
- std::unique_ptr< ObjectNameApproval_Impl > m_pImpl;
+ css::uno::WeakReference< css::sdbc::XConnection > mxConnection;
+ sal_Int32 mnCommandType;
public:
enum ObjectType
@@ -73,6 +71,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECTNAMEAPPROVAL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/preparedstatement.hxx b/dbaccess/source/core/inc/preparedstatement.hxx
index d8e0f5b6a7b5..d39af31e13cb 100644
--- a/dbaccess/source/core/inc/preparedstatement.hxx
+++ b/dbaccess/source/core/inc/preparedstatement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_PREPAREDSTATEMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_PREPAREDSTATEMENT_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
@@ -43,7 +42,7 @@ namespace dbaccess
css::uno::Reference< css::sdbc::XParameters > m_xAggregateAsParameters;
public:
- OPreparedStatement(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
+ OPreparedStatement(const rtl::Reference< OConnection > & _xConn,
const css::uno::Reference< css::uno::XInterface > & _xStatement);
virtual ~OPreparedStatement() override;
@@ -53,8 +52,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -102,6 +101,5 @@ namespace dbaccess
virtual void SAL_CALL clearParameters( ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_PREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/querycomposer.hxx b/dbaccess/source/core/inc/querycomposer.hxx
index 1e5ef2ab07ec..c5d764d98cf8 100644
--- a/dbaccess/source/core/inc/querycomposer.hxx
+++ b/dbaccess/source/core/inc/querycomposer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
+#pragma once
#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
#include <com/sun/star/sdb/XParametersSupplier.hpp>
@@ -63,8 +62,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
@@ -88,6 +87,5 @@ namespace dbaccess
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getParameters( ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/querycontainer.hxx b/dbaccess/source/core/inc/querycontainer.hxx
index 0aeb806aed7c..f36e605ce3a3 100644
--- a/dbaccess/source/core/inc/querycontainer.hxx
+++ b/dbaccess/source/core/inc/querycontainer.hxx
@@ -17,17 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCONTAINER_HXX
+#pragma once
#include <cppuhelper/implbase5.hxx>
#include <connectivity/CommonTools.hxx>
#include <rtl/ref.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/sdbcx/XAppend.hpp>
#include <com/sun/star/sdbcx/XDrop.hpp>
@@ -67,7 +64,6 @@ namespace dbaccess
/** a class which automatically resets m_eDoingCurrently in its destructor
*/
- class OAutoActionReset; // just for the following friend declaration
friend class OAutoActionReset;
class OAutoActionReset
{
@@ -163,6 +159,4 @@ namespace dbaccess
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx
index c5dadce4549d..4f0f68d306c9 100644
--- a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx
+++ b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx
@@ -17,21 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_RECOVERY_DBDOCRECOVERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_RECOVERY_DBDOCRECOVERY_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <vector>
-#include <memory>
namespace dbaccess
{
// DatabaseDocumentRecovery
- struct DatabaseDocumentRecovery_Data;
class DatabaseDocumentRecovery
{
public:
@@ -64,11 +61,9 @@ namespace dbaccess
);
private:
- const std::unique_ptr< DatabaseDocumentRecovery_Data > m_pData;
+ css::uno::Reference<css::uno::XComponentContext> mxContext;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_RECOVERY_DBDOCRECOVERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/sdbcoretools.hxx b/dbaccess/source/core/inc/sdbcoretools.hxx
index 41097c676f58..05e04b1bcf81 100644
--- a/dbaccess/source/core/inc/sdbcoretools.hxx
+++ b/dbaccess/source/core/inc/sdbcoretools.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_SDBCORETOOLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_SDBCORETOOLS_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -35,10 +34,10 @@ namespace dbaccess
*/
OUString extractExceptionMessage( const css::uno::Reference< css::uno::XComponentContext >& _rContext, const css::uno::Any& _rError );
- namespace tools
- {
- namespace stor
- {
+} // namespace dbaccess
+
+namespace dbaccesstools
+{
bool storageIsWritable_nothrow(
const css::uno::Reference< css::embed::XStorage >& _rxStorage
);
@@ -47,12 +46,6 @@ namespace dbaccess
bool commitStorageIfWriteable(
const css::uno::Reference< css::embed::XStorage >& _rxStorage
);
- }
-
- }
-
-} // namespace dbaccess
-
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_SDBCORETOOLS_HXX
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/statement.hxx b/dbaccess/source/core/inc/statement.hxx
index 2024bb0de81e..cde3d1cf9c6a 100644
--- a/dbaccess/source/core/inc/statement.hxx
+++ b/dbaccess/source/core/inc/statement.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/util/XCancellable.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
#include <com/sun/star/sdbc/XCloseable.hpp>
@@ -34,13 +32,15 @@
#include <comphelper/proparrhlp.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/implbase3.hxx>
-#include <apitools.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <unotools/weakref.hxx>
+namespace dbaccess { class OConnection; class OResultSet; }
// OStatementBase
class OStatementBase : public cppu::BaseMutex,
- public OSubComponent,
+ public ::cppu::WeakComponentImplHelper<>,
public ::cppu::OPropertySetHelper,
public ::comphelper::OPropertyArrayUsageHelper < OStatementBase >,
public css::util::XCancellable,
@@ -51,9 +51,10 @@ class OStatementBase : public cppu::BaseMutex,
public css::sdbc::XGeneratedResultSet
{
protected:
+ unotools::WeakReference<::dbaccess::OConnection> m_xParent;
::osl::Mutex m_aCancelMutex;
- css::uno::WeakReferenceHelper m_aResultSet;
+ unotools::WeakReference<::dbaccess::OResultSet> m_xWeakResultSet;
css::uno::Reference< css::beans::XPropertySet > m_xAggregateAsSet;
css::uno::Reference< css::util::XCancellable > m_xAggregateAsCancellable;
bool m_bUseBookmarks;
@@ -62,7 +63,7 @@ protected:
virtual ~OStatementBase() override;
public:
- OStatementBase(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
+ OStatementBase(const rtl::Reference< ::dbaccess::OConnection > & _xConn,
const css::uno::Reference< css::uno::XInterface > & _xStatement);
@@ -71,8 +72,8 @@ public:
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -142,7 +143,7 @@ private:
bool m_bAttemptedComposerCreation;
public:
- OStatement(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
+ OStatement(const rtl::Reference< ::dbaccess::OConnection > & _xConn,
const css::uno::Reference< css::uno::XInterface > & _xStatement);
DECLARE_XINTERFACE()
@@ -177,6 +178,4 @@ private:
bool impl_ensureComposer_nothrow() const;
};
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/table.hxx b/dbaccess/source/core/inc/table.hxx
index ec851f3b50d6..6c71e7447653 100644
--- a/dbaccess/source/core/inc/table.hxx
+++ b/dbaccess/source/core/inc/table.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
+#pragma once
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -45,7 +44,6 @@ namespace dbaccess
private:
::rtl::Reference< OContainerMediator > m_pColumnMediator;
- protected:
css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions;
css::uno::Reference< css::container::XNameAccess > m_xDriverColumns;
@@ -53,11 +51,12 @@ namespace dbaccess
sal_Int32 m_nPrivileges;
// </properties>
+ protected:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -115,7 +114,6 @@ namespace dbaccess
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
// css::lang::XServiceInfo
DECLARE_SERVICE_INFO();
@@ -129,14 +127,10 @@ namespace dbaccess
// css::sdbcx::XAlterTable,
virtual void SAL_CALL alterColumnByName( const OUString& _rName, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
private:
using OTable_Base::createArrayHelper;
using OTable_Base::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx
index bc5a38818104..ba2ddb13ae19 100644
--- a/dbaccess/source/core/inc/tablecontainer.hxx
+++ b/dbaccess/source/core/inc/tablecontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -28,7 +27,6 @@
#include <cppuhelper/implbase1.hxx>
#include <rtl/ref.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include "FilteredContainer.hxx"
@@ -51,9 +49,9 @@ namespace dbaccess
virtual OUString getTableTypeRestriction() const override;
// ::connectivity::sdbcx::OCollection
- virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual connectivity::sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
virtual void disposing() override;
@@ -69,8 +67,8 @@ namespace dbaccess
virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
public:
- virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();}
- virtual void SAL_CALL release() throw() override { OFilteredContainer::release();}
+ virtual void SAL_CALL acquire() noexcept override { OFilteredContainer::acquire();}
+ virtual void SAL_CALL release() noexcept override { OFilteredContainer::release();}
/** ctor of the container. The parent has to support the <type scope="css::sdbc">XConnection</type>
interface.<BR>
@@ -93,6 +91,5 @@ namespace dbaccess
virtual ~OTableContainer() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/veto.hxx b/dbaccess/source/core/inc/veto.hxx
index 63a0748b24af..ec44172f70d4 100644
--- a/dbaccess/source/core/inc/veto.hxx
+++ b/dbaccess/source/core/inc/veto.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VETO_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_VETO_HXX
+#pragma once
#include <com/sun/star/util/XVeto.hpp>
@@ -38,7 +37,7 @@ namespace dbaccess
const css::uno::Any m_aDetails;
public:
- Veto( const css::uno::Any& _rDetails );
+ Veto( css::uno::Any _aDetails );
virtual OUString SAL_CALL getReason() override;
virtual css::uno::Any SAL_CALL getDetails() override;
@@ -53,6 +52,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_VETO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/viewcontainer.hxx b/dbaccess/source/core/inc/viewcontainer.hxx
index 12d7f74805fb..017ac7630dba 100644
--- a/dbaccess/source/core/inc/viewcontainer.hxx
+++ b/dbaccess/source/core/inc/viewcontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -27,16 +26,10 @@
#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include "FilteredContainer.hxx"
-namespace dbtools
-{
- class WarningsContainer;
-}
-
namespace dbaccess
{
// OViewContainer
@@ -68,8 +61,8 @@ namespace dbaccess
virtual OUString getTableTypeRestriction() const override;
private:
- virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();}
- virtual void SAL_CALL release() throw() override { OFilteredContainer::release();}
+ virtual void SAL_CALL acquire() noexcept override { OFilteredContainer::acquire();}
+ virtual void SAL_CALL release() noexcept override { OFilteredContainer::release();}
// css::lang::XServiceInfo
DECLARE_SERVICE_INFO();
@@ -81,9 +74,9 @@ namespace dbaccess
virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
// ::connectivity::sdbcx::OCollection
- virtual ::connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual ::css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual connectivity::sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
using OFilteredContainer::disposing;
@@ -91,6 +84,5 @@ namespace dbaccess
bool m_bInElementRemoved;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/ContainerMediator.cxx b/dbaccess/source/core/misc/ContainerMediator.cxx
index 338858c87e76..3c6fcb55de0c 100644
--- a/dbaccess/source/core/misc/ContainerMediator.cxx
+++ b/dbaccess/source/core/misc/ContainerMediator.cxx
@@ -22,10 +22,9 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -222,8 +221,7 @@ void OContainerMediator::notifyElementCreated( const OUString& _sName, const Ref
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- ::rtl::Reference pForward( new OPropertyForward( _xDest, m_xSettings, _sName, aPropertyList ) );
- m_aForwardList[ _sName ] = pForward;
+ m_aForwardList[_sName].set(new OPropertyForward(_xDest, m_xSettings, _sName, aPropertyList));
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index b5179e57b32f..1104d8f28b6f 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -23,9 +23,7 @@
#include <comphelper/types.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <connectivity/FValue.hxx>
-#include <rtl/math.hxx>
-#include <sal/macros.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
@@ -38,6 +36,7 @@
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <utility>
#include <vector>
// TODO: update for new HavingClause-aware FilterManager
@@ -52,14 +51,13 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >(
context, IMPLEMENTS_PROPERTY_SET, uno::Sequence< OUString >()),
m_aParameterManager( m_aMutex, context ),
- m_aFilterManager(),
m_xContext(context),
m_CommandType(sdb::CommandType::COMMAND), // #i94114
m_RowLimit(0),
m_EscapeProcessing(true),
m_ApplyFilter(true)
{
- m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.chart.InternalDataProvider",m_xContext ), uno::UNO_QUERY );
+ m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.chart.InternalDataProvider"_ustr,m_xContext ), uno::UNO_QUERY );
m_xRangeConversion.set(m_xInternal,uno::UNO_QUERY);
m_xComplexDescriptionAccess.set(m_xInternal,uno::UNO_QUERY);
@@ -71,8 +69,8 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
uno::Reference<beans::XPropertySet> xProp(static_cast< ::cppu::OWeakObject* >( this ),uno::UNO_QUERY);
m_aFilterManager.initialize( m_xAggregateSet );
m_aParameterManager.initialize( xProp, m_xAggregate );
- m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::makeAny(m_CommandType));
- m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::makeAny(m_EscapeProcessing));
+ m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::Any(m_CommandType));
+ m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::Any(m_EscapeProcessing));
}
osl_atomic_decrement( &m_refCount );
}
@@ -80,7 +78,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
void SAL_CALL DatabaseDataProvider::disposing()
{
m_aParameterManager.dispose(); // (to free any references it may have to me)
- m_aFilterManager.dispose(); // (dito)
+ m_aFilterManager.dispose(); // (ditto)
m_xParent.clear();
m_xAggregateSet.clear();
@@ -96,15 +94,10 @@ uno::Any DatabaseDataProvider::queryInterface(uno::Type const & type)
return TDatabaseDataProvider::queryInterface(type);
}
-OUString DatabaseDataProvider::getImplementationName_Static( )
-{
- return "com.sun.star.comp.dbaccess.DatabaseDataProvider";
-}
-
// XServiceInfo
OUString SAL_CALL DatabaseDataProvider::getImplementationName( )
{
- return getImplementationName_Static();
+ return u"com.sun.star.comp.dbaccess.DatabaseDataProvider"_ustr;
}
sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const OUString& _rServiceName )
@@ -112,62 +105,48 @@ sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const OUString& _rServi
return cppu::supportsService(this, _rServiceName);
}
-uno::Sequence< OUString > DatabaseDataProvider::getSupportedServiceNames_Static( )
-{
- return { "com.sun.star.chart2.data.DatabaseDataProvider" };
-}
-
uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getSupportedServiceNames( )
{
- return getSupportedServiceNames_Static();
-}
-
-uno::Reference< uno::XInterface > DatabaseDataProvider::Create(uno::Reference< uno::XComponentContext > const & context)
-{
- return *(new DatabaseDataProvider(context)) ;
+ return { u"com.sun.star.chart2.data.DatabaseDataProvider"_ustr };
}
// lang::XInitialization:
void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > & aArguments)
{
osl::MutexGuard g(m_aMutex);
- const uno::Any* pIter = aArguments.getConstArray();
- const uno::Any* pEnd = pIter + aArguments.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& arg : aArguments)
{
if ( !m_xActiveConnection.is() )
- (*pIter) >>= m_xActiveConnection;
+ arg >>= m_xActiveConnection;
else if ( !m_xHandler.is() )
- (*pIter) >>= m_xHandler;
+ arg >>= m_xHandler;
}
- m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::makeAny( m_xActiveConnection ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::Any( m_xActiveConnection ) );
}
// chart2::data::XDataProvider:
sal_Bool SAL_CALL DatabaseDataProvider::createDataSourcePossible(const uno::Sequence< beans::PropertyValue > & _aArguments)
{
- const beans::PropertyValue* pArgIter = _aArguments.getConstArray();
- const beans::PropertyValue* pArgEnd = pArgIter + _aArguments.getLength();
- for(;pArgIter != pArgEnd;++pArgIter)
+ for (auto& arg : _aArguments)
{
- if ( pArgIter->Name == "DataRowSource" )
+ if (arg.Name == "DataRowSource")
{
css::chart::ChartDataRowSource eRowSource = css::chart::ChartDataRowSource_COLUMNS;
- pArgIter->Value >>= eRowSource;
+ arg.Value >>= eRowSource;
if ( eRowSource != css::chart::ChartDataRowSource_COLUMNS )
return false;
}
- else if ( pArgIter->Name == "CellRangeRepresentation" )
+ else if (arg.Name == "CellRangeRepresentation")
{
OUString sRange;
- pArgIter->Value >>= sRange;
+ arg.Value >>= sRange;
if ( sRange != "all" )
return false;
}
- else if ( pArgIter->Name == "FirstCellAsLabel" )
+ else if (arg.Name == "FirstCellAsLabel")
{
bool bFirstCellAsLabel = true;
- pArgIter->Value >>= bFirstCellAsLabel;
+ arg.Value >>= bFirstCellAsLabel;
if ( !bFirstCellAsLabel )
return false;
}
@@ -194,9 +173,9 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
}
::comphelper::NamedValueCollection aArgs( _aArguments );
- const bool bHasCategories = aArgs.getOrDefault( "HasCategories", true );
+ const bool bHasCategories = aArgs.getOrDefault( u"HasCategories"_ustr, true );
uno::Sequence< OUString > aColumnNames =
- aArgs.getOrDefault( "ColumnDescriptions", uno::Sequence< OUString >() );
+ aArgs.getOrDefault( u"ColumnDescriptions"_ustr, uno::Sequence< OUString >() );
bool bRet = false;
if ( !m_Command.isEmpty() && m_xActiveConnection.is() )
@@ -218,9 +197,8 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY);
if ( xIni.is() )
{
- uno::Sequence< uno::Any > aInitArgs(1);
- beans::NamedValue aParam("CreateDefaultData",uno::makeAny(true));
- aInitArgs[0] <<= aParam;
+ beans::NamedValue aParam(u"CreateDefaultData"_ustr,uno::Any(true));
+ uno::Sequence< uno::Any > aInitArgs{ uno::Any(aParam) };
xIni->initialize(aInitArgs);
}
}
@@ -232,10 +210,10 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArguments(const uno::Reference< chart2::data::XDataSource > & _xDataSource)
{
::comphelper::NamedValueCollection aArguments;
- aArguments.put( "CellRangeRepresentation", uno::Any( OUString( "all" ) ) );
- aArguments.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
+ aArguments.put( u"CellRangeRepresentation"_ustr, uno::Any( u"all"_ustr ) );
+ aArguments.put( u"DataRowSource"_ustr, uno::Any( chart::ChartDataRowSource_COLUMNS ) );
// internal data always contains labels
- aArguments.put( "FirstCellAsLabel", uno::makeAny( true ) );
+ aArguments.put( u"FirstCellAsLabel"_ustr, uno::Any( true ) );
bool bHasCategories = false;
if( _xDataSource.is())
@@ -249,7 +227,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArgum
uno::Reference< beans::XPropertySet > xSeqProp( aSequences[nIdx]->getValues(), uno::UNO_QUERY );
OUString aRole;
if ( xSeqProp.is()
- && ( xSeqProp->getPropertyValue( "Role" ) >>= aRole )
+ && ( xSeqProp->getPropertyValue( u"Role"_ustr ) >>= aRole )
&& aRole == "categories"
)
{
@@ -259,7 +237,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArgum
}
}
}
- aArguments.put( "HasCategories", uno::makeAny( bHasCategories ) );
+ aArguments.put( u"HasCategories"_ustr, uno::Any( bHasCategories ) );
return aArguments.getPropertyValues();
}
@@ -273,7 +251,7 @@ uno::Any DatabaseDataProvider::impl_getNumberFormatKey_nothrow(const OUString &
std::map< OUString,css::uno::Any>::const_iterator aFind = m_aNumberFormats.find(_sRangeRepresentation);
if ( aFind != m_aNumberFormats.end() )
return aFind->second;
- return uno::makeAny(sal_Int32(0));
+ return uno::Any(sal_Int32(0));
}
uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentation(const OUString & _sRangeRepresentation)
@@ -281,7 +259,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre
osl::MutexGuard g(m_aMutex);
uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation);
uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY);
- static const char s_sNumberFormatKey[] = "NumberFormatKey";
+ static constexpr OUString s_sNumberFormatKey = u"NumberFormatKey"_ustr;
if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) )
{
xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation));
@@ -291,7 +269,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre
uno::Reference<chart2::data::XDataSequence>
SAL_CALL DatabaseDataProvider::createDataSequenceByValueArray(
- const OUString& /*aRole*/, const OUString& /*aRangeRepresentation*/ )
+ const OUString& /*aRole*/, const OUString& /*aRangeRepresentation*/, const OUString& /*aRoleQualifier*/ )
{
return uno::Reference<chart2::data::XDataSequence>();
}
@@ -437,7 +415,7 @@ uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getMasterFields()
void SAL_CALL DatabaseDataProvider::setMasterFields(const uno::Sequence< OUString > & the_value)
{
impl_invalidateParameter_nothrow();
- set("MasterFields",the_value,m_MasterFields);
+ set(u"MasterFields"_ustr,the_value,m_MasterFields);
}
uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getDetailFields()
@@ -448,7 +426,7 @@ uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getDetailFields()
void SAL_CALL DatabaseDataProvider::setDetailFields(const uno::Sequence< OUString > & the_value)
{
- set("DetailFields",the_value,m_DetailFields);
+ set(u"DetailFields"_ustr,the_value,m_DetailFields);
}
OUString SAL_CALL DatabaseDataProvider::getCommand()
@@ -462,7 +440,7 @@ void SAL_CALL DatabaseDataProvider::setCommand(const OUString & the_value)
{
osl::MutexGuard g(m_aMutex);
impl_invalidateParameter_nothrow();
- m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND, uno::Any( the_value ) );
}
set(PROPERTY_COMMAND,the_value,m_Command);
}
@@ -477,7 +455,7 @@ void SAL_CALL DatabaseDataProvider::setCommandType(::sal_Int32 the_value)
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND_TYPE, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND_TYPE, uno::Any( the_value ) );
}
set(PROPERTY_COMMAND_TYPE,the_value,m_CommandType);
}
@@ -507,7 +485,7 @@ void SAL_CALL DatabaseDataProvider::setApplyFilter( sal_Bool the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER, uno::Any( the_value ) );
}
set(PROPERTY_APPLYFILTER,static_cast<bool>(the_value),m_ApplyFilter);
}
@@ -522,7 +500,7 @@ void SAL_CALL DatabaseDataProvider::setHavingClause( const OUString& the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_HAVING_CLAUSE, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_HAVING_CLAUSE, uno::Any( the_value ) );
}
set(PROPERTY_HAVING_CLAUSE,the_value,m_HavingClause);
}
@@ -537,7 +515,7 @@ void SAL_CALL DatabaseDataProvider::setGroupBy( const OUString& the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_GROUP_BY, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_GROUP_BY, uno::Any( the_value ) );
}
set(PROPERTY_GROUP_BY,the_value,m_GroupBy);
}
@@ -552,7 +530,7 @@ void SAL_CALL DatabaseDataProvider::setOrder( const OUString& the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_ORDER, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_ORDER, uno::Any( the_value ) );
}
set(PROPERTY_ORDER,the_value,m_Order);
}
@@ -576,7 +554,7 @@ void SAL_CALL DatabaseDataProvider::setEscapeProcessing(sal_Bool the_value)
void SAL_CALL DatabaseDataProvider::setRowLimit(::sal_Int32 the_value)
{
- set("RowLimit",the_value,m_RowLimit);
+ set(u"RowLimit"_ustr,the_value,m_RowLimit);
}
uno::Reference< sdbc::XConnection > SAL_CALL DatabaseDataProvider::getActiveConnection()
@@ -612,13 +590,12 @@ namespace
sal_Int32 nDataType;
ColumnDescription()
- :sName()
- ,nResultSetPosition( 0 )
+ :nResultSetPosition( 0 )
,nDataType( sdbc::DataType::VARCHAR )
{
}
- explicit ColumnDescription( const OUString& i_rName )
- :sName( i_rName )
+ explicit ColumnDescription( OUString i_sName )
+ :sName(std::move( i_sName ))
,nResultSetPosition( 0 )
,nDataType( sdbc::DataType::VARCHAR )
{
@@ -677,13 +654,13 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
{
const sal_Int32 nAssumedRowSetColumnIndex = _bHasCategories ? 1 : 0;
if ( nAssumedRowSetColumnIndex < aRowSetColumnNames.getLength() )
- aImposedColumnNames[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ];
+ aImposedColumnNames.getArray()[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ];
}
const sal_Int32 nCount = aImposedColumnNames.getLength();
for ( sal_Int32 i = 0 ; i < nCount; ++i )
{
- const OUString sColumnName( aImposedColumnNames[i] );
+ const OUString& sColumnName( aImposedColumnNames[i] );
if ( !xColumns->hasByName( sColumnName ) )
continue;
@@ -753,16 +730,12 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
aValue.fill( column.nResultSetPosition, column.nDataType, xRow );
if ( aValue.isNull() )
- {
- double nValue;
- ::rtl::math::setNan( &nValue );
- aRow.push_back( nValue );
- }
+ aRow.push_back( std::numeric_limits<double>::quiet_NaN() );
else
aRow.push_back( aValue.getDouble() );
}
- aDataValues.push_back( aRow );
+ aDataValues.push_back(std::move(aRow));
}
// insert default data when no rows exist
@@ -778,14 +751,14 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
{
aRowLabels.push_back(OUString::number(h+1));
std::vector< double > aRow;
- const sal_Int32 nSize = SAL_N_ELEMENTS(fDefaultData);
+ const sal_Int32 nSize = std::size(fDefaultData);
for (size_t j = 0; j < (aColumns.size()-1); ++j,++k)
{
if ( k >= nSize )
k = 0;
aRow.push_back(fDefaultData[k]);
}
- aDataValues.push_back(aRow);
+ aDataValues.push_back(std::move(aRow));
}
}
@@ -815,7 +788,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
void DatabaseDataProvider::impl_fillRowSet_throw()
{
- m_xAggregateSet->setPropertyValue( PROPERTY_FILTER, uno::makeAny( getFilter() ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_FILTER, uno::Any( getFilter() ) );
uno::Reference< sdbc::XParameters> xParam(m_xRowSet,uno::UNO_QUERY_THROW);
xParam->clearParameters( );
}
@@ -1077,4 +1050,13 @@ void DatabaseDataProvider::impl_invalidateParameter_nothrow()
} // namespace dbaccess
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_dbaccess_DatabaseDataProvider_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+{
+ return cppu::acquire(new dbaccess::DatabaseDataProvider(context));
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/PropertyForward.cxx b/dbaccess/source/core/misc/PropertyForward.cxx
index 239bd422fd41..07e1068f695f 100644
--- a/dbaccess/source/core/misc/PropertyForward.cxx
+++ b/dbaccess/source/core/misc/PropertyForward.cxx
@@ -24,7 +24,8 @@
#include <com/sun/star/sdbcx/XAppend.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -37,10 +38,10 @@ namespace dbaccess
OPropertyForward::OPropertyForward( const Reference< XPropertySet>& _xSource, const Reference< XNameAccess>& _xDestContainer,
- const OUString& _sName, const std::vector< OUString>& _aPropertyList )
+ OUString _sName, const std::vector< OUString>& _aPropertyList )
:m_xSource( _xSource, UNO_SET_THROW )
,m_xDestContainer( _xDestContainer, UNO_SET_THROW )
- ,m_sName( _sName )
+ ,m_sName(std::move( _sName ))
,m_bInInsert( false )
{
diff --git a/dbaccess/source/core/misc/apitools.cxx b/dbaccess/source/core/misc/apitools.cxx
index c080979ba042..0d29f7102628 100644
--- a/dbaccess/source/core/misc/apitools.cxx
+++ b/dbaccess/source/core/misc/apitools.cxx
@@ -18,7 +18,6 @@
*/
#include <apitools.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star::uno;
@@ -29,7 +28,7 @@ using namespace osl;
// various helper functions
// OSubComponent
OSubComponent::OSubComponent(Mutex& _rMutex, const Reference< XInterface > & xParent)
- :OComponentHelper(_rMutex)
+ :WeakComponentImplHelper(_rMutex)
,m_xParent(xParent)
{
@@ -41,74 +40,51 @@ OSubComponent::~OSubComponent()
}
-// css::lang::XTypeProvider
-Sequence< Type > OSubComponent::getTypes()
-{
- OTypeCollection aTypes(cppu::UnoType<XComponent>::get(),
- cppu::UnoType<XTypeProvider>::get(),
- cppu::UnoType<XWeak>::get());
-
- return aTypes.getTypes();
-}
-
// XInterface
-void OSubComponent::release() throw ( )
+void OSubComponent::release() noexcept
{
- Reference< XInterface > x( xDelegator );
- if (! x.is())
+ if (osl_atomic_decrement( &m_refCount ) == 0 )
{
- if (osl_atomic_decrement( &m_refCount ) == 0 )
+ if (! rBHelper.bDisposed)
{
- if (! rBHelper.bDisposed)
+ // *before* again incrementing our ref count, ensure that our weak connection point
+ // will not create references to us anymore (via XAdapter::queryAdapted)
+ disposeWeakConnectionPoint();
+
+ Reference< XInterface > xHoldAlive( *this );
+ // remember the parent
+ Reference< XInterface > xParent;
{
- // *before* again incrementing our ref count, ensure that our weak connection point
- // will not create references to us anymore (via XAdapter::queryAdapted)
- disposeWeakConnectionPoint();
-
- Reference< XInterface > xHoldAlive( *this );
- // remember the parent
- Reference< XInterface > xParent;
- {
- MutexGuard aGuard( rBHelper.rMutex );
- xParent = m_xParent;
- m_xParent = nullptr;
- }
-
- SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (before dispose)!" );
-
- // First dispose
- dispose();
-
- // only the alive ref holds the object
- SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (after dispose)!" );
-
- // release the parent in the ~
- if (xParent.is())
- {
- MutexGuard aGuard( rBHelper.rMutex );
- m_xParent = xParent;
- }
-
- // destroy the object if xHoldAlive decrement the refcount to 0
- return;
+ MutexGuard aGuard( rBHelper.rMutex );
+ xParent = m_xParent;
+ m_xParent = nullptr;
}
- }
- // restore the reference count
- osl_atomic_increment( &m_refCount );
- }
- // as we cover the job of the componenthelper we use the ...
- OWeakAggObject::release();
-}
+ SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (before dispose)!" );
-Any OSubComponent::queryInterface( const Type & rType )
-{
- Any aReturn;
- if (!rType.equals(cppu::UnoType<XAggregation>::get()))
- aReturn = OComponentHelper::queryInterface(rType);
+ // First dispose
+ dispose();
+
+ // only the alive ref holds the object
+ SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (after dispose)!" );
+
+ // release the parent in the ~
+ if (xParent.is())
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ m_xParent = std::move(xParent);
+ }
+
+ // destroy the object if xHoldAlive decrement the refcount to 0
+ return;
+ }
+ }
+ // restore the reference count
+ osl_atomic_increment( &m_refCount );
- return aReturn;
+ // as we cover the job of the WeakComponentImplHelper we use the ...
+ OWeakObject::release();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 8256f370cce3..f3d792b4f59e 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -17,13 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_java.h>
#include <dsntypes.hxx>
#include <unotools/confignode.hxx>
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
-#include <svtools/miscopt.hxx>
#include <tools/wldcrd.hxx>
#include <osl/file.hxx>
+#include <officecfg/Office/Common.hxx>
#include <comphelper/string.hxx>
+#include <utility>
namespace dbaccess
{
@@ -31,17 +35,16 @@ namespace dbaccess
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
namespace
{
- void lcl_extractHostAndPort(const OUString& _sUrl,OUString& _sHostname,sal_Int32& _nPortNumber)
+ void lcl_extractHostAndPort(std::u16string_view _sUrl, OUString& _sHostname, sal_Int32& _nPortNumber)
{
if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 )
{
sal_Int32 nPos {0};
- _sHostname = _sUrl.getToken(0, ':', nPos);
- _nPortNumber = _sUrl.getToken(0, ':', nPos).toInt32();
+ _sHostname = o3tl::getToken(_sUrl, 0, ':', nPos);
+ _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos));
}
}
}
@@ -52,13 +55,10 @@ ODsnTypeCollection::ODsnTypeCollection(const css::uno::Reference< css::uno::XCom
,m_nLivingIterators(0)
#endif
{
- const uno::Sequence< OUString > aURLs = m_aDriverConfig.getURLs();
- const OUString* pIter = aURLs.getConstArray();
- const OUString* pEnd = pIter + aURLs.getLength();
- for(;pIter != pEnd;++pIter )
+ for (auto& url : m_aDriverConfig.getURLs())
{
- m_aDsnPrefixes.push_back(*pIter);
- m_aDsnTypesDisplayNames.push_back(m_aDriverConfig.getDriverTypeDisplayName(*pIter));
+ m_aDsnPrefixes.push_back(url);
+ m_aDsnTypesDisplayNames.push_back(m_aDriverConfig.getDriverTypeDisplayName(url));
}
OSL_ENSURE(m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size(),
@@ -72,18 +72,18 @@ ODsnTypeCollection::~ODsnTypeCollection()
#endif
}
-OUString ODsnTypeCollection::getTypeDisplayName(const OUString& _sURL) const
+OUString ODsnTypeCollection::getTypeDisplayName(std::u16string_view _sURL) const
{
return m_aDriverConfig.getDriverTypeDisplayName(_sURL);
}
-OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
+OUString ODsnTypeCollection::cutPrefix(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
// on Windows or with gen rendering, the urls may begin with an ~
- const OUString& sCleanURL = comphelper::string::stripStart(_sURL, '~');
+ std::u16string_view sCleanURL = comphelper::string::stripStart(_sURL, '~');
for (auto const& dsnPrefix : m_aDsnPrefixes)
{
@@ -94,8 +94,8 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
// foo*
// that is, the very concept of "prefix" applies.
OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
- OSL_ENSURE(prefix.getLength() <= sCleanURL.getLength(), "How can A match B when A shorter than B?");
- sRet = sCleanURL.copy(prefix.getLength());
+ OSL_ENSURE(o3tl::make_unsigned(prefix.getLength()) <= sCleanURL.size(), "How can A match B when A shorter than B?");
+ sRet = sCleanURL.substr(prefix.getLength());
sOldPattern = dsnPrefix;
}
}
@@ -103,7 +103,7 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
return sRet;
}
-OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const
+OUString ODsnTypeCollection::getPrefix(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
@@ -116,7 +116,7 @@ OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const
// foo*
// that is, the very concept of "prefix" applies.
sRet = comphelper::string::stripEnd(dsnPrefix, '*');
- OSL_ENSURE(sRet.getLength() <= _sURL.getLength(), "How can A match B when A shorter than B?");
+ OSL_ENSURE(sRet.getLength() <= static_cast<sal_Int32>(_sURL.size()), "How can A match B when A shorter than B?");
sOldPattern = dsnPrefix;
}
}
@@ -124,13 +124,13 @@ OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const
return sRet;
}
-bool ODsnTypeCollection::hasDriver( const char* _pAsciiPattern ) const
+bool ODsnTypeCollection::hasDriver( std::u16string_view _rAsciiPattern ) const
{
- OUString sPrefix( getPrefix( OUString::createFromAscii( _pAsciiPattern ) ) );
+ OUString sPrefix( getPrefix( _rAsciiPattern ) );
return !sPrefix.isEmpty();
}
-bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const
+bool ODsnTypeCollection::isConnectionUrlRequired(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
@@ -146,31 +146,28 @@ bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const
return !sRet.isEmpty() && sRet[sRet.getLength()-1] == '*';
}
-OUString ODsnTypeCollection::getMediaType(const OUString& _sURL) const
+OUString ODsnTypeCollection::getMediaType(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
- return aFeatures.getOrDefault("MediaType",OUString());
+ return aFeatures.getOrDefault(u"MediaType"_ustr,OUString());
}
-OUString ODsnTypeCollection::getDatasourcePrefixFromMediaType(const OUString& _sMediaType,const OUString& _sExtension)
+OUString ODsnTypeCollection::getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType,std::u16string_view _sExtension)
{
OUString sURL, sFallbackURL;
- const uno::Sequence< OUString > aURLs = m_aDriverConfig.getURLs();
- const OUString* pIter = aURLs.getConstArray();
- const OUString* pEnd = pIter + aURLs.getLength();
- for(;pIter != pEnd;++pIter )
+ for (auto& url : m_aDriverConfig.getURLs())
{
- const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(*pIter);
- if ( aFeatures.getOrDefault("MediaType",OUString()) == _sMediaType )
+ const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(url);
+ if ( aFeatures.getOrDefault(u"MediaType"_ustr,OUString()) == _sMediaType )
{
- const OUString sFileExtension = aFeatures.getOrDefault("Extension",OUString());
+ const OUString sFileExtension = aFeatures.getOrDefault(u"Extension"_ustr,OUString());
if ( _sExtension == sFileExtension )
{
- sURL = *pIter;
+ sURL = url;
break;
}
- if ( sFileExtension.isEmpty() && !_sExtension.isEmpty() )
- sFallbackURL = *pIter;
+ if ( sFileExtension.isEmpty() && !_sExtension.empty() )
+ sFallbackURL = url;
}
}
@@ -225,8 +222,7 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD
_rsHostname = sUrl.getToken(0,'/');
_sDatabaseName = sUrl.copy(sUrl.lastIndexOf('/')+1);
}
- else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")
- || _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=") )
+ else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
{
OUString sNewFileName;
if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
@@ -236,64 +232,63 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD
}
}
-OUString ODsnTypeCollection::getJavaDriverClass(const OUString& _sURL) const
+OUString ODsnTypeCollection::getJavaDriverClass(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getProperties(_sURL);
- return aFeatures.getOrDefault("JavaDriverClass",OUString());
+ return aFeatures.getOrDefault(u"JavaDriverClass"_ustr,OUString());
}
-bool ODsnTypeCollection::isFileSystemBased(const OUString& _sURL) const
+bool ODsnTypeCollection::isFileSystemBased(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
- return aFeatures.getOrDefault("FileSystemBased",false);
+ return aFeatures.getOrDefault(u"FileSystemBased"_ustr,false);
}
-bool ODsnTypeCollection::supportsTableCreation(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsTableCreation(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
- return aFeatures.getOrDefault("SupportsTableCreation",false);
+ return aFeatures.getOrDefault(u"SupportsTableCreation"_ustr,false);
}
-bool ODsnTypeCollection::supportsColumnDescription(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsColumnDescription(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
- return aFeatures.getOrDefault("SupportsColumnDescription",false);
+ return aFeatures.getOrDefault(u"SupportsColumnDescription"_ustr,false);
}
-bool ODsnTypeCollection::supportsBrowsing(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsBrowsing(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
- return aFeatures.getOrDefault("SupportsBrowsing",false);
+ return aFeatures.getOrDefault(u"SupportsBrowsing"_ustr,false);
}
-bool ODsnTypeCollection::supportsDBCreation(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsDBCreation(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
- return aFeatures.getOrDefault("SupportsDBCreation",false);
+ return aFeatures.getOrDefault(u"SupportsDBCreation"_ustr,false);
}
-Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const OUString& _sURL ) const
+Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( std::u16string_view _sURL ) const
{
const ::comphelper::NamedValueCollection& aProperties = m_aDriverConfig.getProperties(_sURL);
return aProperties.getPropertyValues();
}
-bool ODsnTypeCollection::isEmbeddedDatabase( const OUString& _sURL )
+bool ODsnTypeCollection::isEmbeddedDatabase( std::u16string_view _sURL )
{
- return _sURL.startsWith( "sdbc:embedded:" );
+ return o3tl::starts_with( _sURL, u"sdbc:embedded:" );
}
OUString ODsnTypeCollection::getEmbeddedDatabase()
{
- SvtMiscOptions aMiscOptions;
- if (aMiscOptions.IsExperimentalMode())
- return "sdbc:embedded:firebird";
+ if (!HAVE_FEATURE_JAVA || officecfg::Office::Common::Misc::ExperimentalMode::get())
+ return u"sdbc:embedded:firebird"_ustr;
else
- return "sdbc:embedded:hsqldb";
+ return u"sdbc:embedded:hsqldb"_ustr;
}
-DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
+DATASOURCE_TYPE ODsnTypeCollection::determineType(std::u16string_view _rDsn) const
{
OUString sDsn(comphelper::string::stripEnd(_rDsn, '*'));
sal_Int32 nSeparator = sDsn.indexOf(u':');
@@ -321,6 +316,9 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
if (sDsn.equalsIgnoreAsciiCase("sdbc:embedded:firebird"))
return DST_EMBEDDED_FIREBIRD;
+ if (sDsn.startsWithIgnoreAsciiCase("sdbc:embedded:"))
+ return DST_EMBEDDED_UNKNOWN;
+
// find second :
nSeparator = sDsn.indexOf(u':', nSeparator + 1);
if (-1 == nSeparator)
@@ -334,10 +332,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
{
if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
{
- if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;"))
- return DST_MSACCESS_2007;
- else
- return DST_MSACCESS;
+ return DST_MSACCESS;
}
return DST_ADO;
}
@@ -348,8 +343,8 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
const DATASOURCE_TYPE eType;
const bool bMatchComplete;
- KnownPrefix( const OUString &_s, const DATASOURCE_TYPE _t, const bool _m )
- :sPrefix( _s )
+ KnownPrefix( OUString _s, const DATASOURCE_TYPE _t, const bool _m )
+ :sPrefix(std::move( _s ))
,eType ( _t )
,bMatchComplete( _m )
{
@@ -369,28 +364,28 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
};
const KnownPrefix aKnowPrefixes[] =
{
- KnownPrefix( "sdbc:calc:", DST_CALC, false ),
- KnownPrefix( "sdbc:writer:", DST_WRITER, false ),
- KnownPrefix( "sdbc:flat:", DST_FLAT, false ),
- KnownPrefix( "sdbc:odbc:", DST_ODBC, false ),
- KnownPrefix( "sdbc:dbase:", DST_DBASE, false ),
- KnownPrefix( "sdbc:firebird:", DST_FIREBIRD, false ),
- KnownPrefix( "sdbc:mysql:odbc:", DST_MYSQL_ODBC, false ),
- KnownPrefix( "sdbc:mysql:jdbc:", DST_MYSQL_JDBC, false ),
- KnownPrefix( "sdbc:mysql:mysqlc:", DST_MYSQL_NATIVE, false ),
- KnownPrefix( "sdbc:mysqlc:", DST_MYSQL_NATIVE_DIRECT,false ),
- KnownPrefix( "sdbc:postgresql:", DST_POSTGRES ,false ),
-
- KnownPrefix( "sdbc:address:mozilla:", DST_MOZILLA, true ),
- KnownPrefix( "sdbc:address:thunderbird:", DST_THUNDERBIRD, true ),
- KnownPrefix( "sdbc:address:ldap:", DST_LDAP, true ),
- KnownPrefix( "sdbc:address:outlook", DST_OUTLOOK, true ),
- KnownPrefix( "sdbc:address:outlookexp", DST_OUTLOOKEXP, true ),
- KnownPrefix( "sdbc:address:evolution:ldap", DST_EVOLUTION_LDAP, true ),
- KnownPrefix( "sdbc:address:evolution:groupwise",DST_EVOLUTION_GROUPWISE,true ),
- KnownPrefix( "sdbc:address:evolution:local", DST_EVOLUTION, true ),
- KnownPrefix( "sdbc:address:kab", DST_KAB, true ),
- KnownPrefix( "sdbc:address:macab", DST_MACAB, true )
+ KnownPrefix( u"sdbc:calc:"_ustr, DST_CALC, false ),
+ KnownPrefix( u"sdbc:writer:"_ustr, DST_WRITER, false ),
+ KnownPrefix( u"sdbc:flat:"_ustr, DST_FLAT, false ),
+ KnownPrefix( u"sdbc:odbc:"_ustr, DST_ODBC, false ),
+ KnownPrefix( u"sdbc:dbase:"_ustr, DST_DBASE, false ),
+ KnownPrefix( u"sdbc:firebird:"_ustr, DST_FIREBIRD, false ),
+ KnownPrefix( u"sdbc:mysql:odbc:"_ustr, DST_MYSQL_ODBC, false ),
+ KnownPrefix( u"sdbc:mysql:jdbc:"_ustr, DST_MYSQL_JDBC, false ),
+ KnownPrefix( u"sdbc:mysql:mysqlc:"_ustr, DST_MYSQL_NATIVE, false ),
+ KnownPrefix( u"sdbc:mysqlc:"_ustr, DST_MYSQL_NATIVE_DIRECT,false ),
+ KnownPrefix( u"sdbc:postgresql:"_ustr, DST_POSTGRES ,false ),
+
+ KnownPrefix( u"sdbc:address:mozilla:"_ustr, DST_MOZILLA, true ),
+ KnownPrefix( u"sdbc:address:thunderbird:"_ustr, DST_THUNDERBIRD, true ),
+ KnownPrefix( u"sdbc:address:ldap:"_ustr, DST_LDAP, true ),
+ KnownPrefix( u"sdbc:address:outlook"_ustr, DST_OUTLOOK, true ),
+ KnownPrefix( u"sdbc:address:outlookexp"_ustr, DST_OUTLOOKEXP, true ),
+ KnownPrefix( u"sdbc:address:evolution:ldap"_ustr, DST_EVOLUTION_LDAP, true ),
+ KnownPrefix( u"sdbc:address:evolution:groupwise"_ustr,DST_EVOLUTION_GROUPWISE,true ),
+ KnownPrefix( u"sdbc:address:evolution:local"_ustr, DST_EVOLUTION, true ),
+ KnownPrefix( u"sdbc:address:kab"_ustr, DST_KAB, true ),
+ KnownPrefix( u"sdbc:address:macab"_ustr, DST_MACAB, true )
};
for (const auto & aKnowPrefixe : aKnowPrefixes)
@@ -404,7 +399,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
return DST_UNKNOWN;
}
-void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16>& _rOutPathIds) const
+void ODsnTypeCollection::fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const
{
DATASOURCE_TYPE eType = determineType(_sURL);
switch(eType)
@@ -443,11 +438,13 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
case DST_ORACLE_JDBC:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ORACLE);
break;
+ case DST_POSTGRES:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_POSTGRES);
+ break;
case DST_LDAP:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_LDAP);
break;
case DST_MSACCESS:
- case DST_MSACCESS_2007:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MSACCESS);
break;
case DST_OUTLOOKEXP:
@@ -461,6 +458,7 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
case DST_MACAB:
case DST_EMBEDDED_HSQLDB:
case DST_EMBEDDED_FIREBIRD:
+ case DST_EMBEDDED_UNKNOWN:
break;
default:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_USERDEFINED);
@@ -468,7 +466,7 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
}
}
-OUString ODsnTypeCollection::getType(const OUString& _sURL) const
+OUString ODsnTypeCollection::getType(std::u16string_view _sURL) const
{
OUString sOldPattern;
for (auto const& dsnPrefix : m_aDsnPrefixes)
@@ -482,7 +480,7 @@ OUString ODsnTypeCollection::getType(const OUString& _sURL) const
return sOldPattern;
}
-sal_Int32 ODsnTypeCollection::getIndexOf(const OUString& _sURL) const
+sal_Int32 ODsnTypeCollection::getIndexOf(std::u16string_view _sURL) const
{
sal_Int32 nRet = -1;
OUString sOldPattern;
@@ -511,7 +509,7 @@ ODsnTypeCollection::TypeIterator::TypeIterator(const ODsnTypeCollection* _pConta
:m_pContainer(_pContainer)
,m_nPosition(_nInitialPos)
{
- OSL_ENSURE(m_pContainer, "ODsnTypeCollection::TypeIterator::TypeIterator : invalid container!");
+ assert(m_pContainer && "ODsnTypeCollection::TypeIterator::TypeIterator : invalid container!");
#if OSL_DEBUG_LEVEL > 0
++const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators;
#endif
diff --git a/dbaccess/source/core/misc/migrwarndlg.cxx b/dbaccess/source/core/misc/migrwarndlg.cxx
index d1712fba3f16..034d52829be3 100644
--- a/dbaccess/source/core/misc/migrwarndlg.cxx
+++ b/dbaccess/source/core/misc/migrwarndlg.cxx
@@ -12,8 +12,9 @@
namespace dbaccess
{
MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
- : MessageDialogController(pParent, "dbaccess/ui/migrwarndlg.ui", "MigrationWarnDialog")
- , m_xLater(m_xBuilder->weld_button("no"))
+ : MessageDialogController(pParent, u"dbaccess/ui/migrwarndlg.ui"_ustr,
+ u"MigrationWarnDialog"_ustr)
+ , m_xLater(m_xBuilder->weld_button(u"no"_ustr))
{
m_xLater->grab_focus();
}
diff --git a/dbaccess/source/core/misc/objectnameapproval.cxx b/dbaccess/source/core/misc/objectnameapproval.cxx
index 3ec15caaa4fd..fa03e81e3d09 100644
--- a/dbaccess/source/core/misc/objectnameapproval.cxx
+++ b/dbaccess/source/core/misc/objectnameapproval.cxx
@@ -23,35 +23,23 @@
#include <com/sun/star/sdb/tools/XConnectionTools.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
-#include <cppuhelper/weakref.hxx>
-
namespace dbaccess
{
using ::com::sun::star::sdbc::XConnection;
- using ::com::sun::star::uno::WeakReference;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::lang::DisposedException;
using ::com::sun::star::sdb::tools::XConnectionTools;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::sdb::tools::XObjectNames;
- using ::com::sun::star::uno::XInterface;
namespace CommandType = com::sun::star::sdb::CommandType;
- // ObjectNameApproval_Impl
- struct ObjectNameApproval_Impl
- {
- WeakReference< XConnection > aConnection;
- sal_Int32 nCommandType;
- };
-
// ObjectNameApproval
ObjectNameApproval::ObjectNameApproval( const Reference< XConnection >& _rxConnection, ObjectType _eType )
- :m_pImpl( new ObjectNameApproval_Impl )
{
- m_pImpl->aConnection = _rxConnection;
- m_pImpl->nCommandType = _eType == TypeQuery ? CommandType::QUERY : CommandType::TABLE;
+ mxConnection = _rxConnection;
+ mnCommandType = _eType == TypeQuery ? CommandType::QUERY : CommandType::TABLE;
}
ObjectNameApproval::~ObjectNameApproval()
@@ -60,13 +48,13 @@ namespace dbaccess
void ObjectNameApproval::approveElement( const OUString& _rName )
{
- Reference< XConnection > xConnection( m_pImpl->aConnection );
+ Reference< XConnection > xConnection( mxConnection );
if ( !xConnection.is() )
throw DisposedException();
Reference< XConnectionTools > xConnectionTools( xConnection, UNO_QUERY_THROW );
Reference< XObjectNames > xObjectNames( xConnectionTools->getObjectNames(), css::uno::UNO_SET_THROW );
- xObjectNames->checkNameForCreate( m_pImpl->nCommandType, _rName );
+ xObjectNames->checkNameForCreate( mnCommandType, _rName );
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx
index 70de1d1944ef..f3ba35d36c3a 100644
--- a/dbaccess/source/core/misc/sdbcoretools.cxx
+++ b/dbaccess/source/core/misc/sdbcoretools.cxx
@@ -27,19 +27,16 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/interaction.hxx>
#include <rtl/ref.hxx>
-#include <rtl/ustrbuf.hxx>
namespace dbaccess
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::task;
@@ -80,8 +77,8 @@ namespace dbaccess
::rtl::Reference pRequest( new ::comphelper::OInteractionRequest( _rError ) );
::rtl::Reference pApprove( new ::comphelper::OInteractionApprove );
- pRequest->addContinuation( pApprove.get() );
- Optional< OUString > aMessage = xStringResolver->getStringFromInformationalRequest( pRequest.get() );
+ pRequest->addContinuation( pApprove );
+ Optional< OUString > aMessage = xStringResolver->getStringFromInformationalRequest( pRequest );
if ( aMessage.IsPresent )
sDisplayMessage = aMessage.Value;
}
@@ -95,18 +92,20 @@ namespace dbaccess
Exception aExcept;
_rError >>= aExcept;
- OUStringBuffer aBuffer;
- aBuffer.append( _rError.getValueTypeName() );
- aBuffer.append( ":\n" );
- aBuffer.append( aExcept.Message );
-
- sDisplayMessage = aBuffer.makeStringAndClear();
+ sDisplayMessage = _rError.getValueTypeName() +
+ ":\n" +
+ aExcept.Message;
}
return sDisplayMessage;
}
+} // namespace dbaccess
- namespace tools::stor {
+namespace dbaccesstools {
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::embed;
bool storageIsWritable_nothrow( const Reference< XStorage >& _rxStorage )
{
@@ -117,7 +116,7 @@ namespace dbaccess
try
{
Reference< XPropertySet > xStorageProps( _rxStorage, UNO_QUERY_THROW );
- xStorageProps->getPropertyValue( "OpenMode" ) >>= nMode;
+ xStorageProps->getPropertyValue( u"OpenMode"_ustr ) >>= nMode;
}
catch( const Exception& )
{
@@ -141,6 +140,4 @@ namespace dbaccess
}
-} // namespace dbaccess
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx
deleted file mode 100644
index c45c1673b03e..000000000000
--- a/dbaccess/source/core/misc/services.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <DatabaseDataProvider.hxx>
-
-#include <databasecontext.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-namespace dba{
- ::cppu::ImplementationEntry const entries[] = {
- {
- &::dbaccess::DatabaseDataProvider::Create,
- &::dbaccess::DatabaseDataProvider::getImplementationName_Static,
- &::dbaccess::DatabaseDataProvider::getSupportedServiceNames_Static,
- &cppu::createSingleComponentFactory, nullptr, 0
- },
-
- {
- &dbaccess::ODatabaseContext::Create,
- &dbaccess::ODatabaseContext::getImplementationName_static,
- &dbaccess::ODatabaseContext::getSupportedServiceNames_static,
- &cppu::createOneInstanceComponentFactory, nullptr, 0
- },
-
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
- };
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* dba_component_getFactory(
- const char* pImplementationName,
- void* pServiceManager,
- void* pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pImplementationName, pServiceManager, pRegistryKey, dba::entries);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/veto.cxx b/dbaccess/source/core/misc/veto.cxx
index d2596d4e1e11..07aa9567ec46 100644
--- a/dbaccess/source/core/misc/veto.cxx
+++ b/dbaccess/source/core/misc/veto.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
#include <veto.hxx>
namespace dbaccess
@@ -25,8 +26,8 @@ namespace dbaccess
using ::com::sun::star::uno::Any;
// Veto
- Veto::Veto( const Any& _rDetails )
- :m_aDetails( _rDetails )
+ Veto::Veto( Any _aDetails )
+ :m_aDetails(std::move( _aDetails ))
{
}
diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx
index ab5947d91261..d611354dfce8 100644
--- a/dbaccess/source/core/recovery/dbdocrecovery.cxx
+++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx
@@ -28,9 +28,10 @@
#include <com/sun/star/io/TextInputStream.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <o3tl/string_view.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -65,30 +66,30 @@ namespace dbaccess
o_rBuffer.append( sal_Unicode( i_rComponentDesc.second.bForEditing ? '1' : '0' ) );
}
- bool lcl_extractCompDesc( const OUString& i_rIniLine, OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc )
+ bool lcl_extractCompDesc( std::u16string_view i_rIniLine, OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc )
{
- const sal_Int32 nEqualSignPos = i_rIniLine.indexOf( '=' );
- if ( nEqualSignPos < 1 )
+ const size_t nEqualSignPos = i_rIniLine.find( '=' );
+ if ( nEqualSignPos == 0 || nEqualSignPos == std::u16string_view::npos )
{
OSL_FAIL( "lcl_extractCompDesc: invalid map file entry - unexpected pos of '='" );
return false;
}
- o_rStorName = i_rIniLine.copy( 0, nEqualSignPos );
+ o_rStorName = i_rIniLine.substr( 0, nEqualSignPos );
- const sal_Int32 nCommaPos = i_rIniLine.lastIndexOf( ',' );
- if ( nCommaPos != i_rIniLine.getLength() - 2 )
+ const size_t nCommaPos = i_rIniLine.rfind( ',' );
+ if ( nCommaPos != i_rIniLine.size() - 2 )
{
OSL_FAIL( "lcl_extractCompDesc: invalid map file entry - unexpected pos of ','" );
return false;
}
- o_rCompDesc.sName = i_rIniLine.copy( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 );
+ o_rCompDesc.sName = i_rIniLine.substr( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 );
o_rCompDesc.bForEditing = ( i_rIniLine[ nCommaPos + 1 ] == '1' );
return true;
}
- const char sRecoveryDataSubStorageName[] = "recovery";
+ constexpr OUString sRecoveryDataSubStorageName = u"recovery"_ustr;
- const char sObjectMapStreamName[] = "storage-component-map.ini";
+ constexpr OUString sObjectMapStreamName = u"storage-component-map.ini"_ustr;
void lcl_writeObjectMap_throw( const Reference<XComponentContext> & i_rContext, const Reference< XStorage >& i_rStorage,
const MapStringToCompDesc& i_mapStorageToCompDesc )
@@ -99,7 +100,7 @@ namespace dbaccess
StorageTextOutputStream aTextOutput( i_rContext, i_rStorage, sObjectMapStreamName );
- aTextOutput.writeLine( "[storages]" );
+ aTextOutput.writeLine( u"[storages]"_ustr );
for (auto const& elem : i_mapStorageToCompDesc)
{
@@ -112,12 +113,12 @@ namespace dbaccess
aTextOutput.writeLine();
}
- bool lcl_isSectionStart( const OUString& i_rIniLine, OUString& o_rSectionName )
+ bool lcl_isSectionStart( std::u16string_view i_rIniLine, OUString& o_rSectionName )
{
- const sal_Int32 nLen = i_rIniLine.getLength();
- if ( i_rIniLine.startsWith("[") && i_rIniLine.endsWith("]") )
+ const size_t nLen = i_rIniLine.size();
+ if ( o3tl::starts_with(i_rIniLine, u"[") && o3tl::ends_with(i_rIniLine, u"]") )
{
- o_rSectionName = i_rIniLine.copy( 1, nLen -2 );
+ o_rSectionName = i_rIniLine.substr( 1, nLen -2 );
return true;
}
return false;
@@ -144,7 +145,7 @@ namespace dbaccess
sObjectMapStreamName, ElementModes::READ ), UNO_SET_THROW );
Reference< XTextInputStream2 > xTextInput = TextInputStream::create( i_rxContext );
- xTextInput->setEncoding( "UTF-8" );
+ xTextInput->setEncoding( u"UTF-8"_ustr );
xTextInput->setInputStream( xIniStream->getInputStream() );
OUString sCurrentSection;
@@ -177,7 +178,7 @@ namespace dbaccess
SubComponentDescriptor aCompDesc;
if ( !lcl_extractCompDesc( sLine, sStorageName, aCompDesc ) )
continue;
- o_mapStorageToObjectName[ sStorageName ] = aCompDesc;
+ o_mapStorageToObjectName[ sStorageName ] = std::move(aCompDesc);
}
}
@@ -194,20 +195,9 @@ namespace dbaccess
}
}
- // DatabaseDocumentRecovery_Data
- struct DatabaseDocumentRecovery_Data
- {
- const Reference<XComponentContext> aContext;
-
- explicit DatabaseDocumentRecovery_Data( const Reference<XComponentContext> & i_rContext )
- :aContext( i_rContext )
- {
- }
- };
-
// DatabaseDocumentRecovery
DatabaseDocumentRecovery::DatabaseDocumentRecovery( const Reference<XComponentContext> & i_rContext )
- :m_pData( new DatabaseDocumentRecovery_Data( i_rContext ) )
+ : mxContext( i_rContext )
{
}
@@ -243,7 +233,7 @@ namespace dbaccess
for ( auto const & component : aComponents )
{
- SubComponentRecovery aComponentRecovery( m_pData->aContext, xDatabaseUI, component );
+ SubComponentRecovery aComponentRecovery( mxContext, xDatabaseUI, component );
aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapCompDescs );
}
}
@@ -252,13 +242,13 @@ namespace dbaccess
{
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
SubComponentRecovery::getComponentsStorageName( elem.first ), ElementModes::WRITE | ElementModes::NOCREATE ) );
- lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, elem.second );
- tools::stor::commitStorageIfWriteable( xComponentsStor );
+ lcl_writeObjectMap_throw( mxContext, xComponentsStor, elem.second );
+ dbaccesstools::commitStorageIfWriteable( xComponentsStor );
}
}
// commit the recovery storage
- tools::stor::commitStorageIfWriteable( xRecoveryStorage );
+ dbaccesstools::commitStorageIfWriteable( xRecoveryStorage );
}
void DatabaseDocumentRecovery::recoverSubDocuments( const Reference< XStorage >& i_rDocumentStorage,
@@ -284,7 +274,7 @@ namespace dbaccess
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
SubComponentRecovery::getComponentsStorageName( aKnownType ), ElementModes::READ ) );
- lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownType ] );
+ lcl_readObjectMap_throw( mxContext, xComponentsStor, aMapCompDescs[ aKnownType ] );
xComponentsStor->dispose();
}
@@ -318,7 +308,7 @@ namespace dbaccess
// recover the single component
Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( elem.first, ElementModes::READ ) );
- SubComponentRecovery aComponentRecovery( m_pData->aContext, xDocumentUI, eComponentType );
+ SubComponentRecovery aComponentRecovery( mxContext, xDocumentUI, eComponentType );
Reference< XComponent > xSubComponent( aComponentRecovery.recoverFromStorage( xCompStor, sComponentName, elem.second.bForEditing ) );
// at the moment, we only store, during session save, sub components which are modified. So, set this
diff --git a/dbaccess/source/core/recovery/settingsimport.cxx b/dbaccess/source/core/recovery/settingsimport.cxx
index b64787aa82a4..513dcae7e43d 100644
--- a/dbaccess/source/core/recovery/settingsimport.cxx
+++ b/dbaccess/source/core/recovery/settingsimport.cxx
@@ -19,7 +19,7 @@
#include "settingsimport.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmltoken.hxx>
@@ -45,8 +45,8 @@ namespace dbaccess
// find the name of the setting
if ( i_rAttributes.is() )
{
- m_sItemName = i_rAttributes->getValueByName( "config:name" );
- m_sItemType = i_rAttributes->getValueByName( "config:type" );
+ m_sItemName = i_rAttributes->getValueByName( u"config:name"_ustr );
+ m_sItemType = i_rAttributes->getValueByName( u"config:type"_ustr );
}
}
@@ -54,7 +54,7 @@ namespace dbaccess
{
}
- void SettingsImport::characters( const OUString& i_rCharacters )
+ void SettingsImport::characters( std::u16string_view i_rCharacters )
{
m_aCharacters.append( i_rCharacters );
}
@@ -139,7 +139,7 @@ namespace dbaccess
o_rValue.clear();
// the characters building up th evalue
- const OUString sValue = getAccumulatedCharacters().toString();
+ std::u16string_view sValue = getAccumulatedCharacters();
const OUString& rItemType( getItemType() );
ENSURE_OR_RETURN_VOID( !rItemType.isEmpty(), "no item type -> no item value" );
@@ -170,7 +170,7 @@ namespace dbaccess
}
else if ( ::xmloff::token::IsXMLToken( rItemType, ::xmloff::token::XML_STRING ) )
{
- o_rValue <<= sValue;
+ o_rValue <<= OUString(sValue);
}
else
{
diff --git a/dbaccess/source/core/recovery/settingsimport.hxx b/dbaccess/source/core/recovery/settingsimport.hxx
index c698263adc8a..bc29bd727b8f 100644
--- a/dbaccess/source/core/recovery/settingsimport.hxx
+++ b/dbaccess/source/core/recovery/settingsimport.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
+#pragma once
#include <com/sun/star/xml/sax/XAttributeList.hpp>
@@ -49,7 +48,7 @@ namespace dbaccess
const css::uno::Reference< css::xml::sax::XAttributeList >& i_rAttributes
);
virtual void endElement();
- void characters( const OUString& i_rCharacters );
+ void characters( std::u16string_view i_rCharacters );
protected:
virtual ~SettingsImport() override;
@@ -161,6 +160,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/storagestream.cxx b/dbaccess/source/core/recovery/storagestream.cxx
index 2831f406bbf7..613bfb729903 100644
--- a/dbaccess/source/core/recovery/storagestream.cxx
+++ b/dbaccess/source/core/recovery/storagestream.cxx
@@ -21,13 +21,12 @@
#include <com/sun/star/embed/ElementModes.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::XStream;
diff --git a/dbaccess/source/core/recovery/storagestream.hxx b/dbaccess/source/core/recovery/storagestream.hxx
index 6dffdf7a175e..64c7e369dd1e 100644
--- a/dbaccess/source/core/recovery/storagestream.hxx
+++ b/dbaccess/source/core/recovery/storagestream.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGESTREAM_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGESTREAM_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
@@ -49,6 +48,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGESTREAM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/storagetextstream.cxx b/dbaccess/source/core/recovery/storagetextstream.cxx
index 6ea4ef005320..8d96a73c4d98 100644
--- a/dbaccess/source/core/recovery/storagetextstream.cxx
+++ b/dbaccess/source/core/recovery/storagetextstream.cxx
@@ -28,15 +28,8 @@ namespace dbaccess
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::TextOutputStream;
- using ::com::sun::star::io::XTextOutputStream2;
- // StorageTextOutputStream_Data
- struct StorageTextOutputStream_Data
- {
- Reference< XTextOutputStream2 > xTextOutput;
- };
-
- const char sLineFeed[] = "\n";
+ constexpr OUString sLineFeed = u"\n"_ustr;
// StorageTextOutputStream
StorageTextOutputStream::StorageTextOutputStream( const Reference<XComponentContext>& i_rContext,
@@ -44,11 +37,10 @@ namespace dbaccess
const OUString& i_rStreamName
)
:StorageOutputStream( i_rParentStorage, i_rStreamName )
- ,m_pData( new StorageTextOutputStream_Data )
{
- m_pData->xTextOutput = TextOutputStream::create( i_rContext );
- m_pData->xTextOutput->setEncoding( "UTF-8" );
- m_pData->xTextOutput->setOutputStream( getOutputStream() );
+ mxTextOutput = TextOutputStream::create( i_rContext );
+ mxTextOutput->setEncoding( u"UTF-8"_ustr );
+ mxTextOutput->setOutputStream( getOutputStream() );
}
StorageTextOutputStream::~StorageTextOutputStream()
@@ -57,13 +49,13 @@ namespace dbaccess
void StorageTextOutputStream::writeLine( const OUString& i_rLine )
{
- m_pData->xTextOutput->writeString( i_rLine );
- m_pData->xTextOutput->writeString( sLineFeed );
+ mxTextOutput->writeString( i_rLine );
+ mxTextOutput->writeString( sLineFeed );
}
void StorageTextOutputStream::writeLine()
{
- m_pData->xTextOutput->writeString( sLineFeed );
+ mxTextOutput->writeString( sLineFeed );
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/recovery/storagetextstream.hxx b/dbaccess/source/core/recovery/storagetextstream.hxx
index 5d7c889862e2..31bef3d83bd8 100644
--- a/dbaccess/source/core/recovery/storagetextstream.hxx
+++ b/dbaccess/source/core/recovery/storagetextstream.hxx
@@ -17,20 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGETEXTSTREAM_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGETEXTSTREAM_HXX
+#pragma once
#include "storagestream.hxx"
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <memory>
+namespace com::sun::star::io { class XTextOutputStream2; }
namespace dbaccess
{
// StorageTextStream
- struct StorageTextOutputStream_Data;
class StorageTextOutputStream : public StorageOutputStream
{
public:
@@ -45,11 +43,9 @@ namespace dbaccess
void writeLine();
private:
- std::unique_ptr< StorageTextOutputStream_Data > m_pData;
- };
+ css::uno::Reference< css::io::XTextOutputStream2 > mxTextOutput;
+ };
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGETEXTSTREAM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/storagexmlstream.cxx b/dbaccess/source/core/recovery/storagexmlstream.cxx
index c04eff6f8912..e828ac73d38d 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.cxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.cxx
@@ -25,10 +25,7 @@
#include <com/sun/star/xml/sax/Writer.hpp>
#include <rtl/ref.hxx>
-#include <tools/diagnose_ex.h>
-#include <xmloff/attrlist.hxx>
-
-#include <stack>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -43,28 +40,19 @@ namespace dbaccess
using ::com::sun::star::xml::sax::Parser;
using ::com::sun::star::xml::sax::InputSource;
- // StorageXMLOutputStream_Data
- struct StorageXMLOutputStream_Data
- {
- Reference< XDocumentHandler > xHandler;
- std::stack< OUString > aElements;
- ::rtl::Reference< SvXMLAttributeList > xAttributes;
- };
-
// StorageXMLOutputStream
StorageXMLOutputStream::StorageXMLOutputStream( const Reference<XComponentContext>& i_rContext,
const Reference< XStorage >& i_rParentStorage,
const OUString& i_rStreamName )
:StorageOutputStream( i_rParentStorage, i_rStreamName )
- ,m_pData( new StorageXMLOutputStream_Data )
{
const Reference< XWriter > xSaxWriter = Writer::create( i_rContext );
xSaxWriter->setOutputStream( getOutputStream() );
- m_pData->xHandler.set( xSaxWriter, UNO_QUERY_THROW );
- m_pData->xHandler->startDocument();
+ mxHandler.set( xSaxWriter, UNO_QUERY_THROW );
+ mxHandler->startDocument();
- m_pData->xAttributes = new SvXMLAttributeList;
+ mxAttributes = new comphelper::AttributeList;
}
StorageXMLOutputStream::~StorageXMLOutputStream()
@@ -73,48 +61,48 @@ namespace dbaccess
void StorageXMLOutputStream::close()
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "illegal document handler" );
- m_pData->xHandler->endDocument();
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "illegal document handler" );
+ mxHandler->endDocument();
// do not call the base class, it would call closeOutput on the output stream, which is already done by
// endDocument
}
void StorageXMLOutputStream::addAttribute( const OUString& i_rName, const OUString& i_rValue ) const
{
- m_pData->xAttributes->AddAttribute( i_rName, i_rValue );
+ mxAttributes->AddAttribute( i_rName, i_rValue );
}
- void StorageXMLOutputStream::startElement( const OUString& i_rElementName ) const
+ void StorageXMLOutputStream::startElement( const OUString& i_rElementName )
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
- m_pData->xHandler->startElement( i_rElementName, m_pData->xAttributes.get() );
- m_pData->xAttributes = new SvXMLAttributeList;
- m_pData->aElements.push( i_rElementName );
+ mxHandler->startElement( i_rElementName, mxAttributes );
+ mxAttributes = new comphelper::AttributeList;
+ maElements.push( i_rElementName );
}
- void StorageXMLOutputStream::endElement() const
+ void StorageXMLOutputStream::endElement()
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
- ENSURE_OR_RETURN_VOID( !m_pData->aElements.empty(), "no element on the stack" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( !maElements.empty(), "no element on the stack" );
- const OUString sElementName( m_pData->aElements.top() );
- m_pData->xHandler->endElement( sElementName );
- m_pData->aElements.pop();
+ const OUString sElementName( maElements.top() );
+ mxHandler->endElement( sElementName );
+ maElements.pop();
}
void StorageXMLOutputStream::ignorableWhitespace( const OUString& i_rWhitespace ) const
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
- m_pData->xHandler->ignorableWhitespace( i_rWhitespace );
+ mxHandler->ignorableWhitespace( i_rWhitespace );
}
void StorageXMLOutputStream::characters( const OUString& i_rCharacters ) const
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
- m_pData->xHandler->characters( i_rCharacters );
+ mxHandler->characters( i_rCharacters );
}
// StorageXMLInputStream
diff --git a/dbaccess/source/core/recovery/storagexmlstream.hxx b/dbaccess/source/core/recovery/storagexmlstream.hxx
index ca0f3d3433a2..8a340b6fea0c 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.hxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGEXMLSTREAM_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGEXMLSTREAM_HXX
+#pragma once
#include "storagestream.hxx"
@@ -26,14 +25,13 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-
-#include <memory>
+#include <comphelper/attributelist.hxx>
+#include <rtl/ref.hxx>
+#include <stack>
namespace dbaccess
{
- // StorageXMLOutputStream
- struct StorageXMLOutputStream_Data;
class StorageXMLOutputStream : public StorageOutputStream
{
public:
@@ -48,8 +46,8 @@ namespace dbaccess
void addAttribute( const OUString& i_rName, const OUString& i_rValue ) const;
- void startElement( const OUString& i_rElementName ) const;
- void endElement() const;
+ void startElement( const OUString& i_rElementName );
+ void endElement();
void ignorableWhitespace( const OUString& i_rWhitespace ) const;
void characters( const OUString& i_rCharacters ) const;
@@ -59,7 +57,9 @@ namespace dbaccess
StorageXMLOutputStream& operator=( const StorageXMLOutputStream& ) = delete;
private:
- std::unique_ptr< StorageXMLOutputStream_Data > m_pData;
+ css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler;
+ std::stack< OUString > maElements;
+ ::rtl::Reference<comphelper::AttributeList> mxAttributes;
};
class StorageXMLInputStream
@@ -86,6 +86,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGEXMLSTREAM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/subcomponentloader.cxx b/dbaccess/source/core/recovery/subcomponentloader.cxx
index 3393c3d13d08..a416b997fa38 100644
--- a/dbaccess/source/core/recovery/subcomponentloader.cxx
+++ b/dbaccess/source/core/recovery/subcomponentloader.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/ucb/Command.hpp>
#include <com/sun/star/frame/XController2.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
diff --git a/dbaccess/source/core/recovery/subcomponentloader.hxx b/dbaccess/source/core/recovery/subcomponentloader.hxx
index a8f12071f7c1..4ab8678809a4 100644
--- a/dbaccess/source/core/recovery/subcomponentloader.hxx
+++ b/dbaccess/source/core/recovery/subcomponentloader.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTLOADER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTLOADER_HXX
+#pragma once
#include <com/sun/star/awt/XWindowListener.hpp>
#include <com/sun/star/frame/XController.hpp>
@@ -69,6 +68,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTLOADER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
index ab16ee9e2c04..2cf8ea3a43f4 100644
--- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx
+++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
@@ -36,7 +36,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/implbase.hxx>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <xmloff/XMLSettingsExportContext.hxx>
#include <xmloff/SettingsExportHelper.hxx>
@@ -47,12 +47,10 @@ namespace dbaccess
{
using css::uno::Reference;
- using css::uno::XInterface;
using css::uno::UNO_QUERY;
using css::uno::UNO_QUERY_THROW;
using css::uno::UNO_SET_THROW;
using css::uno::Exception;
- using css::uno::RuntimeException;
using css::uno::Any;
using css::uno::Sequence;
using css::uno::XComponentContext;
@@ -86,13 +84,13 @@ namespace dbaccess
switch ( i_eType )
{
case FORM:
- return "form";
+ return u"form"_ustr;
case REPORT:
- return "report";
+ return u"report"_ustr;
case TABLE:
- return "table";
+ return u"table"_ustr;
case QUERY:
- return "query";
+ return u"query"_ustr;
default:
break;
}
@@ -128,7 +126,7 @@ namespace dbaccess
return false;
::comphelper::NamedValueCollection aDocArgs( xDocument->getArgs() );
- return aDocArgs.getOrDefault( "ReadOnly", false );
+ return aDocArgs.getOrDefault( u"ReadOnly"_ustr, false );
}
Reference< XCommandProcessor > lcl_getSubComponentDef_nothrow( const Reference< XDatabaseDocumentUI >& i_rAppUI,
@@ -160,8 +158,8 @@ namespace dbaccess
return xCommandProcessor;
}
- const char sSettingsStreamName[] = "settings.xml";
- const char sCurrentQueryDesignName[] = "ooo:current-query-design";
+ constexpr OUString sSettingsStreamName = u"settings.xml"_ustr;
+ constexpr OUString sCurrentQueryDesignName = u"ooo:current-query-design"_ustr;
}
namespace {
@@ -170,7 +168,7 @@ namespace dbaccess
class SettingsExportContext : public ::xmloff::XMLSettingsExportContext
{
public:
- SettingsExportContext( const Reference<XComponentContext>& i_rContext, const StorageXMLOutputStream& i_rDelegator )
+ SettingsExportContext( const Reference<XComponentContext>& i_rContext, StorageXMLOutputStream& i_rDelegator )
:m_rContext( i_rContext )
,m_rDelegator( i_rDelegator )
,m_aNamespace( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_NP_CONFIG ) )
@@ -199,7 +197,7 @@ namespace dbaccess
private:
const Reference<XComponentContext>& m_rContext;
- const StorageXMLOutputStream& m_rDelegator;
+ StorageXMLOutputStream& m_rDelegator;
const OUString m_aNamespace;
};
@@ -217,7 +215,7 @@ namespace dbaccess
void SettingsExportContext::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName )
{
- m_rDelegator.ignorableWhitespace( " " );
+ m_rDelegator.ignorableWhitespace( u" "_ustr );
m_rDelegator.startElement( impl_prefix( i_eName ) );
}
@@ -225,7 +223,7 @@ namespace dbaccess
void SettingsExportContext::EndElement( const bool i_bIgnoreWhitespace )
{
if ( i_bIgnoreWhitespace )
- m_rDelegator.ignorableWhitespace( " " );
+ m_rDelegator.ignorableWhitespace( u" "_ustr );
m_rDelegator.endElement();
}
@@ -351,15 +349,15 @@ namespace dbaccess
switch ( i_eType )
{
case FORM:
- return "forms";
+ return u"forms"_ustr;
case REPORT:
- return "reports";
+ return u"reports"_ustr;
case TABLE:
- return "tables";
+ return u"tables"_ustr;
case QUERY:
- return "queries";
+ return u"queries"_ustr;
case RELATION_DESIGN:
- return "relations";
+ return u"relations"_ustr;
default:
break;
}
@@ -376,13 +374,13 @@ namespace dbaccess
return;
// open the sub storage for the given kind of components
- const OUString& rStorageName( getComponentsStorageName( m_eType ) );
+ const OUString aStorageName( getComponentsStorageName( m_eType ) );
const Reference< XStorage > xComponentsStorage( i_rRecoveryStorage->openStorageElement(
- rStorageName, ElementModes::READWRITE ), UNO_SET_THROW );
+ aStorageName, ElementModes::READWRITE ), UNO_SET_THROW );
// find a free sub storage name, and create Yet Another Sub Storage
- const OUString& rBaseName( lcl_getComponentStorageBaseName( m_eType ) );
- const OUString sStorName = ::dbtools::createUniqueName( xComponentsStorage.get(), rBaseName );
+ const OUString aBaseName( lcl_getComponentStorageBaseName( m_eType ) );
+ const OUString sStorName = ::dbtools::createUniqueName( xComponentsStorage, aBaseName );
const Reference< XStorage > xObjectStor( xComponentsStorage->openStorageElement(
sStorName, ElementModes::READWRITE ), UNO_SET_THROW );
@@ -404,8 +402,8 @@ namespace dbaccess
}
// commit the storage(s)
- tools::stor::commitStorageIfWriteable( xObjectStor );
- tools::stor::commitStorageIfWriteable( xComponentsStorage );
+ dbaccesstools::commitStorageIfWriteable( xObjectStor );
+ dbaccesstools::commitStorageIfWriteable( xComponentsStorage );
// remember the relationship from the component name to the storage name
MapStringToCompDesc& rMapCompDescs = io_mapCompDescs[ m_eType ];
@@ -474,15 +472,15 @@ namespace dbaccess
// the latter is updated only upon successful save of the design)
Reference< XPropertySet > xDesignerProps( m_xComponent, UNO_QUERY_THROW );
Sequence< PropertyValue > aCurrentQueryDesign;
- OSL_VERIFY( xDesignerProps->getPropertyValue( "CurrentQueryDesign" ) >>= aCurrentQueryDesign );
+ OSL_VERIFY( xDesignerProps->getPropertyValue( u"CurrentQueryDesign"_ustr ) >>= aCurrentQueryDesign );
// write the query design
StorageXMLOutputStream aDesignOutput( m_rContext, i_rObjectStorage, sSettingsStreamName );
SettingsExportContext aSettingsExportContext( m_rContext, aDesignOutput );
- const OUString sWhitespace( " " );
+ static constexpr OUString sWhitespace( u" "_ustr );
- aDesignOutput.startElement( "office:settings" );
+ aDesignOutput.startElement( u"office:settings"_ustr );
aDesignOutput.ignorableWhitespace( sWhitespace );
XMLSettingsExportHelper aSettingsExporter( aSettingsExportContext );
@@ -510,10 +508,10 @@ namespace dbaccess
Reference< XCommandProcessor > xDocDefinition;
::comphelper::NamedValueCollection aLoadArgs;
- aLoadArgs.put( "RecoveryStorage", i_rRecoveryStorage );
+ aLoadArgs.put( u"RecoveryStorage"_ustr, i_rRecoveryStorage );
// load/create the sub component hidden. We'll show it when the main app window is shown.
- aLoadArgs.put( "Hidden", true );
+ aLoadArgs.put( u"Hidden"_ustr, true );
if ( !i_rComponentName.isEmpty() )
{
@@ -560,7 +558,7 @@ namespace dbaccess
StorageXMLInputStream aDesignInput( m_rContext, i_rRecoveryStorage, sSettingsStreamName );
::rtl::Reference< SettingsDocumentHandler > pDocHandler( new SettingsDocumentHandler );
- aDesignInput.import( pDocHandler.get() );
+ aDesignInput.import( pDocHandler );
const ::comphelper::NamedValueCollection& rSettings( pDocHandler->getSettings() );
const Any& aCurrentQueryDesign = rSettings.get( sCurrentQueryDesignName );
@@ -571,8 +569,8 @@ namespace dbaccess
// then load the query designer
::comphelper::NamedValueCollection aLoadArgs;
- aLoadArgs.put( "CurrentQueryDesign", aCurrentQueryDesign );
- aLoadArgs.put( "Hidden", true );
+ aLoadArgs.put( u"CurrentQueryDesign"_ustr, aCurrentQueryDesign );
+ aLoadArgs.put( u"Hidden"_ustr, true );
if ( !i_rComponentName.isEmpty() )
{
diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.hxx b/dbaccess/source/core/recovery/subcomponentrecovery.hxx
index 9881778002fe..ee41a32dfc89 100644
--- a/dbaccess/source/core/recovery/subcomponentrecovery.hxx
+++ b/dbaccess/source/core/recovery/subcomponentrecovery.hxx
@@ -17,14 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTRECOVERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTRECOVERY_HXX
+#pragma once
#include "subcomponents.hxx"
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <utility>
namespace dbaccess
{
@@ -36,10 +36,10 @@ namespace dbaccess
SubComponentRecovery(
const css::uno::Reference< css::uno::XComponentContext >& i_rContext,
const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& i_rController,
- const css::uno::Reference< css::lang::XComponent >& i_rComponent )
+ css::uno::Reference< css::lang::XComponent > i_xComponent )
:m_rContext( i_rContext )
,m_xDocumentUI( i_rController, css::uno::UNO_SET_THROW )
- ,m_xComponent( i_rComponent )
+ ,m_xComponent(std::move( i_xComponent ))
,m_eType( UNKNOWN )
,m_aCompDesc()
{
@@ -112,6 +112,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTRECOVERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/subcomponents.hxx b/dbaccess/source/core/recovery/subcomponents.hxx
index 029b31c9527c..5e4173605045 100644
--- a/dbaccess/source/core/recovery/subcomponents.hxx
+++ b/dbaccess/source/core/recovery/subcomponents.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTS_HXX
+#pragma once
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
@@ -59,6 +58,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx
index 34ab1b0ba829..2bc3f7a28a04 100644
--- a/dbaccess/source/core/resource/core_resource.cxx
+++ b/dbaccess/source/core/resource/core_resource.cxx
@@ -21,35 +21,24 @@
#include <unotools/resmgr.hxx>
-// ---- needed as long as we have no contexts for components ---
-#include <rtl/instance.hxx>
-
namespace dbaccess
{
- // ResourceManager
- namespace
- {
- // access safety
- struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
- }
-
- OUString ResourceManager::loadString(const char* pResId)
+ OUString ResourceManager::loadString(TranslateId pResId)
{
return Translate::get(pResId, Translate::Create("dba"));
}
- OUString ResourceManager::loadString(const char* pResId, const char* _pPlaceholderAscii, const OUString& _rReplace)
+ OUString ResourceManager::loadString(TranslateNId aContextSingularPlural, int nCardinality)
{
- OUString sString(loadString(pResId));
- return sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii), _rReplace );
+ return Translate::nget(aContextSingularPlural, nCardinality, Translate::Create("dba"));
}
- OUString ResourceManager::loadString(const char* pResId, const char* _pPlaceholderAscii1, const OUString& _rReplace1,
- const char* _pPlaceholderAscii2, const OUString& _rReplace2)
+ OUString ResourceManager::loadString(TranslateId pResId, std::u16string_view _rPlaceholderAscii1, std::u16string_view _rReplace1,
+ std::u16string_view _rPlaceholderAscii2, std::u16string_view _rReplace2)
{
OUString sString(loadString(pResId));
- sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii1), _rReplace1 );
- sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii2), _rReplace2 );
+ sString = sString.replaceFirst( _rPlaceholderAscii1, _rReplace1 );
+ sString = sString.replaceFirst( _rPlaceholderAscii2, _rReplace2 );
return sString;
}
}
diff --git a/dbaccess/source/filter/hsqldb/alterparser.hxx b/dbaccess/source/filter/hsqldb/alterparser.hxx
index 710cd3c798c7..813ca7b0beff 100644
--- a/dbaccess/source/filter/hsqldb/alterparser.hxx
+++ b/dbaccess/source/filter/hsqldb/alterparser.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_ALTERPARSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_ALTERPARSER_HXX
+#pragma once
#include <rtl/ustring.hxx>
@@ -50,6 +49,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_ALTERPARSER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/columndef.cxx b/dbaccess/source/filter/hsqldb/columndef.cxx
index 62bd7b541bf1..22acf31768e0 100644
--- a/dbaccess/source/filter/hsqldb/columndef.cxx
+++ b/dbaccess/source/filter/hsqldb/columndef.cxx
@@ -19,24 +19,22 @@
*/
#include "columndef.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
+#include <utility>
namespace dbahsql
{
-using namespace css::sdbc;
-
-ColumnDefinition::ColumnDefinition(const OUString& sName, sal_Int32 eType,
- const std::vector<sal_Int32>& aParams, bool bPrimary,
+ColumnDefinition::ColumnDefinition(OUString sName, sal_Int32 eType,
+ std::vector<sal_Int32>&& aParams, bool bPrimary,
sal_Int32 nAutoIncr, bool bNullable, bool bCaseInsensitive,
- const OUString& sDefault)
- : m_sName(sName)
+ OUString sDefault)
+ : m_sName(std::move(sName))
, m_eType(eType)
- , m_aParams(aParams)
+ , m_aParams(std::move(aParams))
, m_bPrimaryKey(bPrimary)
, m_nAutoIncrement(nAutoIncr)
, m_bNullable(bNullable)
, m_bCaseInsensitive(bCaseInsensitive)
- , m_sDefaultValue(sDefault)
+ , m_sDefaultValue(std::move(sDefault))
{
}
}
diff --git a/dbaccess/source/filter/hsqldb/columndef.hxx b/dbaccess/source/filter/hsqldb/columndef.hxx
index 849e7c757a9b..4ac3532a3454 100644
--- a/dbaccess/source/filter/hsqldb/columndef.hxx
+++ b/dbaccess/source/filter/hsqldb/columndef.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_COLUMNDEF_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_COLUMNDEF_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <vector>
@@ -29,9 +28,9 @@ private:
OUString m_sDefaultValue;
public:
- ColumnDefinition(const OUString& sName, sal_Int32 eType, const std::vector<sal_Int32>& aParams,
+ ColumnDefinition(OUString sName, sal_Int32 eType, std::vector<sal_Int32>&& aParams,
bool bPrimary = false, sal_Int32 nAutoIncr = -1, bool bNullable = true,
- bool bCaseInsensitive = false, const OUString& sDefault = OUString{});
+ bool bCaseInsensitive = false, OUString sDefault = OUString{});
OUString const& getName() const { return m_sName; }
sal_Int32 getDataType() const { return m_eType; }
@@ -45,6 +44,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_COLUMNDEF_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx
index ad1c95f89966..b93186ddb5c2 100644
--- a/dbaccess/source/filter/hsqldb/createparser.cxx
+++ b/dbaccess/source/filter/hsqldb/createparser.cxx
@@ -19,6 +19,7 @@
#include <comphelper/string.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include "createparser.hxx"
#include "utils.hxx"
#include <com/sun/star/sdbc/DataType.hpp>
@@ -30,16 +31,17 @@ namespace
{
/// Returns substring of sSql from the first occurrence of '(' until the
/// last occurrence of ')' (excluding the parenthesis)
-OUString lcl_getColumnPart(const OUString& sSql)
+std::u16string_view lcl_getColumnPart(std::u16string_view sSql)
{
- sal_Int32 nBeginIndex = sSql.indexOf("(") + 1;
- if (nBeginIndex < 0)
+ size_t nBeginIndex = sSql.find('(');
+ if (nBeginIndex == std::u16string_view::npos)
{
SAL_WARN("dbaccess", "No column definitions found");
- return OUString();
+ return std::u16string_view();
}
- sal_Int32 nCount = sSql.lastIndexOf(")") - nBeginIndex;
- return sSql.copy(nBeginIndex, nCount);
+ sal_Int32 nCount = sSql.rfind(')') - nBeginIndex - 1;
+ auto sPart = sSql.substr(nBeginIndex + 1, nCount);
+ return sPart;
}
/// Constructs a vector of strings that represents the definitions of each
@@ -47,7 +49,7 @@ OUString lcl_getColumnPart(const OUString& sSql)
///
/// @param sColumnPart part of the create statement inside the parenthesis
/// containing the column definitions
-std::vector<OUString> lcl_splitColumnPart(const OUString& sColumnPart)
+std::vector<OUString> lcl_splitColumnPart(std::u16string_view sColumnPart)
{
std::vector<OUString> sParts = string::split(sColumnPart, sal_Unicode(u','));
std::vector<OUString> sReturn;
@@ -67,10 +69,11 @@ std::vector<OUString> lcl_splitColumnPart(const OUString& sColumnPart)
return sReturn;
}
-sal_Int32 lcl_getAutoIncrementDefault(const OUString& sColumnDef)
+sal_Int32 lcl_getAutoIncrementDefault(std::u16string_view sColumnDef)
{
// TODO what if there are more spaces?
- if (sColumnDef.indexOf("GENERATED BY DEFAULT AS IDENTITY") > 0)
+ size_t nPos = sColumnDef.find(u"GENERATED BY DEFAULT AS IDENTITY");
+ if (nPos != std::u16string_view::npos && nPos > 0)
{
// TODO parse starting sequence stated by "START WITH"
return 0;
@@ -78,68 +81,78 @@ sal_Int32 lcl_getAutoIncrementDefault(const OUString& sColumnDef)
return -1;
}
-OUString lcl_getDefaultValue(const OUString& sColumnDef)
+std::u16string_view lcl_getDefaultValue(std::u16string_view sColumnDef)
{
- constexpr char DEFAULT_KW[] = "DEFAULT";
- auto nDefPos = sColumnDef.indexOf(DEFAULT_KW);
- if (nDefPos > 0 && lcl_getAutoIncrementDefault(sColumnDef) < 0)
+ static constexpr std::u16string_view DEFAULT_KW = u"DEFAULT";
+ size_t nDefPos = sColumnDef.find(DEFAULT_KW);
+ if (nDefPos > 0 && nDefPos != std::u16string_view::npos
+ && lcl_getAutoIncrementDefault(sColumnDef) < 0)
{
- const OUString& fromDefault = sColumnDef.copy(nDefPos + sizeof(DEFAULT_KW)).trim();
+ std::u16string_view fromDefault
+ = o3tl::trim(sColumnDef.substr(nDefPos + DEFAULT_KW.size()));
// next word is the value
- auto nNextSpace = fromDefault.indexOf(" ");
- return nNextSpace > 0 ? fromDefault.copy(0, fromDefault.indexOf(" ")) : fromDefault;
+ size_t nNextSpace = fromDefault.find(' ');
+ return (nNextSpace > 0 && nNextSpace != std::u16string_view::npos)
+ ? fromDefault.substr(0, nNextSpace)
+ : fromDefault;
}
- return OUString{};
+ return std::u16string_view();
}
-bool lcl_isNullable(const OUString& sColumnDef) { return sColumnDef.indexOf("NOT NULL") < 0; }
+bool lcl_isNullable(std::u16string_view sColumnDef)
+{
+ return sColumnDef.find(u"NOT NULL") == std::u16string_view::npos;
+}
-bool lcl_isPrimaryKey(const OUString& sColumnDef) { return sColumnDef.indexOf("PRIMARY KEY") >= 0; }
+bool lcl_isPrimaryKey(std::u16string_view sColumnDef)
+{
+ return sColumnDef.find(u"PRIMARY KEY") != std::u16string_view::npos;
+}
-sal_Int32 lcl_getDataTypeFromHsql(const OUString& sTypeName)
+sal_Int32 lcl_getDataTypeFromHsql(std::u16string_view sTypeName)
{
- if (sTypeName == "CHAR")
+ if (sTypeName == u"CHAR")
return DataType::CHAR;
- else if (sTypeName == "VARCHAR" || sTypeName == "VARCHAR_IGNORECASE")
+ else if (sTypeName == u"VARCHAR" || sTypeName == u"VARCHAR_IGNORECASE")
return DataType::VARCHAR;
- else if (sTypeName == "TINYINT")
+ else if (sTypeName == u"TINYINT")
return DataType::TINYINT;
- else if (sTypeName == "SMALLINT")
+ else if (sTypeName == u"SMALLINT")
return DataType::SMALLINT;
- else if (sTypeName == "INTEGER")
+ else if (sTypeName == u"INTEGER")
return DataType::INTEGER;
- else if (sTypeName == "BIGINT")
+ else if (sTypeName == u"BIGINT")
return DataType::BIGINT;
- else if (sTypeName == "NUMERIC")
+ else if (sTypeName == u"NUMERIC")
return DataType::NUMERIC;
- else if (sTypeName == "DECIMAL")
+ else if (sTypeName == u"DECIMAL")
return DataType::DECIMAL;
- else if (sTypeName == "BOOLEAN")
+ else if (sTypeName == u"BOOLEAN")
return DataType::BOOLEAN;
- else if (sTypeName == "LONGVARCHAR")
+ else if (sTypeName == u"LONGVARCHAR")
return DataType::LONGVARCHAR;
- else if (sTypeName == "LONGVARBINARY")
+ else if (sTypeName == u"LONGVARBINARY")
return DataType::LONGVARBINARY;
- else if (sTypeName == "CLOB")
+ else if (sTypeName == u"CLOB")
return DataType::CLOB;
- else if (sTypeName == "BLOB")
+ else if (sTypeName == u"BLOB")
return DataType::BLOB;
- else if (sTypeName == "BINARY")
+ else if (sTypeName == u"BINARY")
return DataType::BINARY;
- else if (sTypeName == "VARBINARY")
+ else if (sTypeName == u"VARBINARY")
return DataType::VARBINARY;
- else if (sTypeName == "DATE")
+ else if (sTypeName == u"DATE")
return DataType::DATE;
- else if (sTypeName == "TIME")
+ else if (sTypeName == u"TIME")
return DataType::TIME;
- else if (sTypeName == "TIMESTAMP")
+ else if (sTypeName == u"TIMESTAMP")
return DataType::TIMESTAMP;
- else if (sTypeName == "DOUBLE")
+ else if (sTypeName == u"DOUBLE")
return DataType::DOUBLE;
- else if (sTypeName == "REAL")
+ else if (sTypeName == u"REAL")
return DataType::REAL;
- else if (sTypeName == "FLOAT")
+ else if (sTypeName == u"FLOAT")
return DataType::FLOAT;
assert(false);
@@ -163,15 +176,15 @@ struct ColumnTypeParts
* Separates full type descriptions (e.g. NUMERIC(5,4)) to type name (NUMERIC) and
* parameters (5,4)
*/
-ColumnTypeParts lcl_getColumnTypeParts(const OUString& sFullTypeName)
+ColumnTypeParts lcl_getColumnTypeParts(std::u16string_view sFullTypeName)
{
ColumnTypeParts parts;
- auto nParenPos = sFullTypeName.indexOf("(");
- if (nParenPos > 0)
+ auto nParenPos = sFullTypeName.find('(');
+ if (nParenPos > 0 && nParenPos != std::u16string_view::npos)
{
- parts.typeName = sFullTypeName.copy(0, nParenPos).trim();
- OUString sParamStr
- = sFullTypeName.copy(nParenPos + 1, sFullTypeName.indexOf(")") - nParenPos - 1);
+ parts.typeName = o3tl::trim(sFullTypeName.substr(0, nParenPos));
+ std::u16string_view sParamStr
+ = sFullTypeName.substr(nParenPos + 1, sFullTypeName.find(')') - nParenPos - 1);
auto sParams = string::split(sParamStr, sal_Unicode(u','));
for (const auto& sParam : sParams)
{
@@ -180,7 +193,7 @@ ColumnTypeParts lcl_getColumnTypeParts(const OUString& sFullTypeName)
}
else
{
- parts.typeName = sFullTypeName.trim();
+ parts.typeName = o3tl::trim(sFullTypeName);
lcl_addDefaultParameters(parts.params, lcl_getDataTypeFromHsql(parts.typeName));
}
return parts;
@@ -192,13 +205,13 @@ namespace dbahsql
{
CreateStmtParser::CreateStmtParser() {}
-void CreateStmtParser::parsePrimaryKeys(const OUString& sPrimaryPart)
+void CreateStmtParser::parsePrimaryKeys(std::u16string_view sPrimaryPart)
{
- sal_Int32 nParenPos = sPrimaryPart.indexOf("(");
- if (nParenPos > 0)
+ size_t nParenPos = sPrimaryPart.find('(');
+ if (nParenPos > 0 && nParenPos != std::u16string_view::npos)
{
- OUString sParamStr
- = sPrimaryPart.copy(nParenPos + 1, sPrimaryPart.lastIndexOf(")") - nParenPos - 1);
+ std::u16string_view sParamStr
+ = sPrimaryPart.substr(nParenPos + 1, sPrimaryPart.rfind(')') - nParenPos - 1);
auto sParams = string::split(sParamStr, sal_Unicode(u','));
for (const auto& sParam : sParams)
{
@@ -207,7 +220,7 @@ void CreateStmtParser::parsePrimaryKeys(const OUString& sPrimaryPart)
}
}
-void CreateStmtParser::parseColumnPart(const OUString& sColumnPart)
+void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart)
{
auto sColumns = lcl_splitColumnPart(sColumnPart);
for (const OUString& sColumn : sColumns)
@@ -232,15 +245,15 @@ void CreateStmtParser::parseColumnPart(const OUString& sColumnPart)
= bIsQuoteUsedForColumnName ? sColumn.indexOf("\"", 1) + 1 : sColumn.indexOf(" ");
OUString rColumnName = sColumn.copy(0, nEndColumnName);
- const OUString& sFromTypeName = sColumn.copy(nEndColumnName).trim();
+ const OUString sFromTypeName(o3tl::trim(sColumn.subView(nEndColumnName)));
// Now let's manage the column type
// search next space to get the whole type name
// eg: INTEGER, VARCHAR(10), DECIMAL(6,3)
auto nNextSpace = sFromTypeName.indexOf(" ");
- OUString sFullTypeName;
+ std::u16string_view sFullTypeName;
if (nNextSpace > 0)
- sFullTypeName = sFromTypeName.copy(0, nNextSpace);
+ sFullTypeName = sFromTypeName.subView(0, nNextSpace);
// perhaps column type corresponds to the last info here
else
sFullTypeName = sFromTypeName;
@@ -253,29 +266,30 @@ void CreateStmtParser::parseColumnPart(const OUString& sColumnPart)
if (isPrimaryKey)
m_PrimaryKeys.push_back(rColumnName);
- const OUString sColumnWithoutName = sColumn.copy(sColumn.indexOf(typeParts.typeName));
+ const std::u16string_view sColumnWithoutName
+ = sColumn.subView(sColumn.indexOf(typeParts.typeName));
ColumnDefinition aColDef(rColumnName, lcl_getDataTypeFromHsql(typeParts.typeName),
- typeParts.params, isPrimaryKey,
+ std::move(typeParts.params), isPrimaryKey,
lcl_getAutoIncrementDefault(sColumnWithoutName),
lcl_isNullable(sColumnWithoutName), bCaseInsensitive,
- lcl_getDefaultValue(sColumnWithoutName));
+ OUString(lcl_getDefaultValue(sColumnWithoutName)));
- m_aColumns.push_back(aColDef);
+ m_aColumns.push_back(std::move(aColDef));
}
}
-void CreateStmtParser::parse(const OUString& sSql)
+void CreateStmtParser::parse(std::u16string_view sSql)
{
// TODO Foreign keys
- if (!sSql.startsWith("CREATE"))
+ if (!o3tl::starts_with(sSql, u"CREATE"))
{
SAL_WARN("dbaccess", "Not a create statement");
return;
}
m_sTableName = utils::getTableNameFromStmt(sSql);
- OUString sColumnPart = lcl_getColumnPart(sSql);
+ std::u16string_view sColumnPart = lcl_getColumnPart(sSql);
parseColumnPart(sColumnPart);
}
diff --git a/dbaccess/source/filter/hsqldb/createparser.hxx b/dbaccess/source/filter/hsqldb/createparser.hxx
index 327cab869f01..a92f745860d5 100644
--- a/dbaccess/source/filter/hsqldb/createparser.hxx
+++ b/dbaccess/source/filter/hsqldb/createparser.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_CREATEPARSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_CREATEPARSER_HXX
+#pragma once
#include <vector>
#include "columndef.hxx"
@@ -24,8 +23,8 @@ private:
OUString m_sTableName;
protected:
- void parseColumnPart(const OUString& sColumnPart);
- void parsePrimaryKeys(const OUString& sPrimaryPart);
+ void parseColumnPart(std::u16string_view sColumnPart);
+ void parsePrimaryKeys(std::u16string_view sPrimaryPart);
public:
CreateStmtParser();
@@ -57,7 +56,7 @@ public:
*
* @param SQL "CREATE" statement
*/
- void parse(const OUString& sSql);
+ void parse(std::u16string_view sSql);
/**
* Recreate the sql statement.
@@ -66,6 +65,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_CREATEPARSER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/fbalterparser.cxx b/dbaccess/source/filter/hsqldb/fbalterparser.cxx
index 818673cbdaf3..a8948069e4e6 100644
--- a/dbaccess/source/filter/hsqldb/fbalterparser.cxx
+++ b/dbaccess/source/filter/hsqldb/fbalterparser.cxx
@@ -32,18 +32,16 @@ OUString FbAlterStmtParser::compose() const
}
else if (getActionType() == AlterAction::ADD_FOREIGN)
return getStatement(); // do nothing with that
- OUStringBuffer sSql("ALTER TABLE ");
- sSql.append(getTableName());
+ OUStringBuffer sSql("ALTER TABLE " + getTableName());
if (getActionType() == AlterAction::IDENTITY_RESTART)
{
sSql.append(" ALTER COLUMN ");
}
- sSql.append(getColumnName());
- sSql.append(" RESTART WITH ");
+ sSql.append(getColumnName() + " RESTART WITH ");
// Firebird: restart with 0 means the first number is 1, not 0.
- sSql.append(OUString::number(getIdentityParam() - 1));
+ sSql.append(getIdentityParam() - 1);
return sSql.makeStringAndClear();
}
diff --git a/dbaccess/source/filter/hsqldb/fbalterparser.hxx b/dbaccess/source/filter/hsqldb/fbalterparser.hxx
index e1546996ce8a..cd48d94d5df9 100644
--- a/dbaccess/source/filter/hsqldb/fbalterparser.hxx
+++ b/dbaccess/source/filter/hsqldb/fbalterparser.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_FBALTERPARSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_FBALTERPARSER_HXX
+#pragma once
#include "alterparser.hxx"
@@ -28,6 +27,4 @@ public:
} // dbahsql
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_FBALTERPARSER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
index 4f8fb8667d1e..f19778f7439d 100644
--- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
+++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
@@ -29,52 +29,46 @@ using namespace css::sdbc;
namespace
{
-void lcl_appendWithSpace(OUStringBuffer& sBuff, const OUString& sStr)
-{
- sBuff.append(" ");
- sBuff.append(sStr);
-}
-
OUString lcl_DataTypetoFbTypeName(sal_Int32 eType)
{
switch (eType)
{
case DataType::CHAR:
case DataType::BINARY:
- return "CHAR";
+ return u"CHAR"_ustr;
case DataType::VARCHAR:
case DataType::VARBINARY:
- return "VARCHAR";
+ return u"VARCHAR"_ustr;
case DataType::TINYINT: // no such type in Firebird
case DataType::SMALLINT:
- return "SMALLINT";
+ return u"SMALLINT"_ustr;
case DataType::INTEGER:
- return "INTEGER";
+ return u"INTEGER"_ustr;
case DataType::BIGINT:
- return "BIGINT";
+ return u"BIGINT"_ustr;
case DataType::NUMERIC:
- return "NUMERIC";
+ return u"NUMERIC"_ustr;
case DataType::DECIMAL:
- return "DECIMAL";
+ return u"DECIMAL"_ustr;
case DataType::BOOLEAN:
- return "BOOLEAN";
+ return u"BOOLEAN"_ustr;
case DataType::LONGVARCHAR:
case DataType::LONGVARBINARY:
case DataType::CLOB:
case DataType::BLOB:
case DataType::OTHER:
- return "BLOB";
+ return u"BLOB"_ustr;
case DataType::DATE:
- return "DATE";
+ return u"DATE"_ustr;
case DataType::TIME:
- return "TIME";
+ return u"TIME"_ustr;
case DataType::TIMESTAMP:
- return "TIMESTAMP";
+ return u"TIMESTAMP"_ustr;
case DataType::DOUBLE:
case DataType::REAL:
- return "DOUBLE PRECISION";
+ return u"DOUBLE PRECISION"_ustr;
case DataType::FLOAT:
- return "FLOAT";
+ return u"FLOAT"_ustr;
default:
assert(false);
return OUString();
@@ -89,12 +83,12 @@ OUString lcl_getTypeModifier(sal_Int32 eType)
{
case DataType::CLOB:
case DataType::LONGVARCHAR:
- return "SUB_TYPE 1";
+ return u"SUB_TYPE 1"_ustr;
case DataType::LONGVARBINARY:
- return "SUB_TYPE -9546";
+ return u"SUB_TYPE -9546"_ustr;
case DataType::BINARY:
case DataType::VARBINARY:
- return "CHARACTER SET OCTETS";
+ return u"CHARACTER SET OCTETS"_ustr;
default:
return OUString();
}
@@ -110,8 +104,7 @@ void FbCreateStmtParser::appendPrimaryKeyPart(OUStringBuffer& rSql) const
if (sPrimaryKeys.empty())
return; // no primary key specified
- rSql.append(",");
- rSql.append("PRIMARY KEY(");
+ rSql.append(",PRIMARY KEY(");
auto it = sPrimaryKeys.cbegin();
while (it != sPrimaryKeys.end())
{
@@ -135,16 +128,14 @@ OUString FbCreateStmtParser::compose() const
{
ensureProperTableLengths();
OUStringBuffer sSql(128);
- sSql.append("CREATE TABLE ");
- sSql.append(getTableName());
+ sSql.append("CREATE TABLE " + getTableName() + " ("); // column declaration
- lcl_appendWithSpace(sSql, "("); // column declaration
auto& rColumns = getColumnDef();
auto columnIter = rColumns.cbegin();
while (columnIter != rColumns.end())
{
- lcl_appendWithSpace(sSql, columnIter->getName());
- lcl_appendWithSpace(sSql, lcl_DataTypetoFbTypeName(columnIter->getDataType()));
+ sSql.append(" " + columnIter->getName() + " "
+ + lcl_DataTypetoFbTypeName(columnIter->getDataType()));
std::vector<sal_Int32> params{ columnIter->getParams() };
@@ -163,7 +154,7 @@ OUString FbCreateStmtParser::compose() const
auto it = params.cbegin();
while (it != params.end())
{
- sSql.append(OUString::number(*it));
+ sSql.append(*it);
++it;
if (it != params.end())
sSql.append(",");
@@ -174,32 +165,30 @@ OUString FbCreateStmtParser::compose() const
// special modifiers here, based on type (e.g. charset, subtype)
OUString sModifier = lcl_getTypeModifier(columnIter->getDataType());
if (!sModifier.isEmpty())
- lcl_appendWithSpace(sSql, sModifier);
+ sSql.append(" " + sModifier);
if (columnIter->isAutoIncremental())
{
- lcl_appendWithSpace(sSql, "GENERATED BY DEFAULT AS IDENTITY (START WITH ");
-
// start with 0:
// HSQLDB: first value will be 0.
// Firebird: first value will be 1.
- sSql.append(columnIter->getStartValue() - 1);
- sSql.append(")");
+ sSql.append(" GENERATED BY DEFAULT AS IDENTITY (START WITH "
+ + OUString::number(columnIter->getStartValue() - 1) + ")");
}
else if (!columnIter->isNullable())
- lcl_appendWithSpace(sSql, "NOT NULL");
+ sSql.append(" NOT NULL");
if (columnIter->isCaseInsensitive())
- lcl_appendWithSpace(sSql, "COLLATE UNICODE_CI");
+ sSql.append(" COLLATE UNICODE_CI");
const OUString& sDefaultVal = columnIter->getDefault();
if (!sDefaultVal.isEmpty())
{
- lcl_appendWithSpace(sSql, "DEFAULT");
+ sSql.append(" DEFAULT ");
if (sDefaultVal.equalsIgnoreAsciiCase("NOW"))
- lcl_appendWithSpace(sSql, "\'NOW\'"); // Fb likes it single quoted
+ sSql.append("'NOW'"); // Fb likes it single quoted
else
- lcl_appendWithSpace(sSql, sDefaultVal);
+ sSql.append(sDefaultVal);
}
++columnIter;
diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.hxx b/dbaccess/source/filter/hsqldb/fbcreateparser.hxx
index c90e05c3bdd8..6706c05beae0 100644
--- a/dbaccess/source/filter/hsqldb/fbcreateparser.hxx
+++ b/dbaccess/source/filter/hsqldb/fbcreateparser.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_FBCREATEPARSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_FBCREATEPARSER_HXX
+#pragma once
#include "createparser.hxx"
@@ -35,6 +34,4 @@ public:
} // dbahsql
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_FBCREATEPARSER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/hsqlbinarynode.cxx b/dbaccess/source/filter/hsqldb/hsqlbinarynode.cxx
index 6211916fcd05..c02da2c4b411 100644
--- a/dbaccess/source/filter/hsqldb/hsqlbinarynode.cxx
+++ b/dbaccess/source/filter/hsqldb/hsqlbinarynode.cxx
@@ -22,8 +22,6 @@
namespace dbahsql
{
-using ColumnTypeVector = std::vector<ColumnDefinition>;
-
HsqlBinaryNode::HsqlBinaryNode(sal_Int32 nPos)
: m_nPos(nPos)
{
diff --git a/dbaccess/source/filter/hsqldb/hsqlbinarynode.hxx b/dbaccess/source/filter/hsqldb/hsqlbinarynode.hxx
index 7f57aae24da8..97777e7d14c8 100644
--- a/dbaccess/source/filter/hsqldb/hsqlbinarynode.hxx
+++ b/dbaccess/source/filter/hsqldb/hsqlbinarynode.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_HSQLBINARYNODE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_HSQLBINARYNODE_HXX
+#pragma once
#include <vector>
@@ -61,6 +60,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_HSQLBINARYNODE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx
index a017d8dfa12e..918397da620f 100644
--- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx
+++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx
@@ -176,13 +176,11 @@ void lcl_setParams(const std::vector<Any>& row, Reference<XParameters> const& xP
}
}
-OUString lcl_createInsertStatement(const OUString& sTableName,
+OUString lcl_createInsertStatement(std::u16string_view sTableName,
const std::vector<dbahsql::ColumnDefinition>& rColTypes)
{
assert(rColTypes.size() > 0);
- OUStringBuffer sql("INSERT INTO ");
- sql.append(sTableName);
- sql.append(" (");
+ OUStringBuffer sql(OUString::Concat("INSERT INTO ") + sTableName + " (");
// column names
for (size_t i = 0; i < rColTypes.size(); ++i)
@@ -191,9 +189,7 @@ OUString lcl_createInsertStatement(const OUString& sTableName,
if (i < rColTypes.size() - 1)
sql.append(", ");
}
- sql.append(")");
-
- sql.append(" VALUES (");
+ sql.append(") VALUES (");
for (size_t i = 0; i < rColTypes.size(); ++i)
{
sql.append("?");
@@ -216,7 +212,8 @@ HsqlImporter::HsqlImporter(Reference<XConnection>& rConnection, const Reference<
m_xStorage.set(rStorage);
}
-void HsqlImporter::insertRow(const std::vector<css::uno::Any>& xRows, const OUString& sTableName,
+void HsqlImporter::insertRow(const std::vector<css::uno::Any>& xRows,
+ std::u16string_view sTableName,
const std::vector<ColumnDefinition>& rColTypes)
{
OUString sStatement = lcl_createInsertStatement(sTableName, rColTypes);
@@ -266,7 +263,7 @@ void HsqlImporter::parseTableRows(const std::vector<sal_Int32>& rIndexes,
const std::vector<ColumnDefinition>& rColTypes,
const OUString& sTableName)
{
- constexpr char BINARY_FILENAME[] = "data";
+ static constexpr OUString BINARY_FILENAME = u"data"_ustr;
if (!m_xStorage->hasByName(BINARY_FILENAME))
{
diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.hxx b/dbaccess/source/filter/hsqldb/hsqlimport.hxx
index c4f4d1f24c18..13bbcd510442 100644
--- a/dbaccess/source/filter/hsqldb/hsqlimport.hxx
+++ b/dbaccess/source/filter/hsqldb/hsqlimport.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_HSQLIMPORT_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_HSQLIMPORT_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -24,14 +23,14 @@ class Window;
namespace dbahsql
{
-class SAL_DLLPUBLIC_EXPORT HsqlImporter
+class UNLESS_MERGELIBS_MORE(SAL_DLLPUBLIC_EXPORT) HsqlImporter
{
private:
css::uno::Reference<css::sdbc::XConnection>& m_rConnection;
css::uno::Reference<css::embed::XStorage> m_xStorage;
protected:
- void insertRow(const std::vector<css::uno::Any>& xRows, const OUString& sTable,
+ void insertRow(const std::vector<css::uno::Any>& xRows, std::u16string_view sTable,
const std::vector<ColumnDefinition>& rColTypes);
void processTree(HsqlBinaryNode& rNode, HsqlRowInputStream& rStream,
const std::vector<ColumnDefinition>& rColTypes, const OUString& sTableName,
@@ -58,6 +57,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_HSQLIMPORT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx
index d2215e96eb31..a2edb611a07c 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.cxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "parseschema.hxx"
#include "fbcreateparser.hxx"
#include "fbalterparser.hxx"
@@ -29,6 +33,7 @@
#include <comphelper/string.hxx>
#include <sal/log.hxx>
#include <connectivity/dbexception.hxx>
+#include <utility>
namespace
{
@@ -42,8 +47,8 @@ private:
OUString m_sql;
public:
- IndexStmtParser(const OUString& sSql)
- : m_sql(sSql)
+ IndexStmtParser(OUString sSql)
+ : m_sql(std::move(sSql))
{
}
@@ -56,9 +61,14 @@ public:
{
assert(isIndexStatement());
- OUString sIndexPart = m_sql.copy(m_sql.indexOf("INDEX") + 5);
- sal_Int32 nQuotePos = sIndexPart.indexOf("'") + 1;
- OUString sIndexNums = sIndexPart.copy(nQuotePos, sIndexPart.lastIndexOf("'") - nQuotePos);
+ std::u16string_view sIndexPart = m_sql.subView(m_sql.indexOf("INDEX") + 5);
+ size_t nQuotePos = sIndexPart.find('\'');
+ if (nQuotePos == std::u16string_view::npos)
+ nQuotePos = 0;
+ else
+ ++nQuotePos;
+ std::u16string_view sIndexNums
+ = sIndexPart.substr(nQuotePos, sIndexPart.rfind('\'') - nQuotePos);
std::vector<OUString> sIndexes = string::split(sIndexNums, u' ');
IndexVector indexes;
@@ -80,18 +90,15 @@ public:
if (sName.indexOf('"') >= 0)
{
// Table name with string delimiter
- OUStringBuffer sMultiName("\"");
- sMultiName.append(string::split(m_sql, u'"')[1]);
- sMultiName.append("\"");
- sName = sMultiName.makeStringAndClear();
+ sName = "\"" + string::split(m_sql, u'"')[1] + "\"";
}
return sName;
}
};
-OUString lcl_createAlterForeign(const OUString& sForeignPart, const OUString& sTableName)
+OUString lcl_createAlterForeign(std::u16string_view sForeignPart, std::u16string_view sTableName)
{
- return "ALTER TABLE " + sTableName + " ADD " + sForeignPart;
+ return OUString::Concat("ALTER TABLE ") + sTableName + " ADD " + sForeignPart;
}
} // anonymous namespace
@@ -102,8 +109,6 @@ using namespace css::io;
using namespace css::uno;
using namespace css::embed;
-typedef std::vector<ColumnDefinition> ColumnTypeVector;
-
SchemaParser::SchemaParser(Reference<XStorage>& rStorage)
: m_rStorage(rStorage)
{
@@ -113,7 +118,7 @@ void SchemaParser::parseSchema()
{
assert(m_rStorage);
- constexpr char SCHEMA_FILENAME[] = "script";
+ static constexpr OUString SCHEMA_FILENAME = u"script"_ustr;
if (!m_rStorage->hasByName(SCHEMA_FILENAME))
{
SAL_WARN("dbaccess", "script file does not exist in storage during hsqldb import");
@@ -122,9 +127,9 @@ void SchemaParser::parseSchema()
Reference<XStream> xStream(m_rStorage->openStreamElement(SCHEMA_FILENAME, ElementModes::READ));
- Reference<XComponentContext> rContext = comphelper::getProcessComponentContext();
+ const Reference<XComponentContext>& rContext = comphelper::getProcessComponentContext();
Reference<XTextInputStream2> xTextInput = TextInputStream::create(rContext);
- xTextInput->setEncoding("UTF-8");
+ xTextInput->setEncoding(u"UTF-8"_ustr);
xTextInput->setInputStream(xStream->getInputStream());
while (!xTextInput->isEOF())
@@ -177,7 +182,8 @@ std::vector<ColumnDefinition> SchemaParser::getTableColumnTypes(const OUString&
{
if (m_ColumnTypes.count(sTableName) < 1)
{
- constexpr char NOT_EXIST[] = "Internal error while getting column information of table";
+ static constexpr OUString NOT_EXIST
+ = u"Internal error while getting column information of table"_ustr;
SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName);
dbtools::throwGenericSQLException(NOT_EXIST, ::comphelper::getProcessComponentContext());
}
diff --git a/dbaccess/source/filter/hsqldb/parseschema.hxx b/dbaccess/source/filter/hsqldb/parseschema.hxx
index 6530eb263041..04a8e09050a3 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.hxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_PARSECHEMA_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_PARSECHEMA_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
#include <vector>
@@ -82,6 +81,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_PARSESCHEMA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx
index 89c748fcbb82..c6d57a76b865 100644
--- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx
+++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "rowinputbinary.hxx"
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/io/WrongFormatException.hpp>
@@ -25,11 +29,12 @@
#include <com/sun/star/util/DateTime.hpp>
#include <unotools/ucbstreamhelper.hxx>
+#include <tools/datetime.hxx>
+#include <tools/duration.hxx>
#include <tools/stream.hxx>
+#include <tools/time.hxx>
#include <rtl/ustrbuf.hxx>
-#include <boost/date_time/posix_time/posix_time.hpp>
-
namespace
{
/**
@@ -82,12 +87,12 @@ OUString lcl_double_dabble(const std::vector<sal_uInt8>& bytes)
digit += '0';
/* Resize and return the resulting string. */
- return OStringToOUString(OString(scratch.data(), scratch.size()), RTL_TEXTENCODING_UTF8);
+ return OStringToOUString(std::string_view(scratch.data(), scratch.size()),
+ RTL_TEXTENCODING_UTF8);
}
-OUString lcl_makeStringFromBigint(const std::vector<sal_uInt8>& bytes)
+OUString lcl_makeStringFromBigint(std::vector<sal_uInt8>&& aBytes)
{
- std::vector<sal_uInt8> aBytes{ bytes };
OUStringBuffer sRet;
// two's complement
@@ -114,15 +119,27 @@ OUString lcl_makeStringFromBigint(const std::vector<sal_uInt8>& bytes)
OUString lcl_putDot(const OUString& sNum, sal_Int32 nScale)
{
// e.g. sNum = "0", nScale = 2 -> "0.00"
+ if (nScale <= 0)
+ return sNum;
+
OUStringBuffer sBuf{ sNum };
sal_Int32 nNullsToAppend = nScale - sNum.getLength() + 1;
for (sal_Int32 i = 0; i < nNullsToAppend; ++i)
sBuf.insert(0, "0");
- if (nScale > 0)
- sBuf.insert(sBuf.getLength() - 1 - nScale, ".");
+ sBuf.insert(sBuf.getLength() - nScale, ".");
return sBuf.makeStringAndClear();
}
+
+DateTime HsqlDateTime(sal_Int64 nanoseconds)
+{
+ const DateTime epoch(Date(1, 1, 1970));
+ const bool negative = nanoseconds < 0;
+ tools::Duration duration(0, 0, 0, 0, negative ? -nanoseconds : nanoseconds);
+ if (negative)
+ duration = -duration;
+ return epoch + duration;
+}
}
namespace dbahsql
@@ -130,8 +147,6 @@ namespace dbahsql
using namespace css::uno;
using namespace css::sdbc;
using namespace css::io;
-using namespace boost::posix_time;
-using namespace boost::gregorian;
HsqlRowInputStream::HsqlRowInputStream() {}
@@ -161,9 +176,8 @@ OUString HsqlRowInputStream::readUTF(sal_Int32 nUTFLen)
sal_Int32 nStrLen = 0;
while (nCount < nUTFLen)
{
- unsigned char cIn = 0;
- m_pStream->ReadUChar(cIn);
- sal_uInt8 c = reinterpret_cast<sal_uInt8&>(cIn);
+ sal_uInt8 c = 0;
+ m_pStream->ReadUChar(c);
sal_uInt8 char2, char3;
switch (c >> 4)
{
@@ -189,8 +203,7 @@ OUString HsqlRowInputStream::readUTF(sal_Int32 nUTFLen)
throw WrongFormatException();
}
- m_pStream->ReadUChar(cIn);
- char2 = reinterpret_cast<sal_uInt8&>(cIn);
+ m_pStream->ReadUChar(char2);
if ((char2 & 0xC0) != 0x80)
{
throw WrongFormatException();
@@ -207,10 +220,8 @@ OUString HsqlRowInputStream::readUTF(sal_Int32 nUTFLen)
throw WrongFormatException();
}
- m_pStream->ReadUChar(cIn);
- char2 = reinterpret_cast<sal_uInt8&>(cIn);
- m_pStream->ReadUChar(cIn);
- char3 = reinterpret_cast<sal_uInt8&>(cIn);
+ m_pStream->ReadUChar(char2);
+ m_pStream->ReadUChar(char3);
if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80))
{
@@ -230,9 +241,8 @@ OUString HsqlRowInputStream::readUTF(sal_Int32 nUTFLen)
bool HsqlRowInputStream::checkNull()
{
- unsigned char cIn = 0;
- m_pStream->ReadUChar(cIn);
- sal_uInt8 nNull = reinterpret_cast<sal_uInt8&>(cIn);
+ sal_uInt8 nNull = 0;
+ m_pStream->ReadUChar(nNull);
return nNull == 0;
}
@@ -245,7 +255,7 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti
{
if (checkNull())
{
- aData.push_back(Any());
+ aData.emplace_back();
continue;
}
@@ -258,28 +268,28 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
- aData.push_back(makeAny(readString()));
+ aData.emplace_back(readString());
break;
case DataType::TINYINT:
case DataType::SMALLINT:
{
sal_Int16 value = 0;
m_pStream->ReadInt16(value);
- aData.push_back(makeAny(value));
+ aData.emplace_back(value);
}
break;
case DataType::INTEGER:
{
sal_Int32 value = 0;
m_pStream->ReadInt32(value);
- aData.push_back(makeAny(value));
+ aData.emplace_back(value);
}
break;
case DataType::BIGINT:
{
sal_Int64 value = 0;
m_pStream->ReadInt64(value);
- aData.push_back(makeAny(value));
+ aData.emplace_back(value);
}
break;
case DataType::REAL:
@@ -289,7 +299,7 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti
double value = 0;
m_pStream->ReadDouble(value);
// FIXME double is not necessarily 4 bytes
- aData.push_back(makeAny(value));
+ aData.emplace_back(value);
}
break;
case DataType::NUMERIC:
@@ -305,77 +315,56 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti
sal_Int32 nScale = 0;
m_pStream->ReadInt32(nScale);
- Sequence<Any> result(2);
- OUString sNum = lcl_makeStringFromBigint(aBytes);
- result[0] <<= lcl_putDot(sNum, nScale);
- result[1] <<= nScale;
- aData.push_back(makeAny(result));
+ OUString sNum = lcl_makeStringFromBigint(std::move(aBytes));
+ Sequence<Any> result{ Any(lcl_putDot(sNum, nScale)), Any(nScale) };
+ aData.emplace_back(result);
}
break;
case DataType::DATE:
{
sal_Int64 value = 0;
m_pStream->ReadInt64(value); // in millisec, from 1970
- ptime epoch = time_from_string("1970-01-01 00:00:00.000");
- ptime time = epoch + milliseconds(value);
- date asDate = time.date();
-
- css::util::Date loDate(asDate.day(), asDate.month(),
- asDate.year()); // day, month, year
- aData.push_back(makeAny(loDate));
+ css::util::Date loDate(
+ HsqlDateTime(value * tools::Time::nanoPerMilli).GetUNODate());
+ aData.emplace_back(loDate);
}
break;
case DataType::TIME:
{
sal_Int64 value = 0;
m_pStream->ReadInt64(value);
- auto valueInSecs = value / 1000;
- /* Observed valueInSecs fall in the range from
+ /* Observed value fall in the range from
negative one day to positive two days. Coerce
- valueInSecs between zero and positive one day.*/
- const int secPerDay = 24 * 60 * 60;
- valueInSecs = (valueInSecs + secPerDay) % secPerDay;
-
- auto nHours = valueInSecs / (60 * 60);
- valueInSecs = valueInSecs % 3600;
- const sal_uInt16 nMins = valueInSecs / 60;
- const sal_uInt16 nSecs = valueInSecs % 60;
- css::util::Time time((value % 1000) * 1000000, nSecs, nMins, nHours, true);
- aData.push_back(makeAny(time));
+ value between zero and positive one day.*/
+ value = (value + tools::Time::milliSecPerDay) % tools::Time::milliSecPerDay;
+ tools::Duration duration(0, 0, 0, 0, value * tools::Time::nanoPerMilli);
+
+ css::util::Time time(duration.GetTime().GetUNOTime());
+ aData.emplace_back(time);
}
break;
case DataType::TIMESTAMP:
{
sal_Int64 nEpochMillis = 0;
m_pStream->ReadInt64(nEpochMillis);
- ptime epoch = time_from_string("1970-01-01 00:00:00.000");
- ptime time = epoch + milliseconds(nEpochMillis);
- date asDate = time.date();
-
sal_Int32 nNanos = 0;
m_pStream->ReadInt32(nNanos);
+ DateTime result(HsqlDateTime(nEpochMillis * tools::Time::nanoPerMilli + nNanos));
// convert into LO internal representation of dateTime
- css::util::DateTime dateTime;
- dateTime.NanoSeconds = nNanos;
- dateTime.Seconds = time.time_of_day().seconds();
- dateTime.Minutes = time.time_of_day().minutes();
- dateTime.Hours = time.time_of_day().hours();
- dateTime.Day = asDate.day();
- dateTime.Month = asDate.month();
- dateTime.Year = asDate.year();
- aData.push_back(makeAny(dateTime));
+ css::util::DateTime dateTime(result.GetUNODateTime());
+ aData.emplace_back(dateTime);
}
break;
case DataType::BOOLEAN:
{
sal_uInt8 nBool = 0;
m_pStream->ReadUChar(nBool);
- aData.push_back(makeAny(static_cast<bool>(nBool)));
+ aData.emplace_back(static_cast<bool>(nBool));
}
break;
case DataType::OTHER:
- aData.push_back(Any{}); // TODO
+ aData.emplace_back(); // TODO
break;
case DataType::BINARY:
case DataType::VARBINARY:
@@ -386,7 +375,7 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti
Sequence<sal_Int8> aBytes(nSize);
m_pStream->ReadBytes(aBytes.getArray(), nSize);
- aData.push_back(makeAny(aBytes));
+ aData.emplace_back(aBytes);
}
break;
diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.hxx b/dbaccess/source/filter/hsqldb/rowinputbinary.hxx
index b5c50a602431..f81fa446f7c2 100644
--- a/dbaccess/source/filter/hsqldb/rowinputbinary.hxx
+++ b/dbaccess/source/filter/hsqldb/rowinputbinary.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_ROWINPUTBINARY_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_ROWINPUTBINARY_HXX
+#pragma once
#include <vector>
#include <tools/stream.hxx>
@@ -50,6 +49,4 @@ public:
} // namespace dbahsql
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_ROWINPUTBINARY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx
index 3dc8f2e55b16..2058bfdeaf57 100644
--- a/dbaccess/source/filter/hsqldb/utils.cxx
+++ b/dbaccess/source/filter/hsqldb/utils.cxx
@@ -21,37 +21,15 @@
#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>
#include <connectivity/dbexception.hxx>
+#include <sal/log.hxx>
+#include <o3tl/numeric.hxx>
#include "utils.hxx"
using namespace dbahsql;
-namespace
-{
-int getHexValue(sal_Unicode c)
-{
- if (c >= '0' && c <= '9')
- {
- return c - '0';
- }
- else if (c >= 'A' && c <= 'F')
- {
- return c - 'A' + 10;
- }
- else if (c >= 'a' && c <= 'f')
- {
- return c - 'a' + 10;
- }
- else
- {
- return -1;
- }
-}
-
-} // unnamed namespace
-
//Convert ascii escaped unicode to utf-8
-OUString utils::convertToUTF8(const OString& original)
+OUString utils::convertToUTF8(std::string_view original)
{
OUString res = OStringToOUString(original, RTL_TEXTENCODING_UTF8);
for (sal_Int32 i = 0;;)
@@ -68,7 +46,7 @@ OUString utils::convertToUTF8(const OString& original)
sal_Unicode c = 0;
for (sal_Int32 j = 0; j != 4; ++j)
{
- auto const n = getHexValue(res[i + j]);
+ auto const n = o3tl::convertToHex<int>(res[i + j]);
if (n == -1)
{
escape = false;
@@ -79,7 +57,7 @@ OUString utils::convertToUTF8(const OString& original)
if (escape)
{
i -= 2;
- res = res.replaceAt(i, 6, OUString(c));
+ res = res.replaceAt(i, 6, rtl::OUStringChar(c));
++i;
}
}
@@ -87,9 +65,9 @@ OUString utils::convertToUTF8(const OString& original)
return res;
}
-OUString utils::getTableNameFromStmt(const OUString& sSql)
+OUString utils::getTableNameFromStmt(std::u16string_view sSql)
{
- auto stmtComponents = comphelper::string::split(sSql, sal_Unicode(u' '));
+ std::vector<OUString> stmtComponents = comphelper::string::split(sSql, sal_Unicode(u' '));
assert(stmtComponents.size() > 2);
auto wordIter = stmtComponents.begin();
@@ -103,17 +81,23 @@ OUString utils::getTableNameFromStmt(const OUString& sSql)
// it may contain spaces if it's put into apostrophes.
if (wordIter->indexOf("\"") >= 0)
{
- sal_Int32 nAposBegin = sSql.indexOf("\"");
- sal_Int32 nAposEnd = nAposBegin;
+ size_t nAposBegin = sSql.find('"');
+ assert(nAposBegin != std::u16string_view::npos);
+ size_t nAposEnd = nAposBegin;
bool bProperEndAposFound = false;
while (!bProperEndAposFound)
{
- nAposEnd = sSql.indexOf("\"", nAposEnd + 1);
+ nAposEnd = sSql.find('"', nAposEnd + 1);
+ if (nAposEnd == std::u16string_view::npos)
+ {
+ SAL_WARN("dbaccess", "no matching \"");
+ return OUString();
+ }
if (sSql[nAposEnd - 1] != u'\\')
bProperEndAposFound = true;
}
- OUString result = sSql.copy(nAposBegin, nAposEnd - nAposBegin + 1);
- return result;
+ std::u16string_view result = sSql.substr(nAposBegin, nAposEnd - nAposBegin + 1);
+ return OUString(result);
}
// next word is the table's name
@@ -125,13 +109,14 @@ OUString utils::getTableNameFromStmt(const OUString& sSql)
return *wordIter;
}
-void utils::ensureFirebirdTableLength(const OUString& sName)
+void utils::ensureFirebirdTableLength(std::u16string_view sName)
{
- if (sName.getLength() > 30) // Firebird limitation
+ if (sName.size() > 30) // Firebird limitation
{
- constexpr char NAME_TOO_LONG[] = "Firebird 3 doesn't support object (table, field) names "
- "of more than 30 characters; please shorten your object "
- "names in the original file and try again.";
+ static constexpr OUStringLiteral NAME_TOO_LONG
+ = u"Firebird 3 doesn't support object (table, field) names "
+ "of more than 30 characters; please shorten your object "
+ "names in the original file and try again.";
dbtools::throwGenericSQLException(NAME_TOO_LONG,
::comphelper::getProcessComponentContext());
}
diff --git a/dbaccess/source/filter/hsqldb/utils.hxx b/dbaccess/source/filter/hsqldb/utils.hxx
index b2d54fbc1a50..ed5fb8a1e380 100644
--- a/dbaccess/source/filter/hsqldb/utils.hxx
+++ b/dbaccess/source/filter/hsqldb/utils.hxx
@@ -7,23 +7,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_UTILS_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_UTILS_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
#include <rtl/ustring.hxx>
-namespace dbahsql
-{
-namespace utils
+namespace dbahsql::utils
{
-OUString convertToUTF8(const OString& original);
+OUString convertToUTF8(std::string_view original);
-OUString getTableNameFromStmt(const OUString& sSql);
+OUString getTableNameFromStmt(std::u16string_view sSql);
-void ensureFirebirdTableLength(const OUString& sName);
+void ensureFirebirdTableLength(std::u16string_view sName);
}
-}
-
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_HSQLDB_UTILS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index 9587647a38ff..e855d9101822 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -19,11 +19,9 @@
#include <strings.hxx>
-#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XController2.hpp>
#include <com/sun/star/frame/XFrame.hpp>
@@ -31,7 +29,6 @@
#include <com/sun/star/frame/XLoadEventListener.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
@@ -47,15 +44,15 @@
#include <comphelper/documentconstants.hxx>
#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/types.hxx>
#include <comphelper/propertysequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <sfx2/docfile.hxx>
+#include <unotools/fcm.hxx>
#include <unotools/moduleoptions.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
using namespace ::ucbhelper;
@@ -66,7 +63,6 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::sdb;
@@ -108,9 +104,9 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
{
::comphelper::NamedValueCollection aMedia( Descriptor );
bool bStreamFromDescr = false;
- OUString sURL = aMedia.getOrDefault( "URL", OUString() );
+ OUString sURL = aMedia.getOrDefault( u"URL"_ustr, OUString() );
- Reference< XInputStream > xInStream( aMedia.getOrDefault( "InputStream", Reference< XInputStream >() ) );
+ Reference< XInputStream > xInStream( aMedia.getOrDefault( u"InputStream"_ustr, Reference< XInputStream >() ) );
Reference< XPropertySet > xStorageProperties;
if ( xInStream.is() )
{
@@ -120,7 +116,7 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
}
else
{
- OUString sSalvagedURL( aMedia.getOrDefault( "SalvagedFile", OUString() ) );
+ OUString sSalvagedURL( aMedia.getOrDefault( u"SalvagedFile"_ustr, OUString() ) );
OUString sFileLocation( sSalvagedURL.isEmpty() ? sURL : sSalvagedURL );
if ( !sFileLocation.isEmpty() )
@@ -134,14 +130,14 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
{
OUString sMediaType;
xStorageProperties->getPropertyValue( INFO_MEDIATYPE ) >>= sMediaType;
- if ( sMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII || sMediaType == MIMETYPE_VND_SUN_XML_BASE_ASCII )
+ if ( sMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DATABASE || sMediaType == MIMETYPE_VND_SUN_XML_BASE )
{
if ( bStreamFromDescr && !sURL.startsWith( "private:stream" ) )
{
// After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further
// for now the file should be reopened to have read/write access
- aMedia.remove( OUString( "InputStream" ) );
- aMedia.remove( OUString( "Stream" ) );
+ aMedia.remove( u"InputStream"_ustr );
+ aMedia.remove( u"Stream"_ustr );
aMedia >>= Descriptor;
try
{
@@ -155,7 +151,7 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
}
}
- return "StarBase";
+ return u"StarBase"_ustr;
}
::comphelper::disposeComponent(xStorageProperties);
}
@@ -166,7 +162,7 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
// XServiceInfo
OUString SAL_CALL DBTypeDetection::getImplementationName()
{
- return "org.openoffice.comp.dbflt.DBTypeDetection";
+ return u"org.openoffice.comp.dbflt.DBTypeDetection"_ustr;
}
// XServiceInfo
@@ -178,7 +174,7 @@ sal_Bool SAL_CALL DBTypeDetection::supportsService(const OUString& ServiceName)
// XServiceInfo
Sequence< OUString > SAL_CALL DBTypeDetection::getSupportedServiceNames()
{
- return { "com.sun.star.document.ExtendedTypeDetection" };
+ return { u"com.sun.star.document.ExtendedTypeDetection"_ustr };
}
} // namespace dbaxml
@@ -199,7 +195,7 @@ class DBContentLoader : public ::cppu::WeakImplHelper< XFrameLoader, XServiceInf
{
private:
const Reference< XComponentContext > m_aContext;
- Reference< XFrameLoader > m_xMySelf;
+ rtl::Reference< DBContentLoader > m_xMySelf;
OUString m_sCurrentURL;
ImplSVEvent * m_nStartWizard;
@@ -234,7 +230,7 @@ DBContentLoader::DBContentLoader(const Reference< XComponentContext >& _rxFactor
// XServiceInfo
OUString SAL_CALL DBContentLoader::getImplementationName()
{
- return "org.openoffice.comp.dbflt.DBContentLoader2";
+ return u"org.openoffice.comp.dbflt.DBContentLoader2"_ustr;
}
// XServiceInfo
@@ -246,7 +242,7 @@ sal_Bool SAL_CALL DBContentLoader::supportsService(const OUString& ServiceName)
// XServiceInfo
Sequence< OUString > SAL_CALL DBContentLoader::getSupportedServiceNames()
{
- return { "com.sun.star.frame.FrameLoader" };
+ return { u"com.sun.star.frame.FrameLoader"_ustr };
}
@@ -265,7 +261,7 @@ namespace
}
catch( const Exception& )
{
- OSL_FAIL( "lcl_urlAllowsInteraction: caught an exception while analyzing the URL!" );
+ TOOLS_WARN_EXCEPTION( "dbaccess", "lcl_urlAllowsInteraction: caught an exception while analyzing the URL!" );
}
return bDoesAllow;
}
@@ -299,7 +295,7 @@ bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel > const &
}));
// create the dialog
- Reference< XExecutableDialog > xAdminDialog( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.sdb.DatabaseWizardDialog", aWizardArgs, m_aContext), UNO_QUERY_THROW);
+ Reference< XExecutableDialog > xAdminDialog( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.sdb.DatabaseWizardDialog"_ustr, aWizardArgs, m_aContext), UNO_QUERY_THROW);
// execute it
if ( RET_OK != xAdminDialog->execute() )
@@ -307,8 +303,8 @@ bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel > const &
Reference<XPropertySet> xProp(xAdminDialog,UNO_QUERY);
bool bSuccess = false;
- xProp->getPropertyValue("OpenDatabase") >>= bSuccess;
- xProp->getPropertyValue("StartTableWizard") >>= _bShouldStartTableWizard;
+ xProp->getPropertyValue(u"OpenDatabase"_ustr) >>= bSuccess;
+ xProp->getPropertyValue(u"StartTableWizard"_ustr) >>= _bShouldStartTableWizard;
return bSuccess;
}
@@ -318,7 +314,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
{
// first check if preview is true, if so return without creating a controller. Preview is not supported
::comphelper::NamedValueCollection aMediaDesc( rArgs );
- bool bPreview = aMediaDesc.getOrDefault( "Preview", false );
+ bool bPreview = aMediaDesc.getOrDefault( u"Preview"_ustr, false );
if ( bPreview )
{
if (rListener.is())
@@ -326,8 +322,8 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
return;
}
- Reference< XModel > xModel = aMediaDesc.getOrDefault( "Model", Reference< XModel >() );
- OUString sSalvagedURL = aMediaDesc.getOrDefault( "SalvagedFile", _rURL );
+ Reference< XModel > xModel = aMediaDesc.getOrDefault( u"Model"_ustr, Reference< XModel >() );
+ OUString sSalvagedURL = aMediaDesc.getOrDefault( u"SalvagedFile"_ustr, _rURL );
bool bCreateNew = false; // does the URL denote the private:factory URL?
bool bStartTableWizard = false; // start the table wizard after everything was loaded successfully?
@@ -340,25 +336,28 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
// a default handler, we simply ensure there is one.
// If a handler is present in the media descriptor, even if it is NULL, we will
// not touch it.
- if ( !aMediaDesc.has( "InteractionHandler" ) )
+ if ( !aMediaDesc.has( u"InteractionHandler"_ustr ) )
{
Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) );
- aMediaDesc.put( "InteractionHandler", xHandler );
+ aMediaDesc.put( u"InteractionHandler"_ustr, xHandler );
}
// it's allowed to pass an existing document
Reference< XOfficeDatabaseDocument > xExistentDBDoc;
- xModel.set( aMediaDesc.getOrDefault( "Model", xExistentDBDoc ), UNO_QUERY );
- aMediaDesc.remove( "Model" );
+ xModel.set( aMediaDesc.getOrDefault( u"Model"_ustr, xExistentDBDoc ), UNO_QUERY );
+ aMediaDesc.remove( u"Model"_ustr );
// also, it's allowed to specify the type of view which should be created
- OUString sViewName = aMediaDesc.getOrDefault( "ViewName", OUString( "Default" ) );
- aMediaDesc.remove( "ViewName" );
+ OUString sViewName = aMediaDesc.getOrDefault( u"ViewName"_ustr, u"Default"_ustr );
+ aMediaDesc.remove( u"ViewName"_ustr );
+
+ // this needs to stay alive for duration of this method
+ Reference< XDatabaseContext > xDatabaseContext;
sal_Int32 nInitialSelection = -1;
if ( !xModel.is() )
{
- Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(m_aContext) );
+ xDatabaseContext = DatabaseContext::create(m_aContext);
OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::DATABASE);
bCreateNew = sFactoryName.match(_rURL);
@@ -373,7 +372,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
else
{
::comphelper::NamedValueCollection aCreationArgs;
- aCreationArgs.put( OUString(INFO_POOLURL), sSalvagedURL );
+ aCreationArgs.put( INFO_POOLURL, sSalvagedURL );
xDocumentDataSource.set( xDatabaseContext->createInstanceWithArguments( aCreationArgs.getWrappedNamedValues() ), UNO_QUERY_THROW );
}
@@ -420,7 +419,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
bool bNeedLoad = xModel->getURL().isEmpty();
try
{
- aMediaDesc.put( "FileName", _rURL );
+ aMediaDesc.put( u"FileName"_ustr, _rURL );
Sequence< PropertyValue > aResource( aMediaDesc.getPropertyValues() );
if ( bNeedLoad )
@@ -446,11 +445,8 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
Reference< XModel2 > xModel2( xModel, UNO_QUERY_THROW );
Reference< XController2 > xController( xModel2->createViewController( sViewName, Sequence< PropertyValue >(), rFrame ), UNO_SET_THROW );
- xController->attachModel( xModel );
- xModel->connectController( xController.get() );
- rFrame->setComponent( xController->getComponentWindow(), xController.get() );
- xController->attachFrame( rFrame );
- xModel->setCurrentController( xController.get() );
+ // introduce model/view/controller to each other
+ utl::ConnectFrameControllerModel(rFrame, xController, xModel);
bSuccess = true;
}
@@ -473,7 +469,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
{
NamedDatabaseObject aSelection;
aSelection.Type = nInitialSelection;
- xDocView->select( makeAny( aSelection ) );
+ xDocView->select( Any( aSelection ) );
}
}
@@ -511,13 +507,13 @@ IMPL_LINK_NOARG( DBContentLoader, OnStartTableWizard, void*, void )
{"DatabaseLocation", Any(m_sCurrentURL)}
}));
SolarMutexGuard aGuard;
- Reference< XJobExecutor > xTableWizard( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.wizards.table.CallTableWizard", aWizArgs, m_aContext), UNO_QUERY);
+ Reference< XJobExecutor > xTableWizard( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.wizards.table.CallTableWizard"_ustr, aWizArgs, m_aContext), UNO_QUERY);
if ( xTableWizard.is() )
- xTableWizard->trigger("start");
+ xTableWizard->trigger(u"start"_ustr);
}
catch(const Exception&)
{
- OSL_FAIL("caught an exception while starting the table wizard!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "caught an exception while starting the table wizard!");
}
m_xMySelf = nullptr;
}
diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.cxx b/dbaccess/source/filter/xml/xmlAutoStyle.cxx
index 99101567111a..82bcab3620ea 100644
--- a/dbaccess/source/filter/xml/xmlAutoStyle.cxx
+++ b/dbaccess/source/filter/xml/xmlAutoStyle.cxx
@@ -24,10 +24,9 @@
namespace dbaxml
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::xml::sax;
void OXMLAutoStylePoolP::exportStyleAttributes(
- SvXMLAttributeList& rAttrList,
+ comphelper::AttributeList& rAttrList,
XmlStyleFamily nFamily,
const std::vector< XMLPropertyState >& rProperties,
const SvXMLExportPropertyMapper& rPropExp
diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.hxx b/dbaccess/source/filter/xml/xmlAutoStyle.hxx
index 3d81a93279a9..c316524ea837 100644
--- a/dbaccess/source/filter/xml/xmlAutoStyle.hxx
+++ b/dbaccess/source/filter/xml/xmlAutoStyle.hxx
@@ -16,9 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLAUTOSTYLE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLAUTOSTYLE_HXX
-#include <xmloff/maptype.hxx>
+#pragma once
+
#include <xmloff/xmlaustp.hxx>
namespace dbaxml
@@ -29,7 +28,7 @@ namespace dbaxml
ODBExport& rODBExport;
virtual void exportStyleAttributes(
- SvXMLAttributeList& rAttrList,
+ comphelper::AttributeList& rAttrList,
XmlStyleFamily nFamily,
const std::vector< XMLPropertyState >& rProperties,
const SvXMLExportPropertyMapper& rPropExp,
@@ -42,6 +41,5 @@ namespace dbaxml
virtual ~OXMLAutoStylePoolP() override;
};
} // dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLAUTOSTYLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlColumn.cxx b/dbaccess/source/filter/xml/xmlColumn.cxx
index 334c4fbfcbe4..1afbf9f0f419 100644
--- a/dbaccess/source/filter/xml/xmlColumn.cxx
+++ b/dbaccess/source/filter/xml/xmlColumn.cxx
@@ -25,7 +25,6 @@
#include <com/sun/star/sdbcx/XAppend.hpp>
#include "xmlStyleImport.hxx"
#include <osl/diagnose.h>
-#include <sal/log.hxx>
namespace dbaxml
{
@@ -48,38 +47,36 @@ OXMLColumn::OXMLColumn( ODBFilter& rImport
OUString sType;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_NAME:
- m_sName = sValue;
+ m_sName = aIter.toString();
break;
case XML_STYLE_NAME:
- m_sStyleName = sValue;
+ m_sStyleName = aIter.toString();
break;
case XML_HELP_MESSAGE:
- m_sHelpMessage = sValue;
+ m_sHelpMessage = aIter.toString();
break;
case XML_VISIBILITY:
- m_bHidden = sValue != "visible";
+ m_bHidden = aIter.toView() != "visible";
break;
case XML_TYPE_NAME:
- sType = sValue;
+ sType = aIter.toString();
OSL_ENSURE(!sType.isEmpty(),"No type name set");
break;
case XML_DEFAULT_VALUE:
- if ( !(sValue.isEmpty() || sType.isEmpty()) )
- m_aDefaultValue <<= sValue;
+ if ( !(aIter.isEmpty() || sType.isEmpty()) )
+ m_aDefaultValue <<= aIter.toString();
break;
case XML_VISIBLE:
- m_bHidden = sValue == "false";
+ m_bHidden = aIter.toView() == "false";
break;
case XML_DEFAULT_CELL_STYLE_NAME:
- m_sCellStyleName = sValue;
+ m_sCellStyleName = aIter.toString();
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << " value=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
}
@@ -97,10 +94,10 @@ void OXMLColumn::endFastElement(sal_Int32 )
Reference<XPropertySet> xProp(xFac->createDataDescriptor());
if ( xProp.is() )
{
- xProp->setPropertyValue(PROPERTY_NAME,makeAny(m_sName));
- xProp->setPropertyValue(PROPERTY_HIDDEN,makeAny(m_bHidden));
+ xProp->setPropertyValue(PROPERTY_NAME,Any(m_sName));
+ xProp->setPropertyValue(PROPERTY_HIDDEN,Any(m_bHidden));
if ( !m_sHelpMessage.isEmpty() )
- xProp->setPropertyValue(PROPERTY_HELPTEXT,makeAny(m_sHelpMessage));
+ xProp->setPropertyValue(PROPERTY_HELPTEXT,Any(m_sHelpMessage));
if ( m_aDefaultValue.hasValue() )
xProp->setPropertyValue(PROPERTY_CONTROLDEFAULT,m_aDefaultValue);
diff --git a/dbaccess/source/filter/xml/xmlColumn.hxx b/dbaccess/source/filter/xml/xmlColumn.hxx
index cc242a905fc2..8deca87c7c42 100644
--- a/dbaccess/source/filter/xml/xmlColumn.hxx
+++ b/dbaccess/source/filter/xml/xmlColumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCOLUMN_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -47,12 +46,8 @@ namespace dbaxml
,const css::uno::Reference< css::beans::XPropertySet >& _xTable
);
virtual ~OXMLColumn() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlComponent.cxx b/dbaccess/source/filter/xml/xmlComponent.cxx
index 863a98f1673b..8f219e4d9eae 100644
--- a/dbaccess/source/filter/xml/xmlComponent.cxx
+++ b/dbaccess/source/filter/xml/xmlComponent.cxx
@@ -20,16 +20,16 @@
#include "xmlComponent.hxx"
#include "xmlfilter.hxx"
#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <strings.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <tools/diagnose_ex.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/propertysequence.hxx>
namespace dbaxml
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::xml::sax;
@@ -43,19 +43,16 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
OUString sName;
OUString sHREF;
bool bAsTemplate(false);
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(XLINK, XML_HREF):
- sHREF = sValue;
+ sHREF = aIter.toString();
break;
case XML_ELEMENT(DB, XML_NAME):
case XML_ELEMENT(DB_OASIS, XML_NAME):
- sName = sValue;
+ sName = aIter.toString();
// sanitize the name. Previously, we allowed to create forms/reports/queries which contain
// a / in their name, which nowadays is forbidden. To not lose such objects if they're contained
// in older files, we replace the slash with something less offending.
@@ -63,10 +60,10 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
break;
case XML_ELEMENT(DB, XML_AS_TEMPLATE):
case XML_ELEMENT(DB_OASIS, XML_AS_TEMPLATE):
- bAsTemplate = sValue == s_sTRUE;
+ bAsTemplate = IsXMLToken(aIter, XML_TRUE);
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
if ( !(!sHREF.isEmpty() && !sName.isEmpty() && _xParentContainer.is()) )
@@ -83,7 +80,7 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
Reference< XMultiServiceFactory > xORB( _xParentContainer, UNO_QUERY_THROW );
Reference< XInterface > xComponent( xORB->createInstanceWithArguments( _sComponentServiceName, aArguments ) );
Reference< XNameContainer > xNameContainer( _xParentContainer, UNO_QUERY_THROW );
- xNameContainer->insertByName( sName, makeAny( xComponent ) );
+ xNameContainer->insertByName( sName, Any( xComponent ) );
}
catch(Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlComponent.hxx b/dbaccess/source/filter/xml/xmlComponent.hxx
index 43eae3261f03..136d5b6854a5 100644
--- a/dbaccess/source/filter/xml/xmlComponent.hxx
+++ b/dbaccess/source/filter/xml/xmlComponent.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCOMPONENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCOMPONENT_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -34,12 +33,8 @@ namespace dbaxml
,const css::uno::Reference< css::container::XNameAccess >& _xParentContainer
,const OUString& _sComponentServiceName
);
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual ~OXMLComponent() override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCOMPONENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlConnectionData.cxx b/dbaccess/source/filter/xml/xmlConnectionData.cxx
index 221358537481..adf1d0323885 100644
--- a/dbaccess/source/filter/xml/xmlConnectionData.cxx
+++ b/dbaccess/source/filter/xml/xmlConnectionData.cxx
@@ -30,7 +30,6 @@
namespace dbaxml
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::xml::sax;
OXMLConnectionData::OXMLConnectionData( ODBFilter& rImport) :
SvXMLImportContext( rImport )
diff --git a/dbaccess/source/filter/xml/xmlConnectionData.hxx b/dbaccess/source/filter/xml/xmlConnectionData.hxx
index 88ef09315520..466c047888f3 100644
--- a/dbaccess/source/filter/xml/xmlConnectionData.hxx
+++ b/dbaccess/source/filter/xml/xmlConnectionData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCONNECTIONDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCONNECTIONDATA_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -34,13 +33,9 @@ namespace dbaxml
OXMLConnectionData( ODBFilter& rImport );
virtual ~OXMLConnectionData() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCONNECTIONDATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlConnectionResource.cxx b/dbaccess/source/filter/xml/xmlConnectionResource.cxx
index b2c37fc3584a..6e4a006be25b 100644
--- a/dbaccess/source/filter/xml/xmlConnectionResource.cxx
+++ b/dbaccess/source/filter/xml/xmlConnectionResource.cxx
@@ -20,9 +20,9 @@
#include "xmlConnectionResource.hxx"
#include "xmlfilter.hxx"
#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaxml
{
@@ -42,7 +42,6 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
aProperty.Name.clear();
aProperty.Value = Any();
@@ -51,7 +50,7 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
case XML_ELEMENT(XLINK, XML_HREF):
try
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
+ xDataSource->setPropertyValue(PROPERTY_URL,Any(aIter.toString()));
}
catch(const Exception&)
{
@@ -68,12 +67,12 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
aProperty.Name = "Actuate";
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
if ( !aProperty.Name.isEmpty() )
{
if ( !aProperty.Value.hasValue() )
- aProperty.Value <<= sValue;
+ aProperty.Value <<= aIter.toString();
rImport.addInfo(aProperty);
}
}
diff --git a/dbaccess/source/filter/xml/xmlConnectionResource.hxx b/dbaccess/source/filter/xml/xmlConnectionResource.hxx
index c73651e986c1..357bbe1e117a 100644
--- a/dbaccess/source/filter/xml/xmlConnectionResource.hxx
+++ b/dbaccess/source/filter/xml/xmlConnectionResource.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCONNECTIONRESOURCE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCONNECTIONRESOURCE_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -30,12 +29,8 @@ namespace dbaxml
OXMLConnectionResource( ODBFilter& rImport,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual ~OXMLConnectionResource() override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLCONNECTIONRESOURCE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDataSource.cxx b/dbaccess/source/filter/xml/xmlDataSource.cxx
index 53095dfe0e2f..9939a197b1aa 100644
--- a/dbaccess/source/filter/xml/xmlDataSource.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSource.cxx
@@ -27,7 +27,7 @@
#include <xmloff/ProgressBarHelper.hxx>
#include "xmlEnums.hxx"
#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "xmlConnectionData.hxx"
namespace dbaxml
@@ -49,13 +49,10 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
bool bFoundAppendTableAliasName = false;
bool bFoundSuppressVersionColumns = false;
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
if (xDataSource.is())
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
aProperty.Name.clear();
aProperty.Value = Any();
@@ -64,7 +61,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
case XML_CONNECTION_RESOURCE:
try
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
+ xDataSource->setPropertyValue(PROPERTY_URL,Any(aIter.toString()));
}
catch(const Exception&)
{
@@ -74,7 +71,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
case XML_SUPPRESS_VERSION_COLUMNS:
try
{
- xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,makeAny(sValue == s_sTRUE));
+ xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,Any(IsXMLToken(aIter, XML_TRUE)));
bFoundSuppressVersionColumns = true;
}
catch(const Exception&)
@@ -90,15 +87,15 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
break;
case XML_IS_FIRST_ROW_HEADER_LINE:
aProperty.Name = INFO_TEXTFILEHEADER;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_SHOW_DELETED:
aProperty.Name = INFO_SHOWDELETEDROWS;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_IS_TABLE_NAME_LENGTH_LIMITED:
aProperty.Name = INFO_ALLOWLONGTABLENAMES;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
bFoundTableNameLengthLimited = true;
break;
case XML_SYSTEM_DRIVER_SETTINGS:
@@ -106,54 +103,54 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
break;
case XML_ENABLE_SQL92_CHECK:
aProperty.Name = PROPERTY_ENABLESQL92CHECK;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_APPEND_TABLE_ALIAS_NAME:
aProperty.Name = INFO_APPEND_TABLE_ALIAS;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
bFoundAppendTableAliasName = true;
break;
case XML_PARAMETER_NAME_SUBSTITUTION:
aProperty.Name = INFO_PARAMETERNAMESUBST;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
bFoundParamNameSubstitution = true;
break;
case XML_IGNORE_DRIVER_PRIVILEGES:
aProperty.Name = INFO_IGNOREDRIVER_PRIV;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_BOOLEAN_COMPARISON_MODE:
aProperty.Name = PROPERTY_BOOLEANCOMPARISONMODE;
- if ( sValue == "equal-integer" )
+ if ( aIter.toView() == "equal-integer" )
aProperty.Value <<= sal_Int32(0);
- else if ( sValue == "is-boolean" )
+ else if ( aIter.toView() == "is-boolean" )
aProperty.Value <<= sal_Int32(1);
- else if ( sValue == "equal-boolean" )
+ else if ( aIter.toView() == "equal-boolean" )
aProperty.Value <<= sal_Int32(2);
- else if ( sValue == "equal-use-only-zero" )
+ else if ( aIter.toView() == "equal-use-only-zero" )
aProperty.Value <<= sal_Int32(3);
break;
case XML_USE_CATALOG:
aProperty.Name = INFO_USECATALOG;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_BASE_DN:
aProperty.Name = INFO_CONN_LDAP_BASEDN;
break;
case XML_MAX_ROW_COUNT:
aProperty.Name = INFO_CONN_LDAP_ROWCOUNT;
- aProperty.Value <<= sValue.toInt32();
+ aProperty.Value <<= aIter.toInt32();
break;
case XML_JAVA_CLASSPATH:
aProperty.Name = "JavaDriverClassPath";
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
if ( !aProperty.Name.isEmpty() )
{
if ( !aProperty.Value.hasValue() )
- aProperty.Value <<= sValue;
+ aProperty.Value <<= aIter.toString();
rImport.addInfo(aProperty);
}
}
@@ -183,7 +180,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
{
try
{
- xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,makeAny(true));
+ xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,Any(true));
}
catch(const Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlDataSource.hxx b/dbaccess/source/filter/xml/xmlDataSource.hxx
index 22bb90f76e5d..5b78ff4fe40d 100644
--- a/dbaccess/source/filter/xml/xmlDataSource.hxx
+++ b/dbaccess/source/filter/xml/xmlDataSource.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCE_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -40,13 +39,9 @@ namespace dbaxml
const UsedFor _eUsedFor );
virtual ~OXMLDataSource() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
index 82ab36eb2c75..c1400970181a 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
@@ -22,7 +22,6 @@
#include <xmloff/xmltoken.hxx>
#include <strings.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <sal/log.hxx>
namespace dbaxml
{
@@ -39,8 +38,6 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport
bool bFoundField = false,bFoundThousand = false, bFoundCharset = false;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
aProperty.Name.clear();
switch( aIter.getToken() & TOKEN_MASK )
@@ -72,11 +69,11 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport
bFoundCharset = true;
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
if ( !aProperty.Name.isEmpty() )
{
- aProperty.Value <<= sValue;
+ aProperty.Value <<= aIter.toString();
rImport.addInfo(aProperty);
}
}
@@ -94,20 +91,20 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport
if ( !bFoundField )
{
aProperty.Name = INFO_FIELDDELIMITER;
- aProperty.Value <<= OUString(";");
+ aProperty.Value <<= u";"_ustr;
rImport.addInfo(aProperty);
}
if ( !bFoundThousand )
{
aProperty.Name = INFO_THOUSANDSDELIMITER;
- aProperty.Value <<= OUString(",");
+ aProperty.Value <<= u","_ustr;
rImport.addInfo(aProperty);
}
}
if ( (nElement & TOKEN_MASK) == XML_FONT_CHARSET && !bFoundCharset )
{
aProperty.Name = INFO_CHARSET;
- aProperty.Value <<= OUString("utf8");
+ aProperty.Value <<= u"utf8"_ustr;
rImport.addInfo(aProperty);
}
}
diff --git a/dbaccess/source/filter/xml/xmlDataSourceInfo.hxx b/dbaccess/source/filter/xml/xmlDataSourceInfo.hxx
index b0f617a53dc8..e29d37a7d3a8 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceInfo.hxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceInfo.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCEINFO_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCEINFO_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -31,12 +30,8 @@ namespace dbaxml
OXMLDataSourceInfo( ODBFilter& rImport,
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList > & _xAttrList);
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual ~OXMLDataSourceInfo() override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCEINFO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
index 3b7e6d512dc9..b3b8310dde51 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
@@ -47,17 +47,15 @@ OXMLDataSourceSetting::OXMLDataSourceSetting( ODBFilter& rImport
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_DATA_SOURCE_SETTING_IS_LIST:
- m_bIsList = sValue == "true";
+ m_bIsList = aIter.toView() == "true";
break;
case XML_DATA_SOURCE_SETTING_TYPE:
{
// needs to be translated into a css::uno::Type
- static std::map< OUString, css::uno::Type > s_aTypeNameMap = [&]()
+ static std::map< OUString, css::uno::Type > s_aTypeNameMap = []()
{
std::map< OUString, css::uno::Type > tmp;
tmp[GetXMLToken( XML_BOOLEAN)] = cppu::UnoType<bool>::get();
@@ -71,17 +69,17 @@ OXMLDataSourceSetting::OXMLDataSourceSetting( ODBFilter& rImport
return tmp;
}();
- const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(sValue);
+ const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(aIter.toString());
OSL_ENSURE(s_aTypeNameMap.end() != aTypePos, "OXMLDataSourceSetting::OXMLDataSourceSetting: invalid type!");
if (s_aTypeNameMap.end() != aTypePos)
m_aPropType = aTypePos->second;
}
break;
case XML_DATA_SOURCE_SETTING_NAME:
- m_aSetting.Name = sValue;
+ m_aSetting.Name = aIter.toString();
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
@@ -140,12 +138,12 @@ void OXMLDataSourceSetting::addValue(const OUString& _sValue)
aValue = convertString(m_aPropType, _sValue);
if ( !m_bIsList )
- m_aSetting.Value = aValue;
+ m_aSetting.Value = std::move(aValue);
else
{
sal_Int32 nPos = m_aInfoSequence.getLength();
m_aInfoSequence.realloc(nPos+1);
- m_aInfoSequence[nPos] = aValue;
+ m_aInfoSequence.getArray()[nPos] = std::move(aValue);
}
}
@@ -171,20 +169,28 @@ Any OXMLDataSourceSetting::convertString(const css::uno::Type& _rExpectedType, c
}
break;
case TypeClass_SHORT: // sal_Int16
+ { // it's a real int16 property
+ sal_Int32 nValue(0);
+ bool const bSuccess =
+ ::sax::Converter::convertNumber(nValue, _rReadCharacters,
+ SAL_MIN_INT16, SAL_MAX_INT16);
+ SAL_WARN_IF(!bSuccess, "dbaccess",
+ "OXMLDataSourceSetting::convertString: could not convert \""
+ << _rReadCharacters << "\" into a sal_Int16!");
+ aReturn <<= static_cast<sal_Int16>(nValue);
+ break;
+ }
case TypeClass_LONG: // sal_Int32
- { // it's a real int32/16 property
- sal_Int32 nValue(0);
- bool const bSuccess =
- ::sax::Converter::convertNumber(nValue, _rReadCharacters);
- SAL_WARN_IF(!bSuccess, "dbaccess",
- "OXMLDataSourceSetting::convertString: could not convert \""
- << _rReadCharacters << "\" into an integer!");
- if (TypeClass_SHORT == _rExpectedType.getTypeClass())
- aReturn <<= static_cast<sal_Int16>(nValue);
- else
- aReturn <<= nValue;
- break;
- }
+ { // it's a real int32 property
+ sal_Int32 nValue(0);
+ bool const bSuccess =
+ ::sax::Converter::convertNumber(nValue, _rReadCharacters);
+ SAL_WARN_IF(!bSuccess, "dbaccess",
+ "OXMLDataSourceSetting::convertString: could not convert \""
+ << _rReadCharacters << "\" into a sal_Int32!");
+ aReturn <<= nValue;
+ break;
+ }
case TypeClass_HYPER:
{
OSL_FAIL("OXMLDataSourceSetting::convertString: 64-bit integers not implemented yet!");
diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.hxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.hxx
index 9f28d3343c83..3ed92f80e79b 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceSetting.hxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCESETTING_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCESETTING_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -46,9 +45,6 @@ namespace dbaxml
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
-
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
virtual void SAL_CALL characters( const OUString& rChars ) override;
@@ -61,6 +57,4 @@ namespace dbaxml
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCESETTING_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDataSourceSettings.cxx b/dbaccess/source/filter/xml/xmlDataSourceSettings.cxx
index 49847ef541ed..e28657b5f00c 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceSettings.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceSettings.cxx
@@ -27,7 +27,6 @@
namespace dbaxml
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::xml::sax;
OXMLDataSourceSettings::OXMLDataSourceSettings( ODBFilter& rImport ) :
SvXMLImportContext( rImport )
diff --git a/dbaccess/source/filter/xml/xmlDataSourceSettings.hxx b/dbaccess/source/filter/xml/xmlDataSourceSettings.hxx
index 27bd20435fb9..50fea5c000aa 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceSettings.hxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceSettings.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCESETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCESETTINGS_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -32,13 +31,9 @@ namespace dbaxml
OXMLDataSourceSettings( ODBFilter& rImport );
virtual ~OXMLDataSourceSettings() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATASOURCESETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDatabase.cxx b/dbaccess/source/filter/xml/xmlDatabase.cxx
index 9de9bf349810..054914c6f486 100644
--- a/dbaccess/source/filter/xml/xmlDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlDatabase.cxx
@@ -37,7 +37,6 @@ namespace dbaxml
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::xml::sax;
OXMLDatabase::OXMLDatabase( ODBFilter& rImport ) :
SvXMLImportContext( rImport )
@@ -57,7 +56,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDatabase::createFa
switch( nElement & TOKEN_MASK )
{
- case XML_DATASOURCE:
+ case XML_DATA_SOURCE:
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
pContext = new OXMLDataSource( GetOwnImport(), xAttrList, OXMLDataSource::eDataSource );
break;
@@ -66,7 +65,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDatabase::createFa
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
Any aValue;
OUString sService;
- dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"Forms",aValue);
+ dbtools::getDataSourceSetting(GetOwnImport().getDataSource(), u"Forms"_ustr, aValue);
aValue >>= sService;
if ( sService.isEmpty() )
{
@@ -81,7 +80,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDatabase::createFa
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
Any aValue;
OUString sService;
- dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"Reports",aValue);
+ dbtools::getDataSourceSetting(GetOwnImport().getDataSource(), u"Reports"_ustr, aValue);
aValue >>= sService;
if ( sService.isEmpty() )
{
@@ -96,7 +95,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDatabase::createFa
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
Any aValue;
OUString sService;
- dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"CommandDefinitions",aValue);
+ dbtools::getDataSourceSetting(GetOwnImport().getDataSource(), u"CommandDefinitions"_ustr, aValue);
aValue >>= sService;
if ( sService.isEmpty() )
{
diff --git a/dbaccess/source/filter/xml/xmlDatabase.hxx b/dbaccess/source/filter/xml/xmlDatabase.hxx
index d1f87c263c3d..0dab56c51ca7 100644
--- a/dbaccess/source/filter/xml/xmlDatabase.hxx
+++ b/dbaccess/source/filter/xml/xmlDatabase.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATABASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATABASE_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -35,12 +34,8 @@ namespace dbaxml
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATABASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDatabaseDescription.cxx b/dbaccess/source/filter/xml/xmlDatabaseDescription.cxx
index a8168e129501..6a09cea6e650 100644
--- a/dbaccess/source/filter/xml/xmlDatabaseDescription.cxx
+++ b/dbaccess/source/filter/xml/xmlDatabaseDescription.cxx
@@ -28,7 +28,6 @@
namespace dbaxml
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::xml::sax;
OXMLDatabaseDescription::OXMLDatabaseDescription( ODBFilter& rImport ) :
SvXMLImportContext( rImport )
diff --git a/dbaccess/source/filter/xml/xmlDatabaseDescription.hxx b/dbaccess/source/filter/xml/xmlDatabaseDescription.hxx
index 0da571da0d24..146ecb401747 100644
--- a/dbaccess/source/filter/xml/xmlDatabaseDescription.hxx
+++ b/dbaccess/source/filter/xml/xmlDatabaseDescription.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATABASEDESCRIPTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATABASEDESCRIPTION_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -34,13 +33,9 @@ namespace dbaxml
OXMLDatabaseDescription( ODBFilter& rImport);
virtual ~OXMLDatabaseDescription() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDATABASEDESCRIPTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlDocuments.cxx b/dbaccess/source/filter/xml/xmlDocuments.cxx
index 71d5b4589e3a..61569ebbdcb9 100644
--- a/dbaccess/source/filter/xml/xmlDocuments.cxx
+++ b/dbaccess/source/filter/xml/xmlDocuments.cxx
@@ -19,6 +19,7 @@
#include "xmlDocuments.hxx"
#include "xmlfilter.hxx"
+#include <utility>
#include <xmloff/xmltoken.hxx>
#include <xmloff/ProgressBarHelper.hxx>
#include "xmlQuery.hxx"
@@ -31,27 +32,26 @@ namespace dbaxml
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::xml::sax;
OXMLDocuments::OXMLDocuments( ODBFilter& rImport
,const Reference< XNameAccess >& _xContainer
- ,const OUString& _sCollectionServiceName
- ,const OUString& _sComponentServiceName) :
+ ,OUString _sCollectionServiceName
+ ,OUString _sComponentServiceName) :
SvXMLImportContext( rImport )
,m_xContainer(_xContainer)
- ,m_sCollectionServiceName(_sCollectionServiceName)
- ,m_sComponentServiceName(_sComponentServiceName)
+ ,m_sCollectionServiceName(std::move(_sCollectionServiceName))
+ ,m_sComponentServiceName(std::move(_sComponentServiceName))
{
}
OXMLDocuments::OXMLDocuments( ODBFilter& rImport
,const Reference< XNameAccess >& _xContainer
- ,const OUString& _sCollectionServiceName
+ ,OUString _sCollectionServiceName
) :
SvXMLImportContext( rImport )
,m_xContainer(_xContainer)
- ,m_sCollectionServiceName(_sCollectionServiceName)
+ ,m_sCollectionServiceName(std::move(_sCollectionServiceName))
{
}
@@ -70,7 +70,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDocuments::createF
case XML_TABLE:
case XML_TABLE_REPRESENTATION:
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
- pContext = new OXMLTable( GetOwnImport(), xAttrList, m_xContainer, "com.sun.star.sdb.TableDefinition");
+ pContext = new OXMLTable( GetOwnImport(), xAttrList, m_xContainer, u"com.sun.star.sdb.TableDefinition"_ustr);
break;
case XML_QUERY:
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
diff --git a/dbaccess/source/filter/xml/xmlDocuments.hxx b/dbaccess/source/filter/xml/xmlDocuments.hxx
index 35f642cf35ce..49c6346aa83e 100644
--- a/dbaccess/source/filter/xml/xmlDocuments.hxx
+++ b/dbaccess/source/filter/xml/xmlDocuments.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDOCUMENTS_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDOCUMENTS_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -38,24 +37,20 @@ namespace dbaxml
// for forms and reports
OXMLDocuments( ODBFilter& rImport
,const css::uno::Reference< css::container::XNameAccess >& _xContainer
- ,const OUString& _sCollectionServiceName
- ,const OUString& _sComponentServiceName);
+ ,OUString _sCollectionServiceName
+ ,OUString _sComponentServiceName);
// for queries
OXMLDocuments( ODBFilter& rImport
,const css::uno::Reference< css::container::XNameAccess >& _xContainer
- ,const OUString& _sCollectionServiceName = OUString()
+ ,OUString _sCollectionServiceName = OUString()
);
virtual ~OXMLDocuments() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLDOCUMENTS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlEnums.hxx b/dbaccess/source/filter/xml/xmlEnums.hxx
index 0f4be1aaa9dc..552f7eb24fb4 100644
--- a/dbaccess/source/filter/xml/xmlEnums.hxx
+++ b/dbaccess/source/filter/xml/xmlEnums.hxx
@@ -16,11 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLENUMS_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLENUMS_HXX
+#pragma once
#define PROGRESS_BAR_STEP 20
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLENUMS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 323e51bd3579..a62f34a24820 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -20,10 +20,10 @@
#include "xmlExport.hxx"
#include "xmlAutoStyle.hxx"
#include <sax/tools/converter.hxx>
+#include <utility>
#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmlnmspe.hxx>
-#include <xmloff/nmspmap.hxx>
-#include <comphelper/processfactory.hxx>
+#include <xmloff/xmlnamespace.hxx>
+#include <xmloff/namespacemap.hxx>
#include <comphelper/string.hxx>
#include <comphelper/types.hxx>
#include <strings.hxx>
@@ -45,13 +45,12 @@
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <svl/filenotation.hxx>
#include <unotools/pathoptions.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <connectivity/DriversConfig.hxx>
#include <connectivity/dbtools.hxx>
#include <optional>
#include <memory>
-#include <iterator>
using namespace comphelper;
using namespace ::com::sun::star::sdb;
@@ -64,7 +63,7 @@ com_sun_star_comp_sdb_DBExportFilter_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new ::dbaxml::ODBExport(context,
- "com.sun.star.comp.sdb.DBExportFilter"));
+ u"com.sun.star.comp.sdb.DBExportFilter"_ustr));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -72,7 +71,7 @@ com_sun_star_comp_sdb_XMLSettingsExporter_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new ::dbaxml::ODBExport(context,
- "com.sun.star.comp.sdb.XMLSettingsExporter",
+ u"com.sun.star.comp.sdb.XMLSettingsExporter"_ustr,
SvXMLExportFlags::SETTINGS | SvXMLExportFlags::PRETTY ));
}
@@ -81,7 +80,7 @@ com_sun_star_comp_sdb_XMLFullExporter_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new ::dbaxml::ODBExport(context,
- "com.sun.star.comp.sdb.XMLFullExporter",
+ u"com.sun.star.comp.sdb.XMLFullExporter"_ustr,
SvXMLExportFlags::ALL));
}
@@ -96,24 +95,24 @@ namespace dbaxml
switch (_rType.getTypeClass())
{
case TypeClass_STRING:
- return "string";
+ return u"string"_ustr;
case TypeClass_DOUBLE:
- return "double";
+ return u"double"_ustr;
case TypeClass_BOOLEAN:
- return "boolean";
+ return u"boolean"_ustr;
case TypeClass_BYTE:
case TypeClass_SHORT:
- return "short";
+ return u"short"_ustr;
case TypeClass_LONG:
- return "int";
+ return u"int"_ustr;
case TypeClass_HYPER:
- return "long";
+ return u"long"_ustr;
case TypeClass_ENUM:
- return "int";
+ return u"int"_ustr;
default:
OSL_FAIL( "lcl_implGetPropertyXMLType: unsupported value type!" );
- return "double";
+ return u"double"_ustr;
}
}
@@ -128,7 +127,7 @@ namespace dbaxml
/** this method is called for every item that has the
MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
virtual void handleSpecialItem(
- SvXMLAttributeList& /*rAttrList*/,
+ comphelper::AttributeList& /*rAttrList*/,
const XMLPropertyState& /*rProperty*/,
const SvXMLUnitConverter& /*rUnitConverter*/,
const SvXMLNamespaceMap& /*rNamespaceMap*/,
@@ -184,27 +183,27 @@ ODBExport::ODBExport(const Reference< XComponentContext >& _rxContext, OUString
GetAutoStylePool()->AddFamily(
XmlStyleFamily::TABLE_TABLE,
- OUString(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ),
+ XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME,
m_xExportHelper.get(),
- OUString(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX ));
+ XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX);
GetAutoStylePool()->AddFamily(
XmlStyleFamily::TABLE_COLUMN,
- OUString(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ),
+ XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME,
m_xColumnExportHelper.get(),
- OUString(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX ));
+ XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX);
GetAutoStylePool()->AddFamily(
XmlStyleFamily::TABLE_CELL,
- OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME ),
+ XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME,
m_xCellExportHelper.get(),
- OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX ));
+ XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX);
GetAutoStylePool()->AddFamily(
XmlStyleFamily::TABLE_ROW,
- OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME ),
+ XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME,
m_xRowExportHelper.get(),
- OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX ));
+ XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX);
}
void ODBExport::exportDataSource()
@@ -246,13 +245,10 @@ void ODBExport::exportDataSource()
{
}
- Sequence< Property > aProperties = xSettingsInfo->getProperties();
- const Property* pProperties = aProperties.getConstArray();
- const Property* pPropertiesEnd = pProperties + aProperties.getLength();
- for ( ; pProperties != pPropertiesEnd; ++pProperties )
+ for (auto& property : xSettingsInfo->getProperties())
{
OUString sValue;
- Any aValue = xDataSourceSettings->getPropertyValue( pProperties->Name );
+ Any aValue = xDataSourceSettings->getPropertyValue(property.Name);
switch ( aValue.getValueTypeClass() )
{
case TypeClass_STRING:
@@ -283,15 +279,15 @@ void ODBExport::exportDataSource()
const XMLTokenEnum eAttributeToken;
const ::std::optional< OUString > aXMLDefault;
- PropertyMap( const OUString& _rPropertyName, const XMLTokenEnum _eToken )
- :sPropertyName( _rPropertyName )
+ PropertyMap( OUString _sPropertyName, const XMLTokenEnum _eToken )
+ :sPropertyName(std::move( _sPropertyName ))
,eAttributeToken( _eToken )
,aXMLDefault()
{
}
- PropertyMap( const OUString& _rPropertyName, const XMLTokenEnum _eToken, const OUString& _rDefault )
- :sPropertyName( _rPropertyName )
+ PropertyMap( OUString _sPropertyName, const XMLTokenEnum _eToken, const OUString& _rDefault )
+ :sPropertyName(std::move( _sPropertyName ))
,eAttributeToken( _eToken )
,aXMLDefault( _rDefault )
{
@@ -316,7 +312,7 @@ void ODBExport::exportDataSource()
bool bIsXMLDefault = false;
for (const auto & aToken : aTokens)
{
- if ( pProperties->Name == aToken.sPropertyName )
+ if (property.Name == aToken.sPropertyName)
{
eToken = aToken.eAttributeToken;
@@ -338,15 +334,15 @@ void ODBExport::exportDataSource()
{
// for properties which are not REMOVABLE, we care for their state, and
// only export them if they're not DEFAULTed
- if ( ( pProperties->Attributes & PropertyAttribute::REMOVABLE ) == 0 )
+ if ((property.Attributes & PropertyAttribute::REMOVABLE) == 0)
{
- PropertyState ePropertyState = xSettingsState->getPropertyState( pProperties->Name );
+ PropertyState ePropertyState = xSettingsState->getPropertyState(property.Name);
if ( PropertyState_DEFAULT_VALUE == ePropertyState )
continue;
}
// special handlings
- if ( pProperties->Name == PROPERTY_BOOLEANCOMPARISONMODE )
+ if (property.Name == PROPERTY_BOOLEANCOMPARISONMODE)
{
if ( sValue == "0" )
sValue = "equal-integer";
@@ -360,56 +356,55 @@ void ODBExport::exportDataSource()
continue;
eToken = XML_BOOLEAN_COMPARISON_MODE;
}
- else if ( pProperties->Name == INFO_AUTORETRIEVEENABLED )
+ else if (property.Name == INFO_AUTORETRIEVEENABLED)
{
aValue >>= bAutoIncrementEnabled;
continue;
}
- else if ( pProperties->Name == INFO_AUTORETRIEVEVALUE )
+ else if (property.Name == INFO_AUTORETRIEVEVALUE)
{
aAutoIncrement.first = sValue;
continue;
}
- else if ( pProperties->Name == PROPERTY_AUTOINCREMENTCREATION )
+ else if (property.Name == PROPERTY_AUTOINCREMENTCREATION)
{
aAutoIncrement.second = sValue;
continue;
}
- else if ( pProperties->Name == INFO_TEXTDELIMITER )
+ else if (property.Name == INFO_TEXTDELIMITER)
{
aDelimiter.sText = sValue;
aDelimiter.bUsed = true;
continue;
}
- else if ( pProperties->Name == INFO_FIELDDELIMITER )
+ else if (property.Name == INFO_FIELDDELIMITER)
{
aDelimiter.sField = sValue;
aDelimiter.bUsed = true;
continue;
}
- else if ( pProperties->Name == INFO_DECIMALDELIMITER )
+ else if (property.Name == INFO_DECIMALDELIMITER)
{
aDelimiter.sDecimal = sValue;
aDelimiter.bUsed = true;
continue;
}
- else if ( pProperties->Name == INFO_THOUSANDSDELIMITER )
+ else if (property.Name == INFO_THOUSANDSDELIMITER)
{
aDelimiter.sThousand = sValue;
aDelimiter.bUsed = true;
continue;
}
- else if ( pProperties->Name == INFO_CHARSET )
+ else if (property.Name == INFO_CHARSET)
{
m_sCharSet = sValue;
continue;
}
else
{
- if ( !aDriverSupportedProperties.has(pProperties->Name) || aDriverSupportedProperties.get(pProperties->Name) != aValue )
+ if ( !aDriverSupportedProperties.has(property.Name) || aDriverSupportedProperties.get(property.Name) != aValue )
{
- m_aDataSourceSettings.emplace_back(
- pProperties->Name, pProperties->Type, aValue );
+ m_aDataSourceSettings.emplace_back(property.Name, property.Type, aValue);
}
continue;
}
@@ -418,11 +413,11 @@ void ODBExport::exportDataSource()
aSettingsMap.emplace(eToken,sValue);
}
if ( bAutoIncrementEnabled && !(aAutoIncrement.first.isEmpty() && aAutoIncrement.second.isEmpty()) )
- m_aAutoIncrement.reset( new TStringPair(aAutoIncrement));
+ m_oAutoIncrement = aAutoIncrement;
if ( aDelimiter.bUsed )
- m_aDelimiter.reset( new TDelimiter( aDelimiter ) );
+ m_aDelimiter.reset(new TDelimiter(std::move(aDelimiter)));
- SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_DATASOURCE, true, true);
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_DB, XML_DATA_SOURCE, true, true);
exportConnectionData();
exportDriverSettings(aSettingsMap);
@@ -562,7 +557,7 @@ void ODBExport::exportConnectionData()
Reference< XPropertySetInfo > xSettingsInfo( xDataSourceSettings->getPropertySetInfo(), UNO_SET_THROW );
- const OUString sPropertyName = "LocalSocket";
+ static constexpr OUString sPropertyName = u"LocalSocket"_ustr;
if ( xSettingsInfo->hasPropertyByName( sPropertyName ) )
{
OUString sPropertyValue;
@@ -597,7 +592,7 @@ template< typename T > void ODBExport::exportDataSourceSettingsSequence(
css::uno::Sequence<T> anySeq;
bool bSuccess = in->Value >>= anySeq;
assert(bSuccess); (void)bSuccess;
- for (T const & i : anySeq )
+ for (T const& i : anySeq)
{
SvXMLElementExport aDataValue(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, true, false);
// (no whitespace inside the tag)
@@ -700,10 +695,10 @@ void ODBExport::exportDelimiter()
void ODBExport::exportAutoIncrement()
{
- if (m_aAutoIncrement)
+ if (m_oAutoIncrement)
{
- AddAttribute(XML_NAMESPACE_DB, XML_ADDITIONAL_COLUMN_STATEMENT,m_aAutoIncrement->second);
- AddAttribute(XML_NAMESPACE_DB, XML_ROW_RETRIEVING_STATEMENT,m_aAutoIncrement->first);
+ AddAttribute(XML_NAMESPACE_DB, XML_ADDITIONAL_COLUMN_STATEMENT,m_oAutoIncrement->second);
+ AddAttribute(XML_NAMESPACE_DB, XML_ROW_RETRIEVING_STATEMENT,m_oAutoIncrement->first);
SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_AUTO_INCREMENT, true, true);
}
}
@@ -716,12 +711,10 @@ void ODBExport::exportSequence(const Sequence< OUString>& _aValue
{
SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, _eTokenFilter, true, true);
- const OUString* pIter = _aValue.getConstArray();
- const OUString* pEnd = pIter + _aValue.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& string : _aValue)
{
SvXMLElementExport aDataSource(*this,XML_NAMESPACE_DB, _eTokenType, true, false);
- Characters(*pIter);
+ Characters(string);
}
}
}
@@ -757,14 +750,11 @@ void ODBExport::exportCollection(const Reference< XNameAccess >& _xCollection
std::unique_ptr<SvXMLElementExport> pComponents;
if ( _bExportContext )
pComponents.reset( new SvXMLElementExport(*this,XML_NAMESPACE_DB, _eComponents, true, true));
- Sequence< OUString> aSeq = _xCollection->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& name : _xCollection->getElementNames())
{
- Reference<XPropertySet> xProp(_xCollection->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xProp(_xCollection->getByName(name), UNO_QUERY);
if ( _bExportContext && XML_TABLE_REPRESENTATIONS != _eComponents )
- AddAttribute(XML_NAMESPACE_DB, XML_NAME,*pIter);
+ AddAttribute(XML_NAMESPACE_DB, XML_NAME, name);
Reference< XNameAccess > xSub(xProp,UNO_QUERY);
if ( xSub.is() )
{
@@ -780,7 +770,7 @@ void ODBExport::exportComponent(XPropertySet* _xProp)
OUString sValue;
_xProp->getPropertyValue(PROPERTY_PERSISTENT_NAME) >>= sValue;
bool bIsForm = true;
- _xProp->getPropertyValue("IsForm") >>= bIsForm;
+ _xProp->getPropertyValue(u"IsForm"_ustr) >>= bIsForm;
if ( bIsForm )
sValue = "forms/" + sValue;
else
@@ -841,7 +831,7 @@ void ODBExport::exportTable(XPropertySet* _xProp)
exportFilter(_xProp,PROPERTY_ORDER,XML_ORDER_STATEMENT);
}
-void ODBExport::exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt)
+void ODBExport::exportStyleName(XPropertySet* _xProp,comphelper::AttributeList& _rAtt)
{
Reference<XPropertySet> xFind(_xProp);
exportStyleName(XML_STYLE_NAME,xFind,_rAtt,m_aAutoStyleNames);
@@ -849,7 +839,7 @@ void ODBExport::exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt)
exportStyleName(XML_DEFAULT_ROW_STYLE_NAME,xFind,_rAtt,m_aRowAutoStyleNames);
}
-void ODBExport::exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const uno::Reference<beans::XPropertySet>& _xProp,SvXMLAttributeList& _rAtt,TPropertyStyleMap& _rMap)
+void ODBExport::exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const uno::Reference<beans::XPropertySet>& _xProp,comphelper::AttributeList& _rAtt,TPropertyStyleMap& _rMap)
{
TPropertyStyleMap::const_iterator aFind = _rMap.find(_xProp);
if ( aFind != _rMap.end() )
@@ -863,15 +853,15 @@ void ODBExport::exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,cons
void ODBExport::exportTableName(XPropertySet* _xProp,bool _bUpdate)
{
OUString sValue;
- _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_TABLENAME) : OUString(PROPERTY_NAME)) >>= sValue;
+ _xProp->getPropertyValue(_bUpdate ? PROPERTY_UPDATE_TABLENAME : PROPERTY_NAME) >>= sValue;
if ( sValue.isEmpty() )
return;
AddAttribute(XML_NAMESPACE_DB, XML_NAME,sValue);
- _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_SCHEMANAME) : OUString(PROPERTY_SCHEMANAME)) >>= sValue;
+ _xProp->getPropertyValue(_bUpdate ? PROPERTY_UPDATE_SCHEMANAME : PROPERTY_SCHEMANAME) >>= sValue;
if ( !sValue.isEmpty() )
AddAttribute(XML_NAMESPACE_DB, XML_SCHEMA_NAME,sValue);
- _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_CATALOGNAME) : OUString(PROPERTY_CATALOGNAME)) >>= sValue;
+ _xProp->getPropertyValue(_bUpdate ? PROPERTY_UPDATE_CATALOGNAME : PROPERTY_CATALOGNAME) >>= sValue;
if ( !sValue.isEmpty() )
AddAttribute(XML_NAMESPACE_DB, XML_CATALOG_NAME,sValue);
@@ -912,10 +902,9 @@ void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup)
if ( aFind != m_aTableDummyColumns.end() )
{
SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, true, true);
- SvXMLAttributeList* pAtt = new SvXMLAttributeList;
- Reference<XAttributeList> xAtt = pAtt;
+ rtl::Reference<comphelper::AttributeList> pAtt = new comphelper::AttributeList;
exportStyleName(aFind->second.get(),*pAtt);
- AddAttributeList(xAtt);
+ AddAttributeList(pAtt);
SvXMLElementExport aColumn(*this,XML_NAMESPACE_DB, XML_COLUMN, true, true);
}
@@ -923,16 +912,12 @@ void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup)
}
SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, true, true);
- Sequence< OUString> aSeq = xNameAccess->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for( ; pIter != pEnd ; ++pIter)
+ for (auto& name : xNameAccess->getElementNames())
{
- Reference<XPropertySet> xProp(xNameAccess->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xProp(xNameAccess->getByName(name), UNO_QUERY);
if ( xProp.is() )
{
- SvXMLAttributeList* pAtt = new SvXMLAttributeList;
- Reference<XAttributeList> xAtt = pAtt;
+ rtl::Reference<comphelper::AttributeList> pAtt = new comphelper::AttributeList;
exportStyleName(xProp.get(),*pAtt);
bool bHidden = getBOOL(xProp->getPropertyValue(PROPERTY_HIDDEN));
@@ -943,7 +928,7 @@ void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup)
if ( bHidden || !sValue.isEmpty() || aColumnDefault.hasValue() || pAtt->getLength() )
{
- AddAttribute(XML_NAMESPACE_DB, XML_NAME,*pIter);
+ AddAttribute(XML_NAMESPACE_DB, XML_NAME, name);
if ( bHidden )
AddAttribute(XML_NAMESPACE_DB, XML_VISIBLE,XML_FALSE);
@@ -960,7 +945,7 @@ void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup)
}
if ( pAtt->getLength() )
- AddAttributeList(xAtt);
+ AddAttributeList(pAtt);
}
if ( GetAttrList().getLength() )
@@ -980,7 +965,7 @@ void ODBExport::exportForms()
{
Any aValue;
OUString sService;
- dbtools::getDataSourceSetting(getDataSource(),"Forms",aValue);
+ dbtools::getDataSourceSetting(getDataSource(), u"Forms"_ustr, aValue);
aValue >>= sService;
if ( !sService.isEmpty() )
return;
@@ -1001,7 +986,7 @@ void ODBExport::exportReports()
{
Any aValue;
OUString sService;
- dbtools::getDataSourceSetting(getDataSource(),"Reports",aValue);
+ dbtools::getDataSourceSetting(getDataSource(), u"Reports"_ustr, aValue);
aValue >>= sService;
if ( !sService.isEmpty() )
return;
@@ -1022,7 +1007,7 @@ void ODBExport::exportQueries(bool _bExportContext)
{
Any aValue;
OUString sService;
- dbtools::getDataSourceSetting(getDataSource(),"CommandDefinitions",aValue);
+ dbtools::getDataSourceSetting(getDataSource(), u"CommandDefinitions"_ustr, aValue);
aValue >>= sService;
if ( !sService.isEmpty() )
return;
@@ -1075,12 +1060,11 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
,TExportPropMapperPair(m_xRowExportHelper,TEnumMapperPair(&m_aRowAutoStyleNames,XmlStyleFamily::TABLE_ROW))
};
- std::vector< XMLPropertyState > aPropertyStates;
for (const auto & i : pExportHelper)
{
- aPropertyStates = i.first->Filter(_xProp);
+ std::vector< XMLPropertyState > aPropertyStates = i.first->Filter(*this, _xProp);
if ( !aPropertyStates.empty() )
- i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, aPropertyStates ) );
+ i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, std::move(aPropertyStates) ) );
}
Reference< XNameAccess > xCollection;
@@ -1092,7 +1076,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,static_cast<FontFamily>(aFont.Family),
static_cast<FontPitch>(aFont.Pitch),aFont.CharSet );
- m_aCurrentPropertyStates = m_xCellExportHelper->Filter(_xProp);
+ m_aCurrentPropertyStates = m_xCellExportHelper->Filter(*this, _xProp);
if ( !m_aCurrentPropertyStates.empty() && !xCollection->hasElements() )
{
Reference< XDataDescriptorFactory> xFac(xCollection,UNO_QUERY);
@@ -1123,7 +1107,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
};
for (const auto & i : pExportHelper)
{
- std::vector< XMLPropertyState > aPropStates = i.first->Filter( _xProp );
+ std::vector< XMLPropertyState > aPropStates = i.first->Filter(*this, _xProp);
if ( !aPropStates.empty() )
{
const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper();
@@ -1152,7 +1136,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp)
if ( XmlStyleFamily::TABLE_CELL == i.second.second )
aPropStates.insert( aPropStates.end(), m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end() );
if ( !aPropStates.empty() )
- i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, aPropStates ) );
+ i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, std::move(aPropStates) ) );
}
}
}
@@ -1197,28 +1181,27 @@ void ODBExport::GetViewSettings(Sequence<PropertyValue>& aProps)
try
{
- sal_Int32 nLength = aProps.getLength();
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = "Queries";
Sequence< OUString> aSeq = xCollection->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
-
Sequence<PropertyValue> aQueries(aSeq.getLength());
- for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
+ auto aQueriesRange = asNonConstRange(aQueries);
+ for (sal_Int32 i = 0; i < aSeq.getLength(); ++i)
{
- Reference<XPropertySet> xProp(xCollection->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xProp(xCollection->getByName(aSeq[i]), UNO_QUERY);
if ( xProp.is() )
{
- aQueries[i].Name = *pIter;
- aQueries[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
+ aQueriesRange[i].Name = aSeq[i];
+ aQueriesRange[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
}
}
- aProps[nLength].Value <<= aQueries;
+ sal_Int32 nLength = aProps.getLength();
+ aProps.realloc(nLength + 1);
+ auto& prop = asNonConstRange(aProps)[nLength];
+ prop.Name = "Queries";
+ prop.Value <<= aQueries;
}
catch(const Exception&)
{
- OSL_FAIL("ODBExport::GetViewSettings: Exception caught!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ODBExport::GetViewSettings");
}
}
@@ -1238,8 +1221,9 @@ void ODBExport::GetConfigurationSettings(Sequence<PropertyValue>& aProps)
if ( aPropValues.hasElements() )
{
aProps.realloc(nLength + 1);
- aProps[nLength].Name = "layout-settings";
- aProps[nLength].Value = aValue;
+ auto pProps = aProps.getArray();
+ pProps[nLength].Name = "layout-settings";
+ pProps[nLength].Value = std::move(aValue);
}
}
catch(const Exception&)
diff --git a/dbaccess/source/filter/xml/xmlExport.hxx b/dbaccess/source/filter/xml/xmlExport.hxx
index 118e3ac94cfa..7695f9da9851 100644
--- a/dbaccess/source/filter/xml/xmlExport.hxx
+++ b/dbaccess/source/filter/xml/xmlExport.hxx
@@ -17,16 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLEXPORT_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLEXPORT_HXX
+#pragma once
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
+
+#include <optional>
+#include <utility>
#include <xmloff/maptype.hxx>
#include <xmloff/txtprmap.hxx>
#include <xmloff/xmlexp.hxx>
@@ -45,11 +42,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::document;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::xml::sax;
class ODBExport : public SvXMLExport
@@ -76,15 +69,15 @@ class ODBExport : public SvXMLExport
css::uno::Type Type;
css::uno::Any Value;
- TypedPropertyValue( const OUString& _name, const css::uno::Type& _type, const css::uno::Any& _value )
- :Name( _name )
+ TypedPropertyValue( OUString _name, const css::uno::Type& _type, css::uno::Any _value )
+ :Name(std::move( _name ))
,Type( _type )
- ,Value( _value )
+ ,Value(std::move( _value ))
{
}
};
- std::unique_ptr< TStringPair > m_aAutoIncrement;
+ std::optional< TStringPair > m_oAutoIncrement;
std::unique_ptr< TDelimiter > m_aDelimiter;
std::vector< TypedPropertyValue > m_aDataSourceSettings;
std::vector< XMLPropertyState > m_aCurrentPropertyStates;
@@ -124,8 +117,8 @@ class ODBExport : public SvXMLExport
void exportReports();
void exportQueries(bool _bExportContext);
void exportTables(bool _bExportContext);
- void exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt);
- void exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const Reference<XPropertySet>& _xProp,SvXMLAttributeList& _rAtt,TPropertyStyleMap& _rMap);
+ void exportStyleName(XPropertySet* _xProp,comphelper::AttributeList& _rAtt);
+ void exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const Reference<XPropertySet>& _xProp,comphelper::AttributeList& _rAtt,TPropertyStyleMap& _rMap);
void exportCollection(const Reference< XNameAccess >& _xCollection
,enum ::xmloff::token::XMLTokenEnum _eComponents
,enum ::xmloff::token::XMLTokenEnum _eSubComponents
@@ -174,6 +167,5 @@ public:
};
} // dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLEXPORT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
index 8070790e4e8c..c54acdd6527f 100644
--- a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
@@ -20,9 +20,9 @@
#include "xmlFileBasedDatabase.hxx"
#include "xmlfilter.hxx"
#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <svl/filenotation.hxx>
#include <unotools/pathoptions.hxx>
#include <dsntypes.hxx>
@@ -78,7 +78,7 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport,
sFileTypeExtension = sValue;
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
if ( !aProperty.Name.isEmpty() )
{
@@ -95,7 +95,7 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport,
OUString sURL = aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension) + sLocation;
try
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sURL));
+ xDataSource->setPropertyValue(PROPERTY_URL,Any(sURL));
}
catch(const Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlFileBasedDatabase.hxx b/dbaccess/source/filter/xml/xmlFileBasedDatabase.hxx
index e82bf1876354..3720e1da354a 100644
--- a/dbaccess/source/filter/xml/xmlFileBasedDatabase.hxx
+++ b/dbaccess/source/filter/xml/xmlFileBasedDatabase.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLFILEBASEDDATABASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLFILEBASEDDATABASE_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -30,12 +29,8 @@ namespace dbaxml
OXMLFileBasedDatabase( ODBFilter& rImport,
const css::uno::Reference< css::xml::sax::XFastAttributeList > & _xAttrList );
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual ~OXMLFileBasedDatabase() override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLFILEBASEDDATABASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlHelper.cxx b/dbaccess/source/filter/xml/xmlHelper.cxx
index a9f156fc5a51..eb0e7d16f9b4 100644
--- a/dbaccess/source/filter/xml/xmlHelper.cxx
+++ b/dbaccess/source/filter/xml/xmlHelper.cxx
@@ -20,19 +20,17 @@
#include "xmlHelper.hxx"
#include <xmloff/XMLConstantsPropertyHandler.hxx>
#include <xmloff/xmlement.hxx>
-#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmltypes.hxx>
#include <xmloff/maptype.hxx>
-#include <com/sun/star/awt/TextAlign.hpp>
#include <strings.hxx>
#include <rtl/ref.hxx>
namespace dbaxml
{
using namespace ::xmloff::token;
- using namespace ::com::sun::star::awt;
OPropertyHandlerFactory::OPropertyHandlerFactory()
{
@@ -68,12 +66,11 @@ const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32
return pHandler;
}
-#define MAP_END() { nullptr, 0, 0, XML_TOKEN_INVALID, 0 , 0, SvtSaveOptions::ODFSVER_010, false}
rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetTableStylesPropertySetMapper( bool bForExport )
{
static const XMLPropertyMapEntry s_aTableStylesProperties[] =
{
- MAP_END()
+ { nullptr }
};
rtl::Reference < XMLPropertyHandlerFactory> xFac = new ::xmloff::OControlPropertyHandlerFactory();
return new XMLPropertySetMapper(s_aTableStylesProperties, xFac, bForExport);
@@ -81,13 +78,14 @@ rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetTableStylesPropertySetMap
rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetColumnStylesPropertySetMapper( bool bForExport )
{
-#define MAP_CONST_COLUMN( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_TABLE_COLUMN, context, SvtSaveOptions::ODFSVER_010, false }
static const XMLPropertyMapEntry s_aColumnStylesProperties[] =
{
- MAP_CONST_COLUMN( PROPERTY_WIDTH, XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_MEASURE, 0),
- MAP_CONST_COLUMN( PROPERTY_HIDDEN, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_DB_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_DB_ISVISIBLE ),
- MAP_CONST_COLUMN( PROPERTY_NUMBERFORMAT, XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM, CTF_DB_NUMBERFORMAT),
- MAP_END()
+ { PROPERTY_WIDTH, XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_MEASURE|XML_TYPE_PROP_TABLE_COLUMN, 0, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_HIDDEN, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_DB_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM|XML_TYPE_PROP_TABLE_COLUMN,
+ CTF_DB_ISVISIBLE, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_NUMBERFORMAT, XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM|XML_TYPE_PROP_TABLE_COLUMN,
+ CTF_DB_NUMBERFORMAT, SvtSaveOptions::ODFSVER_010, false },
+ { nullptr }
};
rtl::Reference < XMLPropertyHandlerFactory> xFac = new OPropertyHandlerFactory();
return new XMLPropertySetMapper(s_aColumnStylesProperties, xFac, bForExport);
@@ -95,40 +93,47 @@ rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetColumnStylesPropertySetMa
rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetCellStylesPropertySetMapper( bool bForExport )
{
-#define MAP_CONST_CELL( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_PARAGRAPH, context, SvtSaveOptions::ODFSVER_010, false }
-#define MAP_CONST_TEXT( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFSVER_010, false }
static const XMLPropertyMapEntry s_aCellStylesProperties[] =
{
- MAP_CONST_CELL( PROPERTY_ALIGN, XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_TEXT_ALIGN, CTF_DB_COLUMN_TEXT_ALIGN),
- MAP_CONST_TEXT( PROPERTY_FONTNAME, XML_NAMESPACE_STYLE, XML_FONT_NAME, XML_TYPE_STRING, 0 ),
- MAP_CONST_TEXT( PROPERTY_TEXTCOLOR, XML_NAMESPACE_FO, XML_COLOR, XML_TYPE_COLOR, 0 ),
- MAP_CONST_TEXT( PROPERTY_TEXTLINECOLOR, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
-
- MAP_CONST_TEXT( PROPERTY_TEXTRELIEF, XML_NAMESPACE_STYLE, XML_FONT_RELIEF, XML_TYPE_TEXT_FONT_RELIEF|MID_FLAG_MULTI_PROPERTY, 0 ),
- MAP_CONST_TEXT( PROPERTY_TEXTEMPHASIS, XML_NAMESPACE_STYLE, XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTCHARWIDTH, XML_NAMESPACE_STYLE, XML_FONT_CHAR_WIDTH, XML_TYPE_NUMBER16, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTCHARSET, XML_NAMESPACE_STYLE, XML_FONT_CHARSET, XML_TYPE_TEXT_FONTENCODING, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTFAMILY, XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC, XML_TYPE_TEXT_FONTFAMILY, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTHEIGHT, XML_NAMESPACE_FO, XML_FONT_SIZE, XML_TYPE_MEASURE16, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTKERNING, XML_NAMESPACE_STYLE, XML_LETTER_KERNING, XML_TYPE_BOOL, 0 ),
-
- MAP_CONST_TEXT( PROPERTY_FONTORIENTATION, XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_ROTATION_ANGLE, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTPITCH, XML_NAMESPACE_STYLE, XML_FONT_PITCH, XML_TYPE_TEXT_FONTPITCH, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTSLANT, XML_NAMESPACE_FO, XML_FONT_STYLE, XML_TYPE_TEXT_POSTURE, 0 ),
- MAP_CONST_TEXT( "CharStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_STYLE, XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY, 0),
- MAP_CONST_TEXT( "CharStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TYPE, XML_TYPE_TEXT_CROSSEDOUT_TYPE|MID_FLAG_MERGE_PROPERTY, 0),
- MAP_CONST_TEXT( "CharStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_WIDTH, XML_TYPE_TEXT_CROSSEDOUT_WIDTH|MID_FLAG_MERGE_PROPERTY, 0),
- MAP_CONST_TEXT( "CharStrikeout", XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT, XML_TYPE_TEXT_CROSSEDOUT_TEXT|MID_FLAG_MERGE_PROPERTY, 0),
- MAP_CONST_TEXT( PROPERTY_FONTSTYLENAME, XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME, XML_TYPE_STRING, 0 ),
- MAP_CONST_TEXT( "CharUnderline", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_STYLE, XML_TYPE_TEXT_UNDERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ),
- MAP_CONST_TEXT( "CharUnderline", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_TYPE, XML_TYPE_TEXT_UNDERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ),
- MAP_CONST_TEXT( "CharUnderline", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_WIDTH, XML_TYPE_TEXT_UNDERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ),
- MAP_CONST_TEXT( "CharUnderlineColor", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
- MAP_CONST_TEXT( "CharUnderlineHasColor", XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTWEIGHT, XML_NAMESPACE_FO, XML_FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTWIDTH, XML_NAMESPACE_STYLE, XML_FONT_WIDTH, XML_TYPE_FONT_WIDTH, 0 ),
- MAP_CONST_TEXT( PROPERTY_FONTWORDLINEMODE, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ),
- MAP_END()
+ { PROPERTY_ALIGN, XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_TEXT_ALIGN|XML_TYPE_PROP_PARAGRAPH, CTF_DB_COLUMN_TEXT_ALIGN, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTNAME, XML_NAMESPACE_STYLE, XML_FONT_NAME, XML_TYPE_STRING|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_TEXTCOLOR, XML_NAMESPACE_FO, XML_COLOR, XML_TYPE_COLOR|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_TEXTLINECOLOR, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR,
+ XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_TEXTRELIEF, XML_NAMESPACE_STYLE, XML_FONT_RELIEF,
+ XML_TYPE_TEXT_FONT_RELIEF|MID_FLAG_MULTI_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_TEXTEMPHASIS, XML_NAMESPACE_STYLE, XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTCHARWIDTH, XML_NAMESPACE_STYLE, XML_FONT_CHAR_WIDTH, XML_TYPE_NUMBER16|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTCHARSET, XML_NAMESPACE_STYLE, XML_FONT_CHARSET, XML_TYPE_TEXT_FONTENCODING|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTFAMILY, XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC, XML_TYPE_TEXT_FONTFAMILY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTHEIGHT, XML_NAMESPACE_FO, XML_FONT_SIZE, XML_TYPE_MEASURE16|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTKERNING, XML_NAMESPACE_STYLE, XML_LETTER_KERNING, XML_TYPE_BOOL|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTORIENTATION, XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_ROTATION_ANGLE|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTPITCH, XML_NAMESPACE_STYLE, XML_FONT_PITCH, XML_TYPE_TEXT_FONTPITCH|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTSLANT, XML_NAMESPACE_FO, XML_FONT_STYLE, XML_TYPE_TEXT_POSTURE|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_STRIKEOUT, XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_STYLE,
+ XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_STRIKEOUT, XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TYPE,
+ XML_TYPE_TEXT_CROSSEDOUT_TYPE|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_STRIKEOUT, XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_WIDTH,
+ XML_TYPE_TEXT_CROSSEDOUT_WIDTH|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_STRIKEOUT, XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT,
+ XML_TYPE_TEXT_CROSSEDOUT_TEXT|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTSTYLENAME, XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME, XML_TYPE_STRING|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_UNDERLINE, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_STYLE,
+ XML_TYPE_TEXT_UNDERLINE_STYLE|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_UNDERLINE, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_TYPE,
+ XML_TYPE_TEXT_UNDERLINE_TYPE|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_UNDERLINE, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_WIDTH,
+ XML_TYPE_TEXT_UNDERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_UNDERLINE_COLOR, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR,
+ XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_CHAR_UNDERLINE_HAS_COLOR, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTWEIGHT, XML_NAMESPACE_FO, XML_FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTWIDTH, XML_NAMESPACE_STYLE, XML_FONT_WIDTH, XML_TYPE_FONT_WIDTH|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { PROPERTY_FONTWORDLINEMODE, XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_MODE,
+ XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY|XML_TYPE_PROP_TEXT, 0 , SvtSaveOptions::ODFSVER_010, false },
+ { nullptr }
};
rtl::Reference < XMLPropertyHandlerFactory> xFac = new /*OPropertyHandlerFactory*/::xmloff::OControlPropertyHandlerFactory();
return new XMLPropertySetMapper(s_aCellStylesProperties, xFac, bForExport);
@@ -136,11 +141,10 @@ rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetCellStylesPropertySetMapp
rtl::Reference < XMLPropertySetMapper > OXMLHelper::GetRowStylesPropertySetMapper()
{
-#define MAP_CONST_ROW( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_TABLE_ROW, context, SvtSaveOptions::ODFSVER_010, false }
static const XMLPropertyMapEntry s_aStylesProperties[] =
{
- MAP_CONST_ROW( PROPERTY_ROW_HEIGHT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_MEASURE, 0),
- MAP_END()
+ { PROPERTY_ROW_HEIGHT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_MEASURE|XML_TYPE_PROP_TABLE_ROW, 0, SvtSaveOptions::ODFSVER_010, false },
+ { nullptr }
};
rtl::Reference < XMLPropertyHandlerFactory> xFac = new OPropertyHandlerFactory();
return new XMLPropertySetMapper(s_aStylesProperties, xFac, true/*bForExport*/);
diff --git a/dbaccess/source/filter/xml/xmlHelper.hxx b/dbaccess/source/filter/xml/xmlHelper.hxx
index fc1c20d3f7f9..a65cef9b35eb 100644
--- a/dbaccess/source/filter/xml/xmlHelper.hxx
+++ b/dbaccess/source/filter/xml/xmlHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLHELPER_HXX
+#pragma once
#include <xmloff/xmlprmap.hxx>
#include <xmloff/contextid.hxx>
@@ -54,6 +53,5 @@ namespace dbaxml
static rtl::Reference < XMLPropertySetMapper > GetRowStylesPropertySetMapper();
};
} // dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
index d542a1ad7807..74a5b5e3f150 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
@@ -21,13 +21,14 @@
#include "xmlComponent.hxx"
#include "xmlColumn.hxx"
#include "xmlfilter.hxx"
+#include <utility>
#include <xmloff/xmltoken.hxx>
#include <xmloff/ProgressBarHelper.hxx>
#include "xmlEnums.hxx"
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/propertysequence.hxx>
-#include <osl/diagnose.h>
-#include <sal/log.hxx>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaxml
{
@@ -40,26 +41,24 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
,const Reference< XFastAttributeList > & _xAttrList
,const Reference< XNameAccess >& _xParentContainer
,const OUString& _sCollectionServiceName
- ,const OUString& _sComponentServiceName) :
+ ,OUString _sComponentServiceName) :
SvXMLImportContext( rImport )
,m_sCollectionServiceName(_sCollectionServiceName)
- ,m_sComponentServiceName(_sComponentServiceName)
+ ,m_sComponentServiceName(std::move(_sComponentServiceName))
{
OUString sName;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_NAME:
- sName = sValue;
+ sName = aIter.toString();
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
- if ( !(!sName.isEmpty() && _xParentContainer.is()) )
+ if ( sName.isEmpty() || !_xParentContainer.is() )
return;
try
@@ -75,12 +74,12 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
m_xContainer.set(xORB->createInstanceWithArguments(_sCollectionServiceName,aArguments),UNO_QUERY);
Reference<XNameContainer> xNameContainer(_xParentContainer,UNO_QUERY);
if ( xNameContainer.is() && !xNameContainer->hasByName(sName) )
- xNameContainer->insertByName(sName,makeAny(m_xContainer));
+ xNameContainer->insertByName(sName,Any(m_xContainer));
}
}
catch(Exception&)
{
- OSL_FAIL("OXMLHierarchyCollection::OXMLHierarchyCollection -> exception caught");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OXMLHierarchyCollection::OXMLHierarchyCollection");
}
}
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx
index ad7e7d39e848..91f0aae869db 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLHIERARCHYCOLLECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLHIERARCHYCOLLECTION_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -40,7 +39,7 @@ namespace dbaxml
,const css::uno::Reference< css::xml::sax::XFastAttributeList > & _xAttrList
,const css::uno::Reference< css::container::XNameAccess >& _xParentContainer
,const OUString& _sCollectionServiceName
- ,const OUString& _sComponentServiceName
+ ,OUString _sComponentServiceName
);
OXMLHierarchyCollection( ODBFilter& rImport
,const css::uno::Reference< css::container::XNameAccess >& _xContainer
@@ -48,13 +47,9 @@ namespace dbaxml
);
virtual ~OXMLHierarchyCollection() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLHIERARCHYCOLLECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlLogin.cxx b/dbaccess/source/filter/xml/xmlLogin.cxx
index c74d98be7ddd..a4519b26e7a9 100644
--- a/dbaccess/source/filter/xml/xmlLogin.cxx
+++ b/dbaccess/source/filter/xml/xmlLogin.cxx
@@ -21,7 +21,7 @@
#include "xmlfilter.hxx"
#include <xmloff/xmltoken.hxx>
#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/sdbc/XDataSource.hpp>
namespace dbaxml
@@ -36,15 +36,12 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
{
Reference<XPropertySet> xDataSource(rImport.getDataSource());
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
bool bUserFound = false;
if (!xDataSource.is())
return;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
try
{
switch( aIter.getToken() & TOKEN_MASK )
@@ -55,7 +52,7 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
bUserFound = true;
try
{
- xDataSource->setPropertyValue(PROPERTY_USER,makeAny(sValue));
+ xDataSource->setPropertyValue(PROPERTY_USER,Any(aIter.toString()));
}
catch(const Exception&)
{
@@ -66,7 +63,7 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
case XML_IS_PASSWORD_REQUIRED:
try
{
- xDataSource->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED,makeAny(sValue == s_sTRUE));
+ xDataSource->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED,Any(IsXMLToken(aIter, XML_TRUE)));
}
catch(const Exception&)
{
@@ -79,14 +76,14 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
bUserFound = true;
PropertyValue aProperty;
aProperty.Name = "UseSystemUser";
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
rImport.addInfo(aProperty);
}
break;
case XML_LOGIN_TIMEOUT:
try
{
- Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(sValue.toInt32());
+ Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(aIter.toInt32());
}
catch(const Exception&)
{
@@ -94,7 +91,7 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
}
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
catch(const Exception&)
diff --git a/dbaccess/source/filter/xml/xmlLogin.hxx b/dbaccess/source/filter/xml/xmlLogin.hxx
index 50297416d221..adb25c739b78 100644
--- a/dbaccess/source/filter/xml/xmlLogin.hxx
+++ b/dbaccess/source/filter/xml/xmlLogin.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLLOGIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLLOGIN_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -30,13 +29,9 @@ namespace dbaxml
OXMLLogin( ODBFilter& rImport,
const css::uno::Reference< css::xml::sax::XFastAttributeList > & _xAttrList );
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual ~OXMLLogin() override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLLOGIN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlQuery.cxx b/dbaccess/source/filter/xml/xmlQuery.cxx
index 7ab4940da9d2..b1cdd90bf1b7 100644
--- a/dbaccess/source/filter/xml/xmlQuery.cxx
+++ b/dbaccess/source/filter/xml/xmlQuery.cxx
@@ -23,8 +23,7 @@
#include <xmloff/ProgressBarHelper.hxx>
#include "xmlEnums.hxx"
#include <strings.hxx>
-#include <osl/diagnose.h>
-#include <sal/log.hxx>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaxml
{
@@ -38,23 +37,21 @@ OXMLQuery::OXMLQuery( ODBFilter& rImport
,const Reference< XFastAttributeList > & _xAttrList
,const css::uno::Reference< css::container::XNameAccess >& _xParentContainer
) :
- OXMLTable( rImport, _xAttrList,_xParentContainer, "com.sun.star.sdb.CommandDefinition" )
+ OXMLTable( rImport, _xAttrList,_xParentContainer, u"com.sun.star.sdb.CommandDefinition"_ustr )
,m_bEscapeProcessing(true)
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_COMMAND:
- m_sCommand = sValue;
+ m_sCommand = aIter.toString();
break;
case XML_ESCAPE_PROCESSING:
- m_bEscapeProcessing = sValue == "true";
+ m_bEscapeProcessing = aIter.toView() == "true";
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
}
@@ -93,25 +90,25 @@ void OXMLQuery::setProperties(Reference< XPropertySet > & _xProp )
{
OXMLTable::setProperties(_xProp);
- _xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(m_sCommand));
- _xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,makeAny(m_bEscapeProcessing));
+ _xProp->setPropertyValue(PROPERTY_COMMAND,Any(m_sCommand));
+ _xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,Any(m_bEscapeProcessing));
if ( !m_sTable.isEmpty() )
- _xProp->setPropertyValue(PROPERTY_UPDATE_TABLENAME,makeAny(m_sTable));
+ _xProp->setPropertyValue(PROPERTY_UPDATE_TABLENAME,Any(m_sTable));
if ( !m_sCatalog.isEmpty() )
- _xProp->setPropertyValue(PROPERTY_UPDATE_CATALOGNAME,makeAny(m_sCatalog));
+ _xProp->setPropertyValue(PROPERTY_UPDATE_CATALOGNAME,Any(m_sCatalog));
if ( !m_sSchema.isEmpty() )
- _xProp->setPropertyValue(PROPERTY_UPDATE_SCHEMANAME,makeAny(m_sSchema));
+ _xProp->setPropertyValue(PROPERTY_UPDATE_SCHEMANAME,Any(m_sSchema));
const ODBFilter::TPropertyNameMap& rSettings = GetOwnImport().getQuerySettings();
ODBFilter::TPropertyNameMap::const_iterator aFind = rSettings.find(m_sName);
if ( aFind != rSettings.end() )
- _xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aFind->second));
+ _xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,Any(aFind->second));
}
}
catch(Exception&)
{
- OSL_FAIL("OXMLTable::EndElement -> exception caught");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OXMLTable::EndElement");
}
}
diff --git a/dbaccess/source/filter/xml/xmlQuery.hxx b/dbaccess/source/filter/xml/xmlQuery.hxx
index bd13072e0f27..d3e01193c473 100644
--- a/dbaccess/source/filter/xml/xmlQuery.hxx
+++ b/dbaccess/source/filter/xml/xmlQuery.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLQUERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLQUERY_HXX
+#pragma once
#include "xmlTable.hxx"
@@ -39,13 +38,9 @@ namespace dbaxml
);
virtual ~OXMLQuery() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLQUERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlServerDatabase.cxx b/dbaccess/source/filter/xml/xmlServerDatabase.cxx
index 87ff119b5a79..a1db053092a1 100644
--- a/dbaccess/source/filter/xml/xmlServerDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlServerDatabase.cxx
@@ -22,7 +22,7 @@
#include <xmloff/xmltoken.hxx>
#include <strings.hxx>
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaxml
{
@@ -64,7 +64,7 @@ OXMLServerDatabase::OXMLServerDatabase( ODBFilter& rImport,
sDatabaseName = sValue;
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
}
@@ -74,51 +74,51 @@ OXMLServerDatabase::OXMLServerDatabase( ODBFilter& rImport,
OUStringBuffer sURL;
if ( sType == "sdbc:mysql:jdbc" || sType == "sdbc:mysqlc" || sType == "sdbc:mysql:mysqlc" )
{
- sURL.append( sType ).append( ":" ).append(sHostName);
+ sURL.append( sType + ":" + sHostName);
if ( !sPortNumber.isEmpty() )
{
- sURL.append(":").append(sPortNumber);
+ sURL.append(":" + sPortNumber);
}
if ( !sDatabaseName.isEmpty() )
{
- sURL.append("/").append(sDatabaseName);
+ sURL.append("/" + sDatabaseName);
}
}
else if ( sType == "jdbc:oracle:thin" )
{
- sURL.append("jdbc:oracle:thin:@").append(sHostName);
+ sURL.append("jdbc:oracle:thin:@" + sHostName);
if ( !sPortNumber.isEmpty() )
{
- sURL.append(":").append(sPortNumber);
+ sURL.append(":" + sPortNumber);
}
if ( !sDatabaseName.isEmpty() )
{
- sURL.append(":").append(sDatabaseName);
+ sURL.append(":" + sDatabaseName);
}
}
else if ( sType == "sdbc:address:ldap" )
{
- sURL.append("sdbc:address:ldap:").append(sHostName);
+ sURL.append("sdbc:address:ldap:" + sHostName);
if ( !sPortNumber.isEmpty() )
{
- sURL.append(":").append(sPortNumber);
+ sURL.append(":" + sPortNumber);
}
}
else
{
- sURL.append(sType).append(":").append(sHostName);
+ sURL.append(sType + ":" + sHostName);
if ( !sPortNumber.isEmpty() )
{
- sURL.append(":").append(sPortNumber);
+ sURL.append(":" + sPortNumber);
}
if ( !sDatabaseName.isEmpty() )
{
- sURL.append(":").append(sDatabaseName);
+ sURL.append(":" + sDatabaseName);
}
}
try
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sURL.makeStringAndClear()));
+ xDataSource->setPropertyValue(PROPERTY_URL,Any(sURL.makeStringAndClear()));
}
catch(const Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlServerDatabase.hxx b/dbaccess/source/filter/xml/xmlServerDatabase.hxx
index 4f0378de4345..ec3401fff795 100644
--- a/dbaccess/source/filter/xml/xmlServerDatabase.hxx
+++ b/dbaccess/source/filter/xml/xmlServerDatabase.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLSERVERDATABASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLSERVERDATABASE_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
@@ -30,12 +29,8 @@ namespace dbaxml
OXMLServerDatabase( ODBFilter& rImport,
const css::uno::Reference< css::xml::sax::XFastAttributeList > & _xAttrList );
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual ~OXMLServerDatabase() override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLSERVERDATABASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx b/dbaccess/source/filter/xml/xmlStyleImport.cxx
index 9e7b1f8cce86..7db5b097dc3b 100644
--- a/dbaccess/source/filter/xml/xmlStyleImport.cxx
+++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx
@@ -33,18 +33,14 @@ namespace dbaxml
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::style;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace xmloff::token;
OTableStyleContext::OTableStyleContext( ODBFilter& rImport,
- sal_uInt16 nPrfx, const OUString& rLName,
- const Reference< XAttributeList > & xAttrList,
- SvXMLStylesContext& rStyles, XmlStyleFamily nFamily )
- :XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, false )
+ OTableStylesContext& rStyles, XmlStyleFamily nFamily )
+ :XMLPropStyleContext( rImport, rStyles, nFamily, false )
,pStyles(&rStyles)
,m_nNumberFormat(-1)
{
@@ -103,23 +99,26 @@ void OTableStyleContext::SetDefaults()
void OTableStyleContext::AddProperty(const sal_Int16 nContextID, const uno::Any& rValue)
{
- sal_Int32 nIndex(static_cast<OTableStylesContext *>(pStyles)->GetIndex(nContextID));
+ sal_Int32 nIndex(pStyles->GetIndex(nContextID));
OSL_ENSURE(nIndex != -1, "Property not found in Map");
XMLPropertyState aPropState(nIndex, rValue);
GetProperties().push_back(aPropState); // has to be inserted in a sort order later
}
-void OTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
- const OUString& rLocalName,
+void OTableStyleContext::SetAttribute( sal_Int32 nElement,
const OUString& rValue )
{
- // TODO: use a map here
- if( IsXMLToken(rLocalName, XML_DATA_STYLE_NAME ) )
- m_sDataStyleName = rValue;
- else if ( IsXMLToken(rLocalName, XML_MASTER_PAGE_NAME ) )
- sPageStyle = rValue;
- else
- XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ switch(nElement & TOKEN_MASK)
+ {
+ case XML_DATA_STYLE_NAME:
+ m_sDataStyleName = rValue;
+ break;
+ case XML_MASTER_PAGE_NAME:
+ sPageStyle = rValue;
+ break;
+ default:
+ XMLPropStyleContext::SetAttribute( nElement, rValue );
+ }
}
ODBFilter& OTableStyleContext::GetOwnImport()
@@ -143,75 +142,71 @@ OTableStylesContext::~OTableStylesContext()
}
-void OTableStylesContext::endFastElement(sal_Int32 nElement)
+void OTableStylesContext::endFastElement(sal_Int32 )
{
- SvXMLStylesContext::endFastElement(nElement);
if (bAutoStyles)
GetImport().GetTextImport()->SetAutoStyles( this );
else
GetImport().GetStyles()->CopyStylesToDoc(true);
}
-rtl::Reference < SvXMLImportPropertyMapper >
+SvXMLImportPropertyMapper*
OTableStylesContext::GetImportPropertyMapper(
XmlStyleFamily nFamily ) const
{
- rtl::Reference < SvXMLImportPropertyMapper > xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
+ SvXMLImportPropertyMapper* pMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
- if (!xMapper.is())
+ if (!pMapper)
{
switch( nFamily )
{
case XmlStyleFamily::TABLE_TABLE:
{
- if ( !m_xTableImpPropMapper.is() )
- m_xTableImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
- xMapper = m_xTableImpPropMapper;
+ if ( !m_xTableImpPropMapper )
+ m_xTableImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
+ pMapper = m_xTableImpPropMapper.get();
}
break;
case XmlStyleFamily::TABLE_COLUMN:
{
- if ( !m_xColumnImpPropMapper.is() )
- m_xColumnImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
- xMapper = m_xColumnImpPropMapper;
+ if ( !m_xColumnImpPropMapper )
+ m_xColumnImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
+ pMapper = m_xColumnImpPropMapper.get();
}
break;
case XmlStyleFamily::TABLE_CELL:
{
- if ( !m_xCellImpPropMapper.is() )
- m_xCellImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
- xMapper = m_xCellImpPropMapper;
+ if ( !m_xCellImpPropMapper )
+ m_xCellImpPropMapper = std::make_unique<SvXMLImportPropertyMapper>( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
+ pMapper = m_xCellImpPropMapper.get();
}
break;
default: break;
}
}
- return xMapper;
+ return pMapper;
}
SvXMLStyleContext *OTableStylesContext::CreateStyleStyleChildContext(
- XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
- const Reference< xml::sax::XAttributeList > & xAttrList )
+ XmlStyleFamily nFamily, sal_Int32 nElement,
+ const Reference< xml::sax::XFastAttributeList > & xAttrList )
{
- SvXMLStyleContext *pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nPrefix,
- rLocalName,
+ SvXMLStyleContext *pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nElement,
xAttrList );
- if (!pStyle)
+ if (pStyle)
+ return pStyle;
+
+ switch( nFamily )
{
- switch( nFamily )
- {
- case XmlStyleFamily::TABLE_TABLE:
- case XmlStyleFamily::TABLE_COLUMN:
- case XmlStyleFamily::TABLE_CELL:
- pStyle = new OTableStyleContext( GetOwnImport(), nPrefix, rLocalName,
- xAttrList, *this, nFamily );
- break;
- default: break;
- }
+ case XmlStyleFamily::TABLE_TABLE:
+ case XmlStyleFamily::TABLE_COLUMN:
+ case XmlStyleFamily::TABLE_CELL:
+ return new OTableStyleContext( GetOwnImport(), *this, nFamily );
+ default: break;
}
- return pStyle;
+ return nullptr;
}
OUString OTableStylesContext::GetServiceName( XmlStyleFamily nFamily ) const
diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx
index 8eeb7ac7dd54..552038fe8f8e 100644
--- a/dbaccess/source/filter/xml/xmlStyleImport.hxx
+++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLSTYLEIMPORT_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLSTYLEIMPORT_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <xmloff/xmlimp.hxx>
@@ -28,29 +27,27 @@
namespace dbaxml
{
class ODBFilter;
+ class OTableStylesContext;
class OTableStyleContext : public XMLPropStyleContext
{
OUString m_sDataStyleName;
OUString sPageStyle;
- SvXMLStylesContext* pStyles;
+ OTableStylesContext* pStyles;
sal_Int32 m_nNumberFormat;
ODBFilter& GetOwnImport();
protected:
- virtual void SetAttribute( sal_uInt16 nPrefixKey,
- const OUString& rLocalName,
+ virtual void SetAttribute( sal_Int32 nElement,
const OUString& rValue ) override;
public:
- OTableStyleContext( ODBFilter& rImport, sal_uInt16 nPrfx,
- const OUString& rLName,
- const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
- SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
+ OTableStyleContext( ODBFilter& rImport,
+ OTableStylesContext& rStyles, XmlStyleFamily nFamily );
virtual ~OTableStyleContext() override;
@@ -68,20 +65,20 @@ namespace dbaxml
sal_Int32 m_nMasterPageNameIndex;
bool bAutoStyles : 1;
- mutable rtl::Reference < SvXMLImportPropertyMapper > m_xTableImpPropMapper;
- mutable rtl::Reference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper;
- mutable rtl::Reference < SvXMLImportPropertyMapper > m_xCellImpPropMapper;
+ mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xTableImpPropMapper;
+ mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xColumnImpPropMapper;
+ mutable std::unique_ptr < SvXMLImportPropertyMapper > m_xCellImpPropMapper;
ODBFilter& GetOwnImport();
protected:
// Create a style context.
+ using SvXMLStylesContext::CreateStyleStyleChildContext;
virtual SvXMLStyleContext *CreateStyleStyleChildContext(
XmlStyleFamily nFamily,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
public:
@@ -91,13 +88,12 @@ namespace dbaxml
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
- virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
+ virtual SvXMLImportPropertyMapper* GetImportPropertyMapper(
XmlStyleFamily nFamily ) const override;
virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override;
sal_Int32 GetIndex(const sal_Int16 nContextID);
};
} // dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLSTYLEIMPORT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlTable.cxx b/dbaccess/source/filter/xml/xmlTable.cxx
index 9477f13faf54..dd7df81c8072 100644
--- a/dbaccess/source/filter/xml/xmlTable.cxx
+++ b/dbaccess/source/filter/xml/xmlTable.cxx
@@ -19,6 +19,7 @@
#include "xmlTable.hxx"
#include "xmlfilter.hxx"
+#include <utility>
#include <xmloff/xmltoken.hxx>
#include <xmloff/ProgressBarHelper.hxx>
#include "xmlEnums.hxx"
@@ -29,8 +30,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/propertysequence.hxx>
-#include <osl/diagnose.h>
-#include <sal/log.hxx>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaxml
{
@@ -41,11 +41,11 @@ namespace dbaxml
OXMLTable::OXMLTable( ODBFilter& _rImport
,const uno::Reference< XFastAttributeList > & _xAttrList
- ,const uno::Reference< css::container::XNameAccess >& _xParentContainer
+ ,uno::Reference< css::container::XNameAccess > _xParentContainer
,const OUString& _sServiceName
)
:SvXMLImportContext( _rImport )
- ,m_xParentContainer(_xParentContainer)
+ ,m_xParentContainer(std::move(_xParentContainer))
,m_bApplyFilter(false)
,m_bApplyOrder(false)
{
@@ -74,7 +74,7 @@ OXMLTable::OXMLTable( ODBFilter& _rImport
m_bApplyOrder = sValue == "true";
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
@@ -142,17 +142,17 @@ void OXMLTable::setProperties(uno::Reference< XPropertySet > & _xProp )
{
if ( _xProp.is() )
{
- _xProp->setPropertyValue(PROPERTY_APPLYFILTER,makeAny(m_bApplyFilter));
- _xProp->setPropertyValue(PROPERTY_FILTER,makeAny(m_sFilterStatement));
+ _xProp->setPropertyValue(PROPERTY_APPLYFILTER,Any(m_bApplyFilter));
+ _xProp->setPropertyValue(PROPERTY_FILTER,Any(m_sFilterStatement));
if ( _xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_APPLYORDER) )
- _xProp->setPropertyValue(PROPERTY_APPLYORDER,makeAny(m_bApplyOrder));
- _xProp->setPropertyValue(PROPERTY_ORDER,makeAny(m_sOrderStatement));
+ _xProp->setPropertyValue(PROPERTY_APPLYORDER,Any(m_bApplyOrder));
+ _xProp->setPropertyValue(PROPERTY_ORDER,Any(m_sOrderStatement));
}
}
catch(Exception&)
{
- OSL_FAIL("OXMLTable::EndElement -> exception caught");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OXMLTable::EndElement -> exception caught");
}
}
@@ -181,12 +181,12 @@ void OXMLTable::endFastElement(sal_Int32 )
}
}
- xNameContainer->insertByName(m_sName,makeAny(m_xTable));
+ xNameContainer->insertByName(m_sName,Any(m_xTable));
}
}
catch(Exception&)
{
- OSL_FAIL("OXMLQuery::EndElement -> exception caught");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OXMLQuery::EndElement");
}
}
@@ -217,7 +217,7 @@ void OXMLTable::fillAttributes(const uno::Reference< XFastAttributeList > & _xAt
_rsTableName = sValue;
break;
default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
}
diff --git a/dbaccess/source/filter/xml/xmlTable.hxx b/dbaccess/source/filter/xml/xmlTable.hxx
index 2ba1f557ff50..9be9feaa023a 100644
--- a/dbaccess/source/filter/xml/xmlTable.hxx
+++ b/dbaccess/source/filter/xml/xmlTable.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLE_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLE_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -54,19 +53,15 @@ namespace dbaxml
OXMLTable( ODBFilter& rImport
,const css::uno::Reference< css::xml::sax::XFastAttributeList > & _xAttrList
- ,const css::uno::Reference< css::container::XNameAccess >& _xParentContainer
+ ,css::uno::Reference< css::container::XNameAccess > _xParentContainer
,const OUString& _sServiceName
);
virtual ~OXMLTable() override;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlTableFilterList.cxx b/dbaccess/source/filter/xml/xmlTableFilterList.cxx
index ddd799087a48..487516acaff5 100644
--- a/dbaccess/source/filter/xml/xmlTableFilterList.cxx
+++ b/dbaccess/source/filter/xml/xmlTableFilterList.cxx
@@ -21,7 +21,7 @@
#include "xmlTableFilterPattern.hxx"
#include "xmlEnums.hxx"
#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <xmloff/ProgressBarHelper.hxx>
#include <strings.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -34,7 +34,6 @@ namespace dbaxml
using namespace ::xmloff::token;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::xml::sax;
OXMLTableFilterList::OXMLTableFilterList( SvXMLImport& rImport)
:SvXMLImportContext( rImport )
@@ -84,9 +83,9 @@ void OXMLTableFilterList::endFastElement(sal_Int32 )
if ( xDataSource.is() )
{
if ( !m_aPatterns.empty() )
- xDataSource->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(comphelper::containerToSequence(m_aPatterns)));
+ xDataSource->setPropertyValue(PROPERTY_TABLEFILTER,Any(comphelper::containerToSequence(m_aPatterns)));
if ( !m_aTypes.empty() )
- xDataSource->setPropertyValue(PROPERTY_TABLETYPEFILTER,makeAny(comphelper::containerToSequence(m_aTypes)));
+ xDataSource->setPropertyValue(PROPERTY_TABLETYPEFILTER,Any(comphelper::containerToSequence(m_aTypes)));
}
}
diff --git a/dbaccess/source/filter/xml/xmlTableFilterList.hxx b/dbaccess/source/filter/xml/xmlTableFilterList.hxx
index 755bb8e9f450..1988bdd29cf7 100644
--- a/dbaccess/source/filter/xml/xmlTableFilterList.hxx
+++ b/dbaccess/source/filter/xml/xmlTableFilterList.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLEFILTERLIST_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLEFILTERLIST_HXX
+#pragma once
#include <xmloff/xmlictxt.hxx>
#include <vector>
@@ -40,9 +39,6 @@ namespace dbaxml
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
-
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
/** pushes a new TableFilterPattern to the list of patterns
@@ -65,6 +61,4 @@ namespace dbaxml
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLEFILTERLIST_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlTableFilterPattern.cxx b/dbaccess/source/filter/xml/xmlTableFilterPattern.cxx
index 0c4b2892d2b7..1df9c037ac38 100644
--- a/dbaccess/source/filter/xml/xmlTableFilterPattern.cxx
+++ b/dbaccess/source/filter/xml/xmlTableFilterPattern.cxx
@@ -22,9 +22,6 @@
namespace dbaxml
{
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::xml::sax;
-
OXMLTableFilterPattern::OXMLTableFilterPattern( SvXMLImport& rImport
,bool _bNameFilter
,OXMLTableFilterList& _rParent)
diff --git a/dbaccess/source/filter/xml/xmlTableFilterPattern.hxx b/dbaccess/source/filter/xml/xmlTableFilterPattern.hxx
index 2c6fbb2c76bc..8f0b64f37a3a 100644
--- a/dbaccess/source/filter/xml/xmlTableFilterPattern.hxx
+++ b/dbaccess/source/filter/xml/xmlTableFilterPattern.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLEFILTERPATTERN_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLEFILTERPATTERN_HXX
+#pragma once
#include <rtl/ustrbuf.hxx>
#include <xmloff/xmlictxt.hxx>
@@ -37,13 +36,9 @@ namespace dbaxml
virtual ~OXMLTableFilterPattern() override;
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
virtual void SAL_CALL characters( const OUString& rChars ) override;
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLTABLEFILTERPATTERN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index bcf498e8c16e..9dc52f514558 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -32,10 +32,10 @@
#include "xmlfilter.hxx"
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
-#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmlscripti.hxx>
#include <xmloff/xmltoken.hxx>
-#include <xmloff/nmspmap.hxx>
+#include <xmloff/namespacemap.hxx>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <xmloff/ProgressBarHelper.hxx>
@@ -51,9 +51,8 @@
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <svtools/sfxecode.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
-#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <comphelper/namedvaluecollection.hxx>
@@ -85,7 +84,7 @@ static ErrCode ReadThroughComponent(
OSL_ENSURE(xModelComponent.is(), "document missing");
OSL_ENSURE(rxContext.is(), "factory missing");
- // prepare ParserInputSrouce
+ // prepare ParserInputSource
InputSource aParserInput;
aParserInput.aInputStream = xInputStream;
@@ -126,49 +125,45 @@ static ErrCode ReadThroughComponent(
static ErrCode ReadThroughComponent(
const uno::Reference< embed::XStorage >& xStorage,
const uno::Reference<XComponent>& xModelComponent,
- const char* pStreamName,
+ const OUString& sStreamName,
const uno::Reference<XComponentContext> & rxContext,
ODBFilter& _rFilter)
{
OSL_ENSURE( xStorage.is(), "Need storage!");
- OSL_ENSURE(nullptr != pStreamName, "Please, please, give me a name!");
- if ( xStorage.is() )
- {
- uno::Reference< io::XStream > xDocStream;
+ if ( !xStorage )
+ // TODO/LATER: better error handling
+ return ErrCode(1);
- try
- {
- // open stream (and set parser input)
- OUString sStreamName = OUString::createFromAscii(pStreamName);
- if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
- {
- // stream name not found! return immediately with OK signal
- return ERRCODE_NONE;
- }
+ uno::Reference< io::XStream > xDocStream;
- // get input stream
- xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
- }
- catch (const packages::WrongPasswordException&)
- {
- return ERRCODE_SFX_WRONGPASSWORD;
- }
- catch (const uno::Exception&)
+ try
+ {
+ // open stream (and set parser input)
+ if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
{
- return ErrCode(1); // TODO/LATER: error handling
+ // stream name not found! return immediately with OK signal
+ return ERRCODE_NONE;
}
- uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
- // read from the stream
- return ReadThroughComponent( xInputStream
- ,xModelComponent
- ,rxContext
- ,_rFilter );
+ // get input stream
+ xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
+ }
+ catch (const packages::WrongPasswordException&)
+ {
+ return ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch (const uno::Exception&)
+ {
+ return ErrCode(1); // TODO/LATER: error handling
}
- // TODO/LATER: better error handling
- return ErrCode(1);
+ uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
+ // read from the stream
+ return ReadThroughComponent( xInputStream
+ ,xModelComponent
+ ,rxContext
+ ,_rFilter );
}
@@ -179,17 +174,17 @@ ODBFilter::ODBFilter( const uno::Reference< XComponentContext >& _rxContext )
GetMM100UnitConverter().SetCoreMeasureUnit(util::MeasureUnit::MM_10TH);
GetMM100UnitConverter().SetXMLMeasureUnit(util::MeasureUnit::CM);
- GetNamespaceMap().Add( "_db",
+ GetNamespaceMap().Add( u"_db"_ustr,
GetXMLToken(XML_N_DB),
XML_NAMESPACE_DB );
- GetNamespaceMap().Add( "__db",
+ GetNamespaceMap().Add( u"__db"_ustr,
GetXMLToken(XML_N_DB_OASIS),
XML_NAMESPACE_DB );
}
-ODBFilter::~ODBFilter() throw()
+ODBFilter::~ODBFilter() noexcept
{
}
@@ -197,7 +192,7 @@ ODBFilter::~ODBFilter() throw()
OUString ODBFilter::getImplementationName_Static()
{
- return "com.sun.star.comp.sdb.DBFilter";
+ return u"com.sun.star.comp.sdb.DBFilter"_ustr;
}
@@ -208,7 +203,7 @@ public:
FocusWindowWaitGuard()
{
SolarMutexGuard aGuard;
- mpWindow.set(Application::GetFocusWindow());
+ mpWindow.reset(Application::GetFocusWindow());
if (mpWindow)
mpWindow->EnterWait();
}
@@ -247,10 +242,10 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
bool bRet = true;
if (!xStorage.is())
{
- if (aMediaDescriptor.has("URL"))
- sFileName = aMediaDescriptor.getOrDefault("URL", OUString());
- if (sFileName.isEmpty() && aMediaDescriptor.has("FileName"))
- sFileName = aMediaDescriptor.getOrDefault("FileName", sFileName);
+ if (aMediaDescriptor.has(u"URL"_ustr))
+ sFileName = aMediaDescriptor.getOrDefault(u"URL"_ustr, OUString());
+ if (sFileName.isEmpty() && aMediaDescriptor.has(u"FileName"_ustr))
+ sFileName = aMediaDescriptor.getOrDefault(u"FileName"_ustr, sFileName);
OSL_ENSURE(!sFileName.isEmpty(), "ODBFilter::implImport: no URL given!");
bRet = !sFileName.isEmpty();
@@ -326,7 +321,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
uno::Reference<XComponent> xModel(GetModel());
ErrCode nRet = ReadThroughComponent( xStorage
,xModel
- ,"settings.xml"
+ ,u"settings.xml"_ustr
,GetComponentContext()
,*this
);
@@ -334,7 +329,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
if ( nRet == ERRCODE_NONE )
nRet = ReadThroughComponent( xStorage
,xModel
- ,"content.xml"
+ ,u"content.xml"_ustr
,GetComponentContext()
,*this
);
@@ -374,9 +369,6 @@ public:
{
}
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
-
virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override
{
@@ -396,10 +388,6 @@ public:
{
}
- virtual void SAL_CALL startFastElement(
- sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) override {}
-
virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override
{
@@ -410,12 +398,10 @@ public:
case XML_ELEMENT(OOO, XML_STYLES):
rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
return rImport.CreateStylesContext(false);
- break;
case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES):
case XML_ELEMENT(OOO, XML_AUTOMATIC_STYLES):
rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
return rImport.CreateStylesContext(true);
- break;
}
return nullptr;
}
@@ -429,9 +415,6 @@ public:
{
}
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
-
virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override
{
@@ -456,9 +439,6 @@ public:
{
}
- virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
-
virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override
{
@@ -468,15 +448,12 @@ public:
case XML_ELEMENT(OFFICE, XML_BODY):
case XML_ELEMENT(OOO, XML_BODY):
return new DBXMLDocumentBodyContext(rImport);
- break;
case XML_ELEMENT(OFFICE, XML_SCRIPTS):
return new XMLScriptContext(GetImport(), rImport.GetModel());
- break;
case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES):
case XML_ELEMENT(OOO, XML_AUTOMATIC_STYLES):
rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
return rImport.CreateStylesContext(true);
- break;
default: break;
}
return nullptr;
@@ -513,17 +490,15 @@ SvXMLImportContext* ODBFilter::CreateFastContext(sal_Int32 nElement,
void ODBFilter::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
{
- const PropertyValue *pIter = aViewProps.getConstArray();
- const PropertyValue *pEnd = pIter + aViewProps.getLength();
- for (; pIter != pEnd; ++pIter)
+ for (auto& prop : aViewProps)
{
- if ( pIter->Name == "Queries" )
+ if (prop.Name == "Queries")
{
- fillPropertyMap(pIter->Value,m_aQuerySettings);
+ fillPropertyMap(prop.Value, m_aQuerySettings);
}
- else if ( pIter->Name == "Tables" )
+ else if (prop.Name == "Tables")
{
- fillPropertyMap(pIter->Value,m_aTablesSettings);
+ fillPropertyMap(prop.Value, m_aTablesSettings);
}
}
}
@@ -531,17 +506,15 @@ void ODBFilter::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
void ODBFilter::SetConfigurationSettings(const Sequence<PropertyValue>& aConfigProps)
{
- const PropertyValue *pIter = aConfigProps.getConstArray();
- const PropertyValue *pEnd = pIter + aConfigProps.getLength();
- for (; pIter != pEnd; ++pIter)
+ for (auto& prop : aConfigProps)
{
- if ( pIter->Name == "layout-settings" )
+ if (prop.Name == "layout-settings")
{
Sequence<PropertyValue> aWindows;
- pIter->Value >>= aWindows;
+ prop.Value >>= aWindows;
uno::Reference<XPropertySet> xProp(getDataSource());
if ( xProp.is() )
- xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aWindows));
+ xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,Any(aWindows));
}
}
}
@@ -551,13 +524,11 @@ void ODBFilter::fillPropertyMap(const Any& _rValue,TPropertyNameMap& _rMap)
{
Sequence<PropertyValue> aWindows;
_rValue >>= aWindows;
- const PropertyValue *pIter = aWindows.getConstArray();
- const PropertyValue *pEnd = pIter + aWindows.getLength();
- for (; pIter != pEnd; ++pIter)
+ for (auto& window : aWindows)
{
Sequence<PropertyValue> aValue;
- pIter->Value >>= aValue;
- _rMap.emplace( pIter->Name,aValue );
+ window.Value >>= aValue;
+ _rMap.emplace(window.Name, aValue);
}
}
@@ -624,7 +595,7 @@ void ODBFilter::setPropertyInfo()
{
try
{
- xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(aInfo));
+ xDataSource->setPropertyValue(PROPERTY_INFO,Any(aInfo));
}
catch (const Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlfilter.hxx b/dbaccess/source/filter/xml/xmlfilter.hxx
index 9e5e3965ec37..3d362bf869c3 100644
--- a/dbaccess/source/filter/xml/xmlfilter.hxx
+++ b/dbaccess/source/filter/xml/xmlfilter.hxx
@@ -17,20 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLFILTER_HXX
-#define INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLFILTER_HXX
+#pragma once
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlprmap.hxx>
#include <map>
-#include <memory>
namespace dbaxml
@@ -81,7 +78,7 @@ protected:
virtual SvXMLImportContext *CreateFastContext(sal_Int32 Element,
const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ) override;
- virtual ~ODBFilter() throw() override;
+ virtual ~ODBFilter() noexcept override;
public:
explicit ODBFilter( const Reference< XComponentContext >& _rxContext );
@@ -119,6 +116,5 @@ public:
};
} // namespace dbaxml
-#endif // INCLUDED_DBACCESS_SOURCE_FILTER_XML_XMLFILTER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/inc/OAuthenticationContinuation.hxx b/dbaccess/source/inc/OAuthenticationContinuation.hxx
index ce933b31b545..dbb6c571c4d2 100644
--- a/dbaccess/source/inc/OAuthenticationContinuation.hxx
+++ b/dbaccess/source/inc/OAuthenticationContinuation.hxx
@@ -17,14 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_INC_OAUTHENTICATIONCONTINUATION_HXX
-#define INCLUDED_DBACCESS_SOURCE_INC_OAUTHENTICATIONCONTINUATION_HXX
+#pragma once
+
+#include <config_options.h>
#include <dbadllapi.hxx>
#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp>
-#include <com/sun/star/ucb/RememberAuthentication.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
#include <comphelper/interaction.hxx>
@@ -32,10 +31,10 @@
namespace dbaccess
{
-class OOO_DLLPUBLIC_DBA OAuthenticationContinuation :
+class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBA) OAuthenticationContinuation :
public comphelper::OInteraction< css::ucb::XInteractionSupplyAuthentication >
{
- bool m_bRemberPassword : 1; // remember the password for this session ?
+ bool m_bRememberPassword : 1; // remember the password for this session ?
bool m_bCanSetUserName;
OUString m_sUser; // the user
@@ -60,11 +59,9 @@ public:
void setCanChangeUserName( bool bVal ) { m_bCanSetUserName = bVal; }
const OUString& getUser() const { return m_sUser; }
const OUString& getPassword() const { return m_sPassword; }
- bool getRememberPassword() const { return m_bRemberPassword; }
+ bool getRememberPassword() const { return m_bRememberPassword; }
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_INC_OAUTHENTICATIONCONTINUATION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/inc/apitools.hxx b/dbaccess/source/inc/apitools.hxx
index d8e2be8cec8f..0f4f2c9bec1c 100644
--- a/dbaccess/source/inc/apitools.hxx
+++ b/dbaccess/source/inc/apitools.hxx
@@ -17,22 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_INC_APITOOLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_INC_APITOOLS_HXX
+#pragma once
#include <sal/config.h>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/component.hxx>
+#include <cppuhelper/compbase.hxx>
#include <osl/mutex.hxx>
-#include <osl/diagnose.h>
-#include <comphelper/sequence.hxx>
-#include <strings.hxx>
// OSubComponent - a component which holds a hard ref to its parent
// and is been hold itself (by the parent) with a weak ref
-class OSubComponent : public ::cppu::OComponentHelper
+class OSubComponent : public ::cppu::WeakComponentImplHelper<>
{
protected:
// the parent must support the tunnel implementation
@@ -43,155 +37,12 @@ public:
OSubComponent(::osl::Mutex& _rMutex,
const css::uno::Reference< css::uno::XInterface >& _xParent);
-// css::lang::XTypeProvider
- virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
-
// css::uno::XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL release() noexcept override;
operator css::uno::Reference< css::uno::XInterface > () const
{ return static_cast<css::uno::XWeak *>(const_cast<OSubComponent *>(this)); }
};
-// helper for implementing the XServiceInfo interface
-
-// (internal - not to be used outside - usually)
-#define IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \
- OUString SAL_CALL classname::getImplementationName( ) \
- { \
- return implasciiname; \
- } \
-
-
-#define IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \
- sal_Bool SAL_CALL classname::supportsService( const OUString& _rServiceName ) \
- { \
- const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames()); \
- for (const OUString& s : aSupported) \
- if (s == _rServiceName) \
- return true; \
- \
- return false; \
- } \
-
-
-
-#define IMPLEMENT_SERVICE_INFO1(classname, implasciiname, serviceasciiname) \
- IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \
- IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \
- css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \
- { \
- return { serviceasciiname }; \
- } \
-
-
-#define IMPLEMENT_SERVICE_INFO2(classname, implasciiname, serviceasciiname1, serviceasciiname2) \
- IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \
- IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \
- css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \
- { \
- return { serviceasciiname1, serviceasciiname2 }; \
- }
-
-
-
-#define IMPLEMENT_SERVICE_INFO3(classname, implasciiname, serviceasciiname1, serviceasciiname2, serviceasciiname3) \
- IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \
- IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \
- css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \
- { \
- return { serviceasciiname1, serviceasciiname2, serviceasciiname3 }; \
- } \
-
-
-// XTypeProvider helpers
-
-#define IMPLEMENT_GETTYPES2( classname, baseclass1, baseclass2 ) \
- css::uno::Sequence< css::uno::Type > classname::getTypes() \
- { \
- return ::comphelper::concatSequences( \
- baseclass1::getTypes( ), \
- baseclass2::getTypes( ) \
- ); \
- }
-
-#define IMPLEMENT_GETTYPES3( classname, baseclass1, baseclass2, baseclass3 ) \
- css::uno::Sequence< css::uno::Type > classname::getTypes() \
- { \
- return ::comphelper::concatSequences( \
- baseclass1::getTypes( ), \
- baseclass2::getTypes( ), \
- baseclass3::getTypes( ) \
- ); \
- }
-
-// helper for declaring/implementing classes based on the OPropertyContainer and an OPropertyArrayUsageHelper
-#define DECLARE_PROPERTYCONTAINER_DEFAULTS( ) \
- virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; \
- virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; \
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override
-
-#define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname , baseclass1) \
- css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL classname::getPropertySetInfo() \
- { \
- Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); \
- return xInfo; \
- } \
- ::cppu::IPropertyArrayHelper& classname::getInfoHelper() \
- { \
- return *baseclass1::getArrayHelper(); \
- } \
- ::cppu::IPropertyArrayHelper* classname::createArrayHelper( ) const \
- { \
- css::uno::Sequence< css::beans::Property > aProps; \
- describeProperties(aProps); \
- return new ::cppu::OPropertyArrayHelper(aProps); \
- }
-#define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( classname ) \
- IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname, classname )
-
-// helper for implementing the createArrayHelper
-#define BEGIN_PROPERTY_SEQUENCE(count) \
- css::uno::Sequence< css::beans::Property> aDescriptor(count); \
- css::beans::Property* pDesc = aDescriptor.getArray(); \
- sal_Int32 nPos = 0; \
-
-#define BEGIN_PROPERTY_HELPER(count) \
- BEGIN_PROPERTY_SEQUENCE(count)
-
-#define DECL_PROP_IMPL(varname, cpputype) \
- pDesc[nPos++] = css::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cpputype,
-
-#define DECL_PROP0(varname, type) \
- DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) 0)
-
-#define DECL_PROP0_BOOL(varname) \
- DECL_PROP_IMPL(varname, cppu::UnoType<bool>::get()) 0)
-
-#define DECL_PROP1(varname, type, attrib1) \
- DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) css::beans::PropertyAttribute::attrib1)
-
-#define DECL_PROP1_BOOL(varname, attrib1) \
- DECL_PROP_IMPL(varname, cppu::UnoType<bool>::get()) css::beans::PropertyAttribute::attrib1)
-
-#define DECL_PROP2_IFACE(varname, iface, attrib1, attrib2) \
- DECL_PROP_IMPL(varname, cppu::UnoType<iface>::get()) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2)
-
-#define DECL_PROP2(varname, type, attrib1, attrib2) \
- DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2)
-
-#define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \
- DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2 | css::beans::PropertyAttribute::attrib3)
-
-#define END_PROPERTY_SEQUENCE() \
- OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?"); \
-
-#define END_PROPERTY_HELPER() \
- END_PROPERTY_SEQUENCE() \
- return new ::cppu::OPropertyArrayHelper(aDescriptor);
-
-#endif // INCLUDED_DBACCESS_SOURCE_INC_APITOOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 334b297b0bf5..c6529ab6c34a 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_INC_DSNTYPES_HXX
-#define INCLUDED_DBACCESS_SOURCE_INC_DSNTYPES_HXX
+#pragma once
#include <sal/config.h>
+#include <string_view>
#include <vector>
#include <dbadllapi.hxx>
@@ -55,7 +55,6 @@ enum DATASOURCE_TYPE
DST_EVOLUTION_LDAP = 19,
DST_KAB = 20,
DST_MACAB = 21,
- DST_MSACCESS_2007 = 22,
DST_EMBEDDED_HSQLDB = 23,
DST_MYSQL_NATIVE = 24,
DST_MYSQL_NATIVE_DIRECT = 25,
@@ -63,6 +62,8 @@ enum DATASOURCE_TYPE
DST_EMBEDDED_FIREBIRD = 27,
DST_POSTGRES = 28,
DST_WRITER = 29,
+ DST_EMBEDDED_UNKNOWN = 30, /// for all embedded addons driver
+
DST_USERDEFINE1, /// first user defined driver
DST_USERDEFINE2,
@@ -96,9 +97,10 @@ enum DATASOURCE_TYPE
#define PAGE_DBSETUPWIZARD_FINAL 16
#define PAGE_DBSETUPWIZARD_USERDEFINED 17
#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18
+#define PAGE_DBSETUPWIZARD_POSTGRES 19
// ODsnTypeCollection
-class OOO_DLLPUBLIC_DBA ODsnTypeCollection final
+class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBA) ODsnTypeCollection final
{
std::vector<OUString> m_aDsnTypesDisplayNames; /// user readable names for the datasource types
@@ -117,47 +119,47 @@ public:
~ODsnTypeCollection();
/// get the datasource type display name from a DSN string
- OUString getTypeDisplayName(const OUString& _sURL) const;
+ OUString getTypeDisplayName(std::u16string_view _sURL) const;
/// on a given string, cut the type prefix and return the result
- OUString cutPrefix(const OUString& _sURL) const;
+ OUString cutPrefix(std::u16string_view _sURL) const;
/// on a given string, return the type prefix
- OUString getPrefix(const OUString& _sURL) const;
+ OUString getPrefix(std::u16string_view _sURL) const;
/// determines whether there is a driver for the given URL prefix/pattern
- bool hasDriver( const char* _pAsciiPattern ) const;
+ bool hasDriver( std::u16string_view _rAsciiPattern ) const;
/// on a given string, return the Java Driver Class
- OUString getJavaDriverClass(const OUString& _sURL) const;
+ OUString getJavaDriverClass(std::u16string_view _sURL) const;
/// returns the media type of a file based database
- OUString getMediaType(const OUString& _sURL) const;
+ OUString getMediaType(std::u16string_view _sURL) const;
/// returns the dsn prefix for a given media type
- OUString getDatasourcePrefixFromMediaType(const OUString& _sMediaType, const OUString& _sExtension );
+ OUString getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType, std::u16string_view _sExtension );
void extractHostNamePort(const OUString& _rDsn,OUString& _sDatabaseName,OUString& _rHostname,sal_Int32& _nPortNumber) const;
/// check if the given data source allows creation of tables
- bool supportsTableCreation(const OUString& _sURL) const;
+ bool supportsTableCreation(std::u16string_view _sURL) const;
/// check if the given data source allows to show column description.
- bool supportsColumnDescription(const OUString& _sURL) const;
+ bool supportsColumnDescription(std::u16string_view _sURL) const;
// check if a Browse button may be shown to insert connection url
- bool supportsBrowsing(const OUString& _sURL) const;
+ bool supportsBrowsing(std::u16string_view _sURL) const;
// check if a Create New Database button may be shown to insert connection url
- bool supportsDBCreation(const OUString& _sURL) const;
+ bool supportsDBCreation(std::u16string_view _sURL) const;
/// check if the given data source type is based on the file system - i.e. the URL is a prefix plus a file URL
- bool isFileSystemBased(const OUString& _sURL) const;
+ bool isFileSystemBased(std::u16string_view _sURL) const;
- bool isConnectionUrlRequired(const OUString& _sURL) const;
+ bool isConnectionUrlRequired(std::u16string_view _sURL) const;
/// checks if the given data source type embeds its data into the database document
- static bool isEmbeddedDatabase( const OUString& _sURL );
+ static bool isEmbeddedDatabase( std::u16string_view _sURL );
static OUString getEmbeddedDatabase();
@@ -167,24 +169,24 @@ public:
/** returns default settings for newly created databases of the given type.
*/
css::uno::Sequence< css::beans::PropertyValue>
- getDefaultDBSettings( const OUString& _sURL ) const;
+ getDefaultDBSettings( std::u16string_view _sURL ) const;
/// get access to the first element of the types collection
inline TypeIterator begin() const;
/// get access to the (last + 1st) element of the types collection
inline TypeIterator end() const;
- void fillPageIds(const OUString& _sURL,std::vector<sal_Int16>& _rOutPathIds) const;
+ void fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const;
- DATASOURCE_TYPE determineType(const OUString& _rDsn) const;
+ DATASOURCE_TYPE determineType(std::u16string_view _rDsn) const;
- sal_Int32 getIndexOf(const OUString& _sURL) const;
+ sal_Int32 getIndexOf(std::u16string_view _sURL) const;
sal_Int32 size() const;
- OUString getType(const OUString& _sURL) const;
+ OUString getType(std::u16string_view _sURL) const;
};
//- ODsnTypeCollection::TypeIterator
-class OOO_DLLPUBLIC_DBA ODsnTypeCollection::TypeIterator
+class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBA) ODsnTypeCollection::TypeIterator
{
friend class ODsnTypeCollection;
@@ -215,6 +217,4 @@ inline ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const { return
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_INC_DSNTYPES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/inc/stringconstants.hxx b/dbaccess/source/inc/stringconstants.hxx
index 9b7e732fee8f..9ff840e92a1c 100644
--- a/dbaccess/source/inc/stringconstants.hxx
+++ b/dbaccess/source/inc/stringconstants.hxx
@@ -17,158 +17,149 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_INC_STRINGCONSTANTS_HRC
-#define INCLUDED_DBACCESS_SOURCE_INC_STRINGCONSTANTS_HRC
+#pragma once
// property ids
-#define PROPERTY_ID_TITLE 1
-#define PROPERTY_ID_URL 2
-#define PROPERTY_ID_INFO 4
-#define PROPERTY_ID_ISPASSWORDREQUIRED 5
-#define PROPERTY_ID_TABLEFILTER 6
-#define PROPERTY_ID_NAME 7
-#define PROPERTY_ID_SCHEMANAME 8
-#define PROPERTY_ID_CATALOGNAME 9
-#define PROPERTY_ID_PRIVILEGES 10
-#define PROPERTY_ID_ESCAPE_PROCESSING 11
-#define PROPERTY_ID_COMMAND 12
-#define PROPERTY_ID_TYPE 13
-#define PROPERTY_ID_TYPENAME 14
-#define PROPERTY_ID_PRECISION 15
-#define PROPERTY_ID_SCALE 16
-#define PROPERTY_ID_ISNULLABLE 17
-#define PROPERTY_ID_ISAUTOINCREMENT 18
-#define PROPERTY_ID_ISROWVERSION 19
-#define PROPERTY_ID_DESCRIPTION 20
-#define PROPERTY_ID_DEFAULTVALUE 21
-#define PROPERTY_ID_NUMBERFORMAT 22
-#define PROPERTY_ID_QUERYTIMEOUT 23
-#define PROPERTY_ID_MAXFIELDSIZE 24
-#define PROPERTY_ID_MAXROWS 25
-#define PROPERTY_ID_CURSORNAME 26
-#define PROPERTY_ID_RESULTSETCONCURRENCY 27
-#define PROPERTY_ID_RESULTSETTYPE 28
-#define PROPERTY_ID_FETCHDIRECTION 29
-#define PROPERTY_ID_FETCHSIZE 30
-#define PROPERTY_ID_USEBOOKMARKS 31
-#define PROPERTY_ID_ISSEARCHABLE 32
-#define PROPERTY_ID_ISCURRENCY 33
-#define PROPERTY_ID_ISSIGNED 34
-#define PROPERTY_ID_DISPLAYSIZE 35
-#define PROPERTY_ID_LABEL 36
-#define PROPERTY_ID_ISREADONLY 37
-#define PROPERTY_ID_ISWRITABLE 38
-#define PROPERTY_ID_ISDEFINITELYWRITABLE 39
-#define PROPERTY_ID_VALUE 40
-#define PROPERTY_ID_TABLENAME 41
-#define PROPERTY_ID_ISCASESENSITIVE 42
-#define PROPERTY_ID_SERVICENAME 43
-#define PROPERTY_ID_ISBOOKMARKABLE 44
-#define PROPERTY_ID_CANUPDATEINSERTEDROWS 45
-#define PROPERTY_ID_ISSET 46
-#define PROPERTY_ID_ISOUTPARAMETER 47
-#define PROPERTY_ID_NUMBERFORMATSSUPPLIER 48
-#define PROPERTY_ID_ISCALCULATED 49
-#define PROPERTY_ID_DATASOURCENAME 50
-#define PROPERTY_ID_TRANSACTIONISOLATION 51
-#define PROPERTY_ID_TYPEMAP 52
-#define PROPERTY_ID_USER 53
-#define PROPERTY_ID_PASSWORD 54
-#define PROPERTY_ID_COMMAND_TYPE 55
-#define PROPERTY_ID_ACTIVECOMMAND 56
-#define PROPERTY_ID_ACTIVE_CONNECTION 57
-#define PROPERTY_ID_FILTER 58
-#define PROPERTY_ID_APPLYFILTER 59
-#define PROPERTY_ID_ORDER 60
-#define PROPERTY_ID_ISMODIFIED 61
-#define PROPERTY_ID_ISNEW 62
-#define PROPERTY_ID_ROWCOUNT 63
-#define PROPERTY_ID_ISROWCOUNTFINAL 64
-#define PROPERTY_ID_HELPFILENAME 65
-#define PROPERTY_ID_REALNAME 66
-#define PROPERTY_ID_HIDDEN 67
-#define PROPERTY_ID_ALIGN 68
-#define PROPERTY_ID_WIDTH 69
-#define PROPERTY_ID_TABLETYPEFILTER 70
-#define PROPERTY_ID_DATABASE_LOCATION 71
-#define PROPERTY_ID_FONT 72
-#define PROPERTY_ID_ROW_HEIGHT 73
-#define PROPERTY_ID_TEXTCOLOR 74
-#define PROPERTY_ID_UPDATE_TABLENAME 75
-#define PROPERTY_ID_UPDATE_SCHEMANAME 76
-#define PROPERTY_ID_UPDATE_CATALOGNAME 77
-#define PROPERTY_ID_CONTROLMODEL 78
-#define PROPERTY_ID_RELATIVEPOSITION 79
-#define PROPERTY_ID_ISASCENDING 80
-#define PROPERTY_ID_RELATEDCOLUMN 81
-#define PROPERTY_ID_ISUNIQUE 82
-#define PROPERTY_ID_ISPRIMARYKEYINDEX 83
-#define PROPERTY_ID_IGNORERESULT 84
-#define PROPERTY_ID_DELETERULE 85
-#define PROPERTY_ID_UPDATERULE 86
-#define PROPERTY_ID_REFERENCEDTABLE 87
-#define PROPERTY_ID_REFERENCEDCOLUMN 88
-#define PROPERTY_ID_PARENTWINDOW 89
-#define PROPERTY_ID_SQLEXCEPTION 90
-#define PROPERTY_ID_ISHIDDEN 91
-#define PROPERTY_ID_SUPPRESSVERSIONCL 92
-#define PROPERTY_ID_LAYOUTINFORMATION 93
-#define PROPERTY_ID_TEXTLINECOLOR 94
-#define PROPERTY_ID_TEXTEMPHASIS 95
-#define PROPERTY_ID_TEXTRELIEF 96
-#define PROPERTY_ID_HELPTEXT 97
-#define PROPERTY_ID_CONTROLDEFAULT 98
-#define PROPERTY_ID_AUTOINCREMENTCREATION 99
-#define PROPERTY_ID_SPECIAL_OPTIONS 100
-#define PROPERTY_ID_FONTCHARWIDTH 101
-#define PROPERTY_ID_FONTCHARSET 102
-#define PROPERTY_ID_FONTFAMILY 103
-#define PROPERTY_ID_FONTHEIGHT 104
-#define PROPERTY_ID_FONTKERNING 105
-#define PROPERTY_ID_FONTNAME 106
-#define PROPERTY_ID_FONTORIENTATION 107
-#define PROPERTY_ID_FONTPITCH 108
-#define PROPERTY_ID_FONTSLANT 109
-#define PROPERTY_ID_FONTSTRIKEOUT 110
-#define PROPERTY_ID_FONTSTYLENAME 111
-#define PROPERTY_ID_FONTUNDERLINE 112
-#define PROPERTY_ID_FONTWEIGHT 113
-#define PROPERTY_ID_FONTWIDTH 114
-#define PROPERTY_ID_FONTWORDLINEMODE 115
-#define PROPERTY_ID_FONTTYPE 116
-#define PROPERTY_ID_PERSISTENT_NAME 117
-#define PROPERTY_ID_ORIGINAL 118
-#define PROPERTY_ID_TABSTOP 119
-#define PROPERTY_ID_DEFAULTCONTROL 120
-#define PROPERTY_ID_ENABLED 121
-#define PROPERTY_ID_BORDER 122
-#define PROPERTY_ID_COLUMN 123
-#define PROPERTY_ID_AS_TEMPLATE 124
-#define PROPERTY_ID_IS_FORM 125
-#define PROPERTY_ID_HAVING_CLAUSE 126
-#define PROPERTY_ID_GROUP_BY 127
-#define PROPERTY_ID_EDIT_WIDTH 128
-#define PROPERTY_ID_SETTINGS 129
-#define PROPERTY_ID_CONNECTION_RESOURCE 130
-#define PROPERTY_ID_RESULT_SET 131
-#define PROPERTY_ID_SELECTION 132
-#define PROPERTY_ID_BOOKMARK_SELECTION 133
-#define PROPERTY_ID_COLUMN_NAME 134
-#define PROPERTY_ID_CONNECTION_INFO 135
-#define PROPERTY_ID_HEADER_LINE 136
-#define PROPERTY_ID_FIELD_DELIMITER 137
-#define PROPERTY_ID_STRING_DELIMITER 138
-#define PROPERTY_ID_DECIMAL_DELIMITER 139
-#define PROPERTY_ID_THOUSAND_DELIMITER 140
-#define PROPERTY_ID_ENCODING 141
-#define PROPERTY_ID_HELP_URL 142
-#define PROPERTY_ID_PERSISTENT_PATH 143
-#define PROPERTY_ID_CURRENT_QUERY_DESIGN 144
-#define PROPERTY_ID_SINGLESELECTQUERYCOMPOSER 145
-#define PROPERTY_ID_PROPCHANGE_NOTIFY 146
-#define PROPERTY_ID_AUTOGROW 147
-
-#endif
+enum PropertyId
+{
+ PROPERTY_ID_URL = 2,
+ PROPERTY_ID_INFO = 4,
+ PROPERTY_ID_ISPASSWORDREQUIRED = 5,
+ PROPERTY_ID_TABLEFILTER = 6,
+ PROPERTY_ID_NAME = 7,
+ PROPERTY_ID_SCHEMANAME = 8,
+ PROPERTY_ID_CATALOGNAME = 9,
+ PROPERTY_ID_PRIVILEGES = 10,
+ PROPERTY_ID_ESCAPE_PROCESSING = 11,
+ PROPERTY_ID_COMMAND = 12,
+ PROPERTY_ID_TYPE = 13,
+ PROPERTY_ID_TYPENAME = 14,
+ PROPERTY_ID_PRECISION = 15,
+ PROPERTY_ID_SCALE = 16,
+ PROPERTY_ID_ISNULLABLE = 17,
+ PROPERTY_ID_ISAUTOINCREMENT = 18,
+ PROPERTY_ID_ISROWVERSION = 19,
+ PROPERTY_ID_DESCRIPTION = 20,
+ PROPERTY_ID_DEFAULTVALUE = 21,
+ PROPERTY_ID_NUMBERFORMAT = 22,
+ PROPERTY_ID_QUERYTIMEOUT = 23,
+ PROPERTY_ID_MAXFIELDSIZE = 24,
+ PROPERTY_ID_MAXROWS = 25,
+ PROPERTY_ID_CURSORNAME = 26,
+ PROPERTY_ID_RESULTSETCONCURRENCY = 27,
+ PROPERTY_ID_RESULTSETTYPE = 28,
+ PROPERTY_ID_FETCHDIRECTION = 29,
+ PROPERTY_ID_FETCHSIZE = 30,
+ PROPERTY_ID_USEBOOKMARKS = 31,
+ PROPERTY_ID_ISSEARCHABLE = 32,
+ PROPERTY_ID_ISCURRENCY = 33,
+ PROPERTY_ID_ISSIGNED = 34,
+ PROPERTY_ID_DISPLAYSIZE = 35,
+ PROPERTY_ID_LABEL = 36,
+ PROPERTY_ID_ISREADONLY = 37,
+ PROPERTY_ID_ISWRITABLE = 38,
+ PROPERTY_ID_ISDEFINITELYWRITABLE = 39,
+ PROPERTY_ID_VALUE = 40,
+ PROPERTY_ID_TABLENAME = 41,
+ PROPERTY_ID_ISCASESENSITIVE = 42,
+ PROPERTY_ID_SERVICENAME = 43,
+ PROPERTY_ID_ISBOOKMARKABLE = 44,
+ PROPERTY_ID_CANUPDATEINSERTEDROWS = 45,
+ PROPERTY_ID_NUMBERFORMATSSUPPLIER = 48,
+ PROPERTY_ID_DATASOURCENAME = 50,
+ PROPERTY_ID_TRANSACTIONISOLATION = 51,
+ PROPERTY_ID_TYPEMAP = 52,
+ PROPERTY_ID_USER = 53,
+ PROPERTY_ID_PASSWORD = 54,
+ PROPERTY_ID_COMMAND_TYPE = 55,
+ PROPERTY_ID_ACTIVECOMMAND = 56,
+ PROPERTY_ID_ACTIVE_CONNECTION = 57,
+ PROPERTY_ID_FILTER = 58,
+ PROPERTY_ID_APPLYFILTER = 59,
+ PROPERTY_ID_ORDER = 60,
+ PROPERTY_ID_ISMODIFIED = 61,
+ PROPERTY_ID_ISNEW = 62,
+ PROPERTY_ID_ROWCOUNT = 63,
+ PROPERTY_ID_ISROWCOUNTFINAL = 64,
+ PROPERTY_ID_REALNAME = 66,
+ PROPERTY_ID_HIDDEN = 67,
+ PROPERTY_ID_ALIGN = 68,
+ PROPERTY_ID_WIDTH = 69,
+ PROPERTY_ID_TABLETYPEFILTER = 70,
+ PROPERTY_ID_DATABASE_LOCATION = 71,
+ PROPERTY_ID_FONT = 72,
+ PROPERTY_ID_ROW_HEIGHT = 73,
+ PROPERTY_ID_TEXTCOLOR = 74,
+ PROPERTY_ID_UPDATE_TABLENAME = 75,
+ PROPERTY_ID_UPDATE_SCHEMANAME = 76,
+ PROPERTY_ID_UPDATE_CATALOGNAME = 77,
+ PROPERTY_ID_CONTROLMODEL = 78,
+ PROPERTY_ID_RELATIVEPOSITION = 79,
+ PROPERTY_ID_ISASCENDING = 80,
+ PROPERTY_ID_RELATEDCOLUMN = 81,
+ PROPERTY_ID_ISUNIQUE = 82,
+ PROPERTY_ID_ISPRIMARYKEYINDEX = 83,
+ PROPERTY_ID_IGNORERESULT = 84,
+ PROPERTY_ID_DELETERULE = 85,
+ PROPERTY_ID_UPDATERULE = 86,
+ PROPERTY_ID_REFERENCEDTABLE = 87,
+ PROPERTY_ID_SQLEXCEPTION = 90,
+ PROPERTY_ID_SUPPRESSVERSIONCL = 92,
+ PROPERTY_ID_LAYOUTINFORMATION = 93,
+ PROPERTY_ID_TEXTLINECOLOR = 94,
+ PROPERTY_ID_TEXTEMPHASIS = 95,
+ PROPERTY_ID_TEXTRELIEF = 96,
+ PROPERTY_ID_HELPTEXT = 97,
+ PROPERTY_ID_CONTROLDEFAULT = 98,
+ PROPERTY_ID_AUTOINCREMENTCREATION = 99,
+ PROPERTY_ID_FONTCHARWIDTH = 101,
+ PROPERTY_ID_FONTCHARSET = 102,
+ PROPERTY_ID_FONTFAMILY = 103,
+ PROPERTY_ID_FONTHEIGHT = 104,
+ PROPERTY_ID_FONTKERNING = 105,
+ PROPERTY_ID_FONTNAME = 106,
+ PROPERTY_ID_FONTORIENTATION = 107,
+ PROPERTY_ID_FONTPITCH = 108,
+ PROPERTY_ID_FONTSLANT = 109,
+ PROPERTY_ID_FONTSTRIKEOUT = 110,
+ PROPERTY_ID_FONTSTYLENAME = 111,
+ PROPERTY_ID_FONTUNDERLINE = 112,
+ PROPERTY_ID_FONTWEIGHT = 113,
+ PROPERTY_ID_FONTWIDTH = 114,
+ PROPERTY_ID_FONTWORDLINEMODE = 115,
+ PROPERTY_ID_FONTTYPE = 116,
+ PROPERTY_ID_PERSISTENT_NAME = 117,
+ PROPERTY_ID_ORIGINAL = 118,
+ PROPERTY_ID_TABSTOP = 119,
+ PROPERTY_ID_DEFAULTCONTROL = 120,
+ PROPERTY_ID_ENABLED = 121,
+ PROPERTY_ID_BORDER = 122,
+ PROPERTY_ID_COLUMN = 123,
+ PROPERTY_ID_AS_TEMPLATE = 124,
+ PROPERTY_ID_IS_FORM = 125,
+ PROPERTY_ID_HAVING_CLAUSE = 126,
+ PROPERTY_ID_GROUP_BY = 127,
+ PROPERTY_ID_EDIT_WIDTH = 128,
+ PROPERTY_ID_SETTINGS = 129,
+ PROPERTY_ID_CONNECTION_RESOURCE = 130,
+ PROPERTY_ID_RESULT_SET = 131,
+ PROPERTY_ID_SELECTION = 132,
+ PROPERTY_ID_BOOKMARK_SELECTION = 133,
+ PROPERTY_ID_COLUMN_NAME = 134,
+ PROPERTY_ID_CONNECTION_INFO = 135,
+ PROPERTY_ID_HEADER_LINE = 136,
+ PROPERTY_ID_FIELD_DELIMITER = 137,
+ PROPERTY_ID_STRING_DELIMITER = 138,
+ PROPERTY_ID_DECIMAL_DELIMITER = 139,
+ PROPERTY_ID_THOUSAND_DELIMITER = 140,
+ PROPERTY_ID_ENCODING = 141,
+ PROPERTY_ID_HELP_URL = 142,
+ PROPERTY_ID_PERSISTENT_PATH = 143,
+ PROPERTY_ID_CURRENT_QUERY_DESIGN = 144,
+ PROPERTY_ID_SINGLESELECTQUERYCOMPOSER = 145,
+ PROPERTY_ID_PROPCHANGE_NOTIFY = 146,
+ PROPERTY_ID_AUTOGROW = 147
+};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/sdbtools/connection/connectiontools.cxx b/dbaccess/source/sdbtools/connection/connectiontools.cxx
index 65db1c64907a..c0189744700c 100644
--- a/dbaccess/source/sdbtools/connection/connectiontools.cxx
+++ b/dbaccess/source/sdbtools/connection/connectiontools.cxx
@@ -89,7 +89,7 @@ namespace sdbtools
OUString SAL_CALL ConnectionTools::getImplementationName()
{
- return "com.sun.star.comp.dbaccess.ConnectionTools";
+ return u"com.sun.star.comp.dbaccess.ConnectionTools"_ustr;
}
sal_Bool SAL_CALL ConnectionTools::supportsService(const OUString & ServiceName)
@@ -99,7 +99,7 @@ namespace sdbtools
Sequence< OUString > SAL_CALL ConnectionTools::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.tools.ConnectionTools" };
+ return { u"com.sun.star.sdb.tools.ConnectionTools"_ustr };
}
void SAL_CALL ConnectionTools::initialize(const Sequence< Any > & _rArguments)
@@ -113,7 +113,7 @@ namespace sdbtools
else
{
::comphelper::NamedValueCollection aArguments( _rArguments );
- aArguments.get( "Connection" ) >>= xConnection;
+ aArguments.get( u"Connection"_ustr ) >>= xConnection;
}
if ( !xConnection.is() )
throw IllegalArgumentException();
@@ -127,6 +127,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_dbaccess_ConnectionTools_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
{
- return cppu::acquire(static_cast<cppu::OWeakObject*>(new sdbtools::ConnectionTools(context)));
+ return cppu::acquire(new sdbtools::ConnectionTools(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx
index 5ec2c22e8ea4..fe1caa97289a 100644
--- a/dbaccess/source/sdbtools/connection/objectnames.cxx
+++ b/dbaccess/source/sdbtools/connection/objectnames.cxx
@@ -33,6 +33,7 @@
#include <osl/diagnose.h>
#include <memory>
+#include <utility>
namespace sdbtools
{
@@ -159,18 +160,18 @@ namespace sdbtools
{
}
- static ::connectivity::ErrorCondition validateName_getErrorCondition( const OUString& _rName )
+ static ::connectivity::ErrorCondition validateName_getErrorCondition( std::u16string_view _rName )
{
- if ( ( _rName.indexOf( u'"' ) >= 0 )
- || ( _rName.indexOf( u'\'' ) >= 0 )
- || ( _rName.indexOf( u'`' ) >= 0 )
- || ( _rName.indexOf( u'\x0091' ) >= 0 )
- || ( _rName.indexOf( u'\x0092' ) >= 0 )
- || ( _rName.indexOf( u'\x00B4' ) >= 0 ) // removed unparsable chars
+ if ( ( _rName.find( u'"' ) != std::u16string_view::npos )
+ || ( _rName.find( u'\'' ) != std::u16string_view::npos )
+ || ( _rName.find( u'`' ) != std::u16string_view::npos )
+ || ( _rName.find( u'\x0091' ) != std::u16string_view::npos )
+ || ( _rName.find( u'\x0092' ) != std::u16string_view::npos )
+ || ( _rName.find( u'\x00B4' ) != std::u16string_view::npos ) // removed unparsable chars
)
return ErrorCondition::DB_QUERY_NAME_WITH_QUOTES;
- if ( _rName.indexOf( '/') >= 0 )
+ if ( _rName.find( '/') != std::u16string_view::npos )
return ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES;
return 0;
@@ -200,9 +201,9 @@ namespace sdbtools
PNameValidation m_pSecondary;
public:
- CombinedNameCheck(const PNameValidation& _pPrimary, const PNameValidation& _pSecondary)
- :m_pPrimary( _pPrimary )
- ,m_pSecondary( _pSecondary )
+ CombinedNameCheck(PNameValidation _pPrimary, PNameValidation _pSecondary)
+ :m_pPrimary(std::move( _pPrimary ))
+ ,m_pSecondary(std::move( _pSecondary ))
{
OSL_ENSURE( m_pPrimary && m_pSecondary, "CombinedNameCheck::CombinedNameCheck: this will crash!" );
}
@@ -312,9 +313,9 @@ namespace sdbtools
if ( aMeta.supportsSubqueriesInFrom() )
pReturn = std::make_shared<CombinedNameCheck>( pTableCheck, pQueryCheck );
else if ( _nCommandType == CommandType::TABLE )
- pReturn = pTableCheck;
+ pReturn = std::move(pTableCheck);
else
- pReturn = pQueryCheck;
+ pReturn = std::move(pQueryCheck);
return pReturn;
}
@@ -330,7 +331,7 @@ namespace sdbtools
catch( const Exception& )
{
throw IllegalArgumentException(
- "The connection could not provide its database's meta data.",
+ u"The connection could not provide its database's meta data."_ustr,
nullptr,
0
);
diff --git a/dbaccess/source/sdbtools/connection/tablename.cxx b/dbaccess/source/sdbtools/connection/tablename.cxx
index 132484a2469f..f6a77dd3e91b 100644
--- a/dbaccess/source/sdbtools/connection/tablename.cxx
+++ b/dbaccess/source/sdbtools/connection/tablename.cxx
@@ -26,7 +26,7 @@
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace sdbtools
{
@@ -51,17 +51,8 @@ namespace sdbtools
using namespace ::dbtools;
// TableName
- struct TableName_Impl
- {
- OUString sCatalog;
- OUString sSchema;
- OUString sName;
- };
-
- // TableName
TableName::TableName( const Reference<XComponentContext>& _rContext, const Reference< XConnection >& _rxConnection )
:ConnectionDependentComponent( _rContext )
- ,m_pImpl( new TableName_Impl )
{
setWeakConnection( _rxConnection );
}
@@ -73,43 +64,43 @@ namespace sdbtools
OUString SAL_CALL TableName::getCatalogName()
{
EntryGuard aGuard( *this );
- return m_pImpl->sCatalog;
+ return msCatalog;
}
void SAL_CALL TableName::setCatalogName( const OUString& _catalogName )
{
EntryGuard aGuard( *this );
- m_pImpl->sCatalog = _catalogName;
+ msCatalog = _catalogName;
}
OUString SAL_CALL TableName::getSchemaName()
{
EntryGuard aGuard( *this );
- return m_pImpl->sSchema;
+ return msSchema;
}
void SAL_CALL TableName::setSchemaName( const OUString& _schemaName )
{
EntryGuard aGuard( *this );
- m_pImpl->sSchema = _schemaName;
+ msSchema = _schemaName;
}
OUString SAL_CALL TableName::getTableName()
{
EntryGuard aGuard( *this );
- return m_pImpl->sName;
+ return msName;
}
void SAL_CALL TableName::setTableName( const OUString& _tableName )
{
EntryGuard aGuard( *this );
- m_pImpl->sName = _tableName;
+ msName = _tableName;
}
OUString SAL_CALL TableName::getNameForSelect()
{
EntryGuard aGuard( *this );
- return composeTableNameForSelect( getConnection(), m_pImpl->sCatalog, m_pImpl->sSchema, m_pImpl->sName );
+ return composeTableNameForSelect( getConnection(), msCatalog, msSchema, msName );
}
Reference< XPropertySet > SAL_CALL TableName::getTable()
@@ -157,9 +148,9 @@ namespace sdbtools
try
{
- OSL_VERIFY( _table->getPropertyValue( PROPERTY_CATALOGNAME ) >>= m_pImpl->sCatalog );
- OSL_VERIFY( _table->getPropertyValue( PROPERTY_SCHEMANAME ) >>= m_pImpl->sSchema );
- OSL_VERIFY( _table->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->sName );
+ OSL_VERIFY( _table->getPropertyValue( PROPERTY_CATALOGNAME ) >>= msCatalog );
+ OSL_VERIFY( _table->getPropertyValue( PROPERTY_SCHEMANAME ) >>= msSchema );
+ OSL_VERIFY( _table->getPropertyValue( PROPERTY_NAME ) >>= msName );
}
catch( const RuntimeException& ) { throw; }
catch( const Exception& e )
@@ -190,19 +181,16 @@ namespace sdbtools
{ CompositionType::Complete, EComposeRule::Complete }
};
- bool found = false;
- size_t i = 0;
- for ( ; i < SAL_N_ELEMENTS( TypeTable ) && !found; ++i )
- if ( TypeTable[i].nCompositionType == _nType )
- found = true;
- if ( !found )
+ auto const found = std::find_if(std::begin(TypeTable), std::end(TypeTable)
+ , [_nType](auto const & type){ return type.nCompositionType == _nType; });
+ if (found == std::end(TypeTable))
throw IllegalArgumentException(
DBA_RES( STR_INVALID_COMPOSITION_TYPE ),
nullptr,
0
);
- return TypeTable[i].eComposeRule;
+ return found->eComposeRule;
}
}
@@ -212,7 +200,7 @@ namespace sdbtools
return composeTableName(
getConnection()->getMetaData(),
- m_pImpl->sCatalog, m_pImpl->sSchema, m_pImpl->sName, Quote,
+ msCatalog, msSchema, msName, Quote,
lcl_translateCompositionType_throw( Type ) );
}
@@ -223,7 +211,7 @@ namespace sdbtools
qualifiedNameComponents(
getConnection()->getMetaData(),
ComposedName,
- m_pImpl->sCatalog, m_pImpl->sSchema, m_pImpl->sName,
+ msCatalog, msSchema, msName,
lcl_translateCompositionType_throw( Type ) );
}
diff --git a/dbaccess/source/sdbtools/connection/tablename.hxx b/dbaccess/source/sdbtools/connection/tablename.hxx
index 3a7ece21a182..74abc3025f49 100644
--- a/dbaccess/source/sdbtools/connection/tablename.hxx
+++ b/dbaccess/source/sdbtools/connection/tablename.hxx
@@ -33,15 +33,11 @@ namespace sdbtools
// TableName
typedef ::cppu::WeakImplHelper< css::sdb::tools::XTableName
> TableName_Base;
- struct TableName_Impl;
/** default implementation for XTableName
*/
class TableName :public TableName_Base
,public ConnectionDependentComponent
{
- private:
- std::unique_ptr< TableName_Impl > m_pImpl;
-
public:
/** constructs the instance
@@ -77,6 +73,10 @@ namespace sdbtools
private:
TableName( const TableName& ) = delete;
TableName& operator=( const TableName& ) = delete;
+
+ OUString msCatalog;
+ OUString msSchema;
+ OUString msName;
};
} // namespace sdbtools
diff --git a/dbaccess/source/sdbtools/inc/connectiondependent.hxx b/dbaccess/source/sdbtools/inc/connectiondependent.hxx
index d315d70187fb..1278920c634c 100644
--- a/dbaccess/source/sdbtools/inc/connectiondependent.hxx
+++ b/dbaccess/source/sdbtools/inc/connectiondependent.hxx
@@ -25,6 +25,7 @@
#include <cppuhelper/weakref.hxx>
#include <osl/mutex.hxx>
+#include <utility>
namespace sdbtools
{
@@ -58,8 +59,8 @@ namespace sdbtools
class EntryGuard;
protected:
- explicit ConnectionDependentComponent( const css::uno::Reference< css::uno::XComponentContext > & _rContext )
- :m_aContext( _rContext )
+ explicit ConnectionDependentComponent( css::uno::Reference< css::uno::XComponentContext > _xContext )
+ :m_aContext(std::move( _xContext ))
{
}
@@ -79,7 +80,6 @@ namespace sdbtools
getConnection() const { return m_xConnection; }
public:
- struct GuardAccess;
friend struct GuardAccess;
/** helper for granting exclusive access to various other methods
*/
diff --git a/dbaccess/source/shared/registrationhelper.cxx b/dbaccess/source/shared/registrationhelper.cxx
deleted file mode 100644
index 2c9fbc1f1042..000000000000
--- a/dbaccess/source/shared/registrationhelper.cxx
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-// be included in other cxx files
-
-#ifndef REGISTRATIONHELPER_CXX_INCLUDED_INDIRECTLY_
-#error "don't build this file directly! use dbu_reghelper.cxx instead!"
-#endif
-
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-using namespace ::cppu;
-
-uno::Sequence< OUString >* OModuleRegistration::s_pImplementationNames = nullptr;
-uno::Sequence< uno::Sequence< OUString > >* OModuleRegistration::s_pSupportedServices = nullptr;
-uno::Sequence< sal_Int64 >* OModuleRegistration::s_pCreationFunctionPointers = nullptr;
-uno::Sequence< sal_Int64 >* OModuleRegistration::s_pFactoryFunctionPointers = nullptr;
-
-void OModuleRegistration::registerComponent(
- const OUString& _rImplementationName,
- const uno::Sequence< OUString >& _rServiceNames,
- ComponentInstantiation _pCreateFunction,
- FactoryInstantiation _pFactoryFunction)
-{
- if (!s_pImplementationNames)
- {
- OSL_ENSURE(!s_pSupportedServices && !s_pCreationFunctionPointers && !s_pFactoryFunctionPointers,
- "OModuleRegistration::registerComponent : inconsistent state (the pointers (1)) !");
- s_pImplementationNames = new uno::Sequence< OUString >;
- s_pSupportedServices = new uno::Sequence< uno::Sequence< OUString > >;
- s_pCreationFunctionPointers = new uno::Sequence< sal_Int64 >;
- s_pFactoryFunctionPointers = new uno::Sequence< sal_Int64 >;
- }
- OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers,
- "OModuleRegistration::registerComponent : inconsistent state (the pointers (2)) !");
-
- OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength())
- && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength())
- && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()),
- "OModuleRegistration::registerComponent : inconsistent state !");
-
- sal_Int32 nOldLen = s_pImplementationNames->getLength();
- s_pImplementationNames->realloc(nOldLen + 1);
- s_pSupportedServices->realloc(nOldLen + 1);
- s_pCreationFunctionPointers->realloc(nOldLen + 1);
- s_pFactoryFunctionPointers->realloc(nOldLen + 1);
-
- s_pImplementationNames->getArray()[nOldLen] = _rImplementationName;
- s_pSupportedServices->getArray()[nOldLen] = _rServiceNames;
- s_pCreationFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pCreateFunction);
- s_pFactoryFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pFactoryFunction);
-}
-
-void OModuleRegistration::revokeComponent(const OUString& _rImplementationName)
-{
- if (!s_pImplementationNames)
- {
- OSL_FAIL("OModuleRegistration::revokeComponent : have no class infos ! Are you sure called this method at the right time ?");
- return;
- }
- OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers,
- "OModuleRegistration::revokeComponent : inconsistent state (the pointers) !");
- OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength())
- && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength())
- && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()),
- "OModuleRegistration::revokeComponent : inconsistent state !");
-
- sal_Int32 nLen = s_pImplementationNames->getLength();
- const OUString* pImplNames = s_pImplementationNames->getConstArray();
- for (sal_Int32 i=0; i<nLen; ++i, ++pImplNames)
- {
- if (*pImplNames == _rImplementationName)
- {
- removeElementAt(*s_pImplementationNames, i);
- removeElementAt(*s_pSupportedServices, i);
- removeElementAt(*s_pCreationFunctionPointers, i);
- removeElementAt(*s_pFactoryFunctionPointers, i);
- break;
- }
- }
-
- if (s_pImplementationNames->getLength() == 0)
- {
- delete s_pImplementationNames; s_pImplementationNames = nullptr;
- delete s_pSupportedServices; s_pSupportedServices = nullptr;
- delete s_pCreationFunctionPointers; s_pCreationFunctionPointers = nullptr;
- delete s_pFactoryFunctionPointers; s_pFactoryFunctionPointers = nullptr;
- }
-}
-
-uno::Reference< uno::XInterface > OModuleRegistration::getComponentFactory(
- const OUString& _rImplementationName,
- const uno::Reference< lang::XMultiServiceFactory >& _rxServiceManager)
-{
- OSL_ENSURE(_rxServiceManager.is(), "OModuleRegistration::getComponentFactory : invalid argument (service manager) !");
- OSL_ENSURE(!_rImplementationName.isEmpty(), "OModuleRegistration::getComponentFactory : invalid argument (implementation name) !");
-
- if (!s_pImplementationNames)
- {
- OSL_FAIL("OModuleRegistration::getComponentFactory : have no class infos ! Are you sure called this method at the right time ?");
- return nullptr;
- }
- OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers,
- "OModuleRegistration::getComponentFactory : inconsistent state (the pointers) !");
- OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength())
- && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength())
- && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()),
- "OModuleRegistration::getComponentFactory : inconsistent state !");
-
- uno::Reference< uno::XInterface > xReturn;
-
- sal_Int32 nLen = s_pImplementationNames->getLength();
- const OUString* pImplName = s_pImplementationNames->getConstArray();
- const uno::Sequence< OUString >* pServices = s_pSupportedServices->getConstArray();
- const sal_Int64* pComponentFunction = s_pCreationFunctionPointers->getConstArray();
- const sal_Int64* pFactoryFunction = s_pFactoryFunctionPointers->getConstArray();
-
- for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices, ++pComponentFunction, ++pFactoryFunction)
- {
- if (*pImplName == _rImplementationName)
- {
- const FactoryInstantiation FactoryInstantiationFunction = reinterpret_cast<FactoryInstantiation>(*pFactoryFunction);
- const ComponentInstantiation ComponentInstantiationFunction = reinterpret_cast<ComponentInstantiation>(*pComponentFunction);
-
- xReturn = FactoryInstantiationFunction( _rxServiceManager, *pImplName, ComponentInstantiationFunction, *pServices, nullptr);
- if (xReturn.is())
- {
- return xReturn.get();
- }
- }
- }
-
- return nullptr;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index b7036d149e25..741dc7afeeb8 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -20,6 +20,7 @@
#include <memory>
#include "AppController.hxx"
#include <core_resource.hxx>
+#include <dbexchange.hxx>
#include <strings.hxx>
#include <advancedsettingsdlg.hxx>
#include "subcomponentmanager.hxx"
@@ -54,20 +55,19 @@
#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>
#include <svl/filenotation.hxx>
-#include <vcl/treelistbox.hxx>
#include <vcl/transfer.hxx>
#include <svtools/cliplistener.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/types.hxx>
#include <comphelper/interaction.hxx>
-#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -97,6 +97,7 @@
#include <strings.hrc>
#include <defaultobjectnamecheck.hxx>
#include <databaseobjectview.hxx>
+#include <dbtreelistbox.hxx>
#include "AppDetailView.hxx"
#include <linkeddocuments.hxx>
#include <UITools.hxx>
@@ -144,7 +145,7 @@ OUString SAL_CALL OApplicationController::getImplementationName()
Sequence< OUString> SAL_CALL OApplicationController::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.application.DefaultViewController" };
+ return { u"com.sun.star.sdb.application.DefaultViewController"_ustr };
}
namespace {
@@ -157,7 +158,7 @@ class SelectionGuard;
class SelectionNotifier
{
private:
- ::comphelper::OInterfaceContainerHelper2 m_aSelectionListeners;
+ ::comphelper::OInterfaceContainerHelper3<XSelectionChangeListener> m_aSelectionListeners;
::cppu::OWeakObject& m_rContext;
sal_Int32 m_nSelectionNestingLevel;
@@ -251,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 )
@@ -326,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;
}
@@ -347,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() );
@@ -356,12 +362,13 @@ void SAL_CALL OApplicationController::disposing()
if ( pFilter )
aFilter = pFilter->GetFilterName();
+ OUString sDatabaseName;
// add to svtool history options
- SvtHistoryOptions().AppendItem( ePICKLIST,
+ 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 )
@@ -468,7 +475,7 @@ sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend)
if ( xBroadcaster.is() )
{
xBroadcaster->notifyDocumentEvent(
- "OnPrepareViewClosing",
+ u"OnPrepareViewClosing"_ustr,
this,
Any()
);
@@ -498,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>());
@@ -532,6 +540,10 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
{
switch (_nId)
{
+ case SID_NEWDOCDIRECT:
+ aReturn.bEnabled = true;
+ aReturn.sTitle = "private:factory/sdatabase";
+ break;
case SID_OPENURL:
aReturn.bEnabled = true;
if ( m_xModel.is() )
@@ -586,11 +598,10 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
case SID_NEWDOC:
case SID_APP_NEW_FORM:
case ID_DOCUMENT_CREATE_REPWIZ:
- aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER);
+ aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsWriterInstalled();
break;
case SID_APP_NEW_REPORT:
- aReturn.bEnabled = !isDataSourceReadOnly()
- && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER);
+ aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsWriterInstalled();
if ( aReturn.bEnabled )
{
Reference< XContentEnumerationAccess > xEnumAccess(m_xContext->getServiceManager(), UNO_QUERY);
@@ -658,7 +669,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
case SID_APP_NEW_REPORT_PRE_SEL:
aReturn.bEnabled = !isDataSourceReadOnly()
- && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER)
+ && SvtModuleOptions().IsWriterInstalled()
&& getContainer()->isALeafSelected();
if ( aReturn.bEnabled )
{
@@ -670,7 +681,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = xEnumAccess.is();
if ( aReturn.bEnabled )
{
- static const char s_sReportDesign[] = "org.libreoffice.report.pentaho.SOReportJobFactory";
+ static constexpr OUStringLiteral s_sReportDesign = u"org.libreoffice.report.pentaho.SOReportJobFactory";
Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign);
aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
}
@@ -788,20 +799,22 @@ 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:
+ case SID_DB_APP_SENDREPORTTOWRITER:
+ case SID_DB_APP_DBADMIN:
aReturn.bEnabled = false;
break;
case SID_MAIL_SENDDOC:
@@ -813,10 +826,6 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = E_REPORT == eType && getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
}
break;
- case SID_DB_APP_SENDREPORTTOWRITER:
- case SID_DB_APP_DBADMIN:
- aReturn.bEnabled = false;
- break;
case SID_DB_APP_STATUS_TYPE:
aReturn.bEnabled = m_xDataSource.is();
if ( aReturn.bEnabled )
@@ -902,17 +911,16 @@ 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 ) );
rtl::Reference pApprove( new ::comphelper::OInteractionApprove );
- pRequest->addContinuation( pApprove.get() );
+ pRequest->addContinuation( pApprove );
try
{
- xHandler->handle( pRequest.get() );
+ xHandler->handle( pRequest );
}
catch( const Exception& )
{
@@ -1009,21 +1017,19 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
std::vector<SotClipboardFormatId> aFormatIds;
getSupportedFormats(getContainer()->getElementType(),aFormatIds);
for (auto const& formatId : aFormatIds)
- pDlg->Insert(formatId,"");
+ pDlg->Insert(formatId,u""_ustr);
const TransferableDataHelper& rClipboard = getViewClipboard();
pasteFormat(pDlg->GetFormat(rClipboard.GetTransferable()));
}
else
{
- const PropertyValue* pIter = aArgs.getConstArray();
- const PropertyValue* pEnd = pIter + aArgs.getLength();
- for( ; pIter != pEnd ; ++pIter)
+ for (auto& arg : aArgs)
{
- if ( pIter->Name == "FormatStringId" )
+ if (arg.Name == "FormatStringId")
{
- sal_uLong nTmp;
- if ( pIter->Value >>= nTmp )
+ sal_uInt32 nTmp;
+ if (arg.Value >>= nTmp)
pasteFormat(static_cast<SotClipboardFormatId>(nTmp));
break;
}
@@ -1031,17 +1037,25 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
}
}
break;
+ case SID_NEWDOCDIRECT:
case SID_OPENDOC:
{
Reference < XDispatchProvider > xProv( getFrame(), UNO_QUERY );
if ( xProv.is() )
{
URL aURL;
- aURL.Complete = ".uno:Open";
+ OUString aTarget;
+ if ( _nId == SID_NEWDOCDIRECT )
+ {
+ aURL.Complete = "private:factory/sdatabase?Interactive";
+ aTarget = "_default";
+ }
+ else
+ aURL.Complete = ".uno:Open";
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aURL );
- Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, OUString(), 0 );
+ Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, aTarget, 0 );
if ( xDisp.is() )
xDisp->dispatch( aURL, Sequence < PropertyValue >() );
}
@@ -1066,13 +1080,13 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
OUString sUrl;
if ( m_xModel.is() )
sUrl = m_xModel->getURL();
- if ( sUrl.isEmpty() )
- sUrl = SvtPathOptions().GetWorkPath();
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
FileDialogFlags::NONE, getFrameWeld());
- aFileDlg.SetDisplayDirectory( sUrl );
+ aFileDlg.SetContext(sfx2::FileDialogHelper::BaseSaveAs);
+ if (!sUrl.isEmpty())
+ aFileDlg.SetDisplayDirectory( sUrl );
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
if ( pFilter )
@@ -1158,7 +1172,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
eType = E_QUERY;
break;
case ID_NEW_QUERY_DESIGN:
- aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), true );
+ aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, true );
[[fallthrough]];
case ID_NEW_QUERY_SQL:
eType = E_QUERY;
@@ -1184,7 +1198,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
{
ElementType eType = getContainer()->getElementType();
OUString sName = getContainer()->getQualifiedName( nullptr );
- insertHierachyElement(eType,sName);
+ insertHierarchyElement(eType,sName);
}
break;
case ID_NEW_VIEW_DESIGN:
@@ -1196,11 +1210,11 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
QueryDesigner aDesigner( getORB(), this, getFrame(), true );
::comphelper::NamedValueCollection aCreationArgs;
- aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), ID_NEW_VIEW_DESIGN == _nId );
+ aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId );
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;
@@ -1224,17 +1238,15 @@ 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 );
- break;
case SID_DB_APP_CONVERTTOVIEW:
- doAction( _nId, E_OPEN_NORMAL );
+ doAction( _nId, ElementOpenMode::Normal );
break;
case SID_SELECTALL:
getContainer()->selectAll();
@@ -1243,7 +1255,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() )
@@ -1252,7 +1264,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 );
}
}
}
@@ -1261,12 +1273,12 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
{
SharedConnection xConnection( ensureConnection() );
if ( xConnection.is() )
- openDialog("com.sun.star.sdb.UserAdministrationDialog");
+ openDialog(u"com.sun.star.sdb.UserAdministrationDialog"_ustr);
}
break;
case SID_DB_APP_TABLEFILTER:
// opens the table filter dialog for the selected data source
- openDialog( "com.sun.star.sdb.TableFilterDialog" );
+ openDialog( u"com.sun.star.sdb.TableFilterDialog"_ustr );
askToReconnect();
break;
case SID_DB_APP_REFRESH_TABLES:
@@ -1274,15 +1286,15 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
break;
case SID_DB_APP_DSPROPS:
// opens the administration dialog for the selected data source
- openDialog( "com.sun.star.sdb.DatasourceAdministrationDialog" );
+ openDialog( u"com.sun.star.sdb.DatasourceAdministrationDialog"_ustr );
askToReconnect();
break;
case SID_DB_APP_DSADVANCED_SETTINGS:
- openDialog("com.sun.star.sdb.AdvancedDatabaseSettingsDialog");
+ openDialog(u"com.sun.star.sdb.AdvancedDatabaseSettingsDialog"_ustr);
askToReconnect();
break;
case SID_DB_APP_DSCONNECTION_TYPE:
- openDialog("com.sun.star.sdb.DataSourceTypeChangeDialog");
+ openDialog(u"com.sun.star.sdb.DataSourceTypeChangeDialog"_ustr);
askToReconnect();
break;
case ID_DIRECT_SQL:
@@ -1306,15 +1318,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:
@@ -1325,7 +1337,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;
}
}
@@ -1340,106 +1352,107 @@ void OApplicationController::describeSupportedFeatures()
{
OGenericUnoController::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:SendMail", SID_MAIL_SENDDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBSendReportAsMail",SID_DB_APP_SENDREPORTASMAIL,
+ implDescribeSupportedFeature( u".uno:AddDirect"_ustr, SID_NEWDOCDIRECT, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:Save"_ustr, ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:SaveAs"_ustr, ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:SendMail"_ustr, SID_MAIL_SENDDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:DBSendReportAsMail"_ustr,SID_DB_APP_SENDREPORTASMAIL,
CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBSendReportToWriter",SID_DB_APP_SENDREPORTTOWRITER,
+ implDescribeSupportedFeature( u".uno:DBSendReportToWriter"_ustr,SID_DB_APP_SENDREPORTTOWRITER,
CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBNewForm", SID_APP_NEW_FORM, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewFolder", SID_APP_NEW_FOLDER, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewFormAutoPilot", SID_DB_FORM_NEW_PILOT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewFormAutoPilotWithPreSelection",
+ implDescribeSupportedFeature( u".uno:DBNewForm"_ustr, SID_APP_NEW_FORM, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewFolder"_ustr, SID_APP_NEW_FOLDER, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewFormAutoPilot"_ustr, SID_DB_FORM_NEW_PILOT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewFormAutoPilotWithPreSelection"_ustr,
SID_FORM_CREATE_REPWIZ_PRE_SEL,
CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBNewReport", SID_APP_NEW_REPORT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewReportAutoPilot",
+ implDescribeSupportedFeature( u".uno:DBNewReport"_ustr, SID_APP_NEW_REPORT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewReportAutoPilot"_ustr,
ID_DOCUMENT_CREATE_REPWIZ, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewReportAutoPilotWithPreSelection",
+ implDescribeSupportedFeature( u".uno:DBNewReportAutoPilotWithPreSelection"_ustr,
SID_REPORT_CREATE_REPWIZ_PRE_SEL,
CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBNewQuery", ID_NEW_QUERY_DESIGN, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewQuerySql", ID_NEW_QUERY_SQL, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewQueryAutoPilot",ID_APP_NEW_QUERY_AUTO_PILOT,
+ implDescribeSupportedFeature( u".uno:DBNewQuery"_ustr, ID_NEW_QUERY_DESIGN, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewQuerySql"_ustr, ID_NEW_QUERY_SQL, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewQueryAutoPilot"_ustr,ID_APP_NEW_QUERY_AUTO_PILOT,
CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewTable", ID_NEW_TABLE_DESIGN, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewTableAutoPilot",ID_NEW_TABLE_DESIGN_AUTO_PILOT,
+ implDescribeSupportedFeature( u".uno:DBNewTable"_ustr, ID_NEW_TABLE_DESIGN, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewTableAutoPilot"_ustr,ID_NEW_TABLE_DESIGN_AUTO_PILOT,
CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewView", ID_NEW_VIEW_DESIGN, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewViewSQL", SID_DB_NEW_VIEW_SQL, CommandGroup::INSERT );
-
- implDescribeSupportedFeature( ".uno:DBDelete", SID_DB_APP_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Delete", SID_DB_APP_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBRename", SID_DB_APP_RENAME, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBEdit", SID_DB_APP_EDIT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBEditSqlView", SID_DB_APP_EDIT_SQL_VIEW, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBOpen", SID_DB_APP_OPEN, CommandGroup::EDIT );
-
- implDescribeSupportedFeature( ".uno:DBTableDelete", SID_DB_APP_TABLE_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBTableRename", SID_DB_APP_TABLE_RENAME, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBTableEdit", SID_DB_APP_TABLE_EDIT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBTableOpen", SID_DB_APP_TABLE_OPEN, CommandGroup::EDIT );
-
- implDescribeSupportedFeature( ".uno:DBQueryDelete", SID_DB_APP_QUERY_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBQueryRename", SID_DB_APP_QUERY_RENAME, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBQueryEdit", SID_DB_APP_QUERY_EDIT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBQueryOpen", SID_DB_APP_QUERY_OPEN, CommandGroup::EDIT );
-
- implDescribeSupportedFeature( ".uno:DBFormDelete", SID_DB_APP_FORM_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBFormRename", SID_DB_APP_FORM_RENAME, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBFormEdit", SID_DB_APP_FORM_EDIT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBFormOpen", SID_DB_APP_FORM_OPEN, CommandGroup::EDIT );
-
- implDescribeSupportedFeature( ".uno:DBReportDelete", SID_DB_APP_REPORT_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBReportRename", SID_DB_APP_REPORT_RENAME, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBReportEdit", SID_DB_APP_REPORT_EDIT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBReportOpen", SID_DB_APP_REPORT_OPEN, CommandGroup::EDIT );
-
- implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT );
-
- implDescribeSupportedFeature( ".uno:Sortup", ID_BROWSER_SORTUP, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:SortDown", ID_BROWSER_SORTDOWN, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBRelationDesign", SID_DB_APP_DSRELDESIGN, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBUserAdmin", SID_DB_APP_DSUSERADMIN, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBTableFilter", SID_DB_APP_TABLEFILTER, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBDSProperties", SID_DB_APP_DSPROPS, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBDSConnectionType", SID_DB_APP_DSCONNECTION_TYPE,
+ implDescribeSupportedFeature( u".uno:DBNewView"_ustr, ID_NEW_VIEW_DESIGN, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DBNewViewSQL"_ustr, SID_DB_NEW_VIEW_SQL, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( u".uno:DBDelete"_ustr, SID_DB_APP_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Delete"_ustr, SID_DB_APP_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBRename"_ustr, SID_DB_APP_RENAME, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBEdit"_ustr, SID_DB_APP_EDIT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBEditSqlView"_ustr, SID_DB_APP_EDIT_SQL_VIEW, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBOpen"_ustr, SID_DB_APP_OPEN, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( u".uno:DBTableDelete"_ustr, SID_DB_APP_TABLE_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBTableRename"_ustr, SID_DB_APP_TABLE_RENAME, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBTableEdit"_ustr, SID_DB_APP_TABLE_EDIT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBTableOpen"_ustr, SID_DB_APP_TABLE_OPEN, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( u".uno:DBQueryDelete"_ustr, SID_DB_APP_QUERY_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBQueryRename"_ustr, SID_DB_APP_QUERY_RENAME, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBQueryEdit"_ustr, SID_DB_APP_QUERY_EDIT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBQueryOpen"_ustr, SID_DB_APP_QUERY_OPEN, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( u".uno:DBFormDelete"_ustr, SID_DB_APP_FORM_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBFormRename"_ustr, SID_DB_APP_FORM_RENAME, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBFormEdit"_ustr, SID_DB_APP_FORM_EDIT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBFormOpen"_ustr, SID_DB_APP_FORM_OPEN, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( u".uno:DBReportDelete"_ustr, SID_DB_APP_REPORT_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBReportRename"_ustr, SID_DB_APP_REPORT_RENAME, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBReportEdit"_ustr, SID_DB_APP_REPORT_EDIT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBReportOpen"_ustr, SID_DB_APP_REPORT_OPEN, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( u".uno:SelectAll"_ustr, SID_SELECTALL, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Undo"_ustr, ID_BROWSER_UNDO, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( u".uno:Sortup"_ustr, ID_BROWSER_SORTUP, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:SortDown"_ustr, ID_BROWSER_SORTDOWN, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBRelationDesign"_ustr, SID_DB_APP_DSRELDESIGN, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:DBUserAdmin"_ustr, SID_DB_APP_DSUSERADMIN, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:DBTableFilter"_ustr, SID_DB_APP_TABLEFILTER, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:DBDSProperties"_ustr, SID_DB_APP_DSPROPS, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBDSConnectionType"_ustr, SID_DB_APP_DSCONNECTION_TYPE,
CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBDSAdvancedSettings",
+ implDescribeSupportedFeature( u".uno:DBDSAdvancedSettings"_ustr,
SID_DB_APP_DSADVANCED_SETTINGS,
CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:PasteSpecial", SID_DB_APP_PASTE_SPECIAL, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBConvertToView", SID_DB_APP_CONVERTTOVIEW, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBRefreshTables", SID_DB_APP_REFRESH_TABLES, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBDirectSQL", ID_DIRECT_SQL, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBViewTables", SID_DB_APP_VIEW_TABLES, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBViewQueries", SID_DB_APP_VIEW_QUERIES, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBViewForms", SID_DB_APP_VIEW_FORMS, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBViewReports", SID_DB_APP_VIEW_REPORTS, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBDisablePreview", SID_DB_APP_DISABLE_PREVIEW,CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBShowDocInfoPreview",
+ implDescribeSupportedFeature( u".uno:PasteSpecial"_ustr, SID_DB_APP_PASTE_SPECIAL, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBConvertToView"_ustr, SID_DB_APP_CONVERTTOVIEW, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBRefreshTables"_ustr, SID_DB_APP_REFRESH_TABLES, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:DBDirectSQL"_ustr, ID_DIRECT_SQL, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:DBViewTables"_ustr, SID_DB_APP_VIEW_TABLES, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBViewQueries"_ustr, SID_DB_APP_VIEW_QUERIES, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBViewForms"_ustr, SID_DB_APP_VIEW_FORMS, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBViewReports"_ustr, SID_DB_APP_VIEW_REPORTS, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBDisablePreview"_ustr, SID_DB_APP_DISABLE_PREVIEW,CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBShowDocInfoPreview"_ustr,
SID_DB_APP_VIEW_DOCINFO_PREVIEW,
CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBShowDocPreview", SID_DB_APP_VIEW_DOC_PREVIEW,
+ implDescribeSupportedFeature( u".uno:DBShowDocPreview"_ustr, SID_DB_APP_VIEW_DOC_PREVIEW,
CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:OpenUrl", SID_OPENURL, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:OpenUrl"_ustr, SID_OPENURL, CommandGroup::APPLICATION );
// this one should not appear under Tools->Customize->Keyboard
- implDescribeSupportedFeature( ".uno:DBNewReportWithPreSelection",
+ implDescribeSupportedFeature( u".uno:DBNewReportWithPreSelection"_ustr,
SID_APP_NEW_REPORT_PRE_SEL );
- implDescribeSupportedFeature( ".uno:DBDSImport", SID_DB_APP_DSIMPORT);
- implDescribeSupportedFeature( ".uno:DBDSExport", SID_DB_APP_DSEXPORT);
- implDescribeSupportedFeature( ".uno:DBDBAdmin", SID_DB_APP_DBADMIN);
+ implDescribeSupportedFeature( u".uno:DBDSImport"_ustr, SID_DB_APP_DSIMPORT);
+ implDescribeSupportedFeature( u".uno:DBDSExport"_ustr, SID_DB_APP_DSEXPORT);
+ implDescribeSupportedFeature( u".uno:DBDBAdmin"_ustr, SID_DB_APP_DBADMIN);
// status info
- implDescribeSupportedFeature( ".uno:DBStatusType", SID_DB_APP_STATUS_TYPE);
- implDescribeSupportedFeature( ".uno:DBStatusDBName", SID_DB_APP_STATUS_DBNAME);
- implDescribeSupportedFeature( ".uno:DBStatusUserName", SID_DB_APP_STATUS_USERNAME);
- implDescribeSupportedFeature( ".uno:DBStatusHostName", SID_DB_APP_STATUS_HOSTNAME);
+ implDescribeSupportedFeature( u".uno:DBStatusType"_ustr, SID_DB_APP_STATUS_TYPE);
+ implDescribeSupportedFeature( u".uno:DBStatusDBName"_ustr, SID_DB_APP_STATUS_DBNAME);
+ implDescribeSupportedFeature( u".uno:DBStatusUserName"_ustr, SID_DB_APP_STATUS_USERNAME);
+ implDescribeSupportedFeature( u".uno:DBStatusHostName"_ustr, SID_DB_APP_STATUS_HOSTNAME);
}
OApplicationView* OApplicationController::getContainer() const
@@ -1670,26 +1683,35 @@ bool OApplicationController::onContainerSelect(ElementType _eType)
return true;
}
-bool OApplicationController::onEntryDoubleClick( SvTreeListBox const & _rTree )
+bool OApplicationController::onEntryDoubleClick(const weld::TreeView& rTreeView)
{
- if ( getContainer() && getContainer()->isLeaf( _rTree.GetHdlEntry() ) )
+ OApplicationView* pContainer = getContainer();
+ if (!pContainer)
+ return false; // not handled
+
+ std::unique_ptr<weld::TreeIter> xHdlEntry = rTreeView.make_iterator();
+ if (!rTreeView.get_cursor(xHdlEntry.get()))
+ return false;
+
+ if (!pContainer->isLeaf(rTreeView, *xHdlEntry))
+ return false; // not handled
+
+ try
{
- try
- {
- // opens a new frame with either the table or the query or report or form or view
- openElementWithArguments(
- getContainer()->getQualifiedName( _rTree.GetHdlEntry() ),
- getContainer()->getElementType(),
- E_OPEN_NORMAL,
- 0,
- ::comphelper::NamedValueCollection() );
- return true; // handled
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ // opens a new frame with either the table or the query or report or form or view
+ openElementWithArguments(
+ getContainer()->getQualifiedName(xHdlEntry.get()),
+ getContainer()->getElementType(),
+ ElementOpenMode::Normal,
+ 0,
+ ::comphelper::NamedValueCollection() );
+ return true; // handled
}
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+
return false; // not handled
}
@@ -1726,7 +1748,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);
@@ -1736,7 +1758,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.
@@ -1773,7 +1795,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
::comphelper::NamedValueCollection aArguments( _rAdditionalArguments );
Any aDataSource;
- if ( _eOpenMode == E_OPEN_DESIGN )
+ if ( _eOpenMode == ElementOpenMode::Design )
{
bool bAddViewTypeArg = false;
@@ -1799,7 +1821,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
if ( bAddViewTypeArg )
{
const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW );
- aArguments.put( OUString(PROPERTY_GRAPHICAL_DESIGN), bQueryGraphicalMode );
+ aArguments.put( PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode );
}
}
@@ -1807,8 +1829,8 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
{
pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
- if ( !aArguments.has( OUString(PROPERTY_SHOWMENU) ) )
- aArguments.put( OUString(PROPERTY_SHOWMENU), makeAny( true ) );
+ if ( !aArguments.has( PROPERTY_SHOWMENU ) )
+ aArguments.put( PROPERTY_SHOWMENU, Any( true ) );
aDataSource <<= getDatabaseName();
}
@@ -1933,7 +1955,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;
}
@@ -2007,11 +2029,11 @@ void OApplicationController::renameEntry()
Reference<XHierarchicalNameContainer> xParent(xChild->getParent(),UNO_QUERY);
if ( xParent.is() )
{
- xHNames = xParent;
+ xHNames = std::move(xParent);
Reference<XPropertySet>(xRename,UNO_QUERY_THROW)->getPropertyValue(PROPERTY_NAME) >>= sName;
}
}
- pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), OUString() ) );
+ pNameChecker.reset( new HierarchicalNameCheck( xHNames, OUString() ) );
xDialog.reset(new OSaveAsDlg(
getFrameWeld(), getORB(), sName, sLabel, *pNameChecker, SADFlags::TitleRename));
}
@@ -2090,7 +2112,7 @@ void OApplicationController::renameEntry()
catch(const ElementExistException& e)
{
OUString sMsg(DBA_RES(STR_NAME_ALREADY_EXISTS));
- showError(SQLExceptionInfo(SQLException(sMsg.replaceAll("#", e.Message), e.Context, "S1000", 0, Any())));
+ showError(SQLExceptionInfo(SQLException(sMsg.replaceAll("#", e.Message), e.Context, u"S1000"_ustr, 0, Any())));
}
catch(const Exception& )
{
@@ -2132,7 +2154,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();
@@ -2224,9 +2246,9 @@ void OApplicationController::onDeleteEntry()
executeChecked(nId,Sequence<PropertyValue>());
}
-OUString OApplicationController::getContextMenuResourceName( Control& /*_rControl*/ ) const
+OUString OApplicationController::getContextMenuResourceName() const
{
- return "edit";
+ return u"edit"_ustr;
}
IController& OApplicationController::getCommandController()
@@ -2239,31 +2261,52 @@ IController& OApplicationController::getCommandController()
return &m_aContextMenuInterceptors;
}
-Any OApplicationController::getCurrentSelection( Control& _rControl ) const
+Any OApplicationController::getCurrentSelection(weld::TreeView& rControl) const
{
Sequence< NamedDatabaseObject > aSelection;
- getContainer()->describeCurrentSelectionForControl( _rControl, aSelection );
- return makeAny( aSelection );
+ getContainer()->describeCurrentSelectionForControl(rControl, aSelection);
+ return Any( aSelection );
}
-bool OApplicationController::requestQuickHelp( const SvTreeListEntry* /*_pEntry*/, OUString& /*_rText*/ ) const
+vcl::Window* OApplicationController::getMenuParent() const
+{
+ return getContainer()->getMenuParent();
+}
+
+void OApplicationController::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ getContainer()->adjustMenuPosition(rControl, rPos);
+}
+
+bool OApplicationController::requestQuickHelp(const void* /*pUserData*/, OUString& /*rText*/) const
{
return false;
}
-bool OApplicationController::requestDrag( const Point& /*_rPosPixel*/ )
+bool OApplicationController::requestDrag(const weld::TreeIter& /*rEntry*/)
{
- rtl::Reference<TransferableHelper> pTransfer;
- if ( getContainer() && getContainer()->getSelectionCount() )
+ bool bSuccess = false;
+
+ OApplicationView* pContainer = getContainer();
+ if (pContainer && pContainer->getSelectionCount())
{
try
{
- pTransfer = copyObject( );
-
- if ( pTransfer && getContainer()->getDetailView() )
+ if (getContainer()->getDetailView())
{
+ TreeListBox* pTreeListBox = getContainer()->getDetailView()->getTreeWindow();
+
ElementType eType = getContainer()->getElementType();
- pTransfer->StartDrag( getContainer()->getDetailView()->getTreeWindow(), ((eType == E_FORM || eType == E_REPORT) ? DND_ACTION_COPYMOVE : DND_ACTION_COPY) );
+ if (eType == E_TABLE || eType == E_QUERY)
+ {
+ ODataClipboard& rExchange = static_cast<ODataClipboard&>(pTreeListBox->GetDataTransfer());
+ bSuccess = copySQLObject(rExchange);
+ }
+ else
+ {
+ svx::OComponentTransferable& rExchange = static_cast<svx::OComponentTransferable&>(pTreeListBox->GetDataTransfer());
+ bSuccess = copyDocObject(rExchange);
+ }
}
}
catch(const Exception& )
@@ -2272,7 +2315,7 @@ bool OApplicationController::requestDrag( const Point& /*_rPosPixel*/ )
}
}
- return pTransfer.is();
+ return bSuccess;
}
sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors )
@@ -2280,44 +2323,42 @@ sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const
sal_Int8 nActionAskedFor = _rEvt.mnAction;
// check if we're a table or query container
OApplicationView* pView = getContainer();
- if ( pView && !isDataSourceReadOnly() )
+ if ( !pView || isDataSourceReadOnly() )
+ return DND_ACTION_NONE;
+
+ ElementType eType = pView->getElementType();
+ if ( eType == E_NONE || (eType == E_TABLE && isConnectionReadOnly()) )
+ return DND_ACTION_NONE;
+
+ // check for the concrete type
+ if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType)))
+ return DND_ACTION_COPY;
+
+ if ( eType != E_FORM && eType != E_REPORT )
+ return DND_ACTION_NONE;
+
+ sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE;
+ if ( nAction == DND_ACTION_NONE )
+ return DND_ACTION_NONE;
+
+ auto xHitEntry = pView->getEntry(_rEvt.maPosPixel);
+ if (xHitEntry)
{
- ElementType eType = pView->getElementType();
- if ( eType != E_NONE && (eType != E_TABLE || !isConnectionReadOnly()) )
+ OUString sName = pView->getQualifiedName(xHitEntry.get());
+ if ( !sName.isEmpty() )
{
- // check for the concrete type
- if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType)))
- return DND_ACTION_COPY;
- if ( eType == E_FORM || eType == E_REPORT )
+ Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY);
+ if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) )
{
- sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE;
- if ( nAction != DND_ACTION_NONE )
- {
- SvTreeListEntry* pHitEntry = pView->getEntry(_rEvt.maPosPixel);
- OUString sName;
- if ( pHitEntry )
- {
- sName = pView->getQualifiedName( pHitEntry );
- if ( !sName.isEmpty() )
- {
- Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY);
- if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) )
- {
- Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY);
- if ( xHitObject.is() )
- nAction = nActionAskedFor & DND_ACTION_COPYMOVE;
- }
- else
- nAction = DND_ACTION_NONE;
- }
- }
- }
- return nAction;
+ Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY);
+ if ( xHitObject.is() )
+ nAction = nActionAskedFor & DND_ACTION_COPYMOVE;
}
+ else
+ nAction = DND_ACTION_NONE;
}
}
-
- return DND_ACTION_NONE;
+ return nAction;
}
sal_Int8 OApplicationController::executeDrop( const ExecuteDropEvent& _rEvt )
@@ -2358,9 +2399,9 @@ sal_Int8 OApplicationController::executeDrop( const ExecuteDropEvent& _rEvt )
else if ( OComponentTransferable::canExtractComponentDescriptor(aDroppedData.GetDataFlavorExVector(),m_aAsyncDrop.nType == E_FORM) )
{
m_aAsyncDrop.aDroppedData = OComponentTransferable::extractComponentDescriptor(aDroppedData);
- SvTreeListEntry* pHitEntry = pView->getEntry(_rEvt.maPosPixel);
- if ( pHitEntry )
- m_aAsyncDrop.aUrl = pView->getQualifiedName( pHitEntry );
+ auto xHitEntry = pView->getEntry(_rEvt.maPosPixel);
+ if ( xHitEntry )
+ m_aAsyncDrop.aUrl = pView->getQualifiedName(xHitEntry.get());
sal_Int8 nAction = _rEvt.mnAction;
Reference<XContent> xContent;
@@ -2472,8 +2513,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
@@ -2481,13 +2521,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(), u""_ustr, nullptr, Any( aWarning ) );
xDialog->execute();
}
catch( const Exception& )
@@ -2526,7 +2563,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
@@ -2573,25 +2610,25 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel >
}
// initial preview mode
- if ( m_xDataSource.is() )
+ if ( !m_xDataSource )
+ return true;
+
+ try
{
- try
+ // to get the 'modified' for the data source
+ ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
+ if ( aLayoutInfo.has( INFO_PREVIEW ) )
{
- // to get the 'modified' for the data source
- ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
- if ( aLayoutInfo.has( OUString(INFO_PREVIEW) ) )
- {
- const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) );
- m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
- if ( getView() )
- getContainer()->switchPreview( m_ePreviewMode );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) );
+ m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
+ if ( getView() )
+ getContainer()->switchPreview( m_ePreviewMode );
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
return true;
}
@@ -2659,20 +2696,18 @@ sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection )
if ( (_aSelection >>= aCurrentSelection) && aCurrentSelection.hasElements() )
{
ElementType eType = E_NONE;
- const NamedValue* pIter = aCurrentSelection.getConstArray();
- const NamedValue* pEnd = pIter + aCurrentSelection.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& item : aCurrentSelection)
{
- if ( pIter->Name == "Type" )
+ if (item.Name == "Type")
{
sal_Int32 nType = 0;
- pIter->Value >>= nType;
+ item.Value >>= nType;
if ( nType < DatabaseObject::TABLE || nType > DatabaseObject::REPORT )
throw IllegalArgumentException();
eType = static_cast< ElementType >( nType );
}
- else if ( pIter->Name == "Selection" )
- pIter->Value >>= aSelection;
+ else if (item.Name == "Selection")
+ item.Value >>= aSelection;
}
m_aSelectContainerEvent.CancelCall(); // just in case the async select request was running
@@ -2686,48 +2721,43 @@ sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection )
if ( !( _aSelection >>= aSelectedObjects ) )
{
aSelectedObjects.realloc( 1 );
- if ( !( _aSelection >>= aSelectedObjects[0] ) )
+ if ( !( _aSelection >>= aSelectedObjects.getArray()[0] ) )
throw IllegalArgumentException();
}
SelectionByElementType aSelectedElements;
ElementType eSelectedCategory = E_NONE;
- for ( const NamedDatabaseObject* pObject = aSelectedObjects.getConstArray();
- pObject != aSelectedObjects.getConstArray() + aSelectedObjects.getLength();
- ++pObject
- )
+ for (sal_Int32 i = 0; i < aSelectedObjects.getLength(); ++i)
{
- switch ( pObject->Type )
+ switch (aSelectedObjects[i].Type)
{
case DatabaseObject::TABLE:
case DatabaseObjectContainer::SCHEMA:
case DatabaseObjectContainer::CATALOG:
- aSelectedElements[ E_TABLE ].push_back( pObject->Name );
+ aSelectedElements[E_TABLE].push_back(aSelectedObjects[i].Name);
break;
case DatabaseObject::QUERY:
- aSelectedElements[ E_QUERY ].push_back( pObject->Name );
+ aSelectedElements[E_QUERY].push_back(aSelectedObjects[i].Name);
break;
case DatabaseObject::FORM:
case DatabaseObjectContainer::FORMS_FOLDER:
- aSelectedElements[ E_FORM ].push_back( pObject->Name );
+ aSelectedElements[E_FORM].push_back(aSelectedObjects[i].Name);
break;
case DatabaseObject::REPORT:
case DatabaseObjectContainer::REPORTS_FOLDER:
- aSelectedElements[ E_REPORT ].push_back( pObject->Name );
+ aSelectedElements[E_REPORT].push_back(aSelectedObjects[i].Name);
break;
case DatabaseObjectContainer::TABLES:
case DatabaseObjectContainer::QUERIES:
case DatabaseObjectContainer::FORMS:
case DatabaseObjectContainer::REPORTS:
if ( eSelectedCategory != E_NONE )
- throw IllegalArgumentException(
- DBA_RES(RID_STR_NO_DIFF_CAT),
- *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) );
+ throw IllegalArgumentException(DBA_RES(RID_STR_NO_DIFF_CAT), *this, i);
eSelectedCategory =
- ( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE
- : ( pObject->Type == DatabaseObjectContainer::QUERIES ) ? E_QUERY
- : ( pObject->Type == DatabaseObjectContainer::FORMS ) ? E_FORM
- : ( pObject->Type == DatabaseObjectContainer::REPORTS ) ? E_REPORT
+ ( aSelectedObjects[i].Type == DatabaseObjectContainer::TABLES ) ? E_TABLE
+ : ( aSelectedObjects[i].Type == DatabaseObjectContainer::QUERIES ) ? E_QUERY
+ : ( aSelectedObjects[i].Type == DatabaseObjectContainer::FORMS ) ? E_FORM
+ : ( aSelectedObjects[i].Type == DatabaseObjectContainer::REPORTS ) ? E_REPORT
: E_NONE;
break;
@@ -2736,8 +2766,8 @@ sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection )
{
OUString sMessage(
DBA_RES(RID_STR_UNSUPPORTED_OBJECT_TYPE).
- replaceFirst("$type$", OUString::number(pObject->Type)));
- throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
+ replaceFirst("$type$", OUString::number(aSelectedObjects[i].Type)));
+ throw IllegalArgumentException(sMessage, *this, i);
}
}
}
@@ -2773,20 +2803,21 @@ Any SAL_CALL OApplicationController::getSelection( )
{ // if no objects are selected, add an entry to the sequence which describes the overall category
// which is selected currently
aCurrentSelection.realloc(1);
- aCurrentSelection[0].Name = getDatabaseName();
+ auto pCurrentSelection = aCurrentSelection.getArray();
+ pCurrentSelection[0].Name = getDatabaseName();
switch ( eType )
{
- case E_TABLE: aCurrentSelection[0].Type = DatabaseObjectContainer::TABLES; break;
- case E_QUERY: aCurrentSelection[0].Type = DatabaseObjectContainer::QUERIES; break;
- case E_FORM: aCurrentSelection[0].Type = DatabaseObjectContainer::FORMS; break;
- case E_REPORT: aCurrentSelection[0].Type = DatabaseObjectContainer::REPORTS; break;
+ case E_TABLE: pCurrentSelection[0].Type = DatabaseObjectContainer::TABLES; break;
+ case E_QUERY: pCurrentSelection[0].Type = DatabaseObjectContainer::QUERIES; break;
+ case E_FORM: pCurrentSelection[0].Type = DatabaseObjectContainer::FORMS; break;
+ case E_REPORT: pCurrentSelection[0].Type = DatabaseObjectContainer::REPORTS; break;
default:
OSL_FAIL( "OApplicationController::getSelection: unexpected current element type!" );
break;
}
}
}
- 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 6f7c1f658545..66c2f67c79e5 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPCONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPCONTROLLER_HXX
+#pragma once
#include <AppElementType.hxx>
#include <callbacks.hxx>
@@ -42,9 +41,6 @@
#include <memory>
-class SvTreeListEntry;
-class SvTreeListBox;
-class TransferableHelper;
class TransferableClipboardListener;
namespace com::sun::star {
@@ -57,10 +53,20 @@ namespace com::sun::star {
}
}
+namespace svx
+{
+ class OComponentTransferable;
+}
+
+namespace weld
+{
+ class TreeView;
+}
+
namespace dbaui
{
+ class ODataClipboard;
class SubComponentManager;
- class OApplicationController;
class OApplicationView;
class OLinkedDocumentsAccess;
class SelectionNotifier;
@@ -128,12 +134,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
@@ -212,7 +212,13 @@ namespace dbaui
void deleteTables(const std::vector< OUString>& _rList);
/// copies the current object into clipboard
- TransferableHelper* copyObject();
+ rtl::Reference<TransferableHelper> copyObject();
+
+ /// fills rExchange with current object if it's a Table or Query
+ bool copySQLObject(ODataClipboard& rExchange);
+
+ /// fills rExchange with current object if it's a Form or Report
+ bool copyDocObject(svx::OComponentTransferable& rExchange);
/// returns the nameaccess
css::uno::Reference< css::container::XNameAccess > getElements(ElementType _eType);
@@ -301,7 +307,7 @@ namespace dbaui
@return
<TRUE/> if the insert operations was successful, otherwise <FALSE/>.
*/
- bool insertHierachyElement( ElementType _eType
+ bool insertHierarchyElement( ElementType _eType
,const OUString& _sParentFolder
,bool _bCollection = true
,const css::uno::Reference< css::ucb::XContent>& _xContent = css::uno::Reference< css::ucb::XContent>()
@@ -442,7 +448,8 @@ namespace dbaui
<TRUE/> if the double click event has been handled by the called, and should not
be processed further.
*/
- bool onEntryDoubleClick(SvTreeListBox const & _rTree);
+ bool onEntryDoubleClick(const weld::TreeView& rTree);
+
/** called when a container (category) in the application view has been selected
@param _pTree
The tree list box.
@@ -450,22 +457,28 @@ namespace dbaui
<TRUE/> if the container could be changed otherwise <FALSE/>
*/
bool onContainerSelect(ElementType _eType);
+
/** called when an entry in a tree view has been selected
@param _pEntry
the selected entry
*/
void onSelectionChanged();
+
/** called when a "Copy" command is executed in a tree view
*/
void onCopyEntry();
+
/** called when a "Paste" command is executed in a tree view
*/
void onPasteEntry();
+
/** called when a "Delete" command is executed in a tree view
*/
void onDeleteEntry();
+
/// called when the preview mode was changed
void previewChanged( sal_Int32 _nMode);
+
/// called when an object container of any kind was found during enumerating tree view elements
void containerFound( const css::uno::Reference< css::container::XContainer >& _xContainer);
@@ -473,18 +486,19 @@ namespace dbaui
virtual bool isDataSourceReadOnly() const override;
// IControlActionListener overridables
- virtual bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const override;
- virtual bool requestDrag( const Point& _rPosPixel ) override;
+ virtual bool requestQuickHelp(const void* pUserData, OUString& rText) const override;
+ virtual bool requestDrag(const weld::TreeIter& rEntry) override;
virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ) override;
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider
- virtual OUString getContextMenuResourceName( Control& _rControl ) const override;
+ virtual OUString getContextMenuResourceName() const override;
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
- virtual css::uno::Any
- getCurrentSelection( Control& _rControl ) const override;
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const override;
+ virtual vcl::Window* getMenuParent() const override;
+ virtual void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const override;
void OnInvalidateClipboard();
DECL_LINK( OnClipboardChanged, TransferableDataHelper*, void );
@@ -514,6 +528,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPCONTROLLER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index 6b0a17d05446..73af7c3514cf 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -49,12 +49,10 @@
#include <connectivity/dbtools.hxx>
#include <dbexchange.hxx>
#include <UITools.hxx>
-#include <algorithm>
-#include <iterator>
#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>
@@ -76,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)
{
@@ -95,7 +92,7 @@ void OApplicationController::deleteTables(const std::vector< OUString>& _rList)
std::vector< OUString>::const_iterator aEnd = _rList.end();
for (std::vector< OUString>::const_iterator aIter = _rList.begin(); aIter != aEnd; ++aIter)
{
- OUString sTableName = *aIter;
+ const OUString& sTableName = *aIter;
sal_Int32 nResult = RET_YES;
if ( bConfirm )
@@ -316,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
@@ -365,7 +363,7 @@ const SharedConnection& OApplicationController::ensureConnection( ::dbtools::SQL
{
if ( _pErrorInfo )
{
- *_pErrorInfo = aError;
+ *_pErrorInfo = std::move(aError);
}
else
{
@@ -482,15 +480,15 @@ std::unique_ptr< OLinkedDocumentsAccess > OApplicationController::getDocumentsAc
return pDocuments;
}
-TransferableHelper* OApplicationController::copyObject()
+bool OApplicationController::copySQLObject(ODataClipboard& rExchange)
{
+ bool bSuccess = false;
try
{
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
ElementType eType = getContainer()->getElementType();
- TransferableHelper* pData = nullptr;
switch( eType )
{
case E_TABLE:
@@ -508,15 +506,42 @@ TransferableHelper* OApplicationController::copyObject()
if ( eType == E_TABLE )
{
- pData = new ODataClipboard(sDataSource, CommandType::TABLE, sName, xConnection, getNumberFormatter(xConnection, getORB()), getORB());
+ rExchange.Update(sDataSource, CommandType::TABLE, sName, xConnection, getNumberFormatter(xConnection, getORB()), getORB());
}
else
{
- pData = new ODataClipboard(sDataSource, CommandType::QUERY, sName, getNumberFormatter(xConnection, getORB()), getORB());
+ rExchange.Update(sDataSource, CommandType::QUERY, sName, getNumberFormatter(xConnection, getORB()), getORB());
}
+ bSuccess = true;
}
+ break;
}
+ default:
break;
+ }
+ }
+ catch(const SQLException&)
+ {
+ showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ return bSuccess;
+}
+
+bool OApplicationController::copyDocObject(svx::OComponentTransferable& rExchange)
+{
+ bool bSuccess = false;
+ try
+ {
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ ElementType eType = getContainer()->getElementType();
+ switch( eType )
+ {
case E_FORM:
case E_REPORT:
{
@@ -526,16 +551,56 @@ TransferableHelper* OApplicationController::copyObject()
if ( xElements.is() && !aList.empty() )
{
Reference< XContent> xContent(xElements->getByHierarchicalName(*aList.begin()),UNO_QUERY);
- pData = new OComponentTransferable( getDatabaseName(), xContent );
+ rExchange.Update(getDatabaseName(), xContent);
+ bSuccess = true;
}
+ break;
}
- break;
default:
break;
}
+ }
+ catch(const SQLException&)
+ {
+ showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ return bSuccess;
+}
- // the ownership goes to ODataClipboards
- return pData;
+rtl::Reference<TransferableHelper> OApplicationController::copyObject()
+{
+ try
+ {
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ ElementType eType = getContainer()->getElementType();
+ switch( eType )
+ {
+ case E_TABLE:
+ case E_QUERY:
+ {
+ rtl::Reference<ODataClipboard> xExchange(new ODataClipboard);
+ if (copySQLObject(*xExchange))
+ return xExchange;
+ break;
+ }
+ case E_FORM:
+ case E_REPORT:
+ {
+ rtl::Reference<svx::OComponentTransferable> xExchange(new svx::OComponentTransferable);
+ if (copyDocObject(*xExchange))
+ return xExchange;
+ break;
+ }
+ break;
+ default:
+ break;
+ }
}
catch(const SQLException&)
{
@@ -679,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() )
{
@@ -699,12 +764,9 @@ bool OApplicationController::paste( ElementType _eType, const svx::ODataAccessDe
{
Reference<XPropertySet> xDstProp(xFac->createDataDescriptor());
- Sequence< OUString> aSeq = xSrcNameAccess->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for( ; pIter != pEnd ; ++pIter)
+ for (auto& name : xSrcNameAccess->getElementNames())
{
- Reference<XPropertySet> xSrcProp(xSrcNameAccess->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xSrcProp(xSrcNameAccess->getByName(name),UNO_QUERY);
::comphelper::copyProperties(xSrcProp,xDstProp);
xAppend->appendByDescriptor(xDstProp);
}
@@ -721,7 +783,7 @@ bool OApplicationController::paste( ElementType _eType, const svx::ODataAccessDe
{
Reference<XContent> xContent;
_rPasteData[DataAccessDescriptorProperty::Component] >>= xContent;
- return insertHierachyElement(_eType,_sParentFolder,Reference<XNameAccess>(xContent,UNO_QUERY).is(),xContent,_bMove);
+ return insertHierarchyElement(_eType,_sParentFolder,Reference<XNameAccess>(xContent,UNO_QUERY).is(),xContent,_bMove);
}
}
catch(const SQLException&) { showError( SQLExceptionInfo( ::cppu::getCaughtException() ) ); }
@@ -787,10 +849,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 2466f22df062..ae5466655386 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -50,12 +50,12 @@
#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/weld.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>
+#include <vcl/weld.hxx>
#include <osl/mutex.hxx>
namespace dbaui
@@ -102,15 +102,15 @@ void OApplicationController::convertToView(const OUString& _sName)
OSaveAsDlg aDlg(getFrameWeld(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker, SADFlags::NONE);
if (aDlg.run() == RET_OK)
{
- OUString sName = aDlg.getName();
+ const OUString& sName = aDlg.getName();
OUString sCatalog = aDlg.getCatalog();
OUString sSchema = aDlg.getSchema();
OUString sNewName(
::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, false, ::dbtools::EComposeRule::InTableDefinitions ) );
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));
+ throw SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE),*this, u"S1000"_ustr,0,Any());
+ getContainer()->elementAdded(E_TABLE,sNewName,Any(xView));
}
}
catch(const SQLException& )
@@ -155,6 +155,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName )
weld::WaitObject aWO(getFrameWeld());
Sequence< Any > aArgs(3);
+ auto pArgs = aArgs.getArray();
sal_Int32 nArgPos = 0;
Reference< css::awt::XWindow> xWindow = getTopMostContainerWindow();
@@ -165,9 +166,9 @@ void OApplicationController::openDialog( const OUString& _sServiceName )
xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent());
}
// the parent window
- aArgs[nArgPos++] <<= PropertyValue( "ParentWindow",
+ pArgs[nArgPos++] <<= PropertyValue( u"ParentWindow"_ustr,
0,
- makeAny(xWindow),
+ Any(xWindow),
PropertyState_DIRECT_VALUE);
// the initial selection
@@ -176,15 +177,15 @@ void OApplicationController::openDialog( const OUString& _sServiceName )
sInitialSelection = getDatabaseName();
if ( !sInitialSelection.isEmpty() )
{
- aArgs[ nArgPos++ ] <<= PropertyValue(
- "InitialSelection", 0,
- makeAny( sInitialSelection ), PropertyState_DIRECT_VALUE );
+ pArgs[ nArgPos++ ] <<= PropertyValue(
+ u"InitialSelection"_ustr, 0,
+ Any( sInitialSelection ), PropertyState_DIRECT_VALUE );
}
SharedConnection xConnection( getConnection() );
if ( xConnection.is() )
{
- aArgs[ nArgPos++ ] <<= PropertyValue(
+ pArgs[ nArgPos++ ] <<= PropertyValue(
PROPERTY_ACTIVE_CONNECTION, 0,
makeAny( xConnection ), PropertyState_DIRECT_VALUE );
}
@@ -320,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 );
}
}
@@ -432,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 )
) );
@@ -482,11 +484,11 @@ void OApplicationController::previewChanged( sal_Int32 _nMode )
try
{
::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
- sal_Int32 nOldMode = aLayoutInfo.getOrDefault( "Preview", _nMode );
+ sal_Int32 nOldMode = aLayoutInfo.getOrDefault( u"Preview"_ustr, _nMode );
if ( nOldMode != _nMode )
{
- aLayoutInfo.put( "Preview", _nMode );
- m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aLayoutInfo.getPropertyValues() ) );
+ aLayoutInfo.put( u"Preview"_ustr, _nMode );
+ m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, Any( aLayoutInfo.getPropertyValues() ) );
}
}
catch ( const Exception& )
@@ -549,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 )
{
@@ -579,10 +575,10 @@ void OApplicationController::onDocumentOpened( const OUString& _rName, const sal
}
}
-bool OApplicationController::insertHierachyElement(ElementType _eType, const OUString& _sParentFolder, bool _bCollection, const Reference<XContent>& _xContent, bool _bMove)
+bool OApplicationController::insertHierarchyElement(ElementType _eType, const OUString& _sParentFolder, bool _bCollection, const Reference<XContent>& _xContent, bool _bMove)
{
Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY);
- return dbaui::insertHierachyElement(getFrameWeld()
+ return dbaui::insertHierarchyElement(getFrameWeld()
,getORB()
,xNames
,_sParentFolder
@@ -638,7 +634,7 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa
if ( !_xLayoutManager.is() )
return;
- static const char s_sStatusbar[] = "private:resource/statusbar/statusbar";
+ static constexpr OUString s_sStatusbar = u"private:resource/statusbar/statusbar"_ustr;
_xLayoutManager->createElement( s_sStatusbar );
_xLayoutManager->requestElement( s_sStatusbar );
@@ -647,14 +643,8 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa
// we need to share the "mnemonic space":
MnemonicGenerator aMnemonicGenerator;
// - the menu already has mnemonics
- SystemWindow* pSystemWindow = getContainer()->GetSystemWindow();
- MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : nullptr;
- if ( pMenu )
- {
- sal_uInt16 nMenuItems = pMenu->GetItemCount();
- for ( sal_uInt16 i = 0; i < nMenuItems; ++i )
- aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) );
- }
+ if (SystemWindow* pSystemWindow = getContainer()->GetSystemWindow())
+ pSystemWindow->CollectMenuBarMnemonics(aMnemonicGenerator);
// - the icons should use automatic ones
getContainer()->createIconAutoMnemonics( aMnemonicGenerator );
// - as well as the entries in the task pane
@@ -672,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;
+ aArguments.put(u"Hidden"_ustr,true);
+ eOpenMode = ElementOpenMode::Normal;
}
std::vector< std::pair< OUString ,Reference< XModel > > > aComponents;
@@ -691,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 502ad243cd76..8e6165b53989 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/XTabController.hpp>
@@ -28,8 +28,10 @@
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/Frame.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XFrames.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
@@ -40,7 +42,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/string.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
+#include <o3tl/string_view.hxx>
#include "AppView.hxx"
#include <helpids.h>
#include <strings.hxx>
@@ -48,13 +50,9 @@
#include <databaseobjectview.hxx>
#include <imageprovider.hxx>
#include <vcl/commandinfoprovider.hxx>
-#include <vcl/settings.hxx>
#include <vcl/cvtgrf.hxx>
-#include <vcl/event.hxx>
-#include <toolkit/awt/vclxmenu.hxx>
#include <tools/stream.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <vcl/treelistentry.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
#include "AppController.hxx"
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -82,133 +80,78 @@ namespace dbaui
namespace
{
- SvTreeListEntry* lcl_findEntry_impl(DBTreeListBox const & rTree, const OUString& _rName, SvTreeListEntry* _pFirst)
+ bool lcl_findEntry_impl(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter)
{
- SvTreeListEntry* pReturn = nullptr;
+ bool bReturn = false;
sal_Int32 nIndex = 0;
- OUString sName( _rName.getToken(0,'/',nIndex) );
+ std::u16string_view sName( o3tl::getToken(rName,0,'/',nIndex) );
- SvTreeListEntry* pEntry = _pFirst;
- while( pEntry )
+ const weld::TreeView& rTreeView = rTree.GetWidget();
+ bool bEntry = true;
+ do
{
- if ( rTree.GetEntryText(pEntry) == sName )
+ if (rTreeView.get_text(rIter) == sName)
{
if ( nIndex != -1 )
{
- sName = _rName.getToken(0,'/',nIndex);
- pEntry = rTree.FirstChild(pEntry);
+ sName = o3tl::getToken(rName,0,'/',nIndex);
+ bEntry = rTreeView.iter_children(rIter);
}
else
{
- pReturn = pEntry;
+ bReturn = true;
break;
}
}
else
- pEntry = pEntry->NextSibling();
+ bEntry = rTreeView.iter_next_sibling(rIter);
}
- return pReturn;
- }
- SvTreeListEntry* lcl_findEntry(DBTreeListBox const & rTree, const OUString& _rName,SvTreeListEntry* _pFirst)
- {
- 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),_pFirst) : nullptr);
- }
- class OTablePreviewWindow : public vcl::Window
- {
- DECL_LINK(OnDisableInput, void*, void);
- void ImplInitSettings();
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
- public:
- OTablePreviewWindow( vcl::Window* pParent, WinBits nStyle );
- virtual bool EventNotify( NotifyEvent& rNEvt ) override;
- };
- OTablePreviewWindow::OTablePreviewWindow(vcl::Window* pParent, WinBits nStyle) : Window( pParent, nStyle)
- {
- ImplInitSettings();
- }
- bool OTablePreviewWindow::EventNotify( NotifyEvent& rNEvt )
- {
- bool bRet = Window::EventNotify(rNEvt);
- if ( rNEvt.GetType() == MouseNotifyEvent::INPUTENABLE && IsInputEnabled() )
- PostUserEvent( LINK( this, OTablePreviewWindow, OnDisableInput), nullptr, true );
- return bRet;
- }
- IMPL_LINK_NOARG(OTablePreviewWindow, OnDisableInput, void*, void)
- {
- EnableInput(false);
- }
- void OTablePreviewWindow::DataChanged( const DataChangedEvent& rDCEvt )
- {
- Window::DataChanged( rDCEvt );
+ while (bEntry);
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
+ return bReturn;
}
- void OTablePreviewWindow::ImplInitSettings()
- {
- //FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- SetBackground( rStyleSettings.GetFieldColor() );
+ bool lcl_findEntry(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter)
+ {
+ sal_Int32 nIndex = 0;
+ 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);
}
-
}
-OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
- ,m_rBorderWin(_rBorderWin)
- ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT))
- ,m_aTBPreview(VclPtr<ToolBox>::Create(this,WB_TABSTOP) )
- ,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY))
- ,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get()))
- ,m_aDocumentInfo(VclPtr< ::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) )
- ,m_ePreviewMode(_ePreviewMode)
+OAppDetailPageHelper::OAppDetailPageHelper(weld::Container* pParent, OAppBorderWindow& rBorderWin, PreviewMode ePreviewMode)
+ : OChildWindow(pParent, u"dbaccess/ui/detailwindow.ui"_ustr, u"DetailWindow"_ustr)
+ , m_rBorderWin(rBorderWin)
+ , m_xBox(m_xBuilder->weld_container(u"box"_ustr))
+ , m_xFL(m_xBuilder->weld_widget(u"separator"_ustr))
+ , m_xMBPreview(m_xBuilder->weld_menu_button(u"disablepreview"_ustr))
+ , m_xPreview(new OPreviewWindow)
+ , m_xPreviewWin(new weld::CustomWeld(*m_xBuilder, u"preview"_ustr, *m_xPreview))
+ , m_xDocumentInfo(new ODocumentInfoPreview)
+ , m_xDocumentInfoWin(new weld::CustomWeld(*m_xBuilder, u"infopreview"_ustr, *m_xDocumentInfo))
+ , m_xTablePreview(m_xBuilder->weld_container(u"tablepreview"_ustr))
+ , m_ePreviewMode(ePreviewMode)
{
- m_aBorder->SetBorderStyle(WindowBorderStyle::MONO);
-
- m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:DBDisablePreview",
- "com.sun.star.sdb.OfficeDatabaseDocument");
- m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
- vcl::CommandInfoProvider::GetLabelForCommand(aProperties),
- ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWNONLY|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
- m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
- m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
- m_aTBPreview->Enable();
+ m_xContainer->set_stack_background();
- m_aPreview->SetHelpId(HID_APP_VIEW_PREVIEW_1);
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(u".uno:DBDisablePreview"_ustr,
+ u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr);
+ m_xMBPreview->set_label(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
+ m_xMBPreview->set_help_id(HID_APP_VIEW_PREVIEW_CB);
- m_pTablePreview.set( VclPtr<OTablePreviewWindow>::Create(m_aBorder.get(), WB_READONLY | WB_DIALOGCONTROL ) );
- m_pTablePreview->SetHelpId(HID_APP_VIEW_PREVIEW_2);
+ m_xMBPreview->connect_selected(LINK(this, OAppDetailPageHelper, MenuSelectHdl));
+ m_xMBPreview->connect_toggled(LINK(this, OAppDetailPageHelper, OnDropdownClickHdl));
- m_aDocumentInfo->SetHelpId(HID_APP_VIEW_PREVIEW_3);
+ m_xPreview->SetHelpId(HID_APP_VIEW_PREVIEW_1);
- m_xWindow = VCLUnoHelper::GetInterface( m_pTablePreview );
+ m_xTablePreview->set_help_id(HID_APP_VIEW_PREVIEW_2);
+ m_xDocumentInfo->SetHelpId(HID_APP_VIEW_PREVIEW_3);
- for (VclPtr<DBTreeListBox> & rpBox : m_pLists)
- rpBox = nullptr;
- ImplInitSettings();
+ m_xWindow = m_xTablePreview->CreateChildFrame();
}
OAppDetailPageHelper::~OAppDetailPageHelper()
{
- disposeOnce();
-}
-
-void OAppDetailPageHelper::dispose()
-{
try
{
Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
@@ -218,27 +161,27 @@ void OAppDetailPageHelper::dispose()
}
catch(const Exception&)
{
- OSL_FAIL("Exception thrown while disposing preview frame!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "Exception thrown while disposing preview frame!");
}
- for (VclPtr<DBTreeListBox> & rpBox : m_pLists)
+ for (auto& rpBox : m_aLists)
{
- if ( rpBox )
- {
- rpBox->clearCurrentSelection();
- rpBox->Hide();
- rpBox->clearCurrentSelection(); // why a second time?
- rpBox.disposeAndClear();
- }
+ if (!rpBox)
+ continue;
+ rpBox.reset();
}
- m_pTablePreview.disposeAndClear();
- m_aDocumentInfo.disposeAndClear();
- m_aPreview.disposeAndClear();
- m_aBorder.disposeAndClear();
- m_aTBPreview.disposeAndClear();
- m_aFL.disposeAndClear();
-
- vcl::Window::dispose();
+
+ m_xWindow->dispose();
+ m_xWindow.clear();
+
+ m_xTablePreview.reset();
+ m_xDocumentInfoWin.reset();
+ m_xDocumentInfo.reset();
+ m_xPreviewWin.reset();
+ m_xPreview.reset();
+ m_xMBPreview.reset();
+ m_xFL.reset();
+ m_xBox.reset();
}
int OAppDetailPageHelper::getVisibleControlIndex() const
@@ -246,7 +189,7 @@ int OAppDetailPageHelper::getVisibleControlIndex() const
int i = 0;
for (; i < E_ELEMENT_TYPE_COUNT ; ++i)
{
- if ( m_pLists[i] && m_pLists[i]->IsVisible() )
+ if (m_aLists[i] && m_aLists[i]->get_visible())
break;
}
return i;
@@ -255,98 +198,112 @@ int OAppDetailPageHelper::getVisibleControlIndex() const
void OAppDetailPageHelper::selectAll()
{
int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
+ if (nPos < E_ELEMENT_TYPE_COUNT)
{
- m_pLists[nPos]->SelectAll(true);
+ m_aLists[nPos]->GetWidget().select_all();
}
}
-void OAppDetailPageHelper::sort(int _nPos,SvSortMode _eSortMode )
+void OAppDetailPageHelper::GrabFocus()
+{
+ int nPos = getVisibleControlIndex();
+ if (nPos < E_ELEMENT_TYPE_COUNT)
+ m_aLists[nPos]->GetWidget().grab_focus();
+ else if (m_xMBPreview && m_xMBPreview->get_visible())
+ m_xMBPreview->grab_focus();
+}
+
+bool OAppDetailPageHelper::HasChildPathFocus() const
{
- OSL_ENSURE(m_pLists[_nPos],"List can not be NULL! ->GPF");
- SvTreeList* pModel = m_pLists[_nPos]->GetModel();
- SvSortMode eOldSortMode = pModel->GetSortMode();
- pModel->SetSortMode(_eSortMode);
- if ( eOldSortMode != _eSortMode )
- pModel->Resort();
+ int nPos = getVisibleControlIndex();
+ if (nPos < E_ELEMENT_TYPE_COUNT && m_aLists[nPos]->GetWidget().has_focus())
+ return true;
+ return m_xMBPreview && m_xMBPreview->has_focus();
+}
+
+void OAppDetailPageHelper::sort(int nPos, bool bAscending)
+{
+ assert(m_aLists[nPos] && "List can not be NULL! ->GPF");
+ m_aLists[nPos]->GetWidget().set_sort_order(bAscending);
}
bool OAppDetailPageHelper::isSortUp() const
{
- SvSortMode eSortMode = SortNone;
+ bool bAscending = false;
+
int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- SvTreeList* pModel = m_pLists[nPos]->GetModel();
- eSortMode = pModel->GetSortMode();
- }
- return eSortMode == SortAscending;
+ if (nPos < E_ELEMENT_TYPE_COUNT)
+ bAscending = m_aLists[nPos]->GetWidget().get_sort_order();
+
+ return bAscending;
}
void OAppDetailPageHelper::sortDown()
{
int nPos = getVisibleControlIndex();
if ( nPos < E_ELEMENT_TYPE_COUNT )
- sort(nPos,SortDescending);
+ sort(nPos, false);
}
void OAppDetailPageHelper::sortUp()
{
int nPos = getVisibleControlIndex();
if ( nPos < E_ELEMENT_TYPE_COUNT )
- sort(nPos,SortAscending);
+ sort(nPos, true);
}
-void OAppDetailPageHelper::getSelectionElementNames( std::vector< OUString>& _rNames ) const
+void OAppDetailPageHelper::getSelectionElementNames(std::vector<OUString>& rNames) const
{
int nPos = getVisibleControlIndex();
if ( nPos >= E_ELEMENT_TYPE_COUNT )
return;
- DBTreeListBox& rTree = *m_pLists[nPos];
- sal_Int32 nCount = rTree.GetEntryCount();
- _rNames.reserve(nCount);
- SvTreeListEntry* pEntry = rTree.FirstSelected();
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
+ sal_Int32 nCount = rTreeView.n_children();
+ rNames.reserve(nCount);
ElementType eType = getElementType();
- while( pEntry )
- {
+
+ rTreeView.selected_foreach([this, eType, &rTreeView, &rNames](weld::TreeIter& rEntry){
if ( eType == E_TABLE )
{
- if( rTree.GetChildCount(pEntry) == 0 )
- _rNames.push_back( getQualifiedName( pEntry ) );
+ if (!rTreeView.iter_has_child(rEntry))
+ rNames.push_back(getQualifiedName(&rEntry));
}
else
{
- OUString sName = rTree.GetEntryText(pEntry);
- SvTreeListEntry* pParent = rTree.GetParent(pEntry);
- while(pParent)
+ OUString sName = rTreeView.get_text(rEntry);
+ std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
+ bool bParent = rTreeView.iter_parent(*xParent);
+ while (bParent)
{
- sName = rTree.GetEntryText(pParent) + "/" + sName;
- pParent = rTree.GetParent(pParent);
+ sName = rTreeView.get_text(*xParent) + "/" + sName;
+ bParent = rTreeView.iter_parent(*xParent);
}
- _rNames.push_back(sName);
+ rNames.push_back(sName);
}
- pEntry = rTree.NextSelected(pEntry);
- }
+
+ return false;
+ });
}
-void OAppDetailPageHelper::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
+void OAppDetailPageHelper::describeCurrentSelectionForControl(const weld::TreeView& rControl, Sequence< NamedDatabaseObject >& out_rSelectedObjects)
{
for (size_t i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
{
- if ( m_pLists[i] == &_rControl )
+ if (&m_aLists[i]->GetWidget() == &rControl)
{
- describeCurrentSelectionForType(static_cast<ElementType>(i), _out_rSelectedObjects);
+ describeCurrentSelectionForType(static_cast<ElementType>(i), out_rSelectedObjects);
return;
}
}
OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForControl: invalid control!" );
}
-void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
+void OAppDetailPageHelper::describeCurrentSelectionForType(const ElementType eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects)
{
- OSL_ENSURE( _eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" );
- DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ].get() : nullptr;
+ OSL_ENSURE( eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" );
+ DBTreeViewBase* pList = ( eType < E_ELEMENT_TYPE_COUNT ) ? m_aLists[eType].get() : nullptr;
OSL_ENSURE( pList, "OAppDetailPageHelper::describeCurrentSelectionForType: "
"You really should ensure this type has already been viewed before!" );
if ( !pList )
@@ -354,60 +311,67 @@ void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _e
std::vector< NamedDatabaseObject > aSelected;
- SvTreeListEntry* pEntry = pList->FirstSelected();
- while( pEntry )
- {
+ weld::TreeView& rTreeView = pList->GetWidget();
+ rTreeView.selected_foreach([pList, eType, &rTreeView, &aSelected](weld::TreeIter& rEntry){
NamedDatabaseObject aObject;
- switch ( _eType )
- {
- case E_TABLE:
- {
- OTableTreeListBox& rTableTree = dynamic_cast< OTableTreeListBox& >( *pList );
- aObject = rTableTree.describeObject( pEntry );
- }
- break;
- case E_QUERY:
- aObject.Type = DatabaseObject::QUERY;
- aObject.Name = pList->GetEntryText( pEntry );
- break;
-
- case E_FORM:
- case E_REPORT:
+ switch (eType)
{
- OUString sName = pList->GetEntryText(pEntry);
- SvTreeListEntry* pParent = pList->GetParent(pEntry);
- while ( pParent )
+ case E_TABLE:
{
- OUStringBuffer buffer;
- buffer.append( pList->GetEntryText( pParent ) );
- buffer.append( '/' );
- buffer.append( sName );
- sName = buffer.makeStringAndClear();
-
- pParent = pList->GetParent( pParent );
+ OTableTreeListBox& rTableTree = static_cast<OTableTreeListBox&>(pList->getListBox());
+ aObject = rTableTree.describeObject(rEntry);
+ break;
}
+ case E_QUERY:
+ aObject.Type = DatabaseObject::QUERY;
+ aObject.Name = rTreeView.get_text(rEntry);
+ break;
+ case E_FORM:
+ case E_REPORT:
+ {
+ OUString sName = rTreeView.get_text(rEntry);
+ std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
+ bool bParent = rTreeView.iter_parent(*xParent);
+ while (bParent)
+ {
+ sName = rTreeView.get_text(*xParent) + "/" + sName;
+ bParent = rTreeView.iter_parent(*xParent);
+ }
- if ( isLeaf( pEntry ) )
- aObject.Type = ( _eType == E_FORM ) ? DatabaseObject::FORM : DatabaseObject::REPORT;
- else
- aObject.Type = ( _eType == E_FORM ) ? DatabaseObjectContainer::FORMS_FOLDER : DatabaseObjectContainer::REPORTS_FOLDER;
- aObject.Name = sName;
- }
- break;
- default:
- OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForType: unexpected type!" );
- break;
+ if (isLeaf(rTreeView, rEntry))
+ aObject.Type = (eType == E_FORM) ? DatabaseObject::FORM : DatabaseObject::REPORT;
+ else
+ aObject.Type = (eType == E_FORM) ? DatabaseObjectContainer::FORMS_FOLDER : DatabaseObjectContainer::REPORTS_FOLDER;
+ aObject.Name = sName;
+ break;
+ }
+ default:
+ OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForType: unexpected type!" );
+ break;
}
- if ( !aObject.Name.isEmpty() )
- {
- aSelected.push_back( aObject );
- }
+ if (!aObject.Name.isEmpty())
+ aSelected.push_back(aObject);
- pEntry = pList->NextSelected(pEntry);
- }
+ return false;
+ });
+
+ _out_rSelectedObjects = comphelper::containerToSequence(aSelected);
+}
+
+vcl::Window* OAppDetailPageHelper::getMenuParent() const
+{
+ return &m_rBorderWin;
+}
- _out_rSelectedObjects = comphelper::containerToSequence( aSelected );
+void OAppDetailPageHelper::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ int x, y, width, height;
+ if (rControl.get_extents_relative_to(m_rBorderWin.getTopLevel(), x, y, width, height))
+ {
+ rPos.AdjustX(x);
+ rPos.AdjustY(y);
+ }
}
void OAppDetailPageHelper::selectElements(const Sequence< OUString>& _aNames)
@@ -416,19 +380,19 @@ void OAppDetailPageHelper::selectElements(const Sequence< OUString>& _aNames)
if ( nPos >= E_ELEMENT_TYPE_COUNT )
return;
- DBTreeListBox& rTree = *m_pLists[nPos];
- rTree.SelectAll(false);
- const OUString* pIter = _aNames.getConstArray();
- const OUString* pEnd = pIter + _aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
+ rTreeView.unselect_all();
+ for (auto& name : _aNames)
{
- SvTreeListEntry* pEntry = rTree.GetEntryPosByName(*pIter);
- if ( pEntry )
- rTree.Select(pEntry);
+ auto xEntry = rTree.getListBox().GetEntryPosByName(name);
+ if (!xEntry)
+ continue;
+ rTreeView.select(*xEntry);
}
}
-OUString OAppDetailPageHelper::getQualifiedName( SvTreeListEntry* _pEntry ) const
+OUString OAppDetailPageHelper::getQualifiedName(const weld::TreeIter* _pEntry) const
{
int nPos = getVisibleControlIndex();
OUString sComposedName;
@@ -436,29 +400,33 @@ OUString OAppDetailPageHelper::getQualifiedName( SvTreeListEntry* _pEntry ) cons
if ( nPos >= E_ELEMENT_TYPE_COUNT )
return sComposedName;
- OSL_ENSURE(m_pLists[nPos],"Tables tree view is NULL! -> GPF");
- DBTreeListBox& rTree = *m_pLists[nPos];
+ OSL_ENSURE(m_aLists[nPos],"Tables tree view is NULL! -> GPF");
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
- SvTreeListEntry* pEntry = _pEntry;
- if ( !pEntry )
- pEntry = rTree.FirstSelected();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator(_pEntry));
+ if (!_pEntry)
+ {
+ if (!rTreeView.get_selected(xEntry.get()))
+ xEntry.reset();
+ }
- if ( !pEntry )
+ if (!xEntry)
return sComposedName;
if ( getElementType() == E_TABLE )
{
- const OTableTreeListBox& rTreeView = dynamic_cast< const OTableTreeListBox& >( *m_pLists[nPos] );
- sComposedName = rTreeView.getQualifiedTableName( pEntry );
+ const OTableTreeListBox& rTableTreeListBox = static_cast<const OTableTreeListBox&>(m_aLists[nPos]->getListBox());
+ sComposedName = rTableTreeListBox.getQualifiedTableName(*xEntry);
}
else
{
- sComposedName = rTree.GetEntryText(pEntry);
- SvTreeListEntry* pParent = rTree.GetParent(pEntry);
- while(pParent)
+ sComposedName = rTreeView.get_text(*xEntry);
+ bool bParent = rTreeView.iter_parent(*xEntry);
+ while (bParent)
{
- sComposedName = rTree.GetEntryText(pParent) + "/" + sComposedName;
- pParent = rTree.GetParent(pParent);
+ sComposedName = rTreeView.get_text(*xEntry) + "/" + sComposedName;
+ bParent = rTreeView.iter_parent(*xEntry);
}
}
@@ -477,13 +445,9 @@ sal_Int32 OAppDetailPageHelper::getSelectionCount()
int nPos = getVisibleControlIndex();
if ( nPos < E_ELEMENT_TYPE_COUNT )
{
- DBTreeListBox& rTree = *m_pLists[nPos];
- SvTreeListEntry* pEntry = rTree.FirstSelected();
- while( pEntry )
- {
- ++nCount;
- pEntry = rTree.NextSelected(pEntry);
- }
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
+ nCount = rTreeView.count_selected_rows();
}
return nCount;
}
@@ -494,16 +458,16 @@ sal_Int32 OAppDetailPageHelper::getElementCount() const
int nPos = getVisibleControlIndex();
if ( nPos < E_ELEMENT_TYPE_COUNT )
{
- nCount = m_pLists[nPos]->GetEntryCount();
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
+ nCount = rTreeView.n_children();
}
return nCount;
}
-bool OAppDetailPageHelper::isLeaf(SvTreeListEntry const * _pEntry)
+bool OAppDetailPageHelper::isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry)
{
- if ( !_pEntry )
- return false;
- sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() );
+ sal_Int32 nEntryType = rTreeView.get_id(rEntry).toInt32();
return !( ( nEntryType == DatabaseObjectContainer::TABLES )
|| ( nEntryType == DatabaseObjectContainer::CATALOG )
|| ( nEntryType == DatabaseObjectContainer::SCHEMA )
@@ -517,55 +481,54 @@ bool OAppDetailPageHelper::isALeafSelected() const
bool bLeafSelected = false;
if ( nPos < E_ELEMENT_TYPE_COUNT )
{
- DBTreeListBox& rTree = *m_pLists[nPos];
- SvTreeListEntry* pEntry = rTree.FirstSelected( );
- while( !bLeafSelected && pEntry )
- {
- bLeafSelected = isLeaf( pEntry );
- pEntry = rTree.NextSelected(pEntry);
- }
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
+ rTreeView.selected_foreach([&rTreeView, &bLeafSelected](weld::TreeIter& rEntry){
+ bLeafSelected = isLeaf(rTreeView, rEntry);
+ return bLeafSelected;
+ });
}
return bLeafSelected;
}
-SvTreeListEntry* OAppDetailPageHelper::getEntry( const Point& _aPosPixel) const
+std::unique_ptr<weld::TreeIter> OAppDetailPageHelper::getEntry( const Point& _aPosPixel) const
{
- SvTreeListEntry* pReturn = nullptr;
+ std::unique_ptr<weld::TreeIter> xReturn;
int nPos = getVisibleControlIndex();
if ( nPos < E_ELEMENT_TYPE_COUNT )
- pReturn = m_pLists[nPos]->GetEntry( _aPosPixel, true );
- return pReturn;
+ {
+ DBTreeViewBase& rTree = *m_aLists[nPos];
+ weld::TreeView& rTreeView = rTree.GetWidget();
+ xReturn = rTreeView.make_iterator();
+ if (!rTreeView.get_dest_row_at_pos(_aPosPixel, xReturn.get(), false))
+ xReturn.reset();
+ }
+ return xReturn;
}
void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xConnection)
{
OSL_ENSURE(_xConnection.is(),"Connection is NULL! -> GPF");
- if ( !m_pLists[E_TABLE] )
+ if ( !m_aLists[E_TABLE] )
{
- VclPtrInstance<OTableTreeListBox> pTreeView(this,
- WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
- pTreeView->SetHelpId(HID_APP_TABLE_TREE);
- m_pLists[E_TABLE] = pTreeView;
-
- createTree( pTreeView,
- ImageProvider::getDefaultImage( DatabaseObject::TABLE )
- );
-
- pTreeView->notifyHiContrastChanged();
- m_aBorder->SetZOrder(pTreeView, ZOrderFlags::Behind);
+ m_aLists[E_TABLE].reset(new DBTableTreeView(m_xBox.get()));
+ setupTree(*m_aLists[E_TABLE]);
+ m_aLists[E_TABLE]->GetWidget().set_help_id(HID_APP_TABLE_TREE);
}
- if ( !m_pLists[E_TABLE]->GetEntryCount() )
+
+ weld::TreeView& rTreeView = m_aLists[E_TABLE]->GetWidget();
+ if (!rTreeView.n_children())
{
- static_cast<OTableTreeListBox*>(m_pLists[E_TABLE].get())->UpdateTableList(_xConnection);
+ static_cast<OTableTreeListBox&>(m_aLists[E_TABLE]->getListBox()).UpdateTableList(_xConnection);
- SvTreeListEntry* pEntry = m_pLists[E_TABLE]->First();
- if ( pEntry )
- m_pLists[E_TABLE]->Expand(pEntry);
- m_pLists[E_TABLE]->SelectAll(false);
+ std::unique_ptr<weld::TreeIter> xFirst(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xFirst))
+ rTreeView.expand_row(*xFirst);
+ rTreeView.unselect_all();
}
- setDetailPage(m_pLists[E_TABLE]);
+ setDetailPage(*m_aLists[E_TABLE]);
}
OUString OAppDetailPageHelper::getElementIcons(ElementType _eType)
@@ -588,65 +551,63 @@ void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameA
{
OSL_ENSURE(E_TABLE != _eType,"E_TABLE isn't allowed.");
- OString sHelpId;
- Image aFolderImage;
+ OUString sHelpId;
switch( _eType )
{
case E_FORM:
sHelpId = HID_APP_FORM_TREE;
- aFolderImage = ImageProvider::getFolderImage( DatabaseObject::FORM );
break;
case E_REPORT:
sHelpId = HID_APP_REPORT_TREE;
- aFolderImage = ImageProvider::getFolderImage( DatabaseObject::REPORT );
break;
case E_QUERY:
sHelpId = HID_APP_QUERY_TREE;
- aFolderImage = ImageProvider::getFolderImage( DatabaseObject::QUERY );
break;
default:
OSL_FAIL("Illegal call!");
}
OUString sImageId = getElementIcons(_eType);
- if ( !m_pLists[_eType] )
+ if ( !m_aLists[_eType] )
{
- m_pLists[_eType] = createSimpleTree( sHelpId, aFolderImage );
+ m_aLists[_eType] = createSimpleTree(sHelpId, _eType);
}
- if ( m_pLists[_eType] )
+ if ( !m_aLists[_eType] )
+ return;
+
+ weld::TreeView& rTreeView = m_aLists[_eType]->GetWidget();
+ if (!rTreeView.n_children() && _xContainer.is())
{
- if ( !m_pLists[_eType]->GetEntryCount() && _xContainer.is() )
- {
- fillNames( _xContainer, _eType, sImageId, nullptr );
+ rTreeView.make_unsorted();
+ fillNames( _xContainer, _eType, sImageId, nullptr );
+ rTreeView.make_sorted();
- m_pLists[_eType]->SelectAll(false);
- }
- setDetailPage(m_pLists[_eType]);
+ rTreeView.unselect_all();
}
+ setDetailPage(*m_aLists[_eType]);
}
-void OAppDetailPageHelper::setDetailPage(vcl::Window* _pWindow)
+void OAppDetailPageHelper::setDetailPage(DBTreeViewBase& rTreeView)
{
- OSL_ENSURE(_pWindow,"OAppDetailPageHelper::setDetailPage: Window is NULL!");
- vcl::Window* pCurrent = getCurrentView();
- if ( pCurrent )
- pCurrent->Hide();
-
- showPreview(nullptr);
bool bHasFocus = false;
- m_aFL->Show();
+
+ DBTreeViewBase* pCurrent = getCurrentView();
+ if (pCurrent)
{
- bHasFocus = pCurrent != nullptr && pCurrent->HasChildPathFocus();
- _pWindow->Show();
+ weld::Widget& rCurrent = pCurrent->GetWidget();
+ bHasFocus = rCurrent.has_focus();
+ pCurrent->hide();
}
- m_aTBPreview->Show();
- m_aBorder->Show();
+
+ showPreview(nullptr);
+ m_xFL->show();
+ rTreeView.show();
+ m_xMBPreview->show();
switchPreview(m_ePreviewMode,true);
- if ( bHasFocus )
- _pWindow->GrabFocus();
- Resize();
+ if (bHasFocus)
+ rTreeView.GetWidget().grab_focus();
}
namespace
@@ -663,12 +624,12 @@ namespace
}
void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContainer, const ElementType _eType,
- const OUString& rImageId, SvTreeListEntry* _pParent )
+ const OUString& rImageId, const weld::TreeIter* _pParent )
{
OSL_ENSURE(_xContainer.is(),"Data source is NULL! -> GPF");
OSL_ENSURE( ( _eType >= E_TABLE ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OAppDetailPageHelper::fillNames: invalid type!" );
- DBTreeListBox* pList = m_pLists[ _eType ].get();
+ DBTreeViewBase* pList = m_aLists[_eType].get();
OSL_ENSURE( pList, "OAppDetailPageHelper::fillNames: you really should create the list before calling this!" );
if ( !pList )
return;
@@ -676,129 +637,137 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
if ( !(_xContainer.is() && _xContainer->hasElements()) )
return;
+ weld::TreeView& rTreeView = pList->GetWidget();
+
+ std::unique_ptr<weld::TreeIter> xRet = rTreeView.make_iterator();
const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
- Sequence< OUString> aSeq = _xContainer->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& name : _xContainer->getElementNames())
{
- SvTreeListEntry* pEntry = nullptr;
- Reference<XNameAccess> xSubElements(_xContainer->getByName(*pIter),UNO_QUERY);
+ Reference<XNameAccess> xSubElements(_xContainer->getByName(name), UNO_QUERY);
if ( xSubElements.is() )
{
- pEntry = pList->InsertEntry( *pIter, _pParent, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
+ OUString sId(OUString::number(nFolderIndicator));
+
+ rTreeView.insert(_pParent, -1, nullptr, &sId, nullptr, nullptr, false, xRet.get());
+ rTreeView.set_text(*xRet, name, 0);
+ rTreeView.set_text_emphasis(*xRet, false, 0);
getBorderWin().getView()->getAppController().containerFound( Reference< XContainer >( xSubElements, UNO_QUERY ) );
- fillNames( xSubElements, _eType, rImageId, pEntry );
+ fillNames( xSubElements, _eType, rImageId, xRet.get());
}
else
{
- pEntry = pList->InsertEntry( *pIter, _pParent );
-
- Image aImage(StockImage::Yes, rImageId);
- pList->SetExpandedEntryBmp(pEntry, aImage);
- pList->SetCollapsedEntryBmp(pEntry, aImage);
+ rTreeView.insert(_pParent, -1, nullptr, nullptr, nullptr, nullptr, false, xRet.get());
+ rTreeView.set_text(*xRet, name, 0);
+ rTreeView.set_text_emphasis(*xRet, false, 0);
+ rTreeView.set_image(*xRet, rImageId);
}
}
}
-DBTreeListBox* OAppDetailPageHelper::createSimpleTree( const OString& _sHelpId, const Image& _rImage)
+std::unique_ptr<DBTreeViewBase> OAppDetailPageHelper::createSimpleTree(const OUString& rHelpId, ElementType eType)
{
- VclPtrInstance<DBTreeListBox> pTreeView(this,
- WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
- pTreeView->SetHelpId( _sHelpId );
- return createTree( pTreeView, _rImage );
+ const bool bSQLType = eType == E_TABLE || eType == E_QUERY;
+ std::unique_ptr<DBTreeViewBase> xTreeView(new DBTreeView(m_xBox.get(), bSQLType));
+ xTreeView->GetWidget().set_help_id(rHelpId);
+ setupTree(*xTreeView);
+ return xTreeView;
}
-DBTreeListBox* OAppDetailPageHelper::createTree( DBTreeListBox* _pTreeView, const Image& _rImage )
+void OAppDetailPageHelper::setupTree(DBTreeViewBase& rDBTreeView)
{
- weld::WaitObject aWaitCursor(GetFrameWeld());
-
- _pTreeView->SetStyle(_pTreeView->GetStyle() | WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
- _pTreeView->GetModel()->SetSortMode(SortAscending);
- _pTreeView->EnableCheckButton( nullptr ); // do not show any buttons
- _pTreeView->SetSelectionMode(SelectionMode::Multiple);
+ weld::WaitObject aWaitCursor(m_rBorderWin.GetFrameWeld());
- _pTreeView->SetDefaultCollapsedEntryBmp( _rImage );
- _pTreeView->SetDefaultExpandedEntryBmp( _rImage );
+ rDBTreeView.getListBox().setCopyHandler(LINK(this, OAppDetailPageHelper, OnCopyEntry));
+ rDBTreeView.getListBox().setPasteHandler(LINK(this, OAppDetailPageHelper, OnPasteEntry));
+ rDBTreeView.getListBox().setDeleteHandler(LINK(this, OAppDetailPageHelper, OnDeleteEntry));
- _pTreeView->SetDoubleClickHdl(LINK(this, OAppDetailPageHelper, OnEntryDoubleClick));
- _pTreeView->SetEnterKeyHdl(LINK(this, OAppDetailPageHelper, OnEntryEnterKey));
- _pTreeView->SetSelChangeHdl(LINK(this, OAppDetailPageHelper, OnEntrySelChange));
+ weld::TreeView& rTreeView = rDBTreeView.GetWidget();
+ rTreeView.make_sorted();
+ rTreeView.set_selection_mode(SelectionMode::Multiple);
+ // an arbitrary small size it's allowed to shrink to
+ rTreeView.set_size_request(42, 42);
- _pTreeView->setCopyHandler(LINK(this, OAppDetailPageHelper, OnCopyEntry));
- _pTreeView->setPasteHandler(LINK(this, OAppDetailPageHelper, OnPasteEntry));
- _pTreeView->setDeleteHandler(LINK(this, OAppDetailPageHelper, OnDeleteEntry));
+ rTreeView.connect_row_activated(LINK(this, OAppDetailPageHelper, OnEntryDoubleClick));
- _pTreeView->setControlActionListener( &getBorderWin().getView()->getAppController() );
- _pTreeView->setContextMenuProvider( &getBorderWin().getView()->getAppController() );
+ rDBTreeView.getListBox().SetSelChangeHdl(LINK(this, OAppDetailPageHelper, OnEntrySelChange));
- return _pTreeView;
+ rDBTreeView.getListBox().setControlActionListener(&getBorderWin().getView()->getAppController());
+ rDBTreeView.getListBox().setContextMenuProvider(&getBorderWin().getView()->getAppController());
}
void OAppDetailPageHelper::clearPages()
{
showPreview(nullptr);
- for (VclPtr<DBTreeListBox> & rpBox : m_pLists)
+ for (auto& rpBox : m_aLists)
{
if ( rpBox )
- rpBox->Clear();
+ rpBox->GetWidget().clear();
}
}
bool OAppDetailPageHelper::isFilled() const
{
size_t i = 0;
- for (; i < E_ELEMENT_TYPE_COUNT && !m_pLists[i]; ++i)
+ for (; i < E_ELEMENT_TYPE_COUNT && !m_aLists[i]; ++i)
;
return i != E_ELEMENT_TYPE_COUNT;
}
-void OAppDetailPageHelper::elementReplaced(ElementType _eType
- ,const OUString& _rOldName
- ,const OUString& _rNewName )
+void OAppDetailPageHelper::elementReplaced(ElementType eType,
+ const OUString& rOldName,
+ const OUString& rNewName)
{
- DBTreeListBox* pTreeView = getCurrentView();
- if ( !pTreeView )
+ DBTreeViewBase* pTreeView = getCurrentView();
+ if (!pTreeView)
return;
- SvTreeListEntry* pEntry = nullptr;
- switch( _eType )
+ weld::TreeView& rTreeView = pTreeView->GetWidget();
+ rTreeView.make_unsorted();
+
+ switch (eType)
{
case E_TABLE:
- static_cast<OTableTreeListBox*>(pTreeView)->removedTable( _rOldName );
- static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rNewName );
- return;
-
+ static_cast<OTableTreeListBox&>(pTreeView->getListBox()).removedTable(rOldName);
+ static_cast<OTableTreeListBox&>(pTreeView->getListBox()).addedTable(rNewName);
+ break;
case E_QUERY:
- pEntry = lcl_findEntry_impl(*pTreeView,_rOldName,pTreeView->First());
+ {
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xIter) && lcl_findEntry_impl(pTreeView->getListBox(), rOldName, *xIter))
+ rTreeView.set_text(*xIter, rNewName);
break;
+ }
case E_FORM:
case E_REPORT:
- pEntry = lcl_findEntry(*pTreeView,_rOldName,pTreeView->First());
+ {
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xIter) && lcl_findEntry(pTreeView->getListBox(), rOldName, *xIter))
+ rTreeView.set_text(*xIter, rNewName);
break;
+ }
default:
OSL_FAIL("Invalid element type");
}
- OSL_ENSURE(pEntry,"Do you know that the name isn't existence!");
- if ( pEntry )
- {
- pTreeView->SetEntryText(pEntry,_rNewName);
- }
+
+ rTreeView.make_sorted();
}
-SvTreeListEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
+std::unique_ptr<weld::TreeIter> OAppDetailPageHelper::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
{
- SvTreeListEntry* pRet = nullptr;
- DBTreeListBox* pTreeView = m_pLists[_eType].get();
- if( _eType == E_TABLE && pTreeView )
+ std::unique_ptr<weld::TreeIter> xRet;
+ DBTreeViewBase* pTreeView = _eType != E_NONE ? m_aLists[_eType].get() : nullptr;
+ if (!pTreeView)
+ return xRet;
+ weld::TreeView& rTreeView = pTreeView->GetWidget();
+ rTreeView.make_unsorted();
+ if (_eType == E_TABLE)
{
- pRet = static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rName );
+ xRet = static_cast<OTableTreeListBox&>(pTreeView->getListBox()).addedTable( _rName );
}
- else if ( pTreeView )
+ else
{
-
- SvTreeListEntry* pEntry = nullptr;
+ std::unique_ptr<weld::TreeIter> xEntry;
Reference<XChild> xChild(_rObject,UNO_QUERY);
if ( xChild.is() && E_QUERY != _eType )
{
@@ -806,7 +775,9 @@ SvTreeListEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const OUS
if ( xContent.is() )
{
OUString sName = xContent->getIdentifier()->getContentIdentifier();
- pEntry = lcl_findEntry(*pTreeView,sName,pTreeView->First());
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xIter) && lcl_findEntry(pTreeView->getListBox(), sName, *xIter))
+ xEntry = std::move(xIter);
}
}
@@ -815,58 +786,66 @@ SvTreeListEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const OUS
if ( xContainer.is() )
{
const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
- pRet = pTreeView->InsertEntry( _rName, pEntry, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
- fillNames( xContainer, _eType, sImageId, pRet );
+ OUString sId(OUString::number(nFolderIndicator));
+
+ xRet = rTreeView.make_iterator();
+ rTreeView.insert(xEntry.get(), -1, nullptr, &sId, nullptr, nullptr, false, xRet.get());
+ rTreeView.set_text(*xRet, _rName, 0);
+ rTreeView.set_text_emphasis(*xRet, false, 0);
+ fillNames(xContainer, _eType, sImageId, xRet.get());
}
else
{
- pRet = pTreeView->InsertEntry( _rName, pEntry );
-
- Image aImage(StockImage::Yes, sImageId);
- pTreeView->SetExpandedEntryBmp( pRet, aImage );
- pTreeView->SetCollapsedEntryBmp( pRet, aImage );
+ xRet = rTreeView.make_iterator();
+ rTreeView.insert(xEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xRet.get());
+ rTreeView.set_text(*xRet, _rName, 0);
+ rTreeView.set_text_emphasis(*xRet, false, 0);
+ rTreeView.set_image(*xRet, sImageId);
}
}
- return pRet;
+ rTreeView.make_sorted();
+ return xRet;
}
void OAppDetailPageHelper::elementRemoved( ElementType _eType,const OUString& _rName )
{
- DBTreeListBox* pTreeView = getCurrentView();
+ DBTreeViewBase* pTreeView = getCurrentView();
if ( !pTreeView )
return;
+ weld::TreeView& rTreeView = pTreeView->GetWidget();
+
switch( _eType )
{
case E_TABLE:
// we don't need to clear the table here, it is already done by the dispose listener
- static_cast< OTableTreeListBox* >( pTreeView )->removedTable( _rName );
+ static_cast<OTableTreeListBox&>(pTreeView->getListBox()).removedTable(_rName);
break;
case E_QUERY:
- if (auto pEntry = lcl_findEntry_impl(*pTreeView, _rName, pTreeView->First()))
- pTreeView->GetModel()->Remove(pEntry);
+ {
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xIter) && lcl_findEntry_impl(pTreeView->getListBox(), _rName, *xIter))
+ rTreeView.remove(*xIter);
break;
+ }
case E_FORM:
case E_REPORT:
- if (auto pEntry = lcl_findEntry(*pTreeView, _rName, pTreeView->First()))
- pTreeView->GetModel()->Remove(pEntry);
+ {
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xIter) && lcl_findEntry(pTreeView->getListBox(), _rName, *xIter))
+ rTreeView.remove(*xIter);
break;
+ }
default:
OSL_FAIL("Invalid element type");
}
- if ( !pTreeView->GetEntryCount() )
+ if (!rTreeView.n_children())
showPreview(nullptr);
}
-IMPL_LINK(OAppDetailPageHelper, OnEntryEnterKey, DBTreeListBox*, _pTree, void )
-{
- OnEntryDoubleClick(_pTree);
-}
-IMPL_LINK(OAppDetailPageHelper, OnEntryDoubleClick, SvTreeListBox*, _pTree, bool)
+IMPL_LINK(OAppDetailPageHelper, OnEntryDoubleClick, weld::TreeView&, rTreeView, bool)
{
- OSL_ENSURE( _pTree, "OAppDetailPageHelper, OnEntryDoubleClick: invalid callback!" );
- bool bHandled = ( _pTree != nullptr ) && getBorderWin().getView()->getAppController().onEntryDoubleClick( *_pTree );
- return bHandled;
+ return getBorderWin().getView()->getAppController().onEntryDoubleClick(rTreeView);
}
IMPL_LINK_NOARG(OAppDetailPageHelper, OnEntrySelChange, LinkParamNone*, void)
@@ -889,47 +868,16 @@ IMPL_LINK_NOARG( OAppDetailPageHelper, OnDeleteEntry, LinkParamNone*, void )
getBorderWin().getView()->getAppController().onDeleteEntry();
}
-void OAppDetailPageHelper::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- vcl::Window* pWindow = getCurrentView();
- if ( !pWindow )
- return;
-
- Size aFLSize = LogicToPixel(Size(2, 6), MapMode(MapUnit::MapAppFont));
- sal_Int32 n6PPT = aFLSize.Height();
- long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
-
- pWindow->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
-
- m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) );
-
- Size aTBSize = m_aTBPreview->CalcWindowSizePixel();
- m_aTBPreview->SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
- aTBSize );
-
- m_aBorder->SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
- Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
- m_aPreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
- m_aDocumentInfo->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
- m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
-}
-
-
bool OAppDetailPageHelper::isPreviewEnabled() const
{
- return m_ePreviewMode != E_PREVIEWNONE;
+ return m_ePreviewMode != PreviewMode::NONE;
}
namespace
{
- OUString stripTrailingDots(const OUString& rStr)
+ OUString stripTrailingDots(std::u16string_view rStr)
{
- return comphelper::string::stripEnd(rStr, '.');
+ return OUString(comphelper::string::stripEnd(rStr, '.'));
}
}
@@ -945,41 +893,41 @@ 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;
}
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr);
OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
- m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
- Resize();
+ m_xMBPreview->set_label(stripTrailingDots(aCommandLabel));
// simulate a selectionChanged event at the controller, to force the preview to be updated
if ( isPreviewEnabled() )
{
- if ( getCurrentView() && getCurrentView()->FirstSelected() )
+ DBTreeViewBase* pCurrent = getCurrentView();
+ if (pCurrent && pCurrent->GetWidget().get_selected(nullptr))
{
getBorderWin().getView()->getAppController().onSelectionChanged();
}
}
else
{
- m_pTablePreview->Hide();
- m_aPreview->Hide();
- m_aDocumentInfo->Hide();
+ m_xTablePreview->hide();
+ m_xPreview->Hide();
+ m_xDocumentInfo->Hide();
}
}
@@ -988,25 +936,25 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
if ( !isPreviewEnabled() )
return;
- m_pTablePreview->Hide();
+ m_xTablePreview->hide();
- weld::WaitObject aWaitCursor(GetFrameWeld());
+ weld::WaitObject aWaitCursor(m_rBorderWin.GetFrameWeld());
try
{
Reference<XCommandProcessor> xContent(_xContent,UNO_QUERY);
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_aDocumentInfo->Hide();
- m_aPreview->Show();
+ m_xDocumentInfo->Hide();
+ m_xPreview->Show();
Graphic aGraphic;
Sequence < sal_Int8 > aBmpSequence;
@@ -1018,24 +966,24 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
GraphicConverter::Import(aData,aGraphic);
}
- m_aPreview->setGraphic( aGraphic );
- m_aPreview->Invalidate();
+ m_xPreview->setGraphic( aGraphic );
+ m_xPreview->Invalidate();
}
else
{
- m_aPreview->Hide();
- m_aDocumentInfo->clear();
- m_aDocumentInfo->Show();
+ m_xPreview->Hide();
+ m_xDocumentInfo->clear();
+ m_xDocumentInfo->Show();
Reference<document::XDocumentProperties> xProp(
aPreview, UNO_QUERY);
if ( xProp.is() )
- m_aDocumentInfo->fill(xProp);
+ m_xDocumentInfo->fill(xProp);
}
}
else
{
- m_aPreview->Hide();
- m_aDocumentInfo->Hide();
+ m_xPreview->Hide();
+ m_xDocumentInfo->Hide();
}
}
catch( const Exception& )
@@ -1051,10 +999,10 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
if ( !isPreviewEnabled() )
return;
- weld::WaitObject aWaitCursor(GetFrameWeld());
- m_aPreview->Hide();
- m_aDocumentInfo->Hide();
- m_pTablePreview->Show();
+ weld::WaitObject aWaitCursor(m_rBorderWin.GetFrameWeld());
+ m_xPreview->Hide();
+ m_xDocumentInfo->Hide();
+ m_xTablePreview->show();
if ( !m_xFrame.is() )
{
try
@@ -1087,12 +1035,12 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
pDispatcher->setTargetFrame( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW) );
::comphelper::NamedValueCollection aArgs;
- aArgs.put( "Preview", true );
- aArgs.put( "ReadOnly", true );
- aArgs.put( "AsTemplate", false );
- aArgs.put( OUString(PROPERTY_SHOWMENU), false );
+ aArgs.put( u"Preview"_ustr, true );
+ aArgs.put( u"ReadOnly"_ustr, true );
+ aArgs.put( u"AsTemplate"_ustr, 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
@@ -1110,19 +1058,38 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
showPreview(nullptr);
}
-IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
+namespace
{
- m_aTBPreview->EndSelection();
+ class MenuStatusListener final : public ::cppu::WeakImplHelper<css::frame::XStatusListener>
+ {
+ weld::MenuButton& m_rMBPreview;
+ public:
+ MenuStatusListener(weld::MenuButton& rMBPreview)
+ : m_rMBPreview(rMBPreview)
+ {
+ }
+
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent &rEvent) override
+ {
+ if (!rEvent.IsEnabled)
+ {
+ const OUString &rURL = rEvent.FeatureURL.Complete;
+ m_rMBPreview.remove_item(rURL);
+ }
+ }
- // tell the toolbox that the item is pressed down
- m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, true );
+ virtual void SAL_CALL disposing( const css::lang::EventObject& /*rSource*/) override
+ {
+ }
+ };
+};
- // simulate a mouse move (so the "down" state is really painted)
- Point aPoint = m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW ).TopLeft();
- MouseEvent aMove( aPoint, 0, MouseEventModifiers::SIMPLEMOVE | MouseEventModifiers::SYNTHETIC );
- m_aTBPreview->MouseMove( aMove );
+IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, weld::Toggleable&, void)
+{
+ if (!m_xMBPreview->get_active())
+ return;
- m_aTBPreview->PaintImmediately();
+ m_xMBPreview->clear();
// execute the menu
css::uno::Reference<css::uno::XComponentContext> xContext(getBorderWin().getView()->getORB());
@@ -1130,30 +1097,49 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
if (!xPopupMenuFactory.is())
return;
+ 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", getBorderWin().getView()->getAppController().getFrame())) };
+ css::uno::Any(comphelper::makePropertyValue(u"InToolbar"_ustr, true)),
+ css::uno::Any(comphelper::makePropertyValue(u"ModuleIdentifier"_ustr, u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr)),
+ css::uno::Any(comphelper::makePropertyValue(u"Frame"_ustr, xFrame)) };
- css::uno::Reference<css::frame::XPopupMenuController> xPopupController(
- xPopupMenuFactory->createInstanceWithArgumentsAndContext(".uno:DBPreview", aArgs, xContext), css::uno::UNO_QUERY);
+ css::uno::Reference<css::frame::XPopupMenuController> xPopupController
+ (xPopupMenuFactory->createInstanceWithArgumentsAndContext(u".uno:DBPreview"_ustr, aArgs, xContext), css::uno::UNO_QUERY);
if (!xPopupController.is())
return;
- rtl::Reference xPopupMenu(new VCLXPopupMenu);
- xPopupController->setPopupMenu(xPopupMenu.get());
- VclPtr<PopupMenu> aMenu(static_cast<PopupMenu*>(xPopupMenu->GetMenu()));
+ rtl::Reference<VCLXPopupMenu> xPopupMenu(new VCLXPopupMenu());
+ xPopupController->setPopupMenu(xPopupMenu);
+
+ css::util::URL aTargetURL;
+ Reference<XDispatchProvider> xDispatchProvider(xFrame, css::uno::UNO_QUERY);
+
+ css::uno::Reference<css::frame::XStatusListener> xStatusListener(new MenuStatusListener(*m_xMBPreview));
- sal_uInt16 nSelectedAction = aMenu->Execute(m_aTBPreview.get(), m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW ));
- // "cleanup" the toolbox state
- MouseEvent aLeave( aPoint, 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC );
- m_aTBPreview->MouseMove( aLeave );
- m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, false);
- if ( nSelectedAction )
+ for (int i = 0, nCount = xPopupMenu->getItemCount(); i < nCount; ++i)
{
- m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aMenu->GetItemText(nSelectedAction)));
- Resize();
+ auto nItemId = xPopupMenu->getItemId(i);
+ // in practice disabled items are initially enabled so this doesn't have an effect and
+ // an status update is needed to query the enabled/disabled state
+ if (!xPopupMenu->isItemEnabled(nItemId))
+ continue;
+
+ aTargetURL.Complete = xPopupMenu->getCommand(nItemId);
+
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aTargetURL.Complete,
+ u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr);
+ m_xMBPreview->append_item(aTargetURL.Complete, vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
+
+ // Add/remove status listener to get a status update once so we can remove any disabled items from the menu
+ auto xDispatch = xDispatchProvider->queryDispatch(aTargetURL, u"_self"_ustr,
+ css::frame::FrameSearchFlag::SELF);
+ if (xDispatch.is())
+ {
+ xDispatch->addStatusListener(xStatusListener, aTargetURL);
+ xDispatch->removeStatusListener(xStatusListener, aTargetURL);
+ }
}
css::uno::Reference<css::lang::XComponent> xComponent(xPopupController, css::uno::UNO_QUERY);
@@ -1161,76 +1147,29 @@ IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
xComponent->dispose();
}
-void OAppDetailPageHelper::KeyInput( const KeyEvent& rKEvt )
+IMPL_LINK(OAppDetailPageHelper, MenuSelectHdl, const OUString&, rIdent, void)
{
- SvTreeListBox* pCurrentView = getCurrentView();
- OSL_PRECOND( pCurrentView, "OAppDetailPageHelper::KeyInput: how this?" );
-
- sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
-
- if ( ( KEY_RETURN == nCode ) && pCurrentView )
- {
- getBorderWin().getView()->getAppController().onEntryDoubleClick( *pCurrentView );
- }
- else
- Window::KeyInput(rKEvt);
-}
-
-void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
+ if (rIdent.isEmpty())
+ return;
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
+ css::util::URL aURL;
+ aURL.Complete = rIdent;
- {
- ImplInitSettings();
- if ( m_pLists[ E_TABLE ] )
- {
- OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ].get() );
- OSL_ENSURE( pTableTree != nullptr, "OAppDetailPageHelper::DataChanged: a tree list for tables which is no TableTreeList?" );
- if ( pTableTree )
- pTableTree->notifyHiContrastChanged();
- }
- }
-}
+ Reference<XDispatchProvider> xProvider(getBorderWin().getView()->getAppController().getFrame(), UNO_QUERY);
+ Reference<XDispatch> xDisp = xProvider->queryDispatch(aURL, u"_self"_ustr, 0);
+ xDisp->dispatch(aURL, css::uno::Sequence<css::beans::PropertyValue>());
-void OAppDetailPageHelper::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
- m_aTBPreview->SetPointFont(*m_aTBPreview, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- m_aBorder->SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aBorder->SetTextFillColor();
- m_aTBPreview->SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aTBPreview->SetTextFillColor();
- SetBackground( rStyleSettings.GetFieldColor() );
- m_aBorder->SetBackground( rStyleSettings.GetFieldColor() );
- m_aFL->SetBackground( rStyleSettings.GetFieldColor() );
- m_aDocumentInfo->SetBackground( rStyleSettings.GetFieldColor() );
- m_aTBPreview->SetBackground( rStyleSettings.GetFieldColor() );
- m_pTablePreview->SetBackground( rStyleSettings.GetFieldColor() );
+ m_xMBPreview->set_label(stripTrailingDots(m_xMBPreview->get_item_label(rIdent)));
}
-OPreviewWindow::OPreviewWindow(vcl::Window* _pParent)
-: Window(_pParent)
+OPreviewWindow::OPreviewWindow()
{
- ImplInitSettings();
}
-bool OPreviewWindow::ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const
+bool OPreviewWindow::ImplGetGraphicCenterRect(const vcl::RenderContext& rRenderContext, const Graphic& rGraphic, tools::Rectangle& rResultRect) const
{
const Size aWinSize( GetOutputSizePixel() );
- Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) );
+ Size aNewSize(rRenderContext.LogicToPixel(rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode()));
bool bRet = false;
if( aNewSize.Width() && aNewSize.Height() )
@@ -1241,13 +1180,13 @@ bool OPreviewWindow::ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::R
if ( fGrfWH < fWinWH )
{
- aNewSize.setWidth( static_cast<long>( aWinSize.Height() * fGrfWH ) );
+ aNewSize.setWidth( static_cast<tools::Long>( aWinSize.Height() * fGrfWH ) );
aNewSize.setHeight( aWinSize.Height() );
}
else
{
aNewSize.setWidth( aWinSize.Width() );
- aNewSize.setHeight( static_cast<long>( aWinSize.Width() / fGrfWH) );
+ aNewSize.setHeight( static_cast<tools::Long>( aWinSize.Width() / fGrfWH) );
}
const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1,
@@ -1260,46 +1199,18 @@ bool OPreviewWindow::ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::R
return bRet;
}
-void OPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
+void OPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
{
- Window::Paint(rRenderContext, rRect);
-
- if (ImplGetGraphicCenterRect(m_aGraphicObj.GetGraphic(), m_aPreviewRect))
+ if (ImplGetGraphicCenterRect(rRenderContext, m_aGraphicObj.GetGraphic(), m_aPreviewRect))
{
const Point aPos(m_aPreviewRect.TopLeft());
- const Size aSize(m_aPreviewRect.GetSize());
+ const Size aSize(m_aPreviewRect.GetSize());
if (m_aGraphicObj.IsAnimated())
- m_aGraphicObj.StartAnimation(&rRenderContext, aPos, aSize);
+ m_aGraphicObj.StartAnimation(rRenderContext, aPos, aSize);
else
- m_aGraphicObj.Draw(&rRenderContext, aPos, aSize);
+ m_aGraphicObj.Draw(rRenderContext, aPos, aSize);
}
}
-void OPreviewWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OPreviewWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 1dd89d84a28a..066ff0c32472 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILPAGEHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILPAGEHELPER_HXX
+#pragma once
#include <vector>
@@ -26,31 +25,31 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#include <AppElementType.hxx>
-#include <vcl/treelistbox.hxx>
-#include <svtools/DocumentInfoPreview.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/toolbox.hxx>
#include <vcl/graph.hxx>
#include <vcl/GraphicObject.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
+#include <AppElementType.hxx>
+#include <ChildWindow.hxx>
+#include "DocumentInfoPreview.hxx"
namespace com::sun::star::awt { class XWindow; }
namespace com::sun::star::frame { class XFrame2; }
-namespace com::sun::star::io { class XPersist; }
-
-#define ELEMENT_COUNT size_t(E_ELEMENT_TYPE_COUNT)
namespace dbaui
{
class OAppBorderWindow;
- class DBTreeListBox;
+ class ODocumentInfoPreview;
+ class DBTreeViewBase;
- class OPreviewWindow : public vcl::Window
+ class OPreviewWindow final : public weld::CustomWidgetController
{
GraphicObject m_aGraphicObj;
- tools::Rectangle m_aPreviewRect;
+ tools::Rectangle m_aPreviewRect;
/** gets the graphic center rect
+ @param rRenderContext
+ the context to which we are drawing
@param rGraphic
the graphic
@param rResultRect
@@ -59,31 +58,34 @@ namespace dbaui
@return
<TRUE/> when successful
*/
- bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
- void ImplInitSettings();
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+ bool ImplGetGraphicCenterRect(const vcl::RenderContext& rRenderContext, const Graphic& rGraphic, tools::Rectangle& rResultRect) const;
+
public:
- explicit OPreviewWindow(vcl::Window* _pParent);
+ OPreviewWindow();
- // Window overrides
- virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
void setGraphic(const Graphic& _rGraphic ) { m_aGraphicObj.SetGraphic(_rGraphic); }
};
+
// A helper class for the controls in the detail page.
// Combines general functionality.
- class OAppDetailPageHelper : public vcl::Window
+ class OAppDetailPageHelper final : public OChildWindow
{
- VclPtr<DBTreeListBox> m_pLists[ELEMENT_COUNT];
+ std::unique_ptr<DBTreeViewBase> m_aLists[size_t(E_ELEMENT_TYPE_COUNT)];
OAppBorderWindow& m_rBorderWin;
- VclPtr<FixedLine> m_aFL;
- VclPtr<ToolBox> m_aTBPreview;
- VclPtr<Window> m_aBorder;
- VclPtr<OPreviewWindow> m_aPreview;
- VclPtr< ::svtools::ODocumentInfoPreview>
- m_aDocumentInfo;
- VclPtr<vcl::Window> m_pTablePreview;
+ std::unique_ptr<weld::Container> m_xBox;
+ std::unique_ptr<weld::Widget> m_xFL;
+ std::unique_ptr<weld::MenuButton> m_xMBPreview;
+
+ std::unique_ptr<OPreviewWindow> m_xPreview;
+ std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
+
+ std::unique_ptr<ODocumentInfoPreview> m_xDocumentInfo;
+ std::unique_ptr<weld::CustomWeld> m_xDocumentInfoWin;
+
+ std::unique_ptr<weld::Container> m_xTablePreview;
+
PreviewMode m_ePreviewMode;
css::uno::Reference < css::frame::XFrame2 >
m_xFrame;
@@ -94,12 +96,12 @@ namespace dbaui
int getVisibleControlIndex() const;
/** sorts the entries in the tree list box.
- @param _nPos
+ @param nPos
Which list should be sorted.
- @param _eSortMode
- How should be sorted.
+ @param bAscending
+ If sort should be Ascending of Descending
*/
- void sort(int _nPos,SvSortMode _eSortMode );
+ void sort(int nPos, bool bAscending);
/** retrieves the resource ids of the images representing elements of the given type
*/
@@ -118,56 +120,48 @@ namespace dbaui
void fillNames( const css::uno::Reference< css::container::XNameAccess >& _xContainer,
const ElementType _eType,
const OUString& rImageId,
- SvTreeListEntry* _pParent );
+ const weld::TreeIter* _pParent );
/** sets the detail page
- @param _pWindow
+ @param rTreeView
The control which should be visible.
*/
- void setDetailPage(vcl::Window* _pWindow);
+ void setDetailPage(DBTreeViewBase& rTreeView);
/** sets all HandleCallbacks
- @param _pTreeView
- The newly created DBTreeListBox
- @param _rImage
- the resource id of the default icon
- @return
- The new tree.
+ @param rTreeView
+ The newly created DBTreeViewBase
*/
- DBTreeListBox* createTree( DBTreeListBox* _pTreeView, const Image& _rImage );
+ void setupTree(DBTreeViewBase& rTreeView);
/** creates the tree and sets all HandleCallbacks
- @param _nHelpId
+ @param nHelpId
The help id of the control
- @param _nCollapsedBitmap
- The image to use in high contrast mode.
+ @param eType
+ The element type of the control
@return
The new tree.
*/
- DBTreeListBox* createSimpleTree( const OString& _sHelpId, const Image& _rImage);
+ std::unique_ptr<DBTreeViewBase> createSimpleTree(const OUString& rHelpId, ElementType eType);
- DECL_LINK( OnEntryDoubleClick, SvTreeListBox*, bool );
- DECL_LINK( OnEntryEnterKey, DBTreeListBox*, void );
+ DECL_LINK( OnEntryDoubleClick, weld::TreeView&, bool );
DECL_LINK( OnEntrySelChange, LinkParamNone*, void );
DECL_LINK( OnCopyEntry, LinkParamNone*, void );
DECL_LINK( OnPasteEntry, LinkParamNone*, void );
DECL_LINK( OnDeleteEntry, LinkParamNone*, void );
- // click a TB slot
- DECL_LINK(OnDropdownClickHdl, ToolBox*, void);
+ DECL_LINK(OnDropdownClickHdl, weld::Toggleable&, void);
+ DECL_LINK(MenuSelectHdl, const OUString&, void);
OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
- void ImplInitSettings();
public:
- OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode);
+ OAppDetailPageHelper(weld::Container* pParent, OAppBorderWindow& rBorderWin, PreviewMode ePreviewMode);
virtual ~OAppDetailPageHelper() override;
- virtual void dispose() override;
- // Window overrides
- virtual void Resize() override;
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void GrabFocus() override;
+ virtual bool HasChildPathFocus() const override;
/** creates the tables page
@param _xConnection
@@ -185,10 +179,10 @@ namespace dbaui
/** returns the current visible tree list box
*/
- DBTreeListBox* getCurrentView() const
+ DBTreeViewBase* getCurrentView() const
{
ElementType eType = getElementType();
- return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)].get() : nullptr;
+ return (eType != E_NONE ) ? m_aLists[static_cast<sal_Int32>(eType)].get() : nullptr;
}
/// select all entries in the visible control
@@ -212,7 +206,7 @@ namespace dbaui
/** describes the current selection for the given control
*/
void describeCurrentSelectionForControl(
- const Control& _rControl,
+ const weld::TreeView& rControl,
css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
);
@@ -223,6 +217,11 @@ namespace dbaui
css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
);
+ /** get the menu parent window for the given control
+ */
+ vcl::Window* getMenuParent() const;
+ void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
+
/** select all names on the currently selected container. Non existence names where ignored.
*
* \param _aNames the element names
@@ -236,7 +235,7 @@ namespace dbaui
@return
the qualified name
*/
- OUString getQualifiedName( SvTreeListEntry* _pEntry ) const;
+ OUString getQualifiedName( const weld::TreeIter* _pEntry ) const;
/// return the element of currently select entry
ElementType getElementType() const;
@@ -248,12 +247,14 @@ namespace dbaui
sal_Int32 getElementCount() const;
/** returns if an entry is a leaf
- @param _pEntry
+ @param rTreeView
+ The TreeView rEntry belongs to
+ @param rEntry
The entry to check
@return
<TRUE/> if the entry is a leaf, otherwise <FALSE/>
*/
- static bool isLeaf(SvTreeListEntry const * _pEntry);
+ static bool isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry);
/** returns if one of the selected entries is a leaf
@return
@@ -261,7 +262,7 @@ namespace dbaui
*/
bool isALeafSelected() const;
- SvTreeListEntry* getEntry( const Point& _aPosPixel ) const;
+ std::unique_ptr<weld::TreeIter> getEntry(const Point& rPosPixel) const;
/// clears the detail pages
void clearPages();
@@ -279,9 +280,9 @@ namespace dbaui
@param _rxConn
If we insert a table, the connection must be set.
*/
- SvTreeListEntry* elementAdded(ElementType eType
- ,const OUString& _rName
- ,const css::uno::Any& _rObject );
+ std::unique_ptr<weld::TreeIter> elementAdded(ElementType eType,
+ const OUString& rName,
+ const css::uno::Any& rObject);
/** replaces an objects name with a new one
@param _eType
@@ -340,11 +341,7 @@ namespace dbaui
void showPreview( const OUString& _sDataSourceName,
const OUString& _sName,
bool _bTable);
-
- protected:
- void DataChanged( const DataChangedEvent& rDCEvt ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILPAGEHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 39da2cd497e1..eec21b32d33e 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -26,28 +26,19 @@
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/ui/ImageType.hpp>
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/util/URL.hpp>
#include <core_resource.hxx>
-#include <vcl/event.hxx>
-#include <vcl/image.hxx>
-#include <vcl/mnemonic.hxx>
-#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
#include "AppDetailPageHelper.hxx"
#include <dbaccess/IController.hxx>
-#include <vcl/treelistentry.hxx>
-#include <vcl/viewdataentry.hxx>
#include <algorithm>
#include <dbtreelistbox.hxx>
-#include <imageprovider.hxx>
#include "AppController.hxx"
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;
@@ -56,399 +47,97 @@ using namespace ::com::sun::star::beans;
using ::com::sun::star::util::URL;
using ::com::sun::star::sdb::application::NamedDatabaseObject;
-#define SPACEBETWEENENTRIES 4
-
-TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, const char* _pHelpID, const char* pTitleResourceID, bool _bHideWhenDisabled )
- :sUNOCommand( OUString::createFromAscii( _pAsciiUNOCommand ) )
+TaskEntry::TaskEntry( const OUString& _rAsciiUNOCommand, TranslateId _pHelpID, TranslateId pTitleResourceID, bool _bHideWhenDisabled )
+ :sUNOCommand( _rAsciiUNOCommand )
,pHelpID( _pHelpID )
,sTitle( DBA_RES(pTitleResourceID) )
,bHideWhenDisabled( _bHideWhenDisabled )
{
}
-OCreationList::OCreationList( OTasksWindow& _rParent )
- :SvTreeListBox( &_rParent, WB_TABSTOP | WB_HASBUTTONSATROOT | WB_HASBUTTONS )
- ,m_rTaskWindow( _rParent )
- ,m_pMouseDownEntry( nullptr )
- ,m_pLastActiveEntry( nullptr )
-{
- SetSpaceBetweenEntries(SPACEBETWEENENTRIES);
- SetSelectionMode( SelectionMode::NONE );
- SetNoAutoCurEntry( true );
- SetNodeDefaultImages( );
- EnableEntryMnemonics();
-}
-
-void OCreationList::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect )
+void OTasksWindow::updateHelpText()
{
- SetBackground();
-
- if (m_pMouseDownEntry)
- m_aOriginalFont = rRenderContext.GetFont();
-
- m_aOriginalBackgroundColor = rRenderContext.GetBackground().GetColor();
- SvTreeListBox::Paint(rRenderContext, _rRect);
- rRenderContext.SetBackground(m_aOriginalBackgroundColor);
-
- if (m_pMouseDownEntry)
- rRenderContext.SetFont(m_aOriginalFont);
+ TranslateId pHelpTextId;
+ int nCurEntry = m_xTreeView->get_selected_index();
+ if (nCurEntry != -1)
+ pHelpTextId = weld::fromId<TaskEntry*>(m_xTreeView->get_id(nCurEntry))->pHelpID;
+ setHelpText(pHelpTextId);
}
-void OCreationList::PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry)
+IMPL_LINK(OTasksWindow, onSelected, weld::TreeView&, rTreeView, bool)
{
- Wallpaper aEntryBackground(m_aOriginalBackgroundColor);
-
- if (&rEntry == GetCurEntry())
+ m_nCursorIndex = rTreeView.get_cursor_index();
+ if (m_nCursorIndex != -1)
{
- // draw a selection background
- bool bIsMouseDownEntry = ( &rEntry == m_pMouseDownEntry );
- vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, GetBoundingRect(&rEntry),
- bIsMouseDownEntry ? 1 : 2, false, true, false );
-
- if (bIsMouseDownEntry)
- {
- vcl::Font aFont(rRenderContext.GetFont());
- aFont.SetColor(rRenderContext.GetSettings().GetStyleSettings().GetHighlightTextColor());
- rRenderContext.SetFont(aFont);
- }
-
- // and temporary set a transparent background, for all the other
- // paint operations the SvTreeListBox is going to do
- aEntryBackground = Wallpaper();
+ URL aCommand;
+ aCommand.Complete = weld::fromId<TaskEntry*>(rTreeView.get_id(m_nCursorIndex))->sUNOCommand;
+ getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
}
-
- rRenderContext.SetBackground(aEntryBackground);
- rEntry.SetBackColor(aEntryBackground.GetColor());
-}
-
-void OCreationList::SelectSearchEntry( const void* _pEntry )
-{
- SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pEntry ) );
- OSL_ENSURE( pEntry, "OCreationList::SelectSearchEntry: invalid entry!" );
-
- if ( pEntry )
- setCurrentEntryInvalidate( pEntry );
-
- if ( !HasChildPathFocus() )
- GrabFocus();
-}
-
-void OCreationList::ExecuteSearchEntry( const void* _pEntry ) const
-{
- SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pEntry ) );
- OSL_ENSURE( pEntry, "OCreationList::ExecuteSearchEntry: invalid entry!" );
- OSL_ENSURE( pEntry == GetCurEntry(), "OCreationList::ExecuteSearchEntry: SelectSearchEntry should have been called before!" );
-
- if ( pEntry )
- onSelected( pEntry );
-}
-
-tools::Rectangle OCreationList::GetFocusRect(const SvTreeListEntry* _pEntry, long _nLine)
-{
- tools::Rectangle aRect = SvTreeListBox::GetFocusRect( _pEntry, _nLine );
- aRect.SetLeft( 0 );
-
- // try to let the focus rect start before the bitmap item - this looks better
- const SvLBoxItem* pBitmapItem = _pEntry->GetFirstItem(SvLBoxItemType::ContextBmp);
- SvLBoxTab* pTab = pBitmapItem ? GetTab( _pEntry, pBitmapItem ) : nullptr;
- SvViewDataItem* pItemData = pBitmapItem ? GetViewDataItem( _pEntry, pBitmapItem ) : nullptr;
- OSL_ENSURE( pTab && pItemData, "OCreationList::GetFocusRect: could not find the first bitmap item!" );
- if ( pTab && pItemData )
- aRect.SetLeft( pTab->GetPos() - pItemData->mnWidth / 2 );
-
- // inflate the rectangle a little bit - looks better, too
- aRect.SetLeft( std::max< long >( 0, aRect.Left() - 2 ) );
- aRect.SetRight( std::min< long >( GetOutputSizePixel().Width() - 1, aRect.Right() + 2 ) );
-
- return aRect;
-}
-
-void OCreationList::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
-{
- // don't give this to the base class, it does a ReleaseMouse as very first action
- // Though I think this is a bug (it should ReleaseMouse only if it is going to do
- // something with the drag-event), I hesitate to fix it in the current state,
- // since I don't overlook the consequences, and we're close to 2.0...)
-}
-
-void OCreationList::ModelHasCleared()
-{
- SvTreeListBox::ModelHasCleared();
- m_pLastActiveEntry = nullptr;
- m_pMouseDownEntry = nullptr;
-}
-
-void OCreationList::GetFocus()
-{
- SvTreeListBox::GetFocus();
- if ( !GetCurEntry() )
- setCurrentEntryInvalidate( m_pLastActiveEntry ? m_pLastActiveEntry : GetFirstEntryInView() );
-}
-
-void OCreationList::LoseFocus()
-{
- SvTreeListBox::LoseFocus();
- m_pLastActiveEntry = GetCurEntry();
- setCurrentEntryInvalidate( nullptr );
-}
-
-void OCreationList::MouseButtonDown( const MouseEvent& rMEvt )
-{
- SvTreeListBox::MouseButtonDown( rMEvt );
-
- OSL_ENSURE( !m_pMouseDownEntry, "OCreationList::MouseButtonDown: I missed some mouse event!" );
- m_pMouseDownEntry = GetCurEntry();
- if ( m_pMouseDownEntry )
- {
- InvalidateEntry( m_pMouseDownEntry );
- CaptureMouse();
- }
-}
-
-void OCreationList::MouseMove( const MouseEvent& rMEvt )
-{
- if ( rMEvt.IsLeaveWindow() )
- {
- setCurrentEntryInvalidate( nullptr );
- }
- else if ( !rMEvt.IsSynthetic() )
- {
- SvTreeListEntry* pEntry = GetEntry( rMEvt.GetPosPixel() );
-
- if ( m_pMouseDownEntry )
- {
- // we're currently in a "mouse down" phase
- OSL_ENSURE( IsMouseCaptured(), "OCreationList::MouseMove: inconsistence (1)!" );
- if ( pEntry == m_pMouseDownEntry )
- {
- setCurrentEntryInvalidate( m_pMouseDownEntry );
- }
- else
- {
- OSL_ENSURE( ( GetCurEntry() == m_pMouseDownEntry ) || !GetCurEntry(),
- "OCreationList::MouseMove: inconsistence (2)!" );
- setCurrentEntryInvalidate( nullptr );
- }
- }
- else
- {
- // the user is simply hovering with the mouse
- if ( setCurrentEntryInvalidate( pEntry ) )
- {
- if ( !m_pMouseDownEntry )
- updateHelpText();
- }
- }
- }
-
- SvTreeListBox::MouseMove(rMEvt);
+ return true;
}
-void OCreationList::MouseButtonUp( const MouseEvent& rMEvt )
+void OTasksWindow::GrabFocus()
{
- SvTreeListEntry* pEntry = GetEntry( rMEvt.GetPosPixel() );
- bool bExecute = false;
- // Was the mouse released over the active entry?
- // (i.e. the entry which was under the mouse when the button went down)
- if ( pEntry && ( m_pMouseDownEntry == pEntry ) )
- {
- if ( !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
- bExecute = true;
- }
-
- if ( m_pMouseDownEntry )
- {
- OSL_ENSURE( IsMouseCaptured(), "OCreationList::MouseButtonUp: hmmm... no mouse captured, but an active entry?" );
- ReleaseMouse();
-
- InvalidateEntry( m_pMouseDownEntry );
- m_pMouseDownEntry = nullptr;
- }
-
- SvTreeListBox::MouseButtonUp( rMEvt );
-
- if ( bExecute )
- onSelected( pEntry );
+ if (!m_xTreeView)
+ return;
+ m_xTreeView->grab_focus();
}
-bool OCreationList::setCurrentEntryInvalidate( SvTreeListEntry* _pEntry )
+bool OTasksWindow::HasChildPathFocus() const
{
- if ( GetCurEntry() != _pEntry )
- {
- if ( GetCurEntry() )
- InvalidateEntry( GetCurEntry() );
- SetCurEntry( _pEntry );
- if ( GetCurEntry() )
- {
- InvalidateEntry( GetCurEntry() );
- CallEventListeners( VclEventId::ListboxTreeSelect, GetCurEntry() );
- }
- updateHelpText();
- return true;
- }
- return false;
+ return m_xTreeView && m_xTreeView->has_focus();
}
-void OCreationList::updateHelpText()
+IMPL_LINK_NOARG(OTasksWindow, FocusInHdl, weld::Widget&, void)
{
- const char* pHelpTextId = nullptr;
- if ( GetCurEntry() )
- pHelpTextId = static_cast< TaskEntry* >( GetCurEntry()->GetUserData() )->pHelpID;
- m_rTaskWindow.setHelpText(pHelpTextId);
+ m_xTreeView->select(m_nCursorIndex != -1 ? m_nCursorIndex : 0);
}
-void OCreationList::onSelected( SvTreeListEntry const * _pEntry ) const
+IMPL_LINK_NOARG(OTasksWindow, FocusOutHdl, weld::Widget&, void)
{
- OSL_ENSURE( _pEntry, "OCreationList::onSelected: invalid entry!" );
- URL aCommand;
- aCommand.Complete = static_cast< TaskEntry* >( _pEntry->GetUserData() )->sUNOCommand;
- m_rTaskWindow.getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
+ m_nCursorIndex = m_xTreeView->get_cursor_index();
+ m_xTreeView->unselect_all();
}
-void OCreationList::KeyInput( const KeyEvent& rKEvt )
+IMPL_LINK_NOARG(OTasksWindow, OnEntrySelectHdl, weld::TreeView&, void)
{
- const vcl::KeyCode& rCode = rKEvt.GetKeyCode();
- if ( !rCode.IsMod1() && !rCode.IsMod2() && !rCode.IsShift() )
- {
- if ( rCode.GetCode() == KEY_RETURN )
- {
- SvTreeListEntry* pEntry = GetCurEntry() ? GetCurEntry() : FirstSelected();
- if ( pEntry )
- onSelected( pEntry );
- return;
- }
- }
- SvTreeListEntry* pOldCurrent = GetCurEntry();
- SvTreeListBox::KeyInput(rKEvt);
- SvTreeListEntry* pNewCurrent = GetCurEntry();
-
- if ( pOldCurrent != pNewCurrent )
- {
- if ( pOldCurrent )
- InvalidateEntry( pOldCurrent );
- if ( pNewCurrent )
- {
- InvalidateEntry( pNewCurrent );
- CallEventListeners( VclEventId::ListboxSelect, pNewCurrent );
- }
- updateHelpText();
- }
+ m_nCursorIndex = m_xTreeView->get_cursor_index();
+ updateHelpText();
}
-OTasksWindow::OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView)
- : Window(_pParent,WB_DIALOGCONTROL )
- ,m_aCreation(VclPtr<OCreationList>::Create(*this))
- ,m_aDescription(VclPtr<FixedText>::Create(this))
- ,m_aHelpText(VclPtr<FixedText>::Create(this,WB_WORDBREAK))
- ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT))
- ,m_pDetailView(_pDetailView)
+OTasksWindow::OTasksWindow(weld::Container* pParent, OApplicationDetailView* pDetailView)
+ : OChildWindow(pParent, u"dbaccess/ui/taskwindow.ui"_ustr, u"TaskWindow"_ustr)
+ , m_xTreeView(m_xBuilder->weld_tree_view(u"treeview"_ustr))
+ , m_xDescription(m_xBuilder->weld_label(u"description"_ustr))
+ , m_xHelpText(m_xBuilder->weld_text_view(u"helptext"_ustr))
+ , m_pDetailView(pDetailView)
+ , m_nCursorIndex(-1)
{
- m_aCreation->SetHelpId(HID_APP_CREATION_LIST);
- m_aCreation->SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl));
- m_aHelpText->SetHelpId(HID_APP_HELP_TEXT);
- m_aDescription->SetHelpId(HID_APP_DESCRIPTION_TEXT);
- m_aDescription->SetText(DBA_RES(STR_DESCRIPTION));
+ m_xContainer->set_stack_background();
- Image aFolderImage = ImageProvider::getFolderImage( css::sdb::application::DatabaseObject::FORM );
- m_aCreation->SetDefaultCollapsedEntryBmp( aFolderImage );
- m_aCreation->SetDefaultExpandedEntryBmp( aFolderImage );
+ m_xTreeView->set_help_id(HID_APP_CREATION_LIST);
+ m_xTreeView->connect_row_activated(LINK(this, OTasksWindow, onSelected));
+ m_xTreeView->connect_selection_changed(LINK(this, OTasksWindow, OnEntrySelectHdl));
+ m_xTreeView->connect_focus_in(LINK(this, OTasksWindow, FocusInHdl));
+ m_xTreeView->connect_focus_out(LINK(this, OTasksWindow, FocusOutHdl));
+ // an arbitrary small size it's allowed to shrink to
+ m_xTreeView->set_size_request(42, 42);
- ImplInitSettings();
+ m_xHelpText->set_help_id(HID_APP_HELP_TEXT);
+ m_xDescription->set_help_id(HID_APP_DESCRIPTION_TEXT);
}
OTasksWindow::~OTasksWindow()
{
- disposeOnce();
-}
-
-void OTasksWindow::dispose()
-{
Clear();
- m_aCreation.disposeAndClear();
- m_aDescription.disposeAndClear();
- m_aHelpText.disposeAndClear();
- m_aFL.disposeAndClear();
- m_pDetailView.clear();
- vcl::Window::dispose();
-}
-
-void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OTasksWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- m_aHelpText->SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aHelpText->SetTextFillColor();
- m_aDescription->SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aDescription->SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
- m_aHelpText->SetBackground( rStyleSettings.GetFieldColor() );
- m_aDescription->SetBackground( rStyleSettings.GetFieldColor() );
- m_aFL->SetBackground( rStyleSettings.GetFieldColor() );
-
- aFont = m_aDescription->GetControlFont();
- aFont.SetWeight(WEIGHT_BOLD);
- m_aDescription->SetControlFont(aFont);
}
-void OTasksWindow::setHelpText(const char* pId)
+void OTasksWindow::setHelpText(TranslateId pId)
{
if (pId)
- {
- OUString sText = DBA_RES(pId);
- m_aHelpText->SetText(sText);
- }
+ m_xHelpText->set_text(DBA_RES(pId));
else
- {
- m_aHelpText->SetText(OUString());
-}
-
-}
-
-IMPL_LINK_NOARG(OTasksWindow, OnEntrySelectHdl, SvTreeListBox*, void)
-{
- SvTreeListEntry* pEntry = m_aCreation->GetHdlEntry();
- if ( pEntry )
- m_aHelpText->SetText(DBA_RES(static_cast<TaskEntry*>(pEntry->GetUserData())->pHelpID));
-}
-
-void OTasksWindow::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- Size aFLSize = LogicToPixel(Size(2, 6), MapMode(MapUnit::MapAppFont));
- sal_Int32 n6PPT = aFLSize.Height();
- long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
-
- m_aCreation->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
- // i77897 make the m_aHelpText a little bit smaller. (-5)
- sal_Int32 nNewWidth = nOutputWidth - nHalfOutputWidth - aFLSize.Width() - 5;
- m_aDescription->SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) );
- Size aDesc = m_aDescription->CalcMinimumSize();
- m_aHelpText->SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) );
-
- m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) );
+ m_xHelpText->set_text(OUString());
}
void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
@@ -460,154 +149,74 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
theModuleUIConfigurationManagerSupplier::get( getDetailView()->getBorderWin().getView()->getORB() );
Reference< XUIConfigurationManager > xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager(
- "com.sun.star.sdb.OfficeDatabaseDocument"
+ u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr
);
Reference< XImageManager > xImageMgr( xUIConfigMgr->getImageManager(), UNO_QUERY );
// copy the commands so we can use them with the config managers
Sequence< OUString > aCommands( _rList.size() );
- OUString* pCommands = aCommands.getArray();
- for (auto const& copyTask : _rList)
- {
- *pCommands = copyTask.sUNOCommand;
- ++pCommands;
- }
+ std::transform(_rList.begin(), _rList.end(), aCommands.getArray(),
+ [](auto& copyTask) { return copyTask.sUNOCommand; });
Sequence< Reference< XGraphic> > aImages = xImageMgr->getImages(
ImageType::SIZE_DEFAULT | ImageType::COLOR_NORMAL ,
aCommands
);
+ assert(aImages.size() == _rList.size());
- const Reference< XGraphic >* pImages( aImages.getConstArray() );
-
- for (auto const& task : _rList)
+ for (size_t nIndex = 0; nIndex < _rList.size(); ++nIndex)
{
- SvTreeListEntry* pEntry = m_aCreation->InsertEntry(task.sTitle);
- pEntry->SetUserData( new TaskEntry(task) );
-
- Image aImage( *pImages );
- m_aCreation->SetExpandedEntryBmp( pEntry, aImage );
- m_aCreation->SetCollapsedEntryBmp( pEntry, aImage );
- ++pImages;
+ OUString sId = weld::toId(new TaskEntry(_rList[nIndex]));
+ m_xTreeView->append(sId, _rList[nIndex].sTitle);
+ m_xTreeView->set_image(nIndex, aImages[nIndex]);
}
}
catch(Exception&)
{
}
- m_aCreation->Show();
- m_aCreation->SelectAll(false);
- m_aHelpText->Show();
- m_aDescription->Show();
- m_aFL->Show();
- m_aCreation->updateHelpText();
+ m_xTreeView->unselect_all();
+ updateHelpText();
Enable(!_rList.empty());
}
void OTasksWindow::Clear()
{
- m_aCreation->resetLastActive();
- SvTreeListEntry* pEntry = m_aCreation->First();
- while ( pEntry )
- {
- delete static_cast< TaskEntry* >( pEntry->GetUserData() );
- pEntry = m_aCreation->Next(pEntry);
- }
- m_aCreation->Clear();
-}
-
-
-OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent )
- ,m_aHorzSplitter(VclPtr<Splitter>::Create(this))
- ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this, STR_TASKS, WB_BORDER | WB_DIALOGCONTROL))
- ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this, nullptr, WB_BORDER | WB_DIALOGCONTROL))
- ,m_rBorderWin(_rParent)
-{
- ImplInitSettings();
-
- m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer.get(),m_rBorderWin,_ePreviewMode);
- m_pControlHelper->Show();
- m_aContainer->setChildWindow(m_pControlHelper);
+ m_xTreeView->all_foreach([this](weld::TreeIter& rEntry){
+ TaskEntry* pUserData = weld::fromId<TaskEntry*>(m_xTreeView->get_id(rEntry));
+ delete pUserData;
+ return false;
+ });
- VclPtrInstance<OTasksWindow> pTasks(m_aTasks.get(),this);
- pTasks->Show();
- pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
- m_aTasks->setChildWindow(pTasks);
- m_aTasks->Show();
-
- m_aContainer->Show();
-
- const long nFrameWidth = LogicToPixel(Size(3, 0), MapMode(MapUnit::MapAppFont)).Width();
- m_aHorzSplitter->SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) );
- // now set the components at the base class
- set(m_aContainer.get(),m_aTasks.get());
-
- m_aHorzSplitter->Show();
- setSplitter(m_aHorzSplitter.get());
+ m_xTreeView->clear();
}
-OApplicationDetailView::~OApplicationDetailView()
+OApplicationDetailView::OApplicationDetailView(weld::Container* pParent, OAppBorderWindow& rBorder,
+ PreviewMode ePreviewMode)
+ : m_xBuilder(Application::CreateBuilder(pParent, u"dbaccess/ui/appdetailwindow.ui"_ustr))
+ , m_xContainer(m_xBuilder->weld_container(u"AppDetailWindow"_ustr))
+ , m_xHorzSplitter(m_xBuilder->weld_paned(u"splitter"_ustr))
+ , m_xTasksParent(m_xBuilder->weld_container(u"tasks"_ustr))
+ , m_xContainerParent(m_xBuilder->weld_container(u"container"_ustr))
+ , m_xTasks(new dbaui::OTitleWindow(m_xTasksParent.get(), STR_TASKS))
+ , m_xTitleContainer(new dbaui::OTitleWindow(m_xContainerParent.get(), TranslateId()))
+ , m_rBorderWin(rBorder)
{
- disposeOnce();
-}
+ m_xControlHelper = std::make_shared<OAppDetailPageHelper>(m_xTitleContainer->getChildContainer(), m_rBorderWin, ePreviewMode);
+ m_xTitleContainer->setChildWindow(m_xControlHelper);
-void OApplicationDetailView::dispose()
-{
- set(nullptr);
- setSplitter(nullptr);
- m_aHorzSplitter.disposeAndClear();
- m_aTasks.disposeAndClear();
- m_aContainer.disposeAndClear();
- m_pControlHelper.clear();
- OSplitterView::dispose();
+ std::shared_ptr<OChildWindow> xTasks = std::make_shared<OTasksWindow>(m_xTasks->getChildContainer(), this);
+ xTasks->Enable(!m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
+ m_xTasks->setChildWindow(xTasks);
}
-void OApplicationDetailView::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_aHorzSplitter->SetBackground( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter->SetFillColor( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter->SetTextFillColor(rStyleSettings.GetDialogColor() );
-}
-
-void OApplicationDetailView::DataChanged( const DataChangedEvent& rDCEvt )
-{
- OSplitterView::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OApplicationDetailView::setTaskExternalMnemonics( MnemonicGenerator const & _rMnemonics )
+OApplicationDetailView::~OApplicationDetailView()
{
- m_aExternalMnemonics = _rMnemonics;
}
-bool OApplicationDetailView::interceptKeyInput( const KeyEvent& _rEvent )
+void OApplicationDetailView::setTaskExternalMnemonics( MnemonicGenerator const & rMnemonics )
{
- const vcl::KeyCode& rKeyCode = _rEvent.GetKeyCode();
- if ( rKeyCode.GetModifier() == KEY_MOD2 )
- return getTasksWindow().HandleKeyInput( _rEvent );
-
- // not handled
- return false;
+ m_aExternalMnemonics = rMnemonics;
}
void OApplicationDetailView::createTablesPage(const Reference< XConnection >& _xConnection )
@@ -632,32 +241,16 @@ void OApplicationDetailView::impl_createPage( ElementType _eType, const Referenc
bool bEnabled = !rData.aTasks.empty()
&& getBorderWin().getView()->getCommandController().isCommandEnabled( rData.aTasks[0].sUNOCommand );
getTasksWindow().Enable( bEnabled );
- m_aContainer->setTitle(rData.pTitleId);
+ m_xTitleContainer->setTitle(rData.pTitleId);
// let our helper create the object list
if ( _eType == E_TABLE )
- m_pControlHelper->createTablesPage( _rxConnection );
+ GetControlHelper()->createTablesPage( _rxConnection );
else
- m_pControlHelper->createPage( _eType, _rxNonTableElements );
-
- // resize for proper window arrangements
- Resize();
+ GetControlHelper()->createPage( _eType, _rxNonTableElements );
}
-const TaskPaneData& OApplicationDetailView::impl_getTaskPaneData( ElementType _eType )
-{
- if ( m_aTaskPaneData.empty() )
- m_aTaskPaneData.resize( ELEMENT_COUNT );
- OSL_ENSURE( ( _eType >= 0 ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OApplicationDetailView::impl_getTaskPaneData: illegal element type!" );
- TaskPaneData& rData = m_aTaskPaneData[ _eType ];
-
- //oj: do not check, otherwise extensions will only be visible after a reload.
- impl_fillTaskPaneData( _eType, rData );
-
- return rData;
-}
-
-void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const
+void OApplicationDetailView::impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData) const
{
TaskEntryList& rList( _rData.aTasks );
rList.clear(); rList.reserve( 4 );
@@ -665,28 +258,28 @@ void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPane
switch ( _eType )
{
case E_TABLE:
- rList.emplace_back( ".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE );
- rList.emplace_back( ".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO );
- rList.emplace_back( ".uno:DBNewView", RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW, true );
+ rList.emplace_back( u".uno:DBNewTable"_ustr, RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE );
+ rList.emplace_back( u".uno:DBNewTableAutoPilot"_ustr, RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO );
+ rList.emplace_back( u".uno:DBNewView"_ustr, RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW, true );
_rData.pTitleId = RID_STR_TABLES_CONTAINER;
break;
case E_FORM:
- rList.emplace_back( ".uno:DBNewForm", RID_STR_FORMS_HELP_TEXT, RID_STR_NEW_FORM );
- rList.emplace_back( ".uno:DBNewFormAutoPilot", RID_STR_FORMS_HELP_TEXT_WIZARD, RID_STR_NEW_FORM_AUTO );
+ rList.emplace_back( u".uno:DBNewForm"_ustr, RID_STR_FORMS_HELP_TEXT, RID_STR_NEW_FORM );
+ rList.emplace_back( u".uno:DBNewFormAutoPilot"_ustr, RID_STR_FORMS_HELP_TEXT_WIZARD, RID_STR_NEW_FORM_AUTO );
_rData.pTitleId = RID_STR_FORMS_CONTAINER;
break;
case E_REPORT:
- rList.emplace_back( ".uno:DBNewReport", RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT, true );
- rList.emplace_back( ".uno:DBNewReportAutoPilot", RID_STR_REPORTS_HELP_TEXT_WIZARD, RID_STR_NEW_REPORT_AUTO );
+ rList.emplace_back( u".uno:DBNewReport"_ustr, RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT, true );
+ rList.emplace_back( u".uno:DBNewReportAutoPilot"_ustr, RID_STR_REPORTS_HELP_TEXT_WIZARD, RID_STR_NEW_REPORT_AUTO );
_rData.pTitleId = RID_STR_REPORTS_CONTAINER;
break;
case E_QUERY:
- rList.emplace_back( ".uno:DBNewQuery", RID_STR_QUERIES_HELP_TEXT, RID_STR_NEW_QUERY );
- rList.emplace_back( ".uno:DBNewQueryAutoPilot", RID_STR_QUERIES_HELP_TEXT_WIZARD, RID_STR_NEW_QUERY_AUTO );
- rList.emplace_back( ".uno:DBNewQuerySql", RID_STR_QUERIES_HELP_TEXT_SQL, RID_STR_NEW_QUERY_SQL );
+ rList.emplace_back( u".uno:DBNewQuery"_ustr, RID_STR_QUERIES_HELP_TEXT, RID_STR_NEW_QUERY );
+ rList.emplace_back( u".uno:DBNewQueryAutoPilot"_ustr, RID_STR_QUERIES_HELP_TEXT_WIZARD, RID_STR_NEW_QUERY_AUTO );
+ rList.emplace_back( u".uno:DBNewQuerySql"_ustr, RID_STR_QUERIES_HELP_TEXT_SQL, RID_STR_NEW_QUERY_SQL );
_rData.pTitleId = RID_STR_QUERIES_CONTAINER;
break;
@@ -694,12 +287,8 @@ void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPane
OSL_FAIL( "OApplicationDetailView::impl_fillTaskPaneData: illegal element type!" );
}
- MnemonicGenerator aAllMnemonics( m_aExternalMnemonics );
-
// remove the entries which are not enabled currently
- for ( TaskEntryList::iterator pTask = rList.begin();
- pTask != rList.end();
- )
+ for (TaskEntryList::iterator pTask = rList.begin(); pTask != rList.end();)
{
if ( pTask->bHideWhenDisabled
&& !getBorderWin().getView()->getCommandController().isCommandEnabled( pTask->sUNOCommand )
@@ -707,99 +296,114 @@ void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPane
pTask = rList.erase( pTask );
else
{
- aAllMnemonics.RegisterMnemonic( pTask->sTitle );
++pTask;
}
}
+}
- // for the remaining entries, assign mnemonics
- for (auto const& task : rList)
- {
- aAllMnemonics.CreateMnemonic(task.sTitle);
- // don't do this for now, until our task window really supports mnemonics
- }
+const TaskPaneData& OApplicationDetailView::impl_getTaskPaneData( ElementType _eType )
+{
+ if ( m_aTaskPaneData.empty() )
+ m_aTaskPaneData.resize( size_t(E_ELEMENT_TYPE_COUNT) );
+ OSL_ENSURE( ( _eType >= 0 ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OApplicationDetailView::impl_getTaskPaneData: illegal element type!" );
+ TaskPaneData& rData = m_aTaskPaneData[ _eType ];
+
+ //oj: do not check, otherwise extensions will only be visible after a reload.
+ impl_fillTaskPaneData( _eType, rData );
+
+ return rData;
}
-OUString OApplicationDetailView::getQualifiedName( SvTreeListEntry* _pEntry ) const
+OUString OApplicationDetailView::getQualifiedName(const weld::TreeIter* _pEntry) const
{
- return m_pControlHelper->getQualifiedName( _pEntry );
+ return GetControlHelper()->getQualifiedName( _pEntry );
}
-bool OApplicationDetailView::isLeaf(SvTreeListEntry const * _pEntry)
+bool OApplicationDetailView::isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry)
{
- return OAppDetailPageHelper::isLeaf(_pEntry);
+ return OAppDetailPageHelper::isLeaf(rTreeView, rEntry);
}
bool OApplicationDetailView::isALeafSelected() const
{
- return m_pControlHelper->isALeafSelected();
+ return GetControlHelper()->isALeafSelected();
}
void OApplicationDetailView::selectAll()
{
- m_pControlHelper->selectAll();
+ GetControlHelper()->selectAll();
}
void OApplicationDetailView::sortDown()
{
- m_pControlHelper->sortDown();
+ GetControlHelper()->sortDown();
}
void OApplicationDetailView::sortUp()
{
- m_pControlHelper->sortUp();
+ GetControlHelper()->sortUp();
}
bool OApplicationDetailView::isFilled() const
{
- return m_pControlHelper->isFilled();
+ return GetControlHelper()->isFilled();
}
ElementType OApplicationDetailView::getElementType() const
{
- return m_pControlHelper->getElementType();
+ return GetControlHelper()->getElementType();
}
void OApplicationDetailView::clearPages(bool _bTaskAlso)
{
if ( _bTaskAlso )
getTasksWindow().Clear();
- m_pControlHelper->clearPages();
+ GetControlHelper()->clearPages();
}
sal_Int32 OApplicationDetailView::getSelectionCount()
{
- return m_pControlHelper->getSelectionCount();
+ return GetControlHelper()->getSelectionCount();
}
sal_Int32 OApplicationDetailView::getElementCount() const
{
- return m_pControlHelper->getElementCount();
+ return GetControlHelper()->getElementCount();
}
void OApplicationDetailView::getSelectionElementNames( std::vector< OUString>& _rNames ) const
{
- m_pControlHelper->getSelectionElementNames( _rNames );
+ GetControlHelper()->getSelectionElementNames( _rNames );
}
-void OApplicationDetailView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
+void OApplicationDetailView::describeCurrentSelectionForControl(const weld::TreeView& rControl, Sequence< NamedDatabaseObject >& out_rSelectedObjects)
{
- m_pControlHelper->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
+ GetControlHelper()->describeCurrentSelectionForControl(rControl, out_rSelectedObjects);
}
void OApplicationDetailView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
{
- m_pControlHelper->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
+ GetControlHelper()->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
+}
+
+vcl::Window* OApplicationDetailView::getMenuParent() const
+{
+ return GetControlHelper()->getMenuParent();
+}
+
+void OApplicationDetailView::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ return GetControlHelper()->adjustMenuPosition(rControl, rPos);
}
void OApplicationDetailView::selectElements(const Sequence< OUString>& _aNames)
{
- m_pControlHelper->selectElements( _aNames );
+ GetControlHelper()->selectElements( _aNames );
}
-SvTreeListEntry* OApplicationDetailView::getEntry( const Point& _aPoint ) const
+std::unique_ptr<weld::TreeIter> OApplicationDetailView::getEntry(const Point& rPoint) const
{
- return m_pControlHelper->getEntry(_aPoint);
+ return GetControlHelper()->getEntry(rPoint);
}
bool OApplicationDetailView::isCutAllowed()
@@ -820,58 +424,78 @@ void OApplicationDetailView::cut() { }
void OApplicationDetailView::paste() { }
-SvTreeListEntry* OApplicationDetailView::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
+std::unique_ptr<weld::TreeIter> OApplicationDetailView::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
{
- return m_pControlHelper->elementAdded(_eType,_rName, _rObject );
+ return GetControlHelper()->elementAdded(_eType, _rName, _rObject);
}
void OApplicationDetailView::elementRemoved(ElementType _eType,const OUString& _rName )
{
- m_pControlHelper->elementRemoved(_eType,_rName );
+ GetControlHelper()->elementRemoved(_eType,_rName );
}
void OApplicationDetailView::elementReplaced(ElementType _eType
,const OUString& _rOldName
,const OUString& _rNewName )
{
- m_pControlHelper->elementReplaced( _eType, _rOldName, _rNewName );
+ GetControlHelper()->elementReplaced( _eType, _rOldName, _rNewName );
}
PreviewMode OApplicationDetailView::getPreviewMode() const
{
- return m_pControlHelper->getPreviewMode();
+ return GetControlHelper()->getPreviewMode();
}
bool OApplicationDetailView::isPreviewEnabled() const
{
- return m_pControlHelper->isPreviewEnabled();
+ return GetControlHelper()->isPreviewEnabled();
}
void OApplicationDetailView::switchPreview(PreviewMode _eMode)
{
- m_pControlHelper->switchPreview(_eMode);
+ GetControlHelper()->switchPreview(_eMode);
}
void OApplicationDetailView::showPreview(const Reference< XContent >& _xContent)
{
- m_pControlHelper->showPreview(_xContent);
+ GetControlHelper()->showPreview(_xContent);
}
void OApplicationDetailView::showPreview( const OUString& _sDataSourceName,
const OUString& _sName,
bool _bTable)
{
- m_pControlHelper->showPreview(_sDataSourceName,_sName,_bTable);
+ GetControlHelper()->showPreview(_sDataSourceName,_sName,_bTable);
}
bool OApplicationDetailView::isSortUp() const
{
- return m_pControlHelper->isSortUp();
+ return GetControlHelper()->isSortUp();
+}
+
+TreeListBox* OApplicationDetailView::getTreeWindow() const
+{
+ DBTreeViewBase* pCurrent = GetControlHelper()->getCurrentView();
+ if (!pCurrent)
+ return nullptr;
+ return &pCurrent->getListBox();
+}
+
+OAppDetailPageHelper* OApplicationDetailView::GetControlHelper()
+{
+ return static_cast<OAppDetailPageHelper*>(m_xControlHelper.get());
+}
+
+const OAppDetailPageHelper* OApplicationDetailView::GetControlHelper() const
+{
+ return static_cast<const OAppDetailPageHelper*>(m_xControlHelper.get());
}
-vcl::Window* OApplicationDetailView::getTreeWindow() const
+bool OApplicationDetailView::HasChildPathFocus() const
{
- return m_pControlHelper->getCurrentView();
+ return m_xHorzSplitter->has_focus() ||
+ m_xTasks->HasChildPathFocus() ||
+ m_xTitleContainer->HasChildPathFocus();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
index 38bc41ab1e46..9b0df37bcfdd 100644
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ b/dbaccess/source/ui/app/AppDetailView.hxx
@@ -16,87 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
-#include <vcl/split.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/mnemonic.hxx>
#include <IClipBoardTest.hxx>
#include "AppTitleWindow.hxx"
#include <AppElementType.hxx>
-#include <vcl/treelistbox.hxx>
-#include <VertSplitView.hxx>
#include <vector>
-class SvTreeListEntry;
-
namespace dbaui
{
class OAppBorderWindow;
class OApplicationDetailView;
class OAppDetailPageHelper;
- class OTasksWindow;
-
- class OCreationList : public SvTreeListBox
- {
- OTasksWindow& m_rTaskWindow;
-
- // members related to drawing the currently hovered/selected entry
- SvTreeListEntry* m_pMouseDownEntry;
- SvTreeListEntry* m_pLastActiveEntry;
- Color m_aOriginalBackgroundColor;
- vcl::Font m_aOriginalFont;
-
- public:
- explicit OCreationList( OTasksWindow& _rParent );
- // Window overrides
- virtual void MouseMove( const MouseEvent& rMEvt ) override;
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
- virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
- virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
- virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
-
- void resetLastActive() { m_pLastActiveEntry = nullptr;}
-
- void updateHelpText();
-
- protected:
- virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry) override;
- virtual tools::Rectangle GetFocusRect(const SvTreeListEntry* _pEntry, long _nLine) override;
- virtual void ModelHasCleared() override;
-
- // IMnemonicEntryList
- virtual void SelectSearchEntry( const void* _pEntry ) override;
- virtual void ExecuteSearchEntry( const void* _pEntry ) const override;
-
- private:
- void onSelected( SvTreeListEntry const * _pEntry ) const;
- /** sets a new current entry, and invalidates the old and the new one, if necessary
- @return <TRUE/> if and only if the "current entry" changed
- */
- bool setCurrentEntryInvalidate( SvTreeListEntry* _pEntry );
- };
+ class TreeListBox;
struct TaskEntry
{
OUString sUNOCommand;
- const char* pHelpID;
+ TranslateId pHelpID;
OUString sTitle;
bool bHideWhenDisabled;
// TODO: we should be consistent in the task pane and the menus/toolbars:
// If an entry is disabled in the latter, it should also be disabled in the former.
// If an entry is *hidden* in the former, it should also be hidden in the latter.
- TaskEntry( const char* _pAsciiUNOCommand, const char* pHelpID, const char* pTitleResourceID, bool _bHideWhenDisabled = false );
+ TaskEntry( const OUString& _rAsciiUNOCommand, TranslateId pHelpID, TranslateId pTitleResourceID, bool _bHideWhenDisabled = false );
};
typedef std::vector< TaskEntry > TaskEntryList;
@@ -105,63 +55,62 @@ namespace dbaui
/// the tasks available in the pane
TaskEntryList aTasks;
/// the resource ID for the title of the pane
- const char* pTitleId;
+ TranslateId pTitleId;
};
- class OTasksWindow : public vcl::Window
+ class OTasksWindow final : public OChildWindow
{
- VclPtr<OCreationList> m_aCreation;
- VclPtr<FixedText> m_aDescription;
- VclPtr<FixedText> m_aHelpText;
- VclPtr<FixedLine> m_aFL;
- VclPtr<OApplicationDetailView> m_pDetailView;
-
- DECL_LINK( OnEntrySelectHdl, SvTreeListBox*, void );
- void ImplInitSettings();
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+ std::unique_ptr<weld::TreeView> m_xTreeView;
+ std::unique_ptr<weld::Label> m_xDescription;
+ std::unique_ptr<weld::TextView> m_xHelpText;
+ OApplicationDetailView* m_pDetailView;
+
+ int m_nCursorIndex;
+
+ DECL_LINK(onSelected, weld::TreeView&, bool);
+ DECL_LINK(OnEntrySelectHdl, weld::TreeView&, void);
+ DECL_LINK(FocusInHdl, weld::Widget&, void);
+ DECL_LINK(FocusOutHdl, weld::Widget&, void);
+
+ void updateHelpText();
+
public:
- OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView);
- virtual ~OTasksWindow() override;
- virtual void dispose() override;
+ OTasksWindow(weld::Container* pParent, OApplicationDetailView* pDetailView);
+ ~OTasksWindow();
+
+ virtual void GrabFocus() override;
- // Window overrides
- virtual void Resize() override;
+ virtual bool HasChildPathFocus() const override;
OApplicationDetailView* getDetailView() const { return m_pDetailView; }
/// fills the Creation listbox with the necessary strings and images
void fillTaskEntryList( const TaskEntryList& _rList );
- bool HandleKeyInput( const KeyEvent& _rKEvt )
- {
- return m_aCreation->HandleKeyInput( _rKEvt );
- }
-
void Clear();
- void setHelpText(const char* pId);
+ void setHelpText(TranslateId pId);
};
- class OApplicationDetailView : public OSplitterView
- , public IClipboardTest
+
+ class OApplicationDetailView final : public IClipboardTest
{
- VclPtr<Splitter> m_aHorzSplitter;
- VclPtr<OTitleWindow> m_aTasks;
- VclPtr<OTitleWindow> m_aContainer;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Paned> m_xHorzSplitter;
+ std::unique_ptr<weld::Container> m_xTasksParent;
+ std::unique_ptr<weld::Container> m_xContainerParent;
+ std::unique_ptr<OTitleWindow> m_xTasks;
+ std::unique_ptr<OTitleWindow> m_xTitleContainer;
OAppBorderWindow& m_rBorderWin; // my parent
- VclPtr<OAppDetailPageHelper> m_pControlHelper;
- std::vector< TaskPaneData > m_aTaskPaneData;
+ std::shared_ptr<OChildWindow> m_xControlHelper;
+ std::vector< TaskPaneData > m_aTaskPaneData;
MnemonicGenerator m_aExternalMnemonics;
- void ImplInitSettings();
-
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+ const OAppDetailPageHelper* GetControlHelper() const;
+ OAppDetailPageHelper* GetControlHelper();
public:
- OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode);
- virtual ~OApplicationDetailView() override;
- // Window overrides
- virtual void dispose() override;
+ OApplicationDetailView(weld::Container* pParent, OAppBorderWindow& rBorder, PreviewMode ePreviewMode);
+ ~OApplicationDetailView();
/** creates the tables page
@param _xConnection
@@ -179,16 +128,8 @@ namespace dbaui
void setTaskExternalMnemonics( MnemonicGenerator const & _rMnemonics );
- /** called to give the window the chance to intercept key events, while it has not
- the focus
-
- @return <TRUE/> if and only if the event has been handled, and should not
- not be further processed
- */
- bool interceptKeyInput( const KeyEvent& _rEvent );
-
OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
- OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks->getChildWindow() ); }
+ OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_xTasks->getChildWindow() ); }
bool isCutAllowed() override ;
bool isCopyAllowed() override ;
@@ -204,15 +145,17 @@ namespace dbaui
@return
the qualified name
*/
- OUString getQualifiedName( SvTreeListEntry* _pEntry ) const;
+ OUString getQualifiedName(const weld::TreeIter* _pEntry) const;
/** returns if an entry is a leaf
- @param _pEntry
+ @param rTreeView
+ The TreeView pEntry belongs to
+ @param rEntry
The entry to check
@return
<TRUE/> if the entry is a leaf, otherwise <FALSE/>
*/
- static bool isLeaf(SvTreeListEntry const * _pEntry);
+ static bool isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry);
/** returns if one of the selected entries is a leaf
@return
@@ -260,7 +203,7 @@ namespace dbaui
/** describes the current selection for the given control
*/
void describeCurrentSelectionForControl(
- const Control& _rControl,
+ const weld::TreeView& rControl,
css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
);
@@ -271,6 +214,11 @@ namespace dbaui
css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
);
+ /** get the menu parent window for the given control
+ */
+ vcl::Window* getMenuParent() const;
+ void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
+
/** select all names on the currently selected container. Non existence names where ignored.
*
* \param _aNames the element names
@@ -287,9 +235,9 @@ namespace dbaui
@param _rxConn
If we insert a table, the connection must be set.
*/
- SvTreeListEntry* elementAdded(ElementType eType
- ,const OUString& _rName
- ,const css::uno::Any& _rObject );
+ std::unique_ptr<weld::TreeIter> elementAdded(ElementType eType,
+ const OUString& rName,
+ const css::uno::Any& rObject);
/** replaces an objects name with a new one
@param _eType
@@ -349,9 +297,11 @@ namespace dbaui
const OUString& _sName,
bool _bTable);
- SvTreeListEntry* getEntry( const Point& _aPoint ) const;
+ std::unique_ptr<weld::TreeIter> getEntry(const Point& rPosPixel) const;
+
+ TreeListBox* getTreeWindow() const;
- vcl::Window* getTreeWindow() const;
+ bool HasChildPathFocus() const;
private:
void impl_createPage(
ElementType _eType,
@@ -363,6 +313,5 @@ namespace dbaui
void impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx
index 514580014f79..bd6e86dcb8b7 100644
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ b/dbaccess/source/ui/app/AppIconControl.cxx
@@ -21,86 +21,217 @@
#include <core_resource.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
-#include <vcl/image.hxx>
+#include <sfx2/thumbnailviewitem.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/event.hxx>
+#include <vcl/i18nhelp.hxx>
+#include <vcl/mnemonic.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
#include <callbacks.hxx>
#include <AppElementType.hxx>
-using namespace ::dbaui;
-OApplicationIconControl::OApplicationIconControl(vcl::Window* _pParent)
- : SvtIconChoiceCtrl(_pParent,WB_ICON | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | /*!WB_NOSELECTION |*/
- WB_TABSTOP | WB_CLIPCHILDREN | WB_NOVSCROLL | WB_SMART_ARRANGE | WB_NOHSCROLL | WB_CENTER)
- ,DropTargetHelper(this)
- ,m_pActionListener(nullptr)
+namespace dbaui
{
+class OApplicationIconControlDropTarget final : public DropTargetHelper
+{
+private:
+ OApplicationIconControl& m_rControl;
+
+public:
+ OApplicationIconControlDropTarget(OApplicationIconControl& rControl)
+ : DropTargetHelper(rControl.GetDrawingArea()->get_drop_target())
+ , m_rControl(rControl)
+ {
+ }
+
+ virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override
+ {
+ return m_rControl.AcceptDrop(rEvt);
+ }
- static const struct CategoryDescriptor
+ virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
+ {
+ return m_rControl.ExecuteDrop(rEvt);
+ }
+};
+
+OApplicationIconControl::OApplicationIconControl(std::unique_ptr<weld::ScrolledWindow> xScroll)
+ : ThumbnailView(std::move(xScroll), nullptr)
+ , m_pActionListener(nullptr)
+ , m_nMaxWidth(0)
+ , m_nMaxHeight(0)
+{
+ mnVItemSpace = 6; // row spacing
+ mbSelectOnFocus = false;
+ DrawMnemonics(true);
+}
+
+void OApplicationIconControl::Fill()
+{
+ static constexpr struct CategoryDescriptor
{
- const char* pLabelResId;
+ TranslateId pLabelResId;
ElementType eType;
- const char* 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 },
- { RID_STR_REPORTS_CONTAINER, E_REPORT, BMP_REPORTFOLDER_TREE_L }
- };
- for (const CategoryDescriptor& aCategorie : aCategories)
+ 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 },
+ { RID_STR_REPORTS_CONTAINER, E_REPORT, BMP_REPORTFOLDER_TREE_L } };
+
+ for (const CategoryDescriptor& aCategory : aCategories)
+ {
+ // E_TABLE is 0, but 0 means void so use id of enum + 1
+ std::unique_ptr<ThumbnailViewItem> xItem(new ThumbnailViewItem(*this, aCategory.eType + 1));
+ xItem->mbBorder = false;
+ xItem->maPreview = Bitmap(aCategory.aImageResId);
+ const Size aSize = xItem->maPreview.GetSizePixel();
+ m_nMaxWidth = std::max(m_nMaxWidth, aSize.Width());
+ m_nMaxHeight = std::max(m_nMaxHeight, aSize.Height());
+ xItem->maTitle = DBA_RES(aCategory.pLabelResId);
+ m_nMaxWidth = std::max<tools::Long>(m_nMaxWidth, GetTextWidth(xItem->maTitle));
+ AppendItem(std::move(xItem));
+ }
+
+ const int nMargin = 12;
+ const int nWidthRequest = m_nMaxWidth + 2 * nMargin;
+ set_size_request(nWidthRequest, -1);
+ // we expect a Resize at which point we'll set the item sizes based on our final size
+}
+
+ElementType OApplicationIconControl::GetSelectedItem() const
+{
+ for (const auto& rItem : mItemList)
{
- SvxIconChoiceCtrlEntry* pEntry = InsertEntry(
- DBA_RES(aCategorie.pLabelResId) ,
- Image(StockImage::Yes, OUString::createFromAscii(aCategorie.aImageResId)));
- if ( pEntry )
- pEntry->SetUserData( new ElementType( aCategorie.eType ) );
+ if (!rItem->mbSelected)
+ continue;
+ return static_cast<ElementType>(rItem->mnId - 1);
}
+ return E_NONE;
+}
+
+void OApplicationIconControl::createIconAutoMnemonics(MnemonicGenerator& rMnemonics)
+{
+ for (const auto& rItem : mItemList)
+ rMnemonics.RegisterMnemonic(rItem->maTitle);
- SetChoiceWithCursor();
- SetSelectionMode(SelectionMode::Single);
+ // exchange texts with generated mnemonics
+ for (auto& rItem : mItemList)
+ rItem->maTitle = rMnemonics.CreateMnemonic(rItem->maTitle);
}
-OApplicationIconControl::~OApplicationIconControl()
+void OApplicationIconControl::Resize()
{
- disposeOnce();
+ // fill the full width of the allocated area and give two lines of space to
+ // center the title in
+ setItemDimensions(GetOutputSizePixel().Width(), m_nMaxHeight, GetTextHeight() * 2, 0);
+ ThumbnailView::Resize();
}
-void OApplicationIconControl::dispose()
+bool OApplicationIconControl::IsMnemonicChar(sal_Unicode cChar, ElementType& rType) const
{
- sal_Int32 nCount = GetEntryCount();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ bool bRet = false;
+
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
+ for (const auto& rItem : mItemList)
{
- SvxIconChoiceCtrlEntry* pEntry = GetEntry( i );
- if ( pEntry )
+ if (rI18nHelper.MatchMnemonic(rItem->maTitle, cChar))
{
- delete static_cast<ElementType*>(pEntry->GetUserData());
- pEntry->SetUserData(nullptr);
+ bRet = true;
+ rType = static_cast<ElementType>(rItem->mnId - 1);
+ break;
}
}
- DropTargetHelper::dispose();
- SvtIconChoiceCtrl::dispose();
+
+ return bRet;
}
-sal_Int8 OApplicationIconControl::AcceptDrop( const AcceptDropEvent& _rEvt )
+bool OApplicationIconControl::DoKeyShortCut(const KeyEvent& rKEvt)
{
- sal_Int8 nDropOption = DND_ACTION_NONE;
- if ( m_pActionListener )
+ bool bMod2 = rKEvt.GetKeyCode().IsMod2();
+ sal_Unicode cChar = rKEvt.GetCharCode();
+ ElementType eType(E_NONE);
+ if (bMod2 && cChar && IsMnemonicChar(cChar, eType))
{
+ // shortcut is clicked
+ deselectItems();
+ SelectItem(eType + 1);
+ return true;
+ }
- SvxIconChoiceCtrlEntry* pEntry = GetEntry(_rEvt.maPosPixel);
- if ( pEntry )
+ return false;
+}
+
+bool OApplicationIconControl::KeyInput(const KeyEvent& rKEvt)
+{
+ return DoKeyShortCut(rKEvt) || ThumbnailView::KeyInput(rKEvt);
+}
+
+void OApplicationIconControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+ ThumbnailView::SetDrawingArea(pDrawingArea);
+ m_xDropTarget.reset(new OApplicationIconControlDropTarget(*this));
+}
+
+sal_Int8 OApplicationIconControl::AcceptDrop(const AcceptDropEvent& rEvt)
+{
+ sal_Int8 nDropOption = DND_ACTION_NONE;
+ if (m_pActionListener)
+ {
+ sal_uInt16 nEntry = GetItemId(rEvt.maPosPixel);
+ if (nEntry)
{
- SetCursor(pEntry);
- nDropOption = m_pActionListener->queryDrop( _rEvt, GetDataFlavorExVector() );
+ deselectItems();
+ SelectItem(nEntry);
+ nDropOption
+ = m_pActionListener->queryDrop(rEvt, m_xDropTarget->GetDataFlavorExVector());
}
}
-
return nDropOption;
}
-sal_Int8 OApplicationIconControl::ExecuteDrop( const ExecuteDropEvent& _rEvt )
+sal_Int8 OApplicationIconControl::ExecuteDrop(const ExecuteDropEvent& rEvt)
{
- if ( m_pActionListener )
- return m_pActionListener->executeDrop( _rEvt );
-
+ if (m_pActionListener)
+ m_pActionListener->executeDrop(rEvt);
return DND_ACTION_NONE;
}
+OApplicationIconControl::~OApplicationIconControl() {}
+
+void OApplicationIconControl::GetFocus()
+{
+ ThumbnailView::GetFocus();
+ Invalidate(); // redraw focus rect
+}
+
+void OApplicationIconControl::LoseFocus()
+{
+ ThumbnailView::LoseFocus();
+ Invalidate(); // redraw focus rect
+}
+
+tools::Rectangle OApplicationIconControl::GetFocusRect()
+{
+ if (HasFocus())
+ {
+ // Get the last selected item in the list
+ for (tools::Long i = mFilteredItemList.size() - 1; i >= 0; --i)
+ {
+ ThumbnailViewItem* pItem = mFilteredItemList[i];
+ if (pItem->isSelected())
+ {
+ tools::Rectangle aRet(pItem->getDrawArea());
+ aRet.AdjustLeft(THUMBNAILVIEW_ITEM_CORNER);
+ aRet.AdjustTop(1);
+ aRet.AdjustRight(-THUMBNAILVIEW_ITEM_CORNER);
+ aRet.AdjustBottom(-2);
+ return aRet;
+ }
+ }
+ }
+ return tools::Rectangle();
+}
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppIconControl.hxx b/dbaccess/source/ui/app/AppIconControl.hxx
index 38408af60687..08bc25b4282b 100644
--- a/dbaccess/source/ui/app/AppIconControl.hxx
+++ b/dbaccess/source/ui/app/AppIconControl.hxx
@@ -16,33 +16,51 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPICONCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPICONCONTROL_HXX
+#pragma once
-#include <vcl/ivctrl.hxx>
+#include <sfx2/thumbnailview.hxx>
#include <vcl/transfer.hxx>
+#include <vcl/weld.hxx>
+#include <AppElementType.hxx>
+
+class MnemonicGenerator;
namespace dbaui
{
class IControlActionListener;
- class OApplicationIconControl :public SvtIconChoiceCtrl
- ,public DropTargetHelper
+ class OApplicationIconControlDropTarget;
+
+ class OApplicationIconControl final : public ThumbnailView
{
- IControlActionListener* m_pActionListener;
+ std::unique_ptr<OApplicationIconControlDropTarget> m_xDropTarget;
+ IControlActionListener* m_pActionListener;
+
+ tools::Long m_nMaxWidth;
+ tools::Long m_nMaxHeight;
+
+ bool IsMnemonicChar(sal_Unicode cChar, ElementType& rType) const;
public:
- explicit OApplicationIconControl(vcl::Window* _pParent);
+ explicit OApplicationIconControl(std::unique_ptr<weld::ScrolledWindow> xScroll);
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual void Resize() override;
+ virtual tools::Rectangle GetFocusRect() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ bool DoKeyShortCut(const KeyEvent& rKEvt);
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
virtual ~OApplicationIconControl() override;
- virtual void dispose() override;
- void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
+ ElementType GetSelectedItem() const;
+
+ void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
+ void Fill();
+
+ void createIconAutoMnemonics(MnemonicGenerator& rMnemonics);
- protected:
- // DropTargetHelper overridables
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ) override;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ) override;
+ sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
+ sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPICONCONTROL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index e291bdb8a6ac..605e249efdce 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -20,161 +20,111 @@
#include "AppSwapWindow.hxx"
#include <helpids.h>
#include "AppView.hxx"
+#include <sfx2/thumbnailviewitem.hxx>
#include <vcl/event.hxx>
#include <vcl/mnemonic.hxx>
-#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
#include "AppController.hxx"
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( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow )
- :Window(_pParent,WB_DIALOGCONTROL )
- ,m_aIconControl(VclPtr<OApplicationIconControl>::Create(this))
- ,m_eLastType(E_NONE)
- ,m_rBorderWin( _rBorderWindow )
-{
- ImplInitSettings();
-
- m_aIconControl->SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
- m_aIconControl->setControlActionListener( &m_rBorderWin.getView()->getAppController() );
- m_aIconControl->SetHelpId(HID_APP_SWAP_ICONCONTROL);
- m_aIconControl->Show();
-}
-OApplicationSwapWindow::~OApplicationSwapWindow()
+OApplicationSwapWindow::OApplicationSwapWindow(weld::Container* pParent,
+ OAppBorderWindow& rBorderWindow)
+ : OChildWindow(pParent, u"dbaccess/ui/appswapwindow.ui"_ustr, u"AppSwapWindow"_ustr)
+ , m_xIconControl(
+ new OApplicationIconControl(m_xBuilder->weld_scrolled_window(u"scroll"_ustr, true)))
+ , m_xIconControlWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *m_xIconControl))
+ , m_eLastType(E_NONE)
+ , m_rBorderWin(rBorderWindow)
+ , m_nChangeEvent(nullptr)
{
- disposeOnce();
-}
+ m_xContainer->set_stack_background();
-void OApplicationSwapWindow::dispose()
-{
- m_aIconControl.disposeAndClear();
- vcl::Window::dispose();
+ m_xIconControl->SetHelpId(HID_APP_SWAP_ICONCONTROL);
+ m_xIconControl->Fill();
+ m_xIconControl->setItemStateHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
+ m_xIconControl->setControlActionListener(&m_rBorderWin.getView()->getAppController());
}
-void OApplicationSwapWindow::Resize()
+void OApplicationSwapWindow::GrabFocus()
{
- Size aFLSize = LogicToPixel(Size(8, 0), MapMode(MapUnit::MapAppFont));
- long nX = 0;
- if ( m_aIconControl->GetEntryCount() != 0 )
- nX = m_aIconControl->GetBoundingBox( m_aIconControl->GetEntry(0) ).GetWidth() + aFLSize.Width();
-
- Size aOutputSize = GetOutputSize();
-
- m_aIconControl->SetPosSizePixel( Point(static_cast<long>((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height()));
- m_aIconControl->ArrangeIcons();
+ if (m_xIconControl)
+ m_xIconControl->GrabFocus();
}
-void OApplicationSwapWindow::ImplInitSettings()
+bool OApplicationSwapWindow::HasChildPathFocus() const
{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
+ return m_xIconControl && m_xIconControl->HasFocus();
}
-void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt )
+OApplicationSwapWindow::~OApplicationSwapWindow()
{
- Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
+ if (m_nChangeEvent)
+ Application::RemoveUserEvent(m_nChangeEvent);
}
void OApplicationSwapWindow::clearSelection()
{
- m_aIconControl->SetNoSelection();
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry();
- if ( pEntry )
- m_aIconControl->InvalidateEntry(pEntry);
- m_aIconControl->GetClickHdl().Call(m_aIconControl.get());
+ m_xIconControl->deselectItems();
+ onContainerSelected(E_NONE);
}
-void OApplicationSwapWindow::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
+void OApplicationSwapWindow::createIconAutoMnemonics(MnemonicGenerator& rMnemonics)
{
- m_aIconControl->CreateAutoMnemonics( _rMnemonics );
+ m_xIconControl->createIconAutoMnemonics(rMnemonics);
}
-bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent )
+bool OApplicationSwapWindow::interceptKeyInput(const KeyEvent& _rEvent)
{
const vcl::KeyCode& rKeyCode = _rEvent.GetKeyCode();
- if ( rKeyCode.GetModifier() == KEY_MOD2 )
- return m_aIconControl->DoKeyInput( _rEvent );
-
+ if (rKeyCode.GetModifier() == KEY_MOD2)
+ return m_xIconControl->DoKeyShortCut(_rEvent);
// not handled
return false;
}
ElementType OApplicationSwapWindow::getElementType() const
{
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry();
- return pEntry ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE;
+ return m_xIconControl->GetSelectedItem();
}
-bool OApplicationSwapWindow::onContainerSelected( ElementType _eType )
+bool OApplicationSwapWindow::onContainerSelected(ElementType _eType)
{
- if ( m_eLastType == _eType )
+ if (m_eLastType == _eType)
return true;
- if ( m_rBorderWin.getView()->getAppController().onContainerSelect( _eType ) )
+ if (m_rBorderWin.getView()->getAppController().onContainerSelect(_eType))
{
- if ( _eType != E_NONE )
+ if (_eType != E_NONE)
m_eLastType = _eType;
return true;
}
- PostUserEvent( LINK( this, OApplicationSwapWindow, ChangeToLastSelected ), nullptr, true );
+ if (!m_nChangeEvent)
+ m_nChangeEvent
+ = Application::PostUserEvent(LINK(this, OApplicationSwapWindow, ChangeToLastSelected));
return false;
}
-IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, SvtIconChoiceCtrl*, _pControl, void)
+IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, const ThumbnailViewItem*, pEntry, void)
{
- SvxIconChoiceCtrlEntry* pEntry = _pControl->GetSelectedEntry();
- ElementType eType = E_NONE;
- if ( pEntry )
+ if (pEntry->mbSelected)
{
- eType = *static_cast<ElementType*>(pEntry->GetUserData());
- onContainerSelected( eType ); // i87582
+ ElementType eType = static_cast<ElementType>(pEntry->mnId - 1);
+ onContainerSelected(eType); // i87582
}
}
IMPL_LINK_NOARG(OApplicationSwapWindow, ChangeToLastSelected, void*, void)
{
+ m_nChangeEvent = nullptr;
selectContainer(m_eLastType);
}
-void OApplicationSwapWindow::selectContainer(ElementType _eType)
+void OApplicationSwapWindow::selectContainer(ElementType eType)
{
- sal_Int32 nCount = m_aIconControl->GetEntryCount();
- SvxIconChoiceCtrlEntry* pEntry = nullptr;
- for (sal_Int32 i=0; i < nCount; ++i)
- {
- pEntry = m_aIconControl->GetEntry(i);
- if ( pEntry && *static_cast<ElementType*>(pEntry->GetUserData()) == _eType )
- break;
- pEntry = nullptr;
- }
-
- if ( pEntry )
- m_aIconControl->SetCursor(pEntry); // this call also initiates a onContainerSelected call
- else
- onContainerSelected( _eType );
+ m_xIconControl->deselectItems();
+ m_xIconControl->SelectItem(eType + 1); // will trigger onContainerSelected
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppSwapWindow.hxx b/dbaccess/source/ui/app/AppSwapWindow.hxx
index 62f58c15248d..1ce972e3b000 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.hxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.hxx
@@ -16,36 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPSWAPWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPSWAPWINDOW_HXX
+#pragma once
#include <IClipBoardTest.hxx>
-#include <vcl/vclptr.hxx>
#include "AppIconControl.hxx"
#include <AppElementType.hxx>
+#include <ChildWindow.hxx>
+
+struct ImplSVEvent;
+class MnemonicGenerator;
namespace dbaui
{
class OAppBorderWindow;
- class OApplicationSwapWindow : public vcl::Window,
- public IClipboardTest
+ class OApplicationSwapWindow : public OChildWindow
+ , public IClipboardTest
{
- VclPtr<OApplicationIconControl> m_aIconControl;
+ std::unique_ptr<OApplicationIconControl> m_xIconControl;
+ std::unique_ptr<weld::CustomWeld> m_xIconControlWin;
ElementType m_eLastType;
OAppBorderWindow& m_rBorderWin;
+ ImplSVEvent* m_nChangeEvent;
- void ImplInitSettings();
-
- DECL_LINK( OnContainerSelectHdl, SvtIconChoiceCtrl*, void );
+ DECL_LINK( OnContainerSelectHdl, const ThumbnailViewItem*, void );
DECL_LINK( ChangeToLastSelected, void*, void );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+
public:
- OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow );
+ OApplicationSwapWindow(weld::Container* pParent, OAppBorderWindow& rBorderWindow);
virtual ~OApplicationSwapWindow() override;
- // Window overrides
- virtual void dispose() override;
- virtual void Resize() override;
+
+ virtual void GrabFocus() override;
+ virtual bool HasChildPathFocus() const override;
bool isCutAllowed() override { return false; }
bool isCopyAllowed() override { return false; }
@@ -54,10 +55,6 @@ namespace dbaui
void cut() override { }
void paste() override { }
- sal_Int32 GetEntryCount() const { return m_aIconControl->GetEntryCount(); }
- SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl->GetEntry(nPos); }
- tools::Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl->GetBoundingBox(pEntry); }
-
/** automatically creates mnemonics for the icon/texts in our left hand side panel
*/
void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
@@ -87,6 +84,5 @@ namespace dbaui
bool onContainerSelected( ElementType _eType );
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPSWAPWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index d6d121ba4909..a458a96e8dfa 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -17,166 +17,49 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "AppTitleWindow.hxx"
#include <core_resource.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/event.hxx>
+#include "AppTitleWindow.hxx"
namespace dbaui
{
-
-OTitleWindow::OTitleWindow(vcl::Window* _pParent, const char* pTitleId, WinBits _nBits, bool _bShift)
-: Window(_pParent,_nBits | WB_DIALOGCONTROL)
-, m_aSpace1(VclPtr<FixedText>::Create(this))
-, m_aSpace2(VclPtr<FixedText>::Create(this))
-, m_aTitle(VclPtr<FixedText>::Create(this))
-, m_pChild(nullptr)
-, m_bShift(_bShift)
+OTitleWindow::OTitleWindow(weld::Container* pParent, TranslateId pTitleId)
+ : m_xBuilder(Application::CreateBuilder(pParent, u"dbaccess/ui/titlewindow.ui"_ustr))
+ , m_xContainer(m_xBuilder->weld_container(u"TitleWindow"_ustr))
+ , m_xTitleFrame(m_xBuilder->weld_container(u"titleparent"_ustr))
+ , m_xTitle(m_xBuilder->weld_label(u"title"_ustr))
+ , m_xChildContainer(m_xBuilder->weld_container(u"box"_ustr))
{
setTitle(pTitleId);
- SetBorderStyle(WindowBorderStyle::MONO);
- ImplInitSettings();
-
- const StyleSettings& rStyle = Application::GetSettings().GetStyleSettings();
- vcl::Window* pWindows[] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() };
- for (vcl::Window* pWindow : pWindows)
- {
- vcl::Font aFont = pWindow->GetControlFont();
- aFont.SetWeight(WEIGHT_BOLD);
- pWindow->SetControlFont(aFont);
- pWindow->SetControlForeground(rStyle.GetLightColor());
- pWindow->SetControlBackground(rStyle.GetShadowColor());
- pWindow->Show();
- }
-}
-
-OTitleWindow::~OTitleWindow()
-{
- disposeOnce();
-}
-void OTitleWindow::dispose()
-{
- if ( m_pChild )
- {
- m_pChild->Hide();
- }
- m_pChild.disposeAndClear();
- m_aSpace1.disposeAndClear();
- m_aSpace2.disposeAndClear();
- m_aTitle.disposeAndClear();
- vcl::Window::dispose();
-}
-
-void OTitleWindow::setChildWindow(vcl::Window* _pChild)
-{
- m_pChild = _pChild;
+ m_xContainer->set_stack_background();
+ m_xTitleFrame->set_title_background();
+ m_xTitle->set_label_type(weld::LabelType::Title);
}
-#define SPACE_BORDER 1
-void OTitleWindow::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- Size aTextSize = LogicToPixel(Size(6, 3), MapMode(MapUnit::MapAppFont));
- sal_Int32 nXOffset = aTextSize.Width();
- sal_Int32 nYOffset = aTextSize.Height();
- sal_Int32 nHeight = GetTextHeight() + 2*nYOffset;
+OTitleWindow::~OTitleWindow() {}
- m_aSpace1->SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ),
- Size(nXOffset , nHeight - SPACE_BORDER) );
- m_aSpace2->SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ),
- Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nYOffset) );
- m_aTitle->SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER),
- Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nHeight - nYOffset - SPACE_BORDER) );
- if ( m_pChild )
- {
- m_pChild->SetPosSizePixel( Point(m_bShift ? (nXOffset+SPACE_BORDER) : sal_Int32(SPACE_BORDER), nHeight + nXOffset + SPACE_BORDER),
- Size(nOutputWidth - ( m_bShift ? (2*nXOffset - 2*SPACE_BORDER) : sal_Int32(SPACE_BORDER) ), nOutputHeight - nHeight - 2*nXOffset - 2*SPACE_BORDER) );
- }
-}
+weld::Container* OTitleWindow::getChildContainer() { return m_xChildContainer.get(); }
-void OTitleWindow::setTitle(const char* pTitleId)
+void OTitleWindow::setChildWindow(const std::shared_ptr<OChildWindow>& rChild)
{
- if (pTitleId)
- {
- m_aTitle->SetText(DBA_RES(pTitleId));
- }
+ m_xChild = rChild;
}
-void OTitleWindow::GetFocus()
+void OTitleWindow::setTitle(TranslateId pTitleId)
{
- Window::GetFocus();
- if ( m_pChild )
- m_pChild->GrabFocus();
+ if (!pTitleId)
+ return;
+ m_xTitle->set_label(DBA_RES(pTitleId));
}
-long OTitleWindow::GetWidthPixel() const
+void OTitleWindow::GrabFocus()
{
- Size aTextSize = LogicToPixel(Size(12, 0), MapMode(MapUnit::MapAppFont));
- sal_Int32 nWidth = GetTextWidth(m_aTitle->GetText()) + 2*aTextSize.Width();
-
- return nWidth;
+ if (m_xChild)
+ m_xChild->GrabFocus();
}
-void OTitleWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OTitleWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- AllSettings aAllSettings = GetSettings();
- StyleSettings aStyle = aAllSettings.GetStyleSettings();
- aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
- aAllSettings.SetStyleSettings(aStyle);
- SetSettings(aAllSettings);
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-
-void OTitleWindow::ApplySettings(vcl::RenderContext& rRenderContext)
-{
- // FIXME RenderContext
- AllSettings aAllSettings = rRenderContext.GetSettings();
- StyleSettings aStyle = aAllSettings.GetStyleSettings();
- aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
- aAllSettings.SetStyleSettings(aStyle);
- rRenderContext.SetSettings(aAllSettings);
-
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor(rStyleSettings.GetWindowTextColor());
- SetPointFont(*this, aFont);
-
- rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
- rRenderContext.SetTextFillColor();
-
- rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
-}
+bool OTitleWindow::HasChildPathFocus() const { return m_xChild && m_xChild->HasChildPathFocus(); }
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx
index c6a8d417df7f..d57f5241650f 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.hxx
@@ -16,61 +16,52 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
+#pragma once
-#include <vcl/fixed.hxx>
+#include <ChildWindow.hxx>
+#include <unotools/resmgr.hxx>
namespace dbaui
{
- class OTitleWindow : public vcl::Window
+ class OTitleWindow final
{
- VclPtr<FixedText> m_aSpace1;
- VclPtr<FixedText> m_aSpace2;
- VclPtr<FixedText> m_aTitle;
- VclPtr<vcl::Window> m_pChild;
- bool m_bShift;
- void ImplInitSettings();
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Container> m_xTitleFrame;
+ std::unique_ptr<weld::Label> m_xTitle;
+ std::unique_ptr<weld::Container> m_xChildContainer;
+ std::shared_ptr<OChildWindow> m_xChild;
+
public:
- OTitleWindow(vcl::Window* _pParent, const char* pTitleId, WinBits _nBits, bool _bShift = true);
- virtual ~OTitleWindow() override;
- virtual void dispose() override;
+ OTitleWindow(weld::Container* pParent, TranslateId pTitleId);
+ ~OTitleWindow();
+
+ void GrabFocus();
- // Window overrides
- virtual void Resize() override;
- virtual void GetFocus() override;
+ bool HasChildPathFocus() const;
- virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+ /** gets the window which should be used as a child's parent */
+ weld::Container* getChildContainer();
/** sets the child window which should be displayed below the title. It will be destroyed at the end.
@param _pChild
The child window.
*/
- void setChildWindow(vcl::Window* _pChild);
+ void setChildWindow(const std::shared_ptr<OChildWindow>& rChild);
/** gets the child window.
@return
The child window.
*/
- vcl::Window* getChildWindow() const { return m_pChild; }
+ OChildWindow* getChildWindow() const { return m_xChild.get(); }
/** sets the title text out of the resource
@param pTitleId
The resource id of the title text.
*/
- void setTitle(const char* pTitleId);
-
- /** Gets the min Width in Pixel which is needed to display the whole
-
- @return
- the min width
- */
- long GetWidthPixel() const;
+ void setTitle(TranslateId pTitleId);
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index fb61be9092d1..78c5fc00caea 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>
@@ -33,7 +33,6 @@
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
@@ -42,24 +41,20 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using ::com::sun::star::sdb::application::NamedDatabaseObject;
-OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
- ,m_pPanel(nullptr)
- ,m_pDetailView(nullptr)
- ,m_pView(_pParent)
+OAppBorderWindow::OAppBorderWindow(OApplicationView* pParent, PreviewMode ePreviewMode)
+ : InterimItemWindow(pParent, u"dbaccess/ui/appborderwindow.ui"_ustr, u"AppBorderWindow"_ustr, false)
+ , m_xPanelParent(m_xBuilder->weld_container(u"panel"_ustr))
+ , m_xDetailViewParent(m_xBuilder->weld_container(u"detail"_ustr))
+ , m_xView(pParent)
{
+ SetStyle(GetStyle() | WB_DIALOGCONTROL);
- SetBorderStyle(WindowBorderStyle::MONO);
+ m_xPanel.reset(new OTitleWindow(m_xPanelParent.get(), STR_DATABASE));
+ std::shared_ptr<OChildWindow> xSwap = std::make_shared<OApplicationSwapWindow>(m_xPanel->getChildContainer(), *this);
- m_pPanel = VclPtr<OTitleWindow>::Create(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false);
- m_pPanel->SetBorderStyle(WindowBorderStyle::MONO);
- VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel, *this );
- pSwap->Show();
+ m_xPanel->setChildWindow(xSwap);
- m_pPanel->setChildWindow(pSwap);
- m_pPanel->Show();
-
- m_pDetailView = VclPtr<OApplicationDetailView>::Create(*this,_ePreviewMode);
- m_pDetailView->Show();
+ m_xDetailView.reset(new OApplicationDetailView(m_xDetailViewParent.get(), *this, ePreviewMode));
ImplInitSettings();
}
@@ -72,81 +67,25 @@ OAppBorderWindow::~OAppBorderWindow()
void OAppBorderWindow::dispose()
{
// destroy children
- if ( m_pPanel )
- m_pPanel->Hide();
- m_pPanel.disposeAndClear();
- if ( m_pDetailView )
- m_pDetailView->Hide();
- m_pDetailView.disposeAndClear();
- m_pView.clear();
- vcl::Window::dispose();
+ m_xPanel.reset();
+ m_xDetailView.reset();
+ m_xPanelParent.reset();
+ m_xDetailViewParent.reset();
+ m_xView.reset();
+ InterimItemWindow::dispose();
}
void OAppBorderWindow::GetFocus()
{
- if ( m_pPanel )
- m_pPanel->GrabFocus();
+ if (m_xPanel)
+ m_xPanel->GrabFocus();
}
-void OAppBorderWindow::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
- long nX = 0;
-
- Size aFLSize = LogicToPixel(Size(3, 8), MapMode(MapUnit::MapAppFont));
- if ( m_pPanel )
- {
- OApplicationSwapWindow* pSwap = getPanel();
- if ( pSwap && pSwap->GetEntryCount() != 0 )
- nX = pSwap->GetBoundingBox( pSwap->GetEntry(0) ).GetWidth() + aFLSize.Height();
- nX = std::max(m_pPanel->GetWidthPixel() ,nX);
- m_pPanel->SetPosSizePixel(Point(0,0),Size(nX,nOutputHeight));
- }
-
- if ( m_pDetailView )
- m_pDetailView->SetPosSizePixel(Point(nX + aFLSize.Width(),0),Size(nOutputWidth - nX - aFLSize.Width(),nOutputHeight));
-}
-
-void OAppBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OAppBorderWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetDialogColor() );
-}
-
-
OApplicationSwapWindow* OAppBorderWindow::getPanel() const
{
- return static_cast< OApplicationSwapWindow* >( m_pPanel->getChildWindow() );
+ return static_cast<OApplicationSwapWindow*>(m_xPanel->getChildWindow());
}
-
OApplicationView::OApplicationView( vcl::Window* pParent
,const Reference< XComponentContext >& _rxOrb
,OApplicationController& _rAppController
@@ -154,7 +93,6 @@ OApplicationView::OApplicationView( vcl::Window* pParent
) :
ODataView( pParent, _rAppController, _rxOrb, WB_DIALOGCONTROL )
,m_rAppController( _rAppController )
- ,m_eChildFocus(NONE)
{
m_pWin = VclPtr<OAppBorderWindow>::Create(this,_ePreviewMode);
m_pWin->Show();
@@ -219,29 +157,29 @@ void OApplicationView::resizeDocumentView(tools::Rectangle& _rPlayground)
_rPlayground.SetSize( Size( 0, 0 ) );
}
+OApplicationView::ChildFocusState OApplicationView::getChildFocus() const
+{
+ ChildFocusState eChildFocus;
+ if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
+ eChildFocus = PANELSWAP;
+ else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
+ eChildFocus = DETAIL;
+ else
+ eChildFocus = NONE;
+ return eChildFocus;
+}
+
bool OApplicationView::PreNotify( NotifyEvent& rNEvt )
{
switch(rNEvt.GetType())
{
- case MouseNotifyEvent::GETFOCUS:
- if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
- m_eChildFocus = PANELSWAP;
- else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
- m_eChildFocus = DETAIL;
- else
- m_eChildFocus = NONE;
- break;
- case MouseNotifyEvent::KEYINPUT:
+ case NotifyEventType::KEYINPUT:
{
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
// give the pane the chance to intercept mnemonic accelerators
// #i34790#
if ( getPanel() && getPanel()->interceptKeyInput( *pKeyEvent ) )
return true;
- // and ditto the detail view
- // #i72799#
- if ( getDetailView() && getDetailView()->interceptKeyInput( *pKeyEvent ) )
- return true;
}
break;
default:
@@ -254,7 +192,7 @@ bool OApplicationView::PreNotify( NotifyEvent& rNEvt )
IClipboardTest* OApplicationView::getActiveChild() const
{
IClipboardTest* pTest = nullptr;
- if ( DETAIL == m_eChildFocus )
+ if (getChildFocus() == DETAIL)
pTest = getDetailView();
return pTest;
}
@@ -298,16 +236,16 @@ void OApplicationView::paste()
pTest->paste();
}
-OUString OApplicationView::getQualifiedName( SvTreeListEntry* _pEntry ) const
+OUString OApplicationView::getQualifiedName(const weld::TreeIter* _pEntry) const
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
return getDetailView()->getQualifiedName( _pEntry );
}
-bool OApplicationView::isLeaf(SvTreeListEntry const * _pEntry) const
+bool OApplicationView::isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry) const
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return OApplicationDetailView::isLeaf(_pEntry);
+ return OApplicationDetailView::isLeaf(rTreeView, rEntry);
}
bool OApplicationView::isALeafSelected() const
@@ -370,10 +308,22 @@ void OApplicationView::getSelectionElementNames( std::vector< OUString>& _rNames
getDetailView()->getSelectionElementNames( _rNames );
}
-void OApplicationView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
+void OApplicationView::describeCurrentSelectionForControl(const weld::TreeView& rControl, Sequence<NamedDatabaseObject>& out_rSelectedObjects)
+{
+ OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
+ getDetailView()->describeCurrentSelectionForControl(rControl, out_rSelectedObjects);
+}
+
+vcl::Window* OApplicationView::getMenuParent() const
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
+ return getDetailView()->getMenuParent();
+}
+
+void OApplicationView::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
+ return getDetailView()->adjustMenuPosition(rControl, rPos);
}
void OApplicationView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
@@ -388,7 +338,7 @@ void OApplicationView::selectElements(const Sequence< OUString>& _aNames)
getDetailView()->selectElements( _aNames );
}
-SvTreeListEntry* OApplicationView::elementAdded(ElementType eType,const OUString& _rName, const Any& _rObject )
+std::unique_ptr<weld::TreeIter> OApplicationView::elementAdded(ElementType eType,const OUString& _rName, const Any& _rObject )
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
return getDetailView()->elementAdded(eType,_rName,_rObject);
@@ -422,10 +372,10 @@ void OApplicationView::selectContainer(ElementType _eType)
getPanel()->selectContainer(_eType);
}
-SvTreeListEntry* OApplicationView::getEntry( const Point& _aPosPixel ) const
+std::unique_ptr<weld::TreeIter> OApplicationView::getEntry(const Point& rPosPixel) const
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getEntry(_aPosPixel);
+ return getDetailView()->getEntry(rPosPixel);
}
PreviewMode OApplicationView::getPreviewMode() const
@@ -494,10 +444,8 @@ void OApplicationView::showPreview( const OUString& _sDataSourceName,
void OApplicationView::GetFocus()
{
- if ( m_eChildFocus == NONE && m_pWin )
- {
+ if (m_pWin && getChildFocus() == NONE)
m_pWin->GrabFocus();
- }
}
void OApplicationView::_disposing( const css::lang::EventObject& /*_rSource*/ )
@@ -513,7 +461,7 @@ void OApplicationView::ImplInitSettings()
vcl::Font aFont = rStyleSettings.GetFieldFont();
aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
+ SetPointFont(*GetOutDev(), aFont);
SetTextColor( rStyleSettings.GetFieldTextColor() );
SetTextFillColor();
diff --git a/dbaccess/source/ui/app/AppView.hxx b/dbaccess/source/ui/app/AppView.hxx
index 0d492953a5e4..43dc46b222b4 100644
--- a/dbaccess/source/ui/app/AppView.hxx
+++ b/dbaccess/source/ui/app/AppView.hxx
@@ -16,21 +16,18 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPVIEW_HXX
+#pragma once
#include <dbaccess/dataview.hxx>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <unotools/eventlisteneradapter.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
#include <IClipBoardTest.hxx>
#include <AppElementType.hxx>
-namespace com::sun::star::beans { class XPropertySet; }
-
-class Control;
-class SvTreeListEntry;
class MnemonicGenerator;
namespace dbaui
@@ -41,28 +38,26 @@ namespace dbaui
class OTitleWindow;
class OApplicationController;
- class OAppBorderWindow : public vcl::Window
+ class OAppBorderWindow final : public InterimItemWindow
{
- VclPtr<OTitleWindow> m_pPanel;
- VclPtr<OApplicationDetailView> m_pDetailView;
- VclPtr<OApplicationView> m_pView;
+ std::unique_ptr<weld::Container> m_xPanelParent;
+ std::unique_ptr<weld::Container> m_xDetailViewParent;
+ std::unique_ptr<OTitleWindow> m_xPanel;
+ std::unique_ptr<OApplicationDetailView> m_xDetailView;
+ VclPtr<OApplicationView> m_xView;
- void ImplInitSettings();
- protected:
- // Window
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public:
- OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
+ OAppBorderWindow(OApplicationView* pParent, PreviewMode ePreviewMode);
virtual ~OAppBorderWindow() override;
virtual void dispose() override;
// Window overrides
virtual void GetFocus() override;
- virtual void Resize() override;
- OApplicationView* getView() const { return m_pView;}
+ OApplicationView* getView() const { return m_xView.get(); }
OApplicationSwapWindow* getPanel() const;
- OApplicationDetailView* getDetailView() const { return m_pDetailView;}
+ OApplicationDetailView* getDetailView() const { return m_xDetailView.get(); }
+ weld::Container& getTopLevel() { return *m_xContainer; }
};
class OApplicationView : public ODataView
@@ -80,8 +75,8 @@ namespace dbaui
m_xObject;
VclPtr<OAppBorderWindow> m_pWin;
OApplicationController& m_rAppController;
- ChildFocusState m_eChildFocus;
+ ChildFocusState getChildFocus() const;
IClipboardTest* getActiveChild() const;
void ImplInitSettings();
@@ -136,15 +131,17 @@ namespace dbaui
@return
the qualified name
*/
- OUString getQualifiedName( SvTreeListEntry* _pEntry ) const;
+ OUString getQualifiedName(const weld::TreeIter* _pEntry) const;
/** returns if an entry is a leaf
- @param _pEntry
+ @param rTreeView
+ The TreeView rEntry belongs to
+ @param rEntry
The entry to check
@return
<TRUE/> if the entry is a leaf, otherwise <FALSE/>
*/
- bool isLeaf(SvTreeListEntry const * _pEntry) const;
+ bool isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry) const;
/** returns if one of the selected entries is a leaf
@return
@@ -191,7 +188,7 @@ namespace dbaui
/** describes the current selection for the given control
*/
void describeCurrentSelectionForControl(
- const Control& _rControl,
+ const weld::TreeView& rControl,
css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
);
@@ -202,6 +199,13 @@ namespace dbaui
css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
);
+ /** get the menu parent window for the given control
+ */
+ vcl::Window* getMenuParent() const;
+
+ /** adjust rPos relative to rControl to instead relative to getMenuParent */
+ void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
+
/** select all names on the currently selected container. Non existence names where ignored.
*
* \param _aNames the element names
@@ -218,9 +222,9 @@ namespace dbaui
@param _rxConn
If we insert a table, the connection must be set.
*/
- SvTreeListEntry* elementAdded(ElementType _eType
- ,const OUString& _rName
- ,const css::uno::Any& _rObject );
+ std::unique_ptr<weld::TreeIter> elementAdded(ElementType eType,
+ const OUString& rName,
+ const css::uno::Any& rObject);
/** replaces an objects name with a new one
@param _eType
@@ -289,9 +293,8 @@ namespace dbaui
const OUString& _sName,
bool _bTable);
- SvTreeListEntry* getEntry( const Point& _aPosPixel ) const;
+ std::unique_ptr<weld::TreeIter> getEntry(const Point& rPosPixel) const;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/ChildWindow.cxx b/dbaccess/source/ui/app/ChildWindow.cxx
new file mode 100644
index 000000000000..2f27ccb30b46
--- /dev/null
+++ b/dbaccess/source/ui/app/ChildWindow.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/svapp.hxx>
+#include <ChildWindow.hxx>
+
+namespace dbaui
+{
+OChildWindow::OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription,
+ const OUString& rID)
+ : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
+ , m_xContainer(m_xBuilder->weld_container(rID))
+{
+}
+
+OChildWindow::~OChildWindow() {}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx
new file mode 100644
index 000000000000..890e19eb2dc2
--- /dev/null
+++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/script/CannotConvertException.hpp>
+#include <com/sun/star/script/Converter.hpp>
+#include <com/sun/star/script/XTypeConverter.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <rtl/ustring.hxx>
+#include "DocumentInfoPreview.hxx"
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/itemset.hxx>
+#include <tools/datetime.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+#include <templwin.hrc>
+#include "templwin.hxx"
+
+namespace dbaui {
+
+ODocumentInfoPreview::ODocumentInfoPreview()
+{
+}
+
+void ODocumentInfoPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+ WeldEditView::SetDrawingArea(pDrawingArea);
+ m_xEditView->HideCursor();
+ m_xEditView->SetReadOnly(true);
+}
+
+ODocumentInfoPreview::~ODocumentInfoPreview()
+{
+}
+
+void ODocumentInfoPreview::clear() {
+ m_xEditEngine->SetText(OUString());
+}
+
+void ODocumentInfoPreview::fill(
+ css::uno::Reference< css::document::XDocumentProperties > const & xDocProps)
+{
+ assert(xDocProps.is());
+
+ insertNonempty(DI_TITLE, xDocProps->getTitle());
+ insertNonempty(DI_FROM, xDocProps->getAuthor());
+ insertDateTime(DI_DATE, xDocProps->getCreationDate());
+ insertNonempty(DI_MODIFIEDBY, xDocProps->getModifiedBy());
+ insertDateTime(DI_MODIFIEDDATE, xDocProps->getModificationDate());
+ insertNonempty(DI_PRINTBY, xDocProps->getPrintedBy());
+ insertDateTime(DI_PRINTDATE, xDocProps->getPrintDate());
+ insertNonempty(DI_THEME, xDocProps->getSubject());
+ insertNonempty(
+ DI_KEYWORDS,
+ comphelper::string::convertCommaSeparated(xDocProps->getKeywords()));
+ insertNonempty(DI_DESCRIPTION, xDocProps->getDescription());
+
+ // User-defined (custom) properties:
+ css::uno::Reference< css::beans::XPropertySet > user(
+ xDocProps->getUserDefinedProperties(), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::beans::XPropertySetInfo > info(
+ user->getPropertySetInfo());
+ const css::uno::Sequence< css::beans::Property > props(info->getProperties());
+ for (const auto& rProp : props) {
+ OUString name(rProp.Name);
+ css::uno::Any aAny(user->getPropertyValue(name));
+ css::uno::Reference< css::script::XTypeConverter > conv(
+ css::script::Converter::create(
+ comphelper::getProcessComponentContext()));
+ OUString value;
+ try {
+ value = conv->convertToSimpleType(aAny, css::uno::TypeClass_STRING).
+ get< OUString >();
+ } catch (css::script::CannotConvertException &) {
+ TOOLS_INFO_EXCEPTION("svtools.contnr", "ignored");
+ }
+ if (!value.isEmpty()) {
+ insertEntry(name, value);
+ }
+ }
+
+ m_xEditView->SetSelection(ESelection(0, 0));
+}
+
+void ODocumentInfoPreview::insertEntry(
+ std::u16string_view title, OUString const & value)
+{
+ if (m_xEditEngine->HasText()) {
+ m_xEditEngine->QuickInsertText(u"\n\n"_ustr, ESelection::AtEnd());
+ }
+
+ OUString caption(OUString::Concat(title) + ":\n");
+ m_xEditEngine->QuickInsertText(caption, ESelection::AtEnd());
+
+ SfxItemSet aSet(m_xEditEngine->GetEmptyItemSet());
+ aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
+ aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT_CJK));
+ aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL));
+ int nCaptionPara = m_xEditEngine->GetParagraphCount() - 2;
+ m_xEditEngine->QuickSetAttribs(aSet, ESelection(nCaptionPara, 0, nCaptionPara, caption.getLength() - 1));
+
+ m_xEditEngine->QuickInsertText(value, ESelection::AtEnd());
+}
+
+void ODocumentInfoPreview::insertNonempty(tools::Long id, OUString const & value)
+{
+ if (!value.isEmpty()) {
+ insertEntry(SvtDocInfoTable_Impl::GetString(id), value);
+ }
+}
+
+void ODocumentInfoPreview::insertDateTime(
+ tools::Long id, css::util::DateTime const & value)
+{
+ DateTime aToolsDT(
+ Date(value.Day, value.Month, value.Year),
+ tools::Time(
+ value.Hours, value.Minutes, value.Seconds, value.NanoSeconds));
+ if (aToolsDT.IsValidAndGregorian()) {
+ const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
+ OUString buf = rLocaleWrapper.getDate(aToolsDT) +
+ ", " +
+ rLocaleWrapper.getTime(aToolsDT);
+ insertEntry(SvtDocInfoTable_Impl::GetString(id), buf);
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.hxx b/dbaccess/source/ui/app/DocumentInfoPreview.hxx
new file mode 100644
index 000000000000..0c9548d0a759
--- /dev/null
+++ b/dbaccess/source/ui/app/DocumentInfoPreview.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <svx/weldeditview.hxx>
+
+namespace com :: sun :: star :: uno { template <typename > class Reference; }
+
+namespace com::sun::star {
+ namespace document { class XDocumentProperties; }
+ namespace util { struct DateTime; }
+}
+
+namespace dbaui {
+
+class ODocumentInfoPreview final : public WeldEditView {
+public:
+ ODocumentInfoPreview();
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ virtual ~ODocumentInfoPreview() override;
+
+ void clear();
+
+ void fill(css::uno::Reference< css::document::XDocumentProperties > const & xDocProps);
+
+private:
+ void insertEntry(std::u16string_view title, OUString const & value);
+
+ void insertNonempty(tools::Long id, OUString const & value);
+
+ void insertDateTime(tools::Long id, css::util::DateTime const & value);
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index 08df1dff0930..de97525bcb48 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;
@@ -88,18 +89,14 @@ namespace dbaui
Reference< XPropertySet > xDocumentDefinitionProperties;
SubComponentDescriptor()
- :sName()
- ,nComponentType( -1 )
- ,eOpenMode( E_OPEN_NORMAL )
- ,xFrame()
- ,xController()
- ,xModel()
+ :nComponentType( -1 )
+ ,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 )
{
@@ -110,7 +107,7 @@ namespace dbaui
Reference< XComponentSupplier > xCompSupp( i_rComponent, UNO_QUERY_THROW );
Reference< XComponent > xComponent( xCompSupp->getComponent(), UNO_QUERY_THROW );
if ( !impl_constructFrom( xComponent ) )
- throw RuntimeException("Illegal component type." );
+ throw RuntimeException(u"Illegal component type."_ustr );
xComponentCommandProcessor.set( i_rComponent, UNO_QUERY_THROW );
xDocumentDefinitionProperties.set( i_rComponent, UNO_QUERY_THROW );
}
@@ -161,9 +158,9 @@ namespace dbaui
Reference< XComponent > operator()( const SubComponentDescriptor &_desc ) const
{
if ( _desc.xModel.is() )
- return _desc.xModel.get();
+ return _desc.xModel;
OSL_ENSURE( _desc.xController.is(), "SelectSubComponent::operator(): illegal component!" );
- return _desc.xController.get();
+ return _desc.xController;
}
};
@@ -172,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 )
{
@@ -196,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 ))
{
}
@@ -310,16 +307,16 @@ namespace dbaui
return bSuccess;
}
- void lcl_notifySubComponentEvent( const SubComponentManager_Data& _rData, const char* _pAsciiEventName,
+ void lcl_notifySubComponentEvent( const SubComponentManager_Data& _rData, const OUString& _rAsciiEventName,
const SubComponentDescriptor& _rComponent )
{
try
{
Reference< XDocumentEventBroadcaster > xBroadcaster( _rData.m_rController.getModel(), UNO_QUERY_THROW );
xBroadcaster->notifyDocumentEvent(
- OUString::createFromAscii( _pAsciiEventName ),
+ _rAsciiEventName,
&_rData.m_rController,
- makeAny( _rComponent.xFrame )
+ Any( _rComponent.xFrame )
);
}
catch( const Exception& )
@@ -400,7 +397,7 @@ namespace dbaui
if ( aClosedComponent.is() )
{
aGuard.clear();
- lcl_notifySubComponentEvent( *m_pData, "OnSubComponentClosed", aClosedComponent );
+ lcl_notifySubComponentEvent( *m_pData, u"OnSubComponentClosed"_ustr, aClosedComponent );
}
}
@@ -477,7 +474,7 @@ namespace dbaui
// notify this to interested parties
aGuard.clear();
- lcl_notifySubComponentEvent( *m_pData, "OnSubComponentOpened", aElement );
+ lcl_notifySubComponentEvent( *m_pData, u"OnSubComponentOpened"_ustr, aElement );
}
bool SubComponentManager::activateSubFrame( const OUString& _rName, const sal_Int32 _nComponentType,
@@ -508,10 +505,10 @@ namespace dbaui
return true;
}
- bool SubComponentManager::closeSubFrames( const OUString& i_rName, const sal_Int32 _nComponentType )
+ bool SubComponentManager::closeSubFrames( std::u16string_view i_rName, const sal_Int32 _nComponentType )
{
::osl::MutexGuard aGuard( m_pData->getMutex() );
- ENSURE_OR_RETURN_FALSE( !i_rName.isEmpty(), "SubComponentManager::closeSubFrames: illegal name!" );
+ ENSURE_OR_RETURN_FALSE( !i_rName.empty(), "SubComponentManager::closeSubFrames: illegal name!" );
SubComponents aWorkingCopy( m_pData->m_aComponents );
for (auto const& elem : aWorkingCopy)
diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx
index a2f56badc8b7..402a3d593b90 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.hxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_SUBCOMPONENTMANAGER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_APP_SUBCOMPONENTMANAGER_HXX
+#pragma once
#include <AppElementType.hxx>
@@ -91,7 +90,7 @@ namespace dbaui
exist.
*/
bool closeSubFrames(
- const OUString& _rName,
+ std::u16string_view _rName,
const sal_Int32 _nComponentType
);
@@ -118,6 +117,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_SUBCOMPONENTMANAGER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/ScrollHelper.cxx b/dbaccess/source/ui/app/templwin.cxx
index a9fcacca957f..224d8be0aed9 100644
--- a/dbaccess/source/ui/control/ScrollHelper.cxx
+++ b/dbaccess/source/ui/app/templwin.cxx
@@ -17,35 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <ScrollHelper.hxx>
+#include <algorithm>
+#include <core_resource.hxx>
+#include <templwin.hrc>
+#include "templwin.hxx"
-#define LISTBOX_SCROLLING_AREA 12
-namespace dbaui
+namespace SvtDocInfoTable_Impl
{
-
- OScrollHelper::OScrollHelper()
- {
- }
- OScrollHelper::~OScrollHelper()
+ OUString GetString(int nId)
{
-
- }
- void OScrollHelper::scroll(const Point& _rPoint, const Size& _rOutputSize)
- {
- // Scrolling Areas
- tools::Rectangle aScrollArea( Point(0, _rOutputSize.Height() - LISTBOX_SCROLLING_AREA),
- Size(_rOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
-
- // if pointer in bottom area begin scroll
- if( aScrollArea.IsInside(_rPoint) )
- m_aUpScroll.Call(nullptr);
- else
- {
- aScrollArea.SetPos(Point(0,0));
- // if pointer in top area begin scroll
- if( aScrollArea.IsInside(_rPoint) )
- m_aDownScroll.Call(nullptr);
- }
+ 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/core/inc/object.hxx b/dbaccess/source/ui/app/templwin.hxx
index a6f08560941b..8978a6ea3e17 100644
--- a/dbaccess/source/core/inc/object.hxx
+++ b/dbaccess/source/ui/app/templwin.hxx
@@ -16,18 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#pragma once
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECT_HXX
+#include <rtl/ustring.hxx>
-enum ObjectType
+namespace SvtDocInfoTable_Impl
{
- dbaTable,
- dbaQuery,
- dbaForm,
- dbaReport
+OUString GetString(int nId);
};
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/browser/AsynchronousLink.cxx b/dbaccess/source/ui/browser/AsynchronousLink.cxx
index c8a7e500fb95..538ea702c4ac 100644
--- a/dbaccess/source/ui/browser/AsynchronousLink.cxx
+++ b/dbaccess/source/ui/browser/AsynchronousLink.cxx
@@ -22,25 +22,23 @@
// OAsynchronousLink
using namespace dbaui;
-OAsynchronousLink::OAsynchronousLink( const Link<void*,void>& _rHandler )
- :m_aHandler(_rHandler)
- ,m_aEventSafety()
- ,m_aDestructionSafety()
- ,m_nEventId(nullptr)
+OAsynchronousLink::OAsynchronousLink(const Link<void*, void>& _rHandler)
+ : m_aHandler(_rHandler)
+ , m_nEventId(nullptr)
{
}
OAsynchronousLink::~OAsynchronousLink()
{
{
- ::osl::MutexGuard aEventGuard( m_aEventSafety );
- if ( m_nEventId )
+ 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,28 +46,28 @@ OAsynchronousLink::~OAsynchronousLink()
}
}
-void OAsynchronousLink::Call( void* _pArgument )
+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 );
+ m_nEventId = Application::PostUserEvent(LINK(this, OAsynchronousLink, OnAsyncCall), _pArgument);
}
void OAsynchronousLink::CancelCall()
{
- ::osl::MutexGuard aEventGuard( m_aEventSafety );
- if ( m_nEventId )
- Application::RemoveUserEvent( m_nEventId );
+ std::unique_lock aEventGuard(m_aEventSafety);
+ if (m_nEventId)
+ Application::RemoveUserEvent(m_nEventId);
m_nEventId = nullptr;
}
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 8a0bb0cb6edc..3a3927a2dfe7 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>
@@ -91,27 +91,6 @@ using namespace ::dbtools;
using namespace ::comphelper;
using namespace ::svt;
-#define HANDLE_SQL_ERRORS( action, successflag, context, message ) \
- try \
- { \
- successflag = false; \
- action; \
- successflag = true; \
- } \
- catch(SQLException& e) \
- { \
- SQLException aError = ::dbtools::prependErrorInfo(e, *this, context); \
- css::sdb::SQLErrorEvent aEvent; \
- aEvent.Reason <<= aError; \
- errorOccured(aEvent); \
- } \
- catch(Exception&) \
- { \
- DBG_UNHANDLED_EXCEPTION("dbaccess"); \
- } \
-
-#define DO_SAFE( action, message ) try { action; } catch(Exception&) { SAL_WARN("dbaccess.ui",message); } ;
-
namespace dbaui
{
@@ -146,7 +125,7 @@ class SbaXDataBrowserController::FormControllerImpl
css::frame::XFrameActionListener >
{
friend class SbaXDataBrowserController;
- ::comphelper::OInterfaceContainerHelper2 m_aActivateListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::form::XFormControllerListener> m_aActivateListeners;
SbaXDataBrowserController* m_pOwner;
public:
@@ -417,12 +396,12 @@ void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setMode( const OUSt
OUString SAL_CALL SbaXDataBrowserController::FormControllerImpl::getMode( )
{
- return "DataMode";
+ return u"DataMode"_ustr;
}
Sequence< OUString > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getSupportedModes( )
{
- Sequence< OUString > aModes { "DataMode" };
+ Sequence< OUString > aModes { u"DataMode"_ustr };
return aModes;
}
@@ -457,8 +436,8 @@ Sequence< Reference< css::awt::XControl > > SAL_CALL SbaXDataBrowserController::
{
if (m_pOwner->getBrowserView())
{
- Reference< css::awt::XControl > xGrid = m_pOwner->getBrowserView()->getGridControl();
- return Sequence< Reference< css::awt::XControl > >(&xGrid, 1);
+ rtl::Reference< SbaXGridControl > xGrid = m_pOwner->getBrowserView()->getGridControl();
+ return { Reference< css::awt::XControl >(xGrid) };
}
return Sequence< Reference< css::awt::XControl > >();
}
@@ -500,7 +479,7 @@ Sequence< Type > SAL_CALL SbaXDataBrowserController::getTypes( )
{
return ::comphelper::concatSequences(
SbaXDataBrowserController_Base::getTypes(),
- m_pFormControllerImpl->getTypes()
+ m_xFormControllerImpl->getTypes()
);
}
@@ -525,12 +504,12 @@ Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType)
SbaXDataBrowserController::SbaXDataBrowserController(const Reference< css::uno::XComponentContext >& _rM)
:SbaXDataBrowserController_Base(_rM)
,m_nRowSetPrivileges(0)
+ ,m_aInvalidateClipboard("dbaui::SbaXDataBrowserController m_aInvalidateClipboard")
,m_aAsyncGetCellFocus(LINK(this, SbaXDataBrowserController, OnAsyncGetCellFocus))
,m_aAsyncDisplayError( LINK( this, SbaXDataBrowserController, OnAsyncDisplayError ) )
,m_sStateSaveRecord(DBA_RES(RID_STR_SAVE_CURRENT_RECORD))
,m_sStateUndoRecord(DBA_RES(RID_STR_UNDO_MODIFY_RECORD))
- ,m_sModuleIdentifier( OUString( "com.sun.star.sdb.DataSourceBrowser" ) )
- ,m_pFormControllerImpl(nullptr)
+ ,m_sModuleIdentifier( u"com.sun.star.sdb.DataSourceBrowser"_ustr )
,m_nFormActionNestingLevel(0)
,m_bLoadCanceled( false )
,m_bCannotSelectUnfiltered( true )
@@ -538,13 +517,11 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< css::uno::
// create the form controller aggregate
osl_atomic_increment(&m_refCount);
{
- m_pFormControllerImpl = new FormControllerImpl(this);
- m_xFormControllerImpl = m_pFormControllerImpl;
+ m_xFormControllerImpl = new FormControllerImpl(this);
m_xFormControllerImpl->setDelegator(*this);
}
osl_atomic_decrement(&m_refCount);
- m_aInvalidateClipboard.SetDebugName("dbaui::SbaXDataBrowserController m_aInvalidateClipboard");
m_aInvalidateClipboard.SetInvokeHandler(LINK(this, SbaXDataBrowserController, OnInvalidateClipboard));
m_aInvalidateClipboard.SetTimeout(300);
}
@@ -691,24 +668,24 @@ void SbaXDataBrowserController::initFormatter()
void SbaXDataBrowserController::describeSupportedFeatures()
{
SbaXDataBrowserController_Base::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:FormSlots/undoRecord", ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:FormController/undoRecord", ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:RecUndo", ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:FormSlots/saveRecord", ID_BROWSER_SAVERECORD, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:FormController/saveRecord", ID_BROWSER_SAVERECORD, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:RecSave", ID_BROWSER_SAVERECORD, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVERECORD, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:RecSearch", SID_FM_SEARCH, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:AutoFilter", SID_FM_AUTOFILTER, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:Refresh", SID_FM_REFRESH, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:OrderCrit", SID_FM_ORDERCRIT, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:RemoveFilterSort", SID_FM_REMOVE_FILTER_SORT,CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:FormFiltered", SID_FM_FORM_FILTERED, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:FilterCrit", SID_FM_FILTERCRIT, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:Sortup", ID_BROWSER_SORTUP, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:SortDown", ID_BROWSER_SORTDOWN, CommandGroup::CONTROLS );
- implDescribeSupportedFeature( ".uno:FormSlots/deleteRecord", SID_FM_DELETEROWS, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:FormSlots/insertRecord", ID_BROWSER_INSERT_ROW, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:FormSlots/undoRecord"_ustr, ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:FormController/undoRecord"_ustr, ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:RecUndo"_ustr, ID_BROWSER_UNDORECORD, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:FormSlots/saveRecord"_ustr, ID_BROWSER_SAVERECORD, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:FormController/saveRecord"_ustr, ID_BROWSER_SAVERECORD, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:RecSave"_ustr, ID_BROWSER_SAVERECORD, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:Save"_ustr, ID_BROWSER_SAVERECORD, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:RecSearch"_ustr, SID_FM_SEARCH, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:AutoFilter"_ustr, SID_FM_AUTOFILTER, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:Refresh"_ustr, SID_FM_REFRESH, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:OrderCrit"_ustr, SID_FM_ORDERCRIT, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:RemoveFilterSort"_ustr, SID_FM_REMOVE_FILTER_SORT,CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:FormFiltered"_ustr, SID_FM_FORM_FILTERED, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:FilterCrit"_ustr, SID_FM_FILTERCRIT, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:Sortup"_ustr, ID_BROWSER_SORTUP, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:SortDown"_ustr, ID_BROWSER_SORTDOWN, CommandGroup::CONTROLS );
+ implDescribeSupportedFeature( u".uno:FormSlots/deleteRecord"_ustr, SID_FM_DELETEROWS, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:FormSlots/insertRecord"_ustr, ID_BROWSER_INSERT_ROW, CommandGroup::INSERT );
}
bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
@@ -735,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
@@ -839,14 +816,14 @@ void SbaXDataBrowserController::RemoveColumnListener(const Reference< XPropertyS
Reference< XRowSet > SbaXDataBrowserController::CreateForm()
{
return Reference< XRowSet > (
- getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.form.component.Form", getORB()),
+ getORB()->getServiceManager()->createInstanceWithContext(u"com.sun.star.form.component.Form"_ustr, getORB()),
UNO_QUERY);
}
Reference< css::form::XFormComponent > SbaXDataBrowserController::CreateGridModel()
{
return Reference< css::form::XFormComponent > (
- getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.form.component.GridControl", getORB()),
+ getORB()->getServiceManager()->createInstanceWithContext(u"com.sun.star.form.component.GridControl"_ustr, getORB()),
UNO_QUERY);
}
@@ -891,14 +868,13 @@ void SbaXDataBrowserController::removeModelListeners(const Reference< XControlMo
void SbaXDataBrowserController::addControlListeners(const Reference< css::awt::XControl > & _xGridControl)
{
// to ge the 'modified' for the current cell
- Reference< XModifyBroadcaster > xBroadcaster(getBrowserView()->getGridControl(), UNO_QUERY);
- if (xBroadcaster.is())
- xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this));
+ rtl::Reference< SbaXGridControl > xGridControl(getBrowserView()->getGridControl() );
+ if (xGridControl.is())
+ xGridControl->addModifyListener(static_cast<XModifyListener*>(this));
// introduce ourself as dispatch provider for the grid
- Reference< XDispatchProviderInterception > xInterception(getBrowserView()->getGridControl(), UNO_QUERY);
- if (xInterception.is())
- xInterception->registerDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this));
+ if (xGridControl.is())
+ xGridControl->registerDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this));
// add as focus listener to the control (needed for the form controller functionality)
Reference< XWindow > xWindow(_xGridControl, UNO_QUERY);
@@ -925,9 +901,7 @@ void SAL_CALL SbaXDataBrowserController::focusGained(const FocusEvent& /*e*/)
{
// notify our activate listeners (registered on the form controller aggregate)
EventObject aEvt(*this);
- ::comphelper::OInterfaceIteratorHelper2 aIter(m_pFormControllerImpl->m_aActivateListeners);
- while (aIter.hasMoreElements())
- static_cast<XFormControllerListener*>(aIter.next())->formActivated(aEvt);
+ m_xFormControllerImpl->m_aActivateListeners.notifyEach( &css::form::XFormControllerListener::formActivated, aEvt );
}
void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e)
@@ -951,12 +925,10 @@ void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e)
// notify the listeners that the "form" we represent has been deactivated
EventObject aEvt(*this);
- ::comphelper::OInterfaceIteratorHelper2 aIter(m_pFormControllerImpl->m_aActivateListeners);
- while (aIter.hasMoreElements())
- static_cast<XFormControllerListener*>(aIter.next())->formDeactivated(aEvt);
+ m_xFormControllerImpl->m_aActivateListeners.notifyEach( &css::form::XFormControllerListener::formDeactivated, aEvt );
// commit the changes of the grid control (as we're deactivated)
- Reference< XBoundComponent > xCommitable(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xCommitable(getBrowserView()->getGridControl());
if (xCommitable.is())
xCommitable->commit();
else
@@ -998,7 +970,7 @@ void SbaXDataBrowserController::disposingColumnModel(const css::lang::EventObjec
void SbaXDataBrowserController::disposing(const EventObject& Source)
{
// if it's a component other than our aggregate, forward it to the aggregate
- if ( m_xFormControllerImpl != Source.Source )
+ if ( uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(m_xFormControllerImpl.get()), UNO_QUERY) != Source.Source )
{
Reference< XEventListener > xAggListener;
m_xFormControllerImpl->queryAggregation( cppu::UnoType<decltype(xAggListener)>::get() ) >>= xAggListener;
@@ -1010,7 +982,7 @@ void SbaXDataBrowserController::disposing(const EventObject& Source)
if (getBrowserView())
{
Reference< css::awt::XControl > xSourceControl(Source.Source, UNO_QUERY);
- if (xSourceControl == getBrowserView()->getGridControl())
+ if (xSourceControl == cppu::getXWeak(getBrowserView()->getGridControl().get()))
removeControlListeners(getBrowserView()->getGridControl());
}
@@ -1266,11 +1238,11 @@ void SbaXDataBrowserController::errorOccured(const css::sdb::SQLErrorEvent& aEve
if ( m_nFormActionNestingLevel )
{
OSL_ENSURE( !m_aCurrentError.isValid(), "SbaXDataBrowserController::errorOccurred: can handle one error per transaction only!" );
- m_aCurrentError = aInfo;
+ m_aCurrentError = std::move(aInfo);
}
else
{
- m_aCurrentError = aInfo;
+ m_aCurrentError = std::move(aInfo);
m_aAsyncDisplayError.Call();
}
}
@@ -1284,28 +1256,26 @@ 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
try
{
// two continuations allowed: OK and Cancel
- OParameterContinuation* pParamValues = new OParameterContinuation;
- OInteractionAbort* pAbort = new OInteractionAbort;
+ rtl::Reference<OParameterContinuation> pParamValues = new OParameterContinuation;
+ 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));
- OInteractionRequest* pParamRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xParamRequest(pParamRequest);
+ rtl::Reference<OInteractionRequest> pParamRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pParamRequest->addContinuation(pParamValues);
pParamRequest->addContinuation(pAbort);
// create the handler, let it handle the request
Reference< XInteractionHandler2 > xHandler(InteractionHandler::createWithParent(getORB(), getComponentWindow()));
- xHandler->handle(xParamRequest);
+ xHandler->handle(pParamRequest);
if (!pParamValues->wasSelected())
{ // canceled
@@ -1321,8 +1291,7 @@ sal_Bool SbaXDataBrowserController::approveParameter(const css::form::DatabasePa
setLoadingCancelled();
return false;
}
- const PropertyValue* pFinalValues = aFinalValues.getConstArray();
- for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues)
+ for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i)
{
Reference< XPropertySet > xParam(
aRequest.Parameters->getByIndex(i), css::uno::UNO_QUERY);
@@ -1332,9 +1301,9 @@ sal_Bool SbaXDataBrowserController::approveParameter(const css::form::DatabasePa
#ifdef DBG_UTIL
OUString sName;
xParam->getPropertyValue(PROPERTY_NAME) >>= sName;
- OSL_ENSURE(sName == pFinalValues->Name, "SbaXDataBrowserController::approveParameter: suspicious value names!");
+ OSL_ENSURE(sName == aFinalValues[i].Name, "SbaXDataBrowserController::approveParameter: suspicious value names!");
#endif
- try { xParam->setPropertyValue(PROPERTY_VALUE, pFinalValues->Value); }
+ try { xParam->setPropertyValue(PROPERTY_VALUE, aFinalValues[i].Value); }
catch(Exception&)
{
SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::approveParameter: setting one of the properties failed!");
@@ -1415,7 +1384,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
try
{
Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
- OSL_VERIFY( xRowSetProps->getPropertyValue("AllowInserts") >>= bAllowInsertions );
+ OSL_VERIFY( xRowSetProps->getPropertyValue(u"AllowInserts"_ustr) >>= bAllowInsertions );
}
catch( const Exception& )
{
@@ -1434,7 +1403,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
try
{
Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
- OSL_VERIFY( xRowSetProps->getPropertyValue("AllowDeletes") >>= bAllowDeletions );
+ OSL_VERIFY( xRowSetProps->getPropertyValue(u"AllowDeletes"_ustr) >>= bAllowDeletions );
OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ROWCOUNT ) >>= nRowCount );
OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ISNEW ) >>= bInsertionRow );
}
@@ -1551,9 +1520,9 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
break; // no datasource -> no edit mode
sal_Int32 nDataSourcePrivileges = ::comphelper::getINT32(xDataSourceSet->getPropertyValue(PROPERTY_PRIVILEGES));
- bool bInsertAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::INSERT) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue("AllowInserts"));
- bool bUpdateAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::UPDATE) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue("AllowUpdates"));
- bool bDeleteAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::DELETE) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue("AllowDeletes"));
+ bool bInsertAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::INSERT) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue(u"AllowInserts"_ustr));
+ bool bUpdateAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::UPDATE) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue(u"AllowUpdates"_ustr));
+ bool bDeleteAllowedAndPossible = ((nDataSourcePrivileges & css::sdbcx::Privilege::DELETE) != 0) && ::comphelper::getBOOL(xDataSourceSet->getPropertyValue(u"AllowDeletes"_ustr));
if (!bInsertAllowedAndPossible && !bUpdateAllowedAndPossible && !bDeleteAllowedAndPossible)
break; // no insert/update/delete -> no edit mode
@@ -1609,7 +1578,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&)
@@ -1618,7 +1587,7 @@ void SbaXDataBrowserController::applyParserOrder(const OUString& _rOldOrder,cons
if (!bSuccess)
{
- xFormSet->setPropertyValue(PROPERTY_ORDER, makeAny(_rOldOrder));
+ xFormSet->setPropertyValue(PROPERTY_ORDER, Any(_rOldOrder));
try
{
@@ -1651,8 +1620,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);
@@ -1663,8 +1632,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
@@ -1791,7 +1760,7 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(bool bFilter)
void SbaXDataBrowserController::ExecuteSearch()
{
// calculate the control source of the active field
- Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xGrid(getBrowserView()->getGridControl());
OSL_ENSURE(xGrid.is(), "SbaXDataBrowserController::ExecuteSearch : the control should have a css::form::XGrid interface !");
Reference< css::form::XGridPeer > xGridPeer(getBrowserView()->getGridControl()->getPeer(), UNO_QUERY);
@@ -1815,9 +1784,9 @@ void SbaXDataBrowserController::ExecuteSearch()
// prohibit the synchronization of the grid's display with the cursor's position
Reference< XPropertySet > xModelSet(getControlModel(), UNO_QUERY);
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(u"DisplayIsSynchron"_ustr, css::uno::Any(false));
+ xModelSet->setPropertyValue(u"AlwaysShowCursor"_ustr, css::uno::Any(true));
+ xModelSet->setPropertyValue(u"CursorColor"_ustr, Any(COL_LIGHTRED));
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
VclPtr<AbstractFmSearchDialog> pDialog;
@@ -1831,9 +1800,9 @@ void SbaXDataBrowserController::ExecuteSearch()
pDialog.disposeAndClear();
// restore the grid's normal operating state
- xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true));
- xModelSet->setPropertyValue("AlwaysShowCursor", css::uno::Any(false));
- xModelSet->setPropertyValue("CursorColor", Any());
+ xModelSet->setPropertyValue(u"DisplayIsSynchron"_ustr, css::uno::Any(true));
+ xModelSet->setPropertyValue(u"AlwaysShowCursor"_ustr, css::uno::Any(false));
+ xModelSet->setPropertyValue(u"CursorColor"_ustr, Any());
}
void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< PropertyValue >& _rArgs)
@@ -1859,7 +1828,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
}
catch(Exception&)
{
- SAL_WARN("dbaccess.ui", "Exception caught!");
+ TOOLS_WARN_EXCEPTION("dbaccess.ui", "" );
}
break;
case SID_FM_DELETEROWS:
@@ -1967,12 +1936,23 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow();
const OUString sOldSort = xParser->getOrder();
bool bParserSuccess = false;
- HANDLE_SQL_ERRORS(
- xParser->setOrder(OUString()); xParser->appendOrderByColumn(xField, bSortUp),
- bParserSuccess,
- DBA_RES(SBA_BROWSER_SETTING_ORDER),
- "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"
- )
+ try
+ {
+ xParser->setOrder(OUString());
+ xParser->appendOrderByColumn(xField, bSortUp);
+ bParserSuccess = true;
+ }
+ catch(SQLException& e)
+ {
+ SQLException aError = ::dbtools::prependErrorInfo(e, *this, DBA_RES(SBA_BROWSER_SETTING_ORDER));
+ css::sdb::SQLErrorEvent aEvent;
+ aEvent.Reason <<= aError;
+ errorOccured(aEvent);
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess", "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !");
+ }
if (bParserSuccess)
applyParserOrder(sOldSort,xParser);
@@ -2004,8 +1984,22 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
// -> completely overwrite it, else append one
if (!bApplied)
{
- DO_SAFE( xParser->setFilter( OUString()), "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" );
- DO_SAFE( xParser->setHavingClause(OUString()), "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" );
+ try
+ {
+ xParser->setFilter(OUString());
+ }
+ catch(Exception&)
+ {
+ SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !");
+ }
+ try
+ {
+ xParser->setHavingClause(OUString());
+ }
+ catch(Exception&)
+ {
+ SAL_WARN("dbaccess.ui", "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !");
+ }
}
bool bParserSuccess = false;
@@ -2014,21 +2008,43 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
if ( bHaving )
{
- HANDLE_SQL_ERRORS(
- xParser->appendHavingClauseByColumn(xField,true,nOp),
- bParserSuccess,
- DBA_RES(SBA_BROWSER_SETTING_FILTER),
- "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"
- )
+ try
+ {
+ bParserSuccess = false;
+ xParser->appendHavingClauseByColumn(xField,true,nOp);
+ bParserSuccess = true;
+ }
+ catch(SQLException& e)
+ {
+ SQLException aError = ::dbtools::prependErrorInfo(e, *this, DBA_RES(SBA_BROWSER_SETTING_FILTER));
+ css::sdb::SQLErrorEvent aEvent;
+ aEvent.Reason <<= aError;
+ errorOccured(aEvent);
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess", "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !");
+ }
}
else
{
- HANDLE_SQL_ERRORS(
- xParser->appendFilterByColumn(xField,true,nOp),
- bParserSuccess,
- DBA_RES(SBA_BROWSER_SETTING_FILTER),
- "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"
- )
+ try
+ {
+ bParserSuccess = false;
+ xParser->appendFilterByColumn(xField,true,nOp);
+ bParserSuccess = true;
+ }
+ catch(SQLException& e)
+ {
+ SQLException aError = ::dbtools::prependErrorInfo(e, *this, DBA_RES(SBA_BROWSER_SETTING_FILTER));
+ css::sdb::SQLErrorEvent aEvent;
+ aEvent.Reason <<= aError;
+ errorOccured(aEvent);
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess", "SbaXDataBrowserController::Execute : caught an exception while composing the new filter !");
+ }
}
if (bParserSuccess)
@@ -2059,9 +2075,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
{
@@ -2131,8 +2147,8 @@ bool SbaXDataBrowserController::SaveModified(bool bAskFor)
{
getBrowserView()->getVclControl()->GrabFocus();
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/savemodifieddialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQry(xBuilder->weld_message_dialog("SaveModifiedDialog"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), u"dbaccess/ui/savemodifieddialog.ui"_ustr));
+ std::unique_ptr<weld::MessageDialog> xQry(xBuilder->weld_message_dialog(u"SaveModifiedDialog"_ustr));
switch (xQry->run())
{
case RET_NO:
@@ -2179,16 +2195,12 @@ bool SbaXDataBrowserController::CommitCurrent()
if (!getBrowserView())
return true;
- Reference< css::awt::XControl > xActiveControl(getBrowserView()->getGridControl());
- Reference< css::form::XBoundControl > xLockingTest(xActiveControl, UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xActiveControl(getBrowserView()->getGridControl());
+ Reference< css::form::XBoundControl > xLockingTest(static_cast<cppu::OWeakObject*>(xActiveControl.get()), UNO_QUERY);
bool bControlIsLocked = xLockingTest.is() && xLockingTest->getLock();
if (xActiveControl.is() && !bControlIsLocked)
{
- // At first check Control if it supports the IFace
- Reference< css::form::XBoundComponent > xBoundControl(xActiveControl, UNO_QUERY);
- if (!xBoundControl.is())
- xBoundControl.set(xActiveControl->getModel(), UNO_QUERY);
- if (xBoundControl.is() && !xBoundControl->commit())
+ if (!xActiveControl->commit())
return false;
}
return true;
@@ -2260,7 +2272,7 @@ Reference< XPropertySet > SbaXDataBrowserController::getBoundField() const
Reference< XPropertySet > xEmptyReturn;
// get the current column from the grid
- Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xGrid(getBrowserView()->getGridControl());
if (!xGrid.is())
return xEmptyReturn;
sal_uInt16 nViewPos = xGrid->getCurrentColumnPosition();
@@ -2280,7 +2292,7 @@ Reference< XPropertySet > SbaXDataBrowserController::getBoundField() const
IMPL_LINK(SbaXDataBrowserController, OnSearchContextRequest, FmSearchContext&, rContext, sal_uInt32)
{
- Reference< css::container::XIndexAccess > xPeerContainer(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xPeerContainer(getBrowserView()->getGridControl());
// check all grid columns for their control source
Reference< css::container::XIndexAccess > xModelColumns(getFormComponent(), UNO_QUERY);
@@ -2335,9 +2347,9 @@ IMPL_LINK(SbaXDataBrowserController, OnFoundData, FmFoundRecordInformation&, rIn
// let the grid sync its display with the cursor
Reference< XPropertySet > xModelSet(getControlModel(), UNO_QUERY);
OSL_ENSURE(xModelSet.is(), "SbaXDataBrowserController::OnFoundData : no model set ?!");
- Any aOld = xModelSet->getPropertyValue("DisplayIsSynchron");
- xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true));
- xModelSet->setPropertyValue("DisplayIsSynchron", aOld);
+ Any aOld = xModelSet->getPropertyValue(u"DisplayIsSynchron"_ustr);
+ xModelSet->setPropertyValue(u"DisplayIsSynchron"_ustr, css::uno::Any(true));
+ xModelSet->setPropertyValue(u"DisplayIsSynchron"_ustr, aOld);
// and move to the field
Reference< css::container::XIndexAccess > aColumnControls(getBrowserView()->getGridControl()->getPeer(), UNO_QUERY);
@@ -2355,7 +2367,7 @@ IMPL_LINK(SbaXDataBrowserController, OnFoundData, FmFoundRecordInformation&, rIn
}
}
- Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xGrid(getBrowserView()->getGridControl());
xGrid->setCurrentColumnPosition(nViewPos); //TODO: sal_Int32 -> sal_Int16!
}
@@ -2379,9 +2391,9 @@ IMPL_LINK(SbaXDataBrowserController, OnCanceledNotFound, FmFoundRecordInformatio
// let the grid sync its display with the cursor
Reference< XPropertySet > xModelSet(getControlModel(), UNO_QUERY);
OSL_ENSURE(xModelSet.is(), "SbaXDataBrowserController::OnCanceledNotFound : no model set ?!");
- Any aOld = xModelSet->getPropertyValue("DisplayIsSynchron");
- xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true));
- xModelSet->setPropertyValue("DisplayIsSynchron", aOld);
+ Any aOld = xModelSet->getPropertyValue(u"DisplayIsSynchron"_ustr);
+ xModelSet->setPropertyValue(u"DisplayIsSynchron"_ustr, css::uno::Any(true));
+ xModelSet->setPropertyValue(u"DisplayIsSynchron"_ustr, aOld);
}
catch( const Exception& )
{
@@ -2407,7 +2419,7 @@ void SbaXDataBrowserController::LoadFinished(bool /*bWasSynch*/)
{
m_nRowSetPrivileges = 0;
- if (!(isValid() && !loadingCancelled()))
+ if (!isValid() || loadingCancelled())
return;
// obtain cached values
@@ -2540,7 +2552,7 @@ bool SbaXDataBrowserController::isValidCursor() const
sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() const
{
- Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xGrid(getBrowserView()->getGridControl());
sal_Int16 nViewPos = -1;
try
{
@@ -2553,7 +2565,7 @@ sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() const
void SbaXDataBrowserController::setCurrentColumnPosition( sal_Int16 _nPos )
{
- Reference< css::form::XGrid > xGrid(getBrowserView()->getGridControl(), UNO_QUERY);
+ rtl::Reference< SbaXGridControl > xGrid(getBrowserView()->getGridControl());
try
{
if ( -1 != _nPos )
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index 01b17fd7c544..92b265657366 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -21,9 +21,7 @@
#include <sbagrid.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/types.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/split.hxx>
-#include "dbtreeview.hxx"
#include <strings.hxx>
#include <com/sun/star/form/XLoadable.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
@@ -34,11 +32,9 @@
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;
-using namespace ::com::sun::star::lang;
namespace
{
@@ -46,7 +42,7 @@ namespace
{
bool bGrabFocus = false;
SbaGridControl* pVclControl = _pView->getVclControl();
- const Reference< css::awt::XControl >& xGrid = _pView->getGridControl();
+ const rtl::Reference< SbaXGridControl > xGrid = _pView->getGridControl();
if (pVclControl && xGrid.is())
{
bGrabFocus = true;
@@ -72,7 +68,6 @@ UnoDataBrowserView::UnoDataBrowserView( vcl::Window* pParent,
,m_pTreeView(nullptr)
,m_pSplitter(nullptr)
,m_pVclControl(nullptr)
- ,m_pStatus(nullptr)
{
}
@@ -91,10 +86,8 @@ void UnoDataBrowserView::Construct(const Reference< css::awt::XControlModel >& x
OSL_ENSURE(m_xGrid.is(), "UnoDataBrowserView::Construct : could not create a grid control !");
// in design mode (for the moment)
m_xGrid->setDesignMode(true);
-
- Reference< css::awt::XWindow > xGridWindow(m_xGrid, UNO_QUERY);
- xGridWindow->setVisible(true);
- xGridWindow->setEnable(true);
+ m_xGrid->setVisible(true);
+ m_xGrid->setEnable(true);
// introduce the model to the grid
m_xGrid->setModel(xModel);
@@ -125,8 +118,6 @@ void UnoDataBrowserView::dispose()
m_pSplitter.disposeAndClear();
setTreeView(nullptr);
- m_pStatus.disposeAndClear();
-
try
{
::comphelper::disposeComponent(m_xGrid);
@@ -134,14 +125,14 @@ void UnoDataBrowserView::dispose()
}
catch(const Exception&)
{}
- m_pTreeView.clear();
- m_pVclControl.clear();
+ m_pTreeView.reset();
+ m_pVclControl.reset();
ODataView::dispose();
}
IMPL_LINK_NOARG( UnoDataBrowserView, SplitHdl, Splitter*, void )
{
- long nYPos = m_pSplitter->GetPosPixel().Y();
+ tools::Long nYPos = m_pSplitter->GetPosPixel().Y();
m_pSplitter->SetPosPixel( Point( m_pSplitter->GetSplitPosPixel(), nYPos ) );
Resize();
}
@@ -153,12 +144,12 @@ void UnoDataBrowserView::setSplitter(Splitter* _pSplitter)
LINK( this, UnoDataBrowserView, SplitHdl ).Call(m_pSplitter);
}
-void UnoDataBrowserView::setTreeView(DBTreeView* _pTreeView)
+void UnoDataBrowserView::setTreeView(InterimDBTreeListBox* pTreeView)
{
- if (m_pTreeView.get() != _pTreeView)
+ if (m_pTreeView.get() != pTreeView)
{
m_pTreeView.disposeAndClear();
- m_pTreeView = _pTreeView;
+ m_pTreeView = pTreeView;
}
}
@@ -168,10 +159,11 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
hideStatus();
else
{
- if (!m_pStatus)
- m_pStatus = VclPtr<FixedText>::Create(this);
- m_pStatus->SetText(_rStatus);
- m_pStatus->Show();
+ if (!m_pTreeView)
+ return;
+ weld::Label& rLabel = m_pTreeView->GetStatusBar();
+ rLabel.set_label(_rStatus);
+ rLabel.show();
Resize();
PaintImmediately();
}
@@ -179,10 +171,15 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
void UnoDataBrowserView::hideStatus()
{
- if (!m_pStatus || !m_pStatus->IsVisible())
+ if (!m_pTreeView)
+ return;
+ weld::Label& rLabel = m_pTreeView->GetStatusBar();
+ if (!rLabel.get_visible())
+ {
// nothing to do
return;
- m_pStatus->Hide();
+ }
+ rLabel.hide();
Resize();
PaintImmediately();
}
@@ -212,20 +209,12 @@ void UnoDataBrowserView::resizeDocumentView(tools::Rectangle& _rPlayground)
Point aTreeViewPos( aPlaygroundPos );
Size aTreeViewSize( aSplitPos.X(), aPlaygroundSize.Height() );
- // the status pos and size
- if (m_pStatus && m_pStatus->IsVisible())
- {
- Size aStatusSize(aPlaygroundPos.X(), GetTextHeight() + 2);
- aStatusSize = LogicToPixel(aStatusSize, MapMode(MapUnit::MapAppFont));
- aStatusSize.setWidth( aTreeViewSize.Width() - 2 - 2 );
-
- Point aStatusPos( aPlaygroundPos.X() + 2, aTreeViewPos.Y() + aTreeViewSize.Height() - aStatusSize.Height() );
- m_pStatus->SetPosSizePixel( aStatusPos, aStatusSize );
- aTreeViewSize.AdjustHeight( -(aStatusSize.Height()) );
- }
-
// set the size of treelistbox
m_pTreeView->SetPosSizePixel( aTreeViewPos, aTreeViewSize );
+ // Call this to trigger InterimItemWindow::Layout immediately, and
+ // not later on idle so the statusbar will be shown to explain
+ // a long delay on opening databases
+ m_pTreeView->Resize();
//set the size of the splitter
m_pSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aPlaygroundSize.Height() ) );
@@ -233,9 +222,8 @@ void UnoDataBrowserView::resizeDocumentView(tools::Rectangle& _rPlayground)
}
// set the size of grid control
- Reference< css::awt::XWindow > xGridAsWindow(m_xGrid, UNO_QUERY);
- if (xGridAsWindow.is())
- xGridAsWindow->setPosSize( aSplitPos.X() + aSplitSize.Width(), aPlaygroundPos.Y(),
+ if (m_xGrid.is())
+ m_xGrid->setPosSize( aSplitPos.X() + aSplitSize.Width(), aPlaygroundPos.Y(),
aPlaygroundSize.Width() - aSplitSize.Width() - aSplitPos.X(), aPlaygroundSize.Height(), css::awt::PosSize::POSSIZE);
// just for completeness: there is no space left, we occupied it all ...
@@ -258,11 +246,11 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const
Reference< css::awt::XWindowPeer > xPeer = m_xGrid->getPeer();
if ( xPeer.is() )
{
- SbaXGridPeer* pPeer = comphelper::getUnoTunnelImplementation<SbaXGridPeer>(xPeer);
+ SbaXGridPeer* pPeer = dynamic_cast<SbaXGridPeer*>(xPeer.get());
UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this);
if ( pPeer )
{
- m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow().get());
+ m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow());
pTHIS->startComponentListening(VCLUnoHelper::GetInterface(m_pVclControl));
}
}
@@ -299,7 +287,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 099199bc2ae4..a06d58029e53 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -23,17 +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/fixed.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,
@@ -43,10 +40,8 @@ namespace dbaui
:Window(pParent,nStyle)
,m_xContext(_rxContext)
,m_xController( &_rController )
- ,m_aSeparator( VclPtr<FixedLine>::Create(this) )
{
m_pAccel = ::svt::AcceleratorExecute::createAcceleratorHelper();
- m_aSeparator->Show();
}
void ODataView::Construct()
@@ -61,12 +56,11 @@ namespace dbaui
void ODataView::dispose()
{
m_xController.clear();
- m_aSeparator.disposeAndClear();
m_pAccel.reset();
vcl::Window::dispose();
}
- void ODataView::resizeDocumentView( tools::Rectangle& /*_rPlayground*/ )
+ void ODataView::resizeDocumentView(tools::Rectangle& /*_rPlayground*/)
{
}
@@ -74,28 +68,21 @@ namespace dbaui
{
// draw the background
{
- rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
- rRenderContext.SetLineColor(COL_TRANSPARENT);
+ auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR);
+ rRenderContext.SetLineColor();
rRenderContext.SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
rRenderContext.DrawRect(_rRect);
- rRenderContext.Pop();
}
// let the base class do anything it needs
Window::Paint(rRenderContext, _rRect);
}
- void ODataView::resizeAll( const tools::Rectangle& _rPlayground )
+ void ODataView::resizeAll(const tools::Rectangle& rPlayground)
{
- tools::Rectangle aPlayground( _rPlayground );
-
- // position the separator
- const Size aSeparatorSize( aPlayground.GetWidth(), 2 );
- m_aSeparator->SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
- aPlayground.AdjustTop(aSeparatorSize.Height() + 1 );
-
// position the controls of the document's view
- resizeDocumentView( aPlayground );
+ tools::Rectangle aPlayground(rPlayground);
+ resizeDocumentView(aPlayground);
}
void ODataView::Resize()
@@ -108,7 +95,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();
@@ -117,9 +104,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:
@@ -131,12 +118,6 @@ namespace dbaui
{
Window::StateChanged( nType );
- if ( nType == StateChangedType::ControlBackground )
- {
- // Check if we need to get new images for normal/high contrast mode
- m_xController->notifyHiContrastChanged();
- }
-
if ( nType != StateChangedType::InitShow )
return;
@@ -149,7 +130,7 @@ namespace dbaui
if ( xModel.is() )
{
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- aArgs.remove( "Hidden" );
+ aArgs.remove( u"Hidden"_ustr );
xModel->attachResource( xModel->getURL(), aArgs.getPropertyValues() );
}
}
@@ -158,20 +139,7 @@ namespace dbaui
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
- void ODataView::DataChanged( const DataChangedEvent& rDCEvt )
- {
- Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- // Check if we need to get new images for normal/high contrast mode
- m_xController->notifyHiContrastChanged();
- }
- }
void ODataView::attachFrame(const Reference< XFrame >& _xFrame)
{
m_pAccel->init(m_xContext, _xFrame);
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index 2fe0a3b21ed5..7803001c78e9 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -21,7 +21,6 @@
#include <sot/formats.hxx>
#include <sot/storage.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/XResultSetAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <TokenWriter.hxx>
@@ -58,34 +57,45 @@ namespace dbaui
}
}
- ODataClipboard::ODataClipboard(
- const OUString& _rDatasource,
- const sal_Int32 _nCommandType,
- const OUString& _rCommand,
- const Reference< XConnection >& _rxConnection,
- const Reference< XNumberFormatter >& _rxFormatter,
- const Reference< XComponentContext >& _rxORB)
- :ODataAccessObjectTransferable( _rDatasource, _nCommandType, _rCommand, _rxConnection )
+ ODataClipboard::ODataClipboard()
{
- osl_atomic_increment( &m_refCount );
- lcl_setListener( _rxConnection, this, true );
+ }
+
+ void ODataClipboard::Update(
+ const OUString& rDatasource,
+ const sal_Int32 nCommandType,
+ const OUString& rCommand,
+ const Reference< XConnection >& rxConnection,
+ const Reference< XNumberFormatter >& rxFormatter,
+ const Reference< XComponentContext >& rxORB)
+ {
+ ClearFormats();
- m_pHtml.set( new OHTMLImportExport( getDescriptor(), _rxORB, _rxFormatter ) );
- m_pRtf.set( new ORTFImportExport( getDescriptor(), _rxORB, _rxFormatter ) );
+ ODataAccessObjectTransferable::Update(rDatasource, nCommandType, rCommand, rxConnection);
- osl_atomic_decrement( &m_refCount );
+ lcl_setListener(rxConnection, this, true);
+
+ m_pHtml.set(new OHTMLImportExport(getDescriptor(), rxORB, rxFormatter));
+ m_pRtf.set(new ORTFImportExport(getDescriptor(), rxORB, rxFormatter));
+
+ AddSupportedFormats();
}
- ODataClipboard::ODataClipboard(
- const OUString& _rDatasource,
- const sal_Int32 _nCommandType,
- const OUString& _rCommand,
- const Reference< XNumberFormatter >& _rxFormatter,
- const Reference< XComponentContext >& _rxORB)
- :ODataAccessObjectTransferable( _rDatasource, _nCommandType, _rCommand)
+ void ODataClipboard::Update(
+ const OUString& rDatasource,
+ const sal_Int32 nCommandType,
+ const OUString& rCommand,
+ const Reference< XNumberFormatter >& rxFormatter,
+ const Reference< XComponentContext >& rxORB)
{
- m_pHtml.set( new OHTMLImportExport( getDescriptor(),_rxORB, _rxFormatter ) );
- m_pRtf.set( new ORTFImportExport( getDescriptor(),_rxORB, _rxFormatter ) );
+ ClearFormats();
+
+ ODataAccessObjectTransferable::Update(rDatasource, nCommandType, rCommand);
+
+ m_pHtml.set(new OHTMLImportExport(getDescriptor(), rxORB, rxFormatter));
+ m_pRtf.set(new ORTFImportExport(getDescriptor(), rxORB, rxFormatter));
+
+ AddSupportedFormats();
}
ODataClipboard::ODataClipboard( const Reference< XPropertySet >& i_rAliveForm,
@@ -129,14 +139,14 @@ namespace dbaui
osl_atomic_decrement( &m_refCount );
}
- bool ODataClipboard::WriteObject( ::tools::SvRef<SotStorageStream>& 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 4f85ca5bc2bc..ba4e206d446c 100644
--- a/dbaccess/source/ui/browser/dbloader.cxx
+++ b/dbaccess/source/ui/browser/dbloader.cxx
@@ -26,21 +26,19 @@
#include <com/sun/star/frame/XFrameLoader.hpp>
#include <com/sun/star/frame/XLoadEventListener.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/sdb/ReportDesign.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/frame/XModule.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/processfactory.hxx>
#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;
@@ -94,7 +92,7 @@ org_openoffice_comp_dbu_DBContentLoader_get_implementation(
// XServiceInfo
OUString SAL_CALL DBContentLoader::getImplementationName()
{
- return "org.openoffice.comp.dbu.DBContentLoader";
+ return u"org.openoffice.comp.dbu.DBContentLoader"_ustr;
}
// XServiceInfo
@@ -106,7 +104,7 @@ sal_Bool SAL_CALL DBContentLoader::supportsService(const OUString& ServiceName)
// XServiceInfo
Sequence< OUString > SAL_CALL DBContentLoader::getSupportedServiceNames()
{
- return { "com.sun.star.frame.FrameLoader", "com.sun.star.sdb.ContentLoader" };
+ return { u"com.sun.star.frame.FrameLoader"_ustr, u"com.sun.star.sdb.ContentLoader"_ustr };
}
void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OUString& rURL,
@@ -116,22 +114,17 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
m_xListener = rListener;
m_aArgs = rArgs;
- static const struct ServiceNameToImplName
+ static constexpr struct ServiceNameToImplName
{
- const char* pAsciiServiceName;
- const char* pAsciiImplementationName;
- ServiceNameToImplName( const char* _pService, const char* _pImpl )
- :pAsciiServiceName( _pService )
- ,pAsciiImplementationName( _pImpl )
- {
- }
+ OUString sServiceName;
+ OUString aAsciiImplementationName;
} aImplementations[] = {
- ServiceNameToImplName( URL_COMPONENT_FORMGRIDVIEW, "org.openoffice.comp.dbu.OFormGridView" ),
- ServiceNameToImplName( URL_COMPONENT_DATASOURCEBROWSER, "org.openoffice.comp.dbu.ODatasourceBrowser" ),
- ServiceNameToImplName( URL_COMPONENT_QUERYDESIGN, "org.openoffice.comp.dbu.OQueryDesign" ),
- ServiceNameToImplName( URL_COMPONENT_TABLEDESIGN, "org.openoffice.comp.dbu.OTableDesign" ),
- ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN, "org.openoffice.comp.dbu.ORelationDesign" ),
- ServiceNameToImplName( URL_COMPONENT_VIEWDESIGN, "org.openoffice.comp.dbu.OViewDesign" )
+ { URL_COMPONENT_FORMGRIDVIEW, u"org.openoffice.comp.dbu.OFormGridView"_ustr },
+ { URL_COMPONENT_DATASOURCEBROWSER, u"org.openoffice.comp.dbu.ODatasourceBrowser"_ustr },
+ { URL_COMPONENT_QUERYDESIGN, u"org.openoffice.comp.dbu.OQueryDesign"_ustr },
+ { URL_COMPONENT_TABLEDESIGN, u"org.openoffice.comp.dbu.OTableDesign"_ustr },
+ { URL_COMPONENT_RELATIONDESIGN, u"org.openoffice.comp.dbu.ORelationDesign"_ustr },
+ { URL_COMPONENT_VIEWDESIGN, u"org.openoffice.comp.dbu.OViewDesign"_ustr }
};
INetURLObject aParser( rURL );
@@ -140,10 +133,10 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
const OUString sComponentURL( aParser.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ) );
for (const ServiceNameToImplName& aImplementation : aImplementations)
{
- if ( sComponentURL.equalsAscii( aImplementation.pAsciiServiceName ) )
+ if ( sComponentURL == aImplementation.sServiceName )
{
xController.set( m_xContext->getServiceManager()->
- createInstanceWithContext( OUString::createFromAscii( aImplementation.pAsciiImplementationName ), m_xContext), UNO_QUERY_THROW );
+ createInstanceWithContext( aImplementation.aAsciiImplementationName, m_xContext), UNO_QUERY_THROW );
break;
}
}
@@ -155,7 +148,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
if ( sComponentURL == URL_COMPONENT_DATASOURCEBROWSER )
{
- bool bDisableBrowser = !aLoadArgs.getOrDefault( "ShowTreeViewButton", true ) // compatibility name
+ bool bDisableBrowser = !aLoadArgs.getOrDefault( u"ShowTreeViewButton"_ustr, true ) // compatibility name
|| !aLoadArgs.getOrDefault( PROPERTY_ENABLE_BROWSER, true );
if ( bDisableBrowser )
@@ -163,7 +156,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
try
{
Reference< XModule > xModule( xController, UNO_QUERY_THROW );
- xModule->setIdentifier( "com.sun.star.sdb.TableDataView" );
+ xModule->setIdentifier( u"com.sun.star.sdb.TableDataView"_ustr );
}
catch( const Exception& )
{
@@ -174,20 +167,18 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
if ( sComponentURL == URL_COMPONENT_REPORTDESIGN )
{
- bool bPreview = aLoadArgs.getOrDefault( "Preview", false );
+ bool bPreview = aLoadArgs.getOrDefault( u"Preview"_ustr, false );
if ( bPreview )
{ // report designs cannot be previewed
if ( rListener.is() )
rListener->loadCancelled( this );
return;
}
- Reference< XModel > xReportModel( aLoadArgs.getOrDefault( "Model", Reference< XModel >() ) );
+ Reference< XModel > xReportModel( aLoadArgs.getOrDefault( u"Model"_ustr, Reference< XModel >() ) );
if ( xReportModel.is() )
{
xController.set( ReportDesign::create( m_xContext ) );
- xController->attachModel( xReportModel );
- xReportModel->connectController( xController.get() );
- xReportModel->setCurrentController( xController.get() );
+ utl::ConnectModelController(xReportModel, xController);
}
}
@@ -195,9 +186,9 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
Reference< XModel > xDatabaseDocument;
if ( bSuccess )
{
- Reference< XDataSource > xDataSource ( aLoadArgs.getOrDefault( "DataSource", Reference< XDataSource >() ) );
- OUString sDataSourceName( aLoadArgs.getOrDefault( "DataSourceName", OUString() ) );
- Reference< XConnection > xConnection ( aLoadArgs.getOrDefault( "ActiveConnection", Reference< XConnection >() ) );
+ Reference< XDataSource > xDataSource ( aLoadArgs.getOrDefault( u"DataSource"_ustr, Reference< XDataSource >() ) );
+ OUString sDataSourceName( aLoadArgs.getOrDefault( u"DataSourceName"_ustr, OUString() ) );
+ Reference< XConnection > xConnection ( aLoadArgs.getOrDefault( u"ActiveConnection"_ustr, Reference< XConnection >() ) );
if ( xDataSource.is() )
{
xDatabaseDocument.set( getDataSourceOrModel( xDataSource ), UNO_QUERY );
@@ -224,17 +215,13 @@ 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(u"Frame"_ustr,0,Any(rFrame),PropertyState_DIRECT_VALUE);
Sequence< Any > aInitArgs(m_aArgs.getLength()+1);
Any* pBegin = aInitArgs.getArray();
- Any* pEnd = pBegin + aInitArgs.getLength();
*pBegin <<= aFrame;
- const PropertyValue* pIter = m_aArgs.getConstArray();
- for(++pBegin;pBegin != pEnd;++pBegin,++pIter)
- {
- *pBegin <<= *pIter;
- }
+ std::transform(m_aArgs.begin(), m_aArgs.end(), ++pBegin,
+ [](auto& val) { return Any(val); });
xIni->initialize(aInitArgs);
}
@@ -258,7 +245,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
{
if ( xController.is() && rFrame.is() )
{
- rFrame->setComponent( xController->getComponentWindow(), xController.get() );
+ rFrame->setComponent( xController->getComponentWindow(), xController );
xController->attachFrame(rFrame);
}
diff --git a/dbaccess/source/ui/browser/dbtreemodel.hxx b/dbaccess/source/ui/browser/dbtreemodel.hxx
index 42887fd00e3d..55b1a3cffcc9 100644
--- a/dbaccess/source/ui/browser/dbtreemodel.hxx
+++ b/dbaccess/source/ui/browser/dbtreemodel.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_BROWSER_DBTREEMODEL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_BROWSER_DBTREEMODEL_HXX
+#pragma once
#include <unodatbr.hxx>
#include <commontypes.hxx>
@@ -30,11 +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
{
struct DBTreeListUserData
@@ -55,6 +49,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_BROWSER_DBTREEMODEL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx
deleted file mode 100644
index 38464068bbb7..000000000000
--- a/dbaccess/source/ui/browser/dbtreeview.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "dbtreeview.hxx"
-#include <vcl/treelistbox.hxx>
-#include <dbtreelistbox.hxx>
-#include <helpids.h>
-
-namespace dbaui
-{
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
- : Window( pParent, nBits )
- , m_pTreeListBox(nullptr)
-{
-
- m_pTreeListBox = VclPtr<DBTreeListBox>::Create(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
- m_pTreeListBox->EnableCheckButton(nullptr);
- m_pTreeListBox->SetDragDropMode( DragDropMode::NONE );
- m_pTreeListBox->EnableInplaceEditing( true );
- m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
- m_pTreeListBox->Show();
-}
-
-DBTreeView::~DBTreeView()
-{
- disposeOnce();
-}
-
-void DBTreeView::dispose()
-{
- m_pTreeListBox.disposeAndClear();
- vcl::Window::dispose();
-}
-
-SvTreeList* DBTreeView::GetTreeModel()
-{
- return m_pTreeListBox->GetModel();
-}
-
-void DBTreeView::SetPreExpandHandler(const Link<SvTreeListEntry*,bool>& _rHdl)
-{
- m_pTreeListBox->SetPreExpandHandler(_rHdl);
-}
-
-void DBTreeView::setCopyHandler(const Link<LinkParamNone*,void>& _rHdl)
-{
- m_pTreeListBox->setCopyHandler(_rHdl);
-}
-
-void DBTreeView::Resize()
-{
- Window::Resize();
- m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
-}
-
-void DBTreeView::setSelChangeHdl( const Link<LinkParamNone*,void>& _rHdl )
-{
- m_pTreeListBox->SetSelChangeHdl( _rHdl );
-}
-
-void DBTreeView::GetFocus()
-{
- Window::GetFocus();
- if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
- m_pTreeListBox->GrabFocus();
-}
-
-} // namespace dbaui
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/browser/dbtreeview.hxx b/dbaccess/source/ui/browser/dbtreeview.hxx
deleted file mode 100644
index 892a6beab394..000000000000
--- a/dbaccess/source/ui/browser/dbtreeview.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_BROWSER_DBTREEVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_BROWSER_DBTREEVIEW_HXX
-
-#include <vcl/window.hxx>
-
-class SvTreeList;
-class SvTreeListEntry;
-
-namespace dbaui
-{
- class DBTreeListBox;
- // - DBTreeView -
-
- class DBTreeView : public vcl::Window
- {
- private:
- VclPtr<DBTreeListBox> m_pTreeListBox;
- protected:
- // window overridables
- virtual void Resize() override;
- public:
-
- DBTreeView( vcl::Window* pParent,
- WinBits nBits );
- virtual ~DBTreeView() override;
- virtual void dispose() override;
-
- /** sets a handler which is called when a list box entry is to be expanded.
- <p>When calling the link, the parameter is an SvTreeListEntry marking the entry to be expanded.
- </p>
- */
- void SetPreExpandHandler(const Link<SvTreeListEntry*,bool>& _rHdl);
-
- void setCopyHandler(const Link<LinkParamNone*,void>& _rHdl);
-
- SvTreeList* GetTreeModel();
- void setSelChangeHdl(const Link<LinkParamNone*,void>& _rHdl);
-
- DBTreeListBox& getListBox() const { return *m_pTreeListBox; }
-
- virtual void GetFocus() override;
- };
-}
-
-#endif // INCLUDED_DBACCESS_SOURCE_UI_BROWSER_DBTREEVIEW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 7e9bfc851360..f2c4dc949c64 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -23,24 +23,18 @@
#include <unodatbr.hxx>
#include <browserids.hxx>
-#include <listviewitems.hxx>
-#include <imageprovider.hxx>
#include <osl/diagnose.h>
-#include "dbtreeview.hxx"
#include <dbtreelistbox.hxx>
#include "dbtreemodel.hxx"
-#include <vcl/treelistentry.hxx>
using namespace ::com::sun::star::frame;
-using namespace ::dbtools;
-using namespace ::svx;
namespace dbaui
{
-SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getChildType( SvTreeListEntry const * _pEntry ) const
+SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getChildType(const weld::TreeIter& rEntry) const
{
- OSL_ENSURE(isContainer(_pEntry), "SbaTableQueryBrowser::getChildType: invalid entry!");
- switch (getEntryType(_pEntry))
+ OSL_ENSURE(isContainer(rEntry), "SbaTableQueryBrowser::getChildType: invalid entry!");
+ switch (getEntryType(rEntry))
{
case etTableContainer:
return etTableOrView;
@@ -52,88 +46,48 @@ SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getChildType( SvTreeListEn
return etUnknown;
}
-OUString SbaTableQueryBrowser::GetEntryText( SvTreeListEntry* _pEntry ) const
+OUString SbaTableQueryBrowser::GetEntryText(const weld::TreeIter& rEntry) const
{
- return m_pTreeView->getListBox().GetEntryText(_pEntry);
+ return m_pTreeView->GetWidget().get_text(rEntry);
}
-SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType( const SvTreeListEntry* _pEntry ) const
+SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType(const weld::TreeIter& rEntry) const
{
- if (!_pEntry)
- return etUnknown;
-
- SvTreeListEntry* pRootEntry = m_pTreeView->getListBox().GetRootLevelParent(const_cast<SvTreeListEntry*>(_pEntry));
- SvTreeListEntry* pEntryParent = m_pTreeView->getListBox().GetParent(const_cast<SvTreeListEntry*>(_pEntry));
- SvTreeListEntry* pTables = m_pTreeView->getListBox().GetEntry(pRootEntry, CONTAINER_TABLES);
- SvTreeListEntry* pQueries = m_pTreeView->getListBox().GetEntry(pRootEntry, CONTAINER_QUERIES);
-
-#ifdef DBG_UTIL
- OUString sTest;
- if (pTables) sTest = m_pTreeView->getListBox().GetEntryText(pTables);
- if (pQueries) sTest = m_pTreeView->getListBox().GetEntryText(pQueries);
-#endif
-
- if (pRootEntry == _pEntry)
- return etDatasource;
-
- if (pTables == _pEntry)
- return etTableContainer;
-
- if (pQueries == _pEntry)
- return etQueryContainer;
-
- if (pTables == pEntryParent)
- return etTableOrView;
-
- if (pQueries == pEntryParent)
- {
- DBTreeListUserData* pEntryData = static_cast<DBTreeListUserData*>(_pEntry->GetUserData());
- if ( pEntryData )
- return pEntryData->eType;
-
- return etQuery;
- }
- while( pEntryParent != pQueries )
- {
- pEntryParent = m_pTreeView->getListBox().GetParent(pEntryParent);
- if ( !pEntryParent )
- return etUnknown;
- }
-
- return etQueryContainer;
+ const weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
+ return pEntryData ? pEntryData->eType : etUnknown;
}
-void SbaTableQueryBrowser::select(SvTreeListEntry* _pEntry, bool _bSelect)
+void SbaTableQueryBrowser::select(const weld::TreeIter* pEntry, bool bSelect)
{
- SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SvLBoxItemType::String) : nullptr;
- if (pTextItem)
+ if (pEntry)
{
- static_cast<OBoldListboxString*>(pTextItem)->emphasize(_bSelect);
- m_pTreeView->GetTreeModel()->InvalidateEntry(_pEntry);
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ rTreeView.set_text_emphasis(*pEntry, bSelect, 0);
}
- else {
+ else
+ {
OSL_FAIL("SbaTableQueryBrowser::select: invalid entry!");
}
}
-void SbaTableQueryBrowser::selectPath(SvTreeListEntry* _pEntry, bool _bSelect)
+void SbaTableQueryBrowser::selectPath(const weld::TreeIter* pEntry, bool bSelect)
{
- while (_pEntry)
+ if (!pEntry)
+ return;
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator(pEntry));
+ do
{
- select(_pEntry, _bSelect);
- _pEntry = m_pTreeView->GetTreeModel()->GetParent(_pEntry);
+ select(xEntry.get(), bSelect);
}
+ while (rTreeView.iter_parent(*xEntry));
}
-bool SbaTableQueryBrowser::isSelected(SvTreeListEntry* _pEntry)
+bool SbaTableQueryBrowser::isSelected(const weld::TreeIter& rEntry) const
{
- SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SvLBoxItemType::String) : nullptr;
- if (pTextItem)
- return static_cast<OBoldListboxString*>(pTextItem)->isEmphasized();
- else {
- OSL_FAIL("SbaTableQueryBrowser::isSelected: invalid entry!");
- }
- return false;
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ return rTreeView.get_text_emphasis(rEntry, 0);
}
void SbaTableQueryBrowser::SelectionChanged()
@@ -152,28 +106,28 @@ void SbaTableQueryBrowser::describeSupportedFeatures()
{
SbaXDataBrowserController::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:Title", ID_BROWSER_TITLE );
+ implDescribeSupportedFeature( u".uno:Title"_ustr, ID_BROWSER_TITLE );
if ( !m_bShowMenu )
{
- implDescribeSupportedFeature( ".uno:DSBEditDB", ID_TREE_EDIT_DATABASE );
- implDescribeSupportedFeature( ".uno:DSBCloseConnection", ID_TREE_CLOSE_CONN );
- implDescribeSupportedFeature( ".uno:DSBAdministrate", ID_TREE_ADMINISTRATE );
+ implDescribeSupportedFeature( u".uno:DSBEditDB"_ustr, ID_TREE_EDIT_DATABASE );
+ implDescribeSupportedFeature( u".uno:DSBCloseConnection"_ustr, ID_TREE_CLOSE_CONN );
+ implDescribeSupportedFeature( u".uno:DSBAdministrate"_ustr, ID_TREE_ADMINISTRATE );
- implDescribeSupportedFeature( ".uno:DSBrowserExplorer", ID_BROWSER_EXPLORER, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DSBrowserExplorer"_ustr, ID_BROWSER_EXPLORER, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DSBFormLetter", ID_BROWSER_FORMLETTER, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DSBInsertColumns", ID_BROWSER_INSERTCOLUMNS, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DSBInsertContent", ID_BROWSER_INSERTCONTENT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DSBDocumentDataSource", ID_BROWSER_DOCUMENT_DATASOURCE, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DSBFormLetter"_ustr, ID_BROWSER_FORMLETTER, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:DSBInsertColumns"_ustr, ID_BROWSER_INSERTCOLUMNS, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DSBInsertContent"_ustr, ID_BROWSER_INSERTCONTENT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( u".uno:DSBDocumentDataSource"_ustr, ID_BROWSER_DOCUMENT_DATASOURCE, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DataSourceBrowser/FormLetter", ID_BROWSER_FORMLETTER );
- implDescribeSupportedFeature( ".uno:DataSourceBrowser/InsertColumns", ID_BROWSER_INSERTCOLUMNS );
- implDescribeSupportedFeature( ".uno:DataSourceBrowser/InsertContent", ID_BROWSER_INSERTCONTENT );
- implDescribeSupportedFeature( ".uno:DataSourceBrowser/DocumentDataSource", ID_BROWSER_DOCUMENT_DATASOURCE );
+ implDescribeSupportedFeature( u".uno:DataSourceBrowser/FormLetter"_ustr, ID_BROWSER_FORMLETTER );
+ implDescribeSupportedFeature( u".uno:DataSourceBrowser/InsertColumns"_ustr, ID_BROWSER_INSERTCOLUMNS );
+ implDescribeSupportedFeature( u".uno:DataSourceBrowser/InsertContent"_ustr, ID_BROWSER_INSERTCONTENT );
+ implDescribeSupportedFeature( u".uno:DataSourceBrowser/DocumentDataSource"_ustr, ID_BROWSER_DOCUMENT_DATASOURCE );
}
- implDescribeSupportedFeature( ".uno:CloseWin", ID_BROWSER_CLOSE, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBRebuildData", ID_BROWSER_REFRESH_REBUILD, CommandGroup::DATA );
+ implDescribeSupportedFeature( u".uno:CloseWin"_ustr, ID_BROWSER_CLOSE, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:DBRebuildData"_ustr, ID_BROWSER_REFRESH_REBUILD, CommandGroup::DATA );
}
sal_Int32 SbaTableQueryBrowser::getDatabaseObjectType( EntryType _eType )
@@ -193,64 +147,6 @@ sal_Int32 SbaTableQueryBrowser::getDatabaseObjectType( EntryType _eType )
return css::sdb::application::DatabaseObject::TABLE;
}
-void SbaTableQueryBrowser::notifyHiContrastChanged()
-{
- if ( !m_pTreeView )
- return;
-
- auto pTreeModel = m_pTreeView->GetTreeModel();
- // change all bitmap entries
- SvTreeListEntry* pEntryLoop = pTreeModel->First();
- while ( pEntryLoop )
- {
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pEntryLoop->GetUserData());
- if ( !pData )
- {
- pEntryLoop = pTreeModel->Next(pEntryLoop);
- continue;
- }
-
- // the connection to which this entry belongs, if any
- std::unique_ptr< ImageProvider > pImageProvider( getImageProviderFor( pEntryLoop ) );
-
- // the images for this entry
- Image aImage;
- if ( pData->eType == etDatasource )
- aImage = ImageProvider::getDatabaseImage();
- else
- {
- bool bIsFolder = !isObject( pData->eType );
- if ( bIsFolder )
- {
- sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
- aImage = ImageProvider::getFolderImage( nObjectType );
- }
- else
- {
- sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
- pImageProvider->getImages( GetEntryText( pEntryLoop ), nObjectType, aImage );
- }
- }
-
- // find the proper item, and set its icons
- sal_uInt16 nCount = pEntryLoop->ItemCount();
- for (sal_uInt16 i=0;i<nCount;++i)
- {
- SvLBoxItem& rItem = pEntryLoop->GetItem(i);
- if (rItem.GetType() != SvLBoxItemType::ContextBmp)
- continue;
-
- SvLBoxContextBmp& rContextBitmapItem = static_cast< SvLBoxContextBmp& >( rItem );
-
- rContextBitmapItem.SetBitmap1( aImage );
- rContextBitmapItem.SetBitmap2( aImage );
- break;
- }
-
- pEntryLoop = pTreeModel->Next(pEntryLoop);
- }
-}
-
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
index cd8c124f059a..dfc04e2d991c 100644
--- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx
+++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
@@ -20,7 +20,6 @@
#include <dbexchange.hxx>
#include <dbtreelistbox.hxx>
#include "dbtreemodel.hxx"
-#include "dbtreeview.hxx"
#include <UITools.hxx>
#include <unodatbr.hxx>
@@ -29,12 +28,10 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include <connectivity/dbexception.hxx>
-#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/treelistentry.hxx>
#include <vcl/svapp.hxx>
#include <algorithm>
@@ -45,40 +42,32 @@ 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;
- TransferableHelper* SbaTableQueryBrowser::implCopyObject( SvTreeListEntry* _pApplyTo, sal_Int32 _nCommandType )
+ bool SbaTableQueryBrowser::implCopyObject(ODataClipboard& rExchange, const weld::TreeIter& rApplyTo, sal_Int32 nCommandType)
{
try
{
- OUString aName = GetEntryText( _pApplyTo );
- OUString aDSName = getDataSourceAccessor( m_pTreeView->getListBox().GetRootLevelParent( _pApplyTo ) );
+ OUString aName = GetEntryText(rApplyTo);
+ std::unique_ptr<weld::TreeIter> xRootEntry(m_pTreeView->GetRootLevelParent(&rApplyTo));
+ OUString aDSName = getDataSourceAccessor(*xRootEntry);
- ODataClipboard* pData = nullptr;
SharedConnection xConnection;
- if ( CommandType::QUERY != _nCommandType )
+ if ( CommandType::QUERY != nCommandType )
{
- if ( !ensureConnection( _pApplyTo, xConnection) )
- return nullptr;
- pData = new ODataClipboard(aDSName, _nCommandType, aName, xConnection, getNumberFormatter(), getORB());
+ if (!ensureConnection(&rApplyTo, xConnection))
+ return false;
+ rExchange.Update(aDSName, nCommandType, aName, xConnection, getNumberFormatter(), getORB());
}
else
- pData = new ODataClipboard(aDSName, _nCommandType, aName, getNumberFormatter(), getORB());
+ rExchange.Update(aDSName, nCommandType, aName, getNumberFormatter(), getORB());
// the ownership goes to ODataClipboards
- return pData;
+ return true;
}
catch(const SQLException& )
{
@@ -88,19 +77,21 @@ namespace dbaui
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- return nullptr;
+ return false;
}
+
sal_Int8 SbaTableQueryBrowser::queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors )
{
// check if we're a table or query container
- SvTreeListEntry* pHitEntry = m_pTreeView->getListBox().GetEntry( _rEvt.maPosPixel );
-
- if ( pHitEntry ) // no drop if no entry was hit...
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xHitEntry(rTreeView.make_iterator());
+ // get_dest_row_at_pos with false cause no drop if no entry was hit exactly
+ if (rTreeView.get_dest_row_at_pos(_rEvt.maPosPixel, xHitEntry.get(), false))
{
// it must be a container
- EntryType eEntryType = getEntryType( pHitEntry );
+ EntryType eEntryType = getEntryType(*xHitEntry);
SharedConnection xConnection;
- if ( eEntryType == etTableContainer && ensureConnection( pHitEntry, xConnection ) && xConnection.is() )
+ if ( eEntryType == etTableContainer && ensureConnection(xHitEntry.get(), xConnection ) && xConnection.is())
{
Reference<XChild> xChild(xConnection,UNO_QUERY);
Reference<XStorable> xStore;
@@ -116,8 +107,12 @@ namespace dbaui
}
sal_Int8 SbaTableQueryBrowser::executeDrop( const ExecuteDropEvent& _rEvt )
{
- SvTreeListEntry* pHitEntry = m_pTreeView->getListBox().GetEntry( _rEvt.maPosPixel );
- EntryType eEntryType = getEntryType( pHitEntry );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xHitEntry(rTreeView.make_iterator());
+ // get_dest_row_at_pos with false cause no drop if no entry was hit exactly
+ if (!rTreeView.get_dest_row_at_pos(_rEvt.maPosPixel, xHitEntry.get(), false))
+ return DND_ACTION_NONE;
+ EntryType eEntryType = getEntryType(*xHitEntry);
if (!isContainer(eEntryType))
{
OSL_FAIL("SbaTableQueryBrowser::executeDrop: what the hell did queryDrop do?");
@@ -137,7 +132,7 @@ namespace dbaui
m_aAsyncDrop.nAction = _rEvt.mnAction;
m_aAsyncDrop.bError = false;
m_aAsyncDrop.bHtml = false;
- m_aAsyncDrop.pDroppedAt = nullptr;
+ m_aAsyncDrop.xDroppedAt.reset();
m_aAsyncDrop.aUrl.clear();
// loop through the available formats and see what we can do ...
@@ -145,7 +140,7 @@ namespace dbaui
if ( ODataAccessObjectTransferable::canExtractObjectDescriptor(aDroppedData.GetDataFlavorExVector()) )
{
m_aAsyncDrop.aDroppedData = ODataAccessObjectTransferable::extractObjectDescriptor(aDroppedData);
- m_aAsyncDrop.pDroppedAt = pHitEntry;
+ m_aAsyncDrop.xDroppedAt = std::move(xHitEntry);
// asynchron because we some dialogs and we aren't allowed to show them while in D&D
m_nAsyncDrop = Application::PostUserEvent(LINK(this, SbaTableQueryBrowser, OnAsyncDrop));
@@ -154,12 +149,12 @@ namespace dbaui
else
{
SharedConnection xDestConnection;
- if ( ensureConnection( pHitEntry, xDestConnection )
+ if ( ensureConnection( xHitEntry.get(), xDestConnection )
&& xDestConnection.is()
&& m_aTableCopyHelper.copyTagTable( aDroppedData, m_aAsyncDrop, xDestConnection )
)
{
- m_aAsyncDrop.pDroppedAt = pHitEntry;
+ m_aAsyncDrop.xDroppedAt = std::move(xHitEntry);
// asynchron because we some dialogs and we aren't allowed to show them while in D&D
m_nAsyncDrop = Application::PostUserEvent(LINK(this, SbaTableQueryBrowser, OnAsyncDrop));
@@ -170,48 +165,39 @@ namespace dbaui
return DND_ACTION_NONE;
}
- bool SbaTableQueryBrowser::requestDrag( const Point& _rPosPixel )
+ bool SbaTableQueryBrowser::requestDrag(const weld::TreeIter& rEntry)
{
- // get the affected list entry
- // ensure that the entry which the user clicked at is selected
- SvTreeListEntry* pHitEntry = m_pTreeView->getListBox().GetEntry( _rPosPixel );
- if (!pHitEntry)
- // no drag of no entry was hit...
- return false;
-
// it must be a query/table
- EntryType eEntryType = getEntryType( pHitEntry );
+ EntryType eEntryType = getEntryType(rEntry);
if (!isObject(eEntryType))
return false;
- rtl::Reference<TransferableHelper> pTransfer = implCopyObject( pHitEntry, ( etTableOrView == eEntryType ) ? CommandType::TABLE : CommandType::QUERY);
-
- if (pTransfer)
- pTransfer->StartDrag( &m_pTreeView->getListBox(), DND_ACTION_COPY );
-
- return pTransfer.is();
+ ODataClipboard& rExchange = static_cast<ODataClipboard&>(m_pTreeView->GetDataTransfer());
+ return implCopyObject(rExchange, rEntry, (etTableOrView == eEntryType) ? CommandType::TABLE : CommandType::QUERY);
}
+
IMPL_LINK_NOARG(SbaTableQueryBrowser, OnCopyEntry, LinkParamNone*, void)
{
- SvTreeListEntry* pSelected = m_pTreeView->getListBox().FirstSelected();
- if( isEntryCopyAllowed( pSelected ) )
- copyEntry( pSelected );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xSelected = rTreeView.make_iterator();
+ if (rTreeView.get_selected(xSelected.get()) && isEntryCopyAllowed(*xSelected))
+ copyEntry(*xSelected);
}
- bool SbaTableQueryBrowser::isEntryCopyAllowed(SvTreeListEntry const * _pEntry) const
+
+ bool SbaTableQueryBrowser::isEntryCopyAllowed(const weld::TreeIter& rEntry) const
{
- EntryType eType = getEntryType(_pEntry);
+ EntryType eType = getEntryType(rEntry);
return ( eType == etTableOrView || eType == etQuery );
}
- void SbaTableQueryBrowser::copyEntry(SvTreeListEntry* _pEntry)
+
+ void SbaTableQueryBrowser::copyEntry(const weld::TreeIter& rEntry)
{
- TransferableHelper* pTransfer = nullptr;
- Reference< XTransferable> aEnsureDelete;
- EntryType eType = getEntryType(_pEntry);
- pTransfer = implCopyObject( _pEntry, eType == etQuery ? CommandType::QUERY : CommandType::TABLE);
- aEnsureDelete = pTransfer;
- if (pTransfer)
- pTransfer->CopyToClipboard(getView());
+ EntryType eType = getEntryType(rEntry);
+ rtl::Reference<ODataClipboard> xTransfer(new ODataClipboard);
+ if (implCopyObject(*xTransfer, rEntry, eType == etQuery ? CommandType::QUERY : CommandType::TABLE))
+ xTransfer->CopyToClipboard(getView());
}
+
IMPL_LINK_NOARG( SbaTableQueryBrowser, OnAsyncDrop, void*, void )
{
m_nAsyncDrop = nullptr;
@@ -221,45 +207,42 @@ namespace dbaui
if ( m_aAsyncDrop.nType == E_TABLE )
{
SharedConnection xDestConnection;
- if ( ensureConnection( m_aAsyncDrop.pDroppedAt, xDestConnection ) && xDestConnection.is() )
+ if ( ensureConnection(m_aAsyncDrop.xDroppedAt.get(), xDestConnection) && xDestConnection.is())
{
- SvTreeListEntry* pDataSourceEntry = m_pTreeView->getListBox().GetRootLevelParent(m_aAsyncDrop.pDroppedAt);
- m_aTableCopyHelper.asyncCopyTagTable( m_aAsyncDrop, getDataSourceAccessor( pDataSourceEntry ), xDestConnection );
+ std::unique_ptr<weld::TreeIter> xDataSourceEntry =
+ m_pTreeView->GetRootLevelParent(m_aAsyncDrop.xDroppedAt.get());
+ m_aTableCopyHelper.asyncCopyTagTable(m_aAsyncDrop, getDataSourceAccessor(*xDataSourceEntry), xDestConnection);
}
}
m_aAsyncDrop.aDroppedData.clear();
}
+
void SbaTableQueryBrowser::clearTreeModel()
{
- if (m_pTreeView)
- {
- auto pTreeModel = m_pTreeView->GetTreeModel();
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ rTreeView.all_foreach([this, &rTreeView](weld::TreeIter& rEntryLoop){
// clear the user data of the tree model
- SvTreeListEntry* pEntryLoop = pTreeModel->First();
- while (pEntryLoop)
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntryLoop));
+ if (pData)
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pEntryLoop->GetUserData());
- if(pData)
- {
- pEntryLoop->SetUserData(nullptr);
- Reference< XContainer > xContainer(pData->xContainer, UNO_QUERY);
- if (xContainer.is())
- xContainer->removeContainerListener(this);
-
- if ( pData->xConnection.is() )
- {
- OSL_ENSURE( impl_isDataSourceEntry( pEntryLoop ), "SbaTableQueryBrowser::clearTreeModel: no data source entry, but a connection?" );
- // connections are to be stored *only* at the data source entries
- impl_releaseConnection( pData->xConnection );
- }
+ rTreeView.set_id(rEntryLoop, OUString());
+ Reference<XContainer> xContainer(pData->xContainer, UNO_QUERY);
+ if (xContainer.is())
+ xContainer->removeContainerListener(this);
- delete pData;
+ if (pData->xConnection.is())
+ {
+ // connections are to be stored *only* at the data source entries
+ impl_releaseConnection(pData->xConnection);
}
- pEntryLoop = pTreeModel->Next(pEntryLoop);
+
+ delete pData;
}
- }
- m_pCurrentlyDisplayed = nullptr;
+ return false;
+ });
+
+ m_xCurrentlyDisplayed.reset();
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 966ab8b90859..ffcf40e3c91d 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -23,14 +23,12 @@
#include <com/sun/star/form/XLoadable.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <formadapter.hxx>
-#include <comphelper/processfactory.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;
@@ -62,7 +60,6 @@ Any SAL_CALL SbaExternalSourceBrowser::queryInterface(const Type& _rType)
SbaExternalSourceBrowser::SbaExternalSourceBrowser(const Reference< css::uno::XComponentContext >& _rM)
:SbaXDataBrowserController(_rM)
,m_aModifyListeners(getMutex())
- ,m_pDataSourceImpl(nullptr)
,m_bInQueryDispatch( false )
{
@@ -74,12 +71,12 @@ SbaExternalSourceBrowser::~SbaExternalSourceBrowser()
css::uno::Sequence<OUString> SAL_CALL SbaExternalSourceBrowser::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.FormGridView" };
+ return { u"com.sun.star.sdb.FormGridView"_ustr };
}
OUString SAL_CALL SbaExternalSourceBrowser::getImplementationName()
{
- return "org.openoffice.comp.dbu.OFormGridView";
+ return u"org.openoffice.comp.dbu.OFormGridView"_ustr;
}
Reference< XRowSet > SbaExternalSourceBrowser::CreateForm()
@@ -106,9 +103,7 @@ void SbaExternalSourceBrowser::modified(const css::lang::EventObject& aEvent)
// multiplex this event to all my listeners
css::lang::EventObject aEvt(*this);
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aModifyListeners);
- while (aIt.hasMoreElements())
- static_cast< css::util::XModifyListener*>(aIt.next())->modified(aEvt);
+ m_aModifyListeners.notifyEach( &css::util::XModifyListener::modified, aEvt );
}
void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, const Sequence< css::beans::PropertyValue>& aArgs)
@@ -162,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
{
@@ -185,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 9620d5840a34..cd1271f5d438 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -59,43 +59,45 @@ SbaXFormAdapter::~SbaXFormAdapter()
}
-Sequence< Type > SAL_CALL SbaXFormAdapter::getTypes( )
-{
- return ::comphelper::concatSequences(
- SbaXFormAdapter_BASE1::getTypes(),
- SbaXFormAdapter_BASE2::getTypes(),
- SbaXFormAdapter_BASE3::getTypes()
- );
-}
-
-Sequence< sal_Int8 > SAL_CALL SbaXFormAdapter::getImplementationId( )
-{
- return css::uno::Sequence<sal_Int8>();
-}
-
-Any SAL_CALL SbaXFormAdapter::queryInterface(const Type& _rType)
-{
- Any aReturn = SbaXFormAdapter_BASE1::queryInterface( _rType );
-
- if (!aReturn.hasValue())
- aReturn = SbaXFormAdapter_BASE2::queryInterface( _rType );
-
- if (!aReturn.hasValue())
- aReturn = SbaXFormAdapter_BASE3::queryInterface( _rType );
-
- return aReturn;
-}
-
void SbaXFormAdapter::StopListening()
{
// log off all our multiplexers
- STOP_MULTIPLEXER_LISTENING(LoadListener, m_aLoadListeners, css::form::XLoadable, m_xMainForm);
- STOP_MULTIPLEXER_LISTENING(RowSetListener, m_aRowSetListeners, css::sdbc::XRowSet, m_xMainForm);
- STOP_MULTIPLEXER_LISTENING(RowSetApproveListener, m_aRowSetApproveListeners, css::sdb::XRowSetApproveBroadcaster, m_xMainForm);
- STOP_MULTIPLEXER_LISTENING(SQLErrorListener, m_aErrorListeners, css::sdb::XSQLErrorBroadcaster, m_xMainForm);
- STOP_MULTIPLEXER_LISTENING(SubmitListener, m_aSubmitListeners, css::form::XSubmit, m_xMainForm);
- STOP_MULTIPLEXER_LISTENING(ResetListener, m_aResetListeners, css::form::XReset, m_xMainForm);
-
+ if (m_aLoadListeners.getLength())
+ {
+ css::uno::Reference< css::form::XLoadable > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeLoadListener(&m_aLoadListeners);
+ }
+ if (m_aRowSetListeners.getLength())
+ {
+ css::uno::Reference< css::sdbc::XRowSet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeRowSetListener(&m_aRowSetListeners);
+ }
+ if (m_aRowSetApproveListeners.getLength())
+ {
+ css::uno::Reference< css::sdb::XRowSetApproveBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeRowSetApproveListener(&m_aRowSetApproveListeners);
+ }
+ if (m_aErrorListeners.getLength())
+ {
+ css::uno::Reference< css::sdb::XSQLErrorBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeSQLErrorListener(&m_aErrorListeners);
+ }
+ if (m_aSubmitListeners.getLength())
+ {
+ css::uno::Reference< css::form::XSubmit > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeSubmitListener(&m_aSubmitListeners);
+ }
+ if (m_aResetListeners.getLength())
+ {
+ css::uno::Reference< css::form::XReset > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeResetListener(&m_aResetListeners);
+ }
if (m_aParameterListeners.getLength())
{
Reference< css::form::XDatabaseParameterBroadcaster > xBroadcaster(m_xMainForm, UNO_QUERY);
@@ -103,8 +105,20 @@ void SbaXFormAdapter::StopListening()
xBroadcaster->removeParameterListener(&m_aParameterListeners);
}
- STOP_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener, m_aPropertyChangeListeners, css::beans::XPropertySet, m_xMainForm);
- STOP_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener, m_aVetoablePropertyChangeListeners, css::beans::XPropertySet, m_xMainForm);
+ if (m_aPropertyChangeListeners.getOverallLen())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removePropertyChangeListener(OUString(), &m_aPropertyChangeListeners);
+ }
+
+ if (m_aVetoablePropertyChangeListeners.getOverallLen())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeVetoableChangeListener(OUString(), &m_aVetoablePropertyChangeListeners);
+ }
+
if (m_aPropertiesChangeListeners.getLength())
{
Reference< css::beans::XMultiPropertySet > xBroadcaster(m_xMainForm, UNO_QUERY);
@@ -121,12 +135,42 @@ void SbaXFormAdapter::StopListening()
void SbaXFormAdapter::StartListening()
{
// log off all our multiplexers
- START_MULTIPLEXER_LISTENING(LoadListener, m_aLoadListeners, css::form::XLoadable, m_xMainForm);
- START_MULTIPLEXER_LISTENING(RowSetListener, m_aRowSetListeners, css::sdbc::XRowSet, m_xMainForm);
- START_MULTIPLEXER_LISTENING(RowSetApproveListener, m_aRowSetApproveListeners, css::sdb::XRowSetApproveBroadcaster, m_xMainForm);
- START_MULTIPLEXER_LISTENING(SQLErrorListener, m_aErrorListeners, css::sdb::XSQLErrorBroadcaster, m_xMainForm);
- START_MULTIPLEXER_LISTENING(SubmitListener, m_aSubmitListeners, css::form::XSubmit, m_xMainForm);
- START_MULTIPLEXER_LISTENING(ResetListener, m_aResetListeners, css::form::XReset, m_xMainForm);
+ if (m_aLoadListeners.getLength())
+ {
+ css::uno::Reference< css::form::XLoadable > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addLoadListener(&m_aLoadListeners);
+ }
+ if (m_aRowSetListeners.getLength())
+ {
+ css::uno::Reference< css::sdbc::XRowSet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addRowSetListener(&m_aRowSetListeners);
+ }
+ if (m_aRowSetApproveListeners.getLength())
+ {
+ css::uno::Reference< css::sdb::XRowSetApproveBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addRowSetApproveListener(&m_aRowSetApproveListeners);
+ }
+ if (m_aErrorListeners.getLength())
+ {
+ css::uno::Reference< css::sdb::XSQLErrorBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addSQLErrorListener(&m_aErrorListeners);
+ }
+ if (m_aSubmitListeners.getLength())
+ {
+ css::uno::Reference< css::form::XSubmit > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addSubmitListener(&m_aSubmitListeners);
+ }
+ if (m_aResetListeners.getLength())
+ {
+ css::uno::Reference< css::form::XReset > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addResetListener(&m_aResetListeners);
+ }
if (m_aParameterListeners.getLength())
{
@@ -135,13 +179,25 @@ void SbaXFormAdapter::StartListening()
xBroadcaster->addParameterListener(&m_aParameterListeners);
}
- START_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener, m_aPropertyChangeListeners, css::beans::XPropertySet, m_xMainForm);
- START_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener, m_aVetoablePropertyChangeListeners, css::beans::XPropertySet, m_xMainForm);
+ if (m_aPropertyChangeListeners.getOverallLen())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addPropertyChangeListener(OUString(), &m_aPropertyChangeListeners);
+ }
+
+ if (m_aVetoablePropertyChangeListeners.getOverallLen())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addVetoableChangeListener(OUString(), &m_aVetoablePropertyChangeListeners);
+ }
+
if (m_aPropertiesChangeListeners.getLength())
{
Reference< css::beans::XMultiPropertySet > xBroadcaster(m_xMainForm, UNO_QUERY);
if (xBroadcaster.is())
- xBroadcaster->addPropertiesChangeListener(css::uno::Sequence<OUString>{""}, &m_aPropertiesChangeListeners);
+ xBroadcaster->addPropertiesChangeListener(css::uno::Sequence<OUString>{u""_ustr}, &m_aPropertiesChangeListeners);
}
// log off ourself
@@ -166,9 +222,7 @@ void SbaXFormAdapter::AttachForm(const Reference< css::sdbc::XRowSet >& xNewMast
if (xLoadable->isLoaded())
{
css::lang::EventObject aEvt(*this);
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aLoadListeners);
- while (aIt.hasMoreElements())
- static_cast< css::form::XLoadListener*>(aIt.next())->unloaded(aEvt);
+ m_aLoadListeners.notifyEach( &css::form::XLoadListener::unloaded, aEvt );
}
}
@@ -184,9 +238,7 @@ void SbaXFormAdapter::AttachForm(const Reference< css::sdbc::XRowSet >& xNewMast
if (xLoadable->isLoaded())
{
css::lang::EventObject aEvt(*this);
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aLoadListeners);
- while (aIt.hasMoreElements())
- static_cast< css::form::XLoadListener*>(aIt.next())->loaded(aEvt);
+ m_aLoadListeners.notifyEach( &css::form::XLoadListener::loaded, aEvt );
}
// TODO : perhaps _all_ of our listeners should be notified about our new state
@@ -218,8 +270,6 @@ sal_Int32 SAL_CALL SbaXFormAdapter::findColumn(const OUString& columnName)
return xIface->findColumn(columnName);
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
// css::sdbcx::XColumnsSupplier
@@ -736,7 +786,26 @@ void SAL_CALL SbaXFormAdapter::execute()
m_xMainForm->execute();
}
-IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdbc, RowSetListener, m_aRowSetListeners, css::sdbc::XRowSet, m_xMainForm)
+void SAL_CALL SbaXFormAdapter::addRowSetListener(const css::uno::Reference< css::sdbc::XRowSetListener >& l)
+{
+ m_aRowSetListeners.addInterface(l);
+ if (m_aRowSetListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::sdbc::XRowSet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addRowSetListener(&m_aRowSetListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeRowSetListener(const css::uno::Reference< css::sdbc::XRowSetListener >& l)
+{
+ if (m_aRowSetListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::sdbc::XRowSet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeRowSetListener(&m_aRowSetListeners);
+ }
+ m_aRowSetListeners.removeInterface(l);
+}
// css::sdbcx::XDeleteRows
Sequence<sal_Int32> SAL_CALL SbaXFormAdapter::deleteRows(const Sequence< Any >& rows)
@@ -764,10 +833,48 @@ void SAL_CALL SbaXFormAdapter::clearWarnings()
}
// css::sdb::XRowSetApproveBroadcaster
-IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdb, RowSetApproveListener, m_aRowSetApproveListeners, css::sdb::XRowSetApproveBroadcaster, m_xMainForm)
+void SAL_CALL SbaXFormAdapter::addRowSetApproveListener(const css::uno::Reference< css::sdb::XRowSetApproveListener >& l)
+{
+ m_aRowSetApproveListeners.addInterface(l);
+ if (m_aRowSetApproveListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::sdb::XRowSetApproveBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addRowSetApproveListener(&m_aRowSetApproveListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeRowSetApproveListener(const css::uno::Reference< css::sdb::XRowSetApproveListener >& l)
+{
+ if (m_aRowSetApproveListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::sdb::XRowSetApproveBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeRowSetApproveListener(&m_aRowSetApproveListeners);
+ }
+ m_aRowSetApproveListeners.removeInterface(l);
+}
// css::sdbc::XSQLErrorBroadcaster
-IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdb, SQLErrorListener, m_aErrorListeners, css::sdb::XSQLErrorBroadcaster, m_xMainForm)
+void SAL_CALL SbaXFormAdapter::addSQLErrorListener(const css::uno::Reference< css::sdb::XSQLErrorListener >& l)
+{
+ m_aErrorListeners.addInterface(l);
+ if (m_aErrorListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::sdb::XSQLErrorBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addSQLErrorListener(&m_aErrorListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeSQLErrorListener(const css::uno::Reference< css::sdb::XSQLErrorListener >& l)
+{
+ if (m_aErrorListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::sdb::XSQLErrorBroadcaster > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeSQLErrorListener(&m_aErrorListeners);
+ }
+ m_aErrorListeners.removeInterface(l);
+}
// css::sdb::XResultSetAccess
Reference< css::sdbc::XResultSet > SAL_CALL SbaXFormAdapter::createResultSet()
@@ -808,7 +915,26 @@ sal_Bool SAL_CALL SbaXFormAdapter::isLoaded()
return false;
}
-IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, LoadListener, m_aLoadListeners, css::form::XLoadable, m_xMainForm)
+void SAL_CALL SbaXFormAdapter::addLoadListener(const css::uno::Reference< css::form::XLoadListener>& l)
+{
+ m_aLoadListeners.addInterface(l);
+ if (m_aLoadListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::form::XLoadable > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addLoadListener(&m_aLoadListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeLoadListener(const css::uno::Reference< css::form::XLoadListener >& l)
+{
+ if (m_aLoadListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::form::XLoadable > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeLoadListener(&m_aLoadListeners);
+ }
+ m_aLoadListeners.removeInterface(l);
+}
// css::sdbc::XParameters
void SAL_CALL SbaXFormAdapter::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType)
@@ -1014,7 +1140,26 @@ void SAL_CALL SbaXFormAdapter::submit(const Reference< css::awt::XControl >& aCo
xSubmit->submit(aControl, aMouseEvt);
}
-IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, SubmitListener, m_aSubmitListeners, css::form::XSubmit, m_xMainForm)
+void SAL_CALL SbaXFormAdapter::addSubmitListener(const css::uno::Reference< css::form::XSubmitListener >& l)
+{
+ m_aSubmitListeners.addInterface(l);
+ if (m_aSubmitListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::form::XSubmit > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addSubmitListener(&m_aSubmitListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeSubmitListener(const css::uno::Reference< css::form::XSubmitListener >& l)
+{
+ if (m_aSubmitListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::form::XSubmit > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeSubmitListener(&m_aSubmitListeners);
+ }
+ m_aSubmitListeners.removeInterface(l);
+}
// css::awt::XTabControllerModel
sal_Bool SAL_CALL SbaXFormAdapter::getGroupControl()
@@ -1099,6 +1244,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)
@@ -1119,7 +1266,7 @@ void SAL_CALL SbaXFormAdapter::setFastPropertyValue(sal_Int32 nHandle, const Any
if (m_nNamePropHandle == nHandle)
{
- if (aValue.getValueType().getTypeClass() != TypeClass_STRING)
+ if (aValue.getValueTypeClass() != TypeClass_STRING)
{
throw css::lang::IllegalArgumentException();
}
@@ -1134,9 +1281,8 @@ void SAL_CALL SbaXFormAdapter::setFastPropertyValue(sal_Int32 nHandle, const Any
aValue >>= m_sName;
- ::cppu::OInterfaceIteratorHelper aIt(*m_aPropertyChangeListeners.getContainer(PROPERTY_NAME));
- while (aIt.hasMoreElements())
- static_cast< css::beans::XPropertyChangeListener*>(aIt.next())->propertyChange(aEvt);
+ m_aPropertyChangeListeners.getContainer(PROPERTY_NAME)->notifyEach(
+ &XPropertyChangeListener::propertyChange, aEvt );
return;
}
@@ -1150,7 +1296,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);
}
@@ -1163,7 +1309,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
@@ -1227,13 +1373,14 @@ Sequence< Any > SAL_CALL SbaXFormAdapter::getPropertyValues(const Sequence< OUSt
return Sequence< Any>(aPropertyNames.getLength());
Sequence< Any> aReturn = xSet->getPropertyValues(aPropertyNames);
+ auto aReturnRange = asNonConstRange(aReturn);
// search for (and fake) the NAME property
OSL_ENSURE(aReturn.getLength() == aPropertyNames.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !");
for (sal_Int32 i=0; i<aPropertyNames.getLength(); ++i)
if (aPropertyNames[i] == PROPERTY_NAME)
{
- aReturn[i] <<= m_sName;
+ aReturnRange[i] <<= m_sName;
break;
}
@@ -1248,7 +1395,7 @@ void SAL_CALL SbaXFormAdapter::addPropertiesChangeListener(const Sequence< OUStr
{
Reference< css::beans::XMultiPropertySet > xBroadcaster(m_xMainForm, UNO_QUERY);
if (xBroadcaster.is())
- xBroadcaster->addPropertiesChangeListener(Sequence< OUString>{""}, &m_aPropertiesChangeListeners);
+ xBroadcaster->addPropertiesChangeListener(Sequence< OUString>{u""_ustr}, &m_aPropertiesChangeListeners);
}
}
@@ -1297,14 +1444,54 @@ Any SAL_CALL SbaXFormAdapter::getPropertyValue(const OUString& PropertyName)
return xSet->getPropertyValue(PropertyName);
}
-IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter, PropertyChangeListener, m_aPropertyChangeListeners, css::beans::XPropertySet, m_xMainForm);
-IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter, VetoableChangeListener, m_aVetoablePropertyChangeListeners, css::beans::XPropertySet, m_xMainForm);
+void SAL_CALL SbaXFormAdapter::addPropertyChangeListener(const OUString& rName, const css::uno::Reference< css::beans::XPropertyChangeListener>& l )
+{
+ m_aPropertyChangeListeners.addInterface(rName, l);
+ if (m_aPropertyChangeListeners.getOverallLen() == 1)
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addPropertyChangeListener(OUString(), &m_aPropertyChangeListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removePropertyChangeListener(const OUString& rName, const css::uno::Reference< css::beans::XPropertyChangeListener>& l )
+{
+ if (m_aPropertyChangeListeners.getOverallLen() == 1)
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removePropertyChangeListener(OUString(), &m_aPropertyChangeListeners);
+ }
+ m_aPropertyChangeListeners.removeInterface(rName, l);
+}
+
+void SAL_CALL SbaXFormAdapter::addVetoableChangeListener(const OUString& rName, const css::uno::Reference< css::beans::XVetoableChangeListener>& l )
+{
+ m_aVetoablePropertyChangeListeners.addInterface(rName, l);
+ if (m_aVetoablePropertyChangeListeners.getOverallLen() == 1)
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addVetoableChangeListener(OUString(), &m_aVetoablePropertyChangeListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeVetoableChangeListener(const OUString& rName, const css::uno::Reference< css::beans::XVetoableChangeListener>& l )
+{
+ if (m_aVetoablePropertyChangeListeners.getOverallLen() == 1)
+ {
+ css::uno::Reference< css::beans::XPropertySet > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeVetoableChangeListener(OUString(), &m_aVetoablePropertyChangeListeners);
+ }
+ m_aVetoablePropertyChangeListeners.removeInterface(rName, l);
+}
+
// css::util::XCancellable
void SAL_CALL SbaXFormAdapter::cancel()
{
Reference< css::util::XCancellable > xCancel(m_xMainForm, UNO_QUERY);
- if (xCancel.is())
+ if (!xCancel.is())
return;
xCancel->cancel();
}
@@ -1326,7 +1513,7 @@ Sequence< css::beans::PropertyState> SAL_CALL SbaXFormAdapter::getPropertyStates
// set them all to DEFAULT
Sequence< css::beans::PropertyState> aReturn(aPropertyName.getLength());
- for (css::beans::PropertyState& rState : aReturn)
+ for (css::beans::PropertyState& rState : asNonConstRange(aReturn))
rState = css::beans::PropertyState_DEFAULT_VALUE;
return aReturn;
}
@@ -1354,13 +1541,32 @@ void SAL_CALL SbaXFormAdapter::reset()
xReset->reset();
}
-IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, ResetListener, m_aResetListeners, css::form::XReset, m_xMainForm)
+void SAL_CALL SbaXFormAdapter::addResetListener(const css::uno::Reference< css::form::XResetListener >& l)
+{
+ m_aResetListeners.addInterface(l);
+ if (m_aResetListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::form::XReset > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addResetListener(&m_aResetListeners);
+ }
+}
+void SAL_CALL SbaXFormAdapter::removeResetListener(const css::uno::Reference< css::form::XResetListener >& l)
+{
+ if (m_aResetListeners.getLength() == 1)
+ {
+ css::uno::Reference< css::form::XReset > xBroadcaster(m_xMainForm, css::uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeResetListener(&m_aResetListeners);
+ }
+ m_aResetListeners.removeInterface(l);
+}
// css::container::XNameContainer
void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OUString* pNewElName)
{
// extract the form component
- if (aElement.getValueType().getTypeClass() != TypeClass_INTERFACE)
+ if (aElement.getValueTypeClass() != TypeClass_INTERFACE)
{
throw css::lang::IllegalArgumentException();
}
@@ -1376,12 +1582,12 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU
if (!xElementSet.is())
{
throw css::lang::IllegalArgumentException();
- }
+ }
OUString sName;
try
{
if (pNewElName)
- xElementSet->setPropertyValue(PROPERTY_NAME, makeAny(*pNewElName));
+ xElementSet->setPropertyValue(PROPERTY_NAME, Any(*pNewElName));
xElementSet->getPropertyValue(PROPERTY_NAME) >>= sName;
}
@@ -1411,9 +1617,7 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU
aEvt.Source = *this;
aEvt.Accessor <<= nIndex;
aEvt.Element <<= xElement;
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aContainerListeners);
- while (aIt.hasMoreElements())
- static_cast< css::container::XContainerListener*>(aIt.next())->elementInserted(aEvt);
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvt );
}
sal_Int32 SbaXFormAdapter::implGetPos(const OUString& rName)
@@ -1462,7 +1666,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()
@@ -1516,10 +1720,7 @@ void SAL_CALL SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex)
css::container::ContainerEvent aEvt;
aEvt.Source = *this;
aEvt.Element <<= xAffected;
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aContainerListeners);
- while (aIt.hasMoreElements())
- static_cast< css::container::XContainerListener*>(aIt.next())->elementRemoved(aEvt);
-
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvt );
}
// css::container::XIndexReplace
@@ -1529,7 +1730,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem
throw css::lang::IndexOutOfBoundsException();
// extract the form component
- if (Element.getValueType().getTypeClass() != TypeClass_INTERFACE)
+ if (Element.getValueTypeClass() != TypeClass_INTERFACE)
{
throw css::lang::IllegalArgumentException();
}
@@ -1545,7 +1746,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem
if (!xElementSet.is())
{
throw css::lang::IllegalArgumentException();
- }
+ }
OUString sName;
try
{
@@ -1579,9 +1780,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem
aEvt.Element <<= xElement;
aEvt.ReplacedElement <<= xOld;
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aContainerListeners);
- while (aIt.hasMoreElements())
- static_cast< css::container::XContainerListener*>(aIt.next())->elementReplaced(aEvt);
+ m_aContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvt );
}
// css::container::XIndexAccess
@@ -1596,7 +1795,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 58f5b55ea940..77aaafdbadfb 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -18,13 +18,12 @@
*/
#include <dbaccess/genericcontroller.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
#include <browserids.hxx>
#include <vcl/svapp.hxx>
#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>
@@ -38,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>
@@ -58,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;
@@ -67,45 +64,22 @@ using namespace ::com::sun::star::ui;
using namespace ::dbtools;
using namespace ::comphelper;
-#define ALL_FEATURES -1
-#define FIRST_USER_DEFINED_FEATURE ( std::numeric_limits< sal_uInt16 >::max() - 1000 )
-#define LAST_USER_DEFINED_FEATURE ( std::numeric_limits< sal_uInt16 >::max() )
+constexpr auto ALL_FEATURES = -1;
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,
- "_self",
+ u"_self"_ustr,
FrameSearchFlag::AUTO
) );
@@ -124,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 )
@@ -153,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
{
@@ -198,7 +154,7 @@ bool OGenericUnoController::Construct(vcl::Window* /*pParent*/)
{
SAL_WARN("dbaccess.ui","OGenericUnoController::Construct: could not create (or start listening at) the database context!");
// at least notify the user. Though the whole component does not make any sense without the database context ...
- ShowServiceNotAvailableError(getFrameWeld(), "com.sun.star.sdb.DatabaseContext", true);
+ ShowServiceNotAvailableError(getFrameWeld(), u"com.sun.star.sdb.DatabaseContext", true);
}
return true;
@@ -210,7 +166,7 @@ IMPL_LINK_NOARG(OGenericUnoController, OnAsyncInvalidateAll, void*, void)
InvalidateFeature_Impl();
}
-void OGenericUnoController::impl_initialize()
+void OGenericUnoController::impl_initialize(const ::comphelper::NamedValueCollection& /*rArguments*/)
{
}
@@ -219,49 +175,46 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
- Reference< XWindow > xParent;
Reference< XFrame > xFrame;
- PropertyValue aValue;
- const Any* pIter = aArguments.getConstArray();
- const Any* pEnd = pIter + aArguments.getLength();
-
- for ( ; pIter != pEnd; ++pIter )
+ for (auto& arg : aArguments)
{
- if ( ( *pIter >>= aValue ) && aValue.Name == "Frame" )
- {
- xFrame.set(aValue.Value,UNO_QUERY_THROW);
- }
- else if ( ( *pIter >>= aValue ) && aValue.Name == "Preview" )
+ PropertyValue aValue;
+ if (arg >>= aValue)
{
- aValue.Value >>= m_bPreview;
- m_bReadOnly = true;
+ if (aValue.Name == "Frame")
+ {
+ xFrame.set(aValue.Value, UNO_QUERY_THROW);
+ }
+ else if (aValue.Name == "Preview")
+ {
+ aValue.Value >>= m_bPreview;
+ m_bReadOnly = true;
+ }
}
}
try
{
if ( !xFrame.is() )
- throw IllegalArgumentException("need a frame", *this, 1 );
+ throw IllegalArgumentException(u"need a frame"_ustr, *this, 1 );
- xParent = xFrame->getContainerWindow();
- VCLXWindow* pParentComponent = comphelper::getUnoTunnelImplementation<VCLXWindow>(xParent);
- VclPtr< vcl::Window > pParentWin = pParentComponent ? pParentComponent->GetWindow() : VclPtr< vcl::Window >();
+ Reference<XWindow> xParent = xFrame->getContainerWindow();
+ VclPtr<vcl::Window> pParentWin = VCLUnoHelper::GetWindow(xParent);
if (!pParentWin)
{
- throw IllegalArgumentException("Parent window is null", *this, 1 );
+ throw IllegalArgumentException(u"Parent window is null"_ustr, *this, 1 );
}
- m_aInitParameters.assign( aArguments );
Construct( pParentWin );
ODataView* pView = getView();
if ( !pView )
- throw RuntimeException("unable to create a view", *this );
+ throw RuntimeException(u"unable to create a view"_ustr, *this );
if ( m_bReadOnly || m_bPreview )
pView->EnableInput( false );
- impl_initialize();
+ impl_initialize(::comphelper::NamedValueCollection(aArguments));
}
catch(Exception&)
{
@@ -271,12 +224,12 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
}
}
-void SAL_CALL OGenericUnoController::acquire( ) throw ()
+void SAL_CALL OGenericUnoController::acquire( ) noexcept
{
OGenericUnoController_Base::acquire();
}
-void SAL_CALL OGenericUnoController::release( ) throw ()
+void SAL_CALL OGenericUnoController::release( ) noexcept
{
OGenericUnoController_Base::release();
}
@@ -328,7 +281,7 @@ Reference<XSidebarProvider> SAL_CALL OGenericUnoController::getSidebar()
OUString SAL_CALL OGenericUnoController::getViewControllerName()
{
- return "Default";
+ return u"Default"_ustr;
}
Sequence< PropertyValue > SAL_CALL OGenericUnoController::getCreationArguments()
@@ -375,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() )
@@ -434,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)
{
@@ -461,15 +414,10 @@ bool OGenericUnoController::isFeatureSupported( sal_Int32 _nId )
void OGenericUnoController::InvalidateFeature_Impl()
{
-#ifdef DBG_UTIL
- static sal_Int32 s_nRecursions = 0;
- ++s_nRecursions;
-#endif
-
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();
@@ -502,16 +450,12 @@ 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)
aNextFeature = m_aFeaturesToInvalidate.front();
}
-
-#ifdef DBG_UTIL
- --s_nRecursions;
-#endif
}
void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Reference< XStatusListener >& _xListener, bool _bForceBroadcast )
@@ -535,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 );
}
@@ -561,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())
@@ -598,19 +542,13 @@ Reference< XDispatch > OGenericUnoController::queryDispatch(const URL& aURL, co
Sequence< Reference< XDispatch > > OGenericUnoController::queryDispatches(const Sequence< DispatchDescriptor >& aDescripts)
{
- Sequence< Reference< XDispatch > > aReturn;
- sal_Int32 nLen = aDescripts.getLength();
- if ( nLen )
+ Sequence< Reference< XDispatch > > aReturn(aDescripts.getLength());
+ if (aDescripts.hasElements())
{
- aReturn.realloc( nLen );
- Reference< XDispatch >* pReturn = aReturn.getArray();
- const Reference< XDispatch >* pReturnEnd = aReturn.getArray() + nLen;
- const DispatchDescriptor* pDescripts = aDescripts.getConstArray();
-
- for ( ; pReturn != pReturnEnd; ++ pReturn, ++pDescripts )
- {
- *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags );
- }
+ std::transform(aDescripts.begin(), aDescripts.end(), aReturn.getArray(),
+ [this](auto& desc) {
+ return queryDispatch(desc.FeatureURL, desc.FrameName, desc.SearchFlags);
+ });
}
return aReturn;
@@ -667,14 +605,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())
@@ -688,18 +624,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()
@@ -721,7 +653,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);
@@ -731,7 +663,7 @@ void OGenericUnoController::disposing()
m_xDatabaseContext = nullptr;
{
- ::osl::MutexGuard aGuard( m_aFeatureMutex);
+ std::unique_lock aGuard( m_aFeatureMutex);
m_aAsyncInvalidateAll.CancelCall();
m_aFeaturesToInvalidate.clear();
}
@@ -747,7 +679,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 )
@@ -769,16 +700,17 @@ 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
OSL_ENSURE( m_bDescribingSupportedFeatures, "OGenericUnoController::implDescribeSupportedFeature: bad timing for this call!" );
#endif
- OSL_PRECOND( _nFeatureId < FIRST_USER_DEFINED_FEATURE, "OGenericUnoController::implDescribeSupportedFeature: invalid feature id!" );
+ OSL_PRECOND( _nFeatureId < ( std::numeric_limits< sal_uInt16 >::max() - 1000 ), // FIRST_USER_DEFINED_FEATURE
+ "OGenericUnoController::implDescribeSupportedFeature: invalid feature id!" );
ControllerFeature aFeature;
- aFeature.Command = OUString::createFromAscii( _pAsciiCommandURL );
+ aFeature.Command = _rCommandURL;
aFeature.nFeatureId = _nFeatureId;
aFeature.GroupId = _nCommandGroup;
@@ -792,11 +724,11 @@ void OGenericUnoController::implDescribeSupportedFeature( const char* _pAsciiCom
void OGenericUnoController::describeSupportedFeatures()
{
// add all supported features
- implDescribeSupportedFeature( ".uno:Copy", ID_BROWSER_COPY, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Cut", ID_BROWSER_CUT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Paste", ID_BROWSER_PASTE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:ClipboardFormatItems", ID_BROWSER_CLIPBOARD_FORMAT_ITEMS );
- implDescribeSupportedFeature( ".uno:DSBEditDoc", ID_BROWSER_EDITDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:Copy"_ustr, ID_BROWSER_COPY, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Cut"_ustr, ID_BROWSER_CUT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Paste"_ustr, ID_BROWSER_PASTE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:ClipboardFormatItems"_ustr, ID_BROWSER_CLIPBOARD_FORMAT_ITEMS );
+ implDescribeSupportedFeature( u".uno:DSBEditDoc"_ustr, ID_BROWSER_EDITDOC, CommandGroup::DOCUMENT );
}
FeatureState OGenericUnoController::GetState( sal_uInt16 _nId ) const
@@ -828,7 +760,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
@@ -853,7 +785,11 @@ URL OGenericUnoController::getURLForId(sal_Int32 _nId) const
bool OGenericUnoController::isUserDefinedFeature( const sal_uInt16 _nFeatureId )
{
- return ( _nFeatureId >= FIRST_USER_DEFINED_FEATURE ) && ( _nFeatureId < LAST_USER_DEFINED_FEATURE );
+ return
+ (_nFeatureId >= ( std::numeric_limits< sal_uInt16 >::max() - 1000 )) // test if >= FIRST_USER_DEFINED_FEATURE
+ &&
+ ( _nFeatureId < (std::numeric_limits< sal_uInt16 >::max())) // test if < LAST_USER_DEFINED_FEATURE
+ ;
}
bool OGenericUnoController::isUserDefinedFeature( const OUString& _rFeatureURL ) const
@@ -872,7 +808,7 @@ sal_Bool SAL_CALL OGenericUnoController::supportsService(const OUString& Service
void OGenericUnoController::startConnectionListening(const Reference< XConnection >& _rxConnection)
{
- // we have to remove ourself before dispoing the connection
+ // we have to remove ourself before disposing the connection
Reference< XComponent > xComponent(_rxConnection, UNO_QUERY);
if (xComponent.is())
xComponent->addEventListener(static_cast<XFrameActionListener*>(this));
@@ -880,7 +816,7 @@ void OGenericUnoController::startConnectionListening(const Reference< XConnectio
void OGenericUnoController::stopConnectionListening(const Reference< XConnection >& _rxConnection)
{
- // we have to remove ourself before dispoing the connection
+ // we have to remove ourself before disposing the connection
Reference< XComponent > xComponent(_rxConnection, UNO_QUERY);
if (xComponent.is())
xComponent->removeEventListener(static_cast<XFrameActionListener*>(this));
@@ -932,7 +868,7 @@ Reference< XLayoutManager > OGenericUnoController::getLayoutManager(const Refere
{
try
{
- xLayoutManager.set(xPropSet->getPropertyValue("LayoutManager"),UNO_QUERY);
+ xLayoutManager.set(xPropSet->getPropertyValue(u"LayoutManager"_ustr),UNO_QUERY);
}
catch ( Exception& )
{
@@ -947,8 +883,8 @@ void OGenericUnoController::loadMenu(const Reference< XFrame >& _xFrame)
if ( xLayoutManager.is() )
{
xLayoutManager->lock();
- xLayoutManager->createElement( "private:resource/menubar/menubar" );
- xLayoutManager->createElement( "private:resource/toolbar/toolbar" );
+ xLayoutManager->createElement( u"private:resource/menubar/menubar"_ustr );
+ xLayoutManager->createElement( u"private:resource/toolbar/toolbar"_ustr );
xLayoutManager->unlock();
xLayoutManager->doLayout();
}
@@ -1059,21 +995,16 @@ Reference< awt::XWindow> OGenericUnoController::getTopMostContainerWindow() cons
return xWindow;
}
-Reference< XTitle > OGenericUnoController::impl_getTitleHelper_throw()
+Reference< XTitle > OGenericUnoController::impl_getTitleHelper_throw(bool bCreateIfNecessary)
{
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
- if ( ! m_xTitleHelper.is ())
+ if (!m_xTitleHelper.is() && bCreateIfNecessary)
{
Reference< XUntitledNumbers > xUntitledProvider(getPrivateModel(), UNO_QUERY );
- Reference< XController > xThis(static_cast< XController* >(this), UNO_QUERY_THROW);
- ::framework::TitleHelper* pHelper = new ::framework::TitleHelper( m_xContext );
- m_xTitleHelper.set( static_cast< ::cppu::OWeakObject* >(pHelper), UNO_QUERY_THROW);
-
- pHelper->setOwner (xThis );
- pHelper->connectWithUntitledNumbers (xUntitledProvider);
+ m_xTitleHelper = new ::framework::TitleHelper( m_xContext, Reference< XController >(this), xUntitledProvider );
}
return m_xTitleHelper;
@@ -1107,7 +1038,7 @@ void SAL_CALL OGenericUnoController::addTitleChangeListener(const Reference< XTi
void SAL_CALL OGenericUnoController::removeTitleChangeListener(const Reference< XTitleChangeListener >& xListener)
{
- Reference< XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), UNO_QUERY);
+ Reference< XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(false), UNO_QUERY);
if (xBroadcaster.is ())
xBroadcaster->removeTitleChangeListener (xListener);
}
@@ -1116,23 +1047,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)
@@ -1146,10 +1077,6 @@ bool OGenericUnoController::isCommandEnabled(sal_uInt16 _nCommandId) const
return GetState( _nCommandId ).bEnabled;
}
-void OGenericUnoController::notifyHiContrastChanged()
-{
-}
-
bool OGenericUnoController::isDataSourceReadOnly() const
{
return false;
@@ -1162,14 +1089,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
@@ -1223,6 +1150,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 4c88ec938766..e962b8331b1e 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -18,7 +18,6 @@
*/
#include <core_resource.hxx>
-#include <helpids.h>
#include <sot/exchange.hxx>
@@ -31,29 +30,24 @@
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-#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>
#include <vcl/svapp.hxx>
-#include <svl/zforlist.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <connectivity/dbtools.hxx>
-#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
-#include <browserids.hxx>
#include <strings.hrc>
#include <strings.hxx>
#include <dbexchange.hxx>
-#include <TableRowExchange.hxx>
-#include <TableRow.hxx>
#include <svtools/stringtransfer.hxx>
#include <UITools.hxx>
#include <TokenWriter.hxx>
@@ -62,14 +56,11 @@
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;
@@ -87,8 +78,8 @@ com_sun_star_comp_dbu_SbaXGridControl_get_implementation(
css::uno::Sequence<OUString> SAL_CALL SbaXGridControl::getSupportedServiceNames()
{
- return { "com.sun.star.form.control.InteractionGridControl", "com.sun.star.form.control.GridControl",
- "com.sun.star.awt.UnoControl" };
+ return { u"com.sun.star.form.control.InteractionGridControl"_ustr, u"com.sun.star.form.control.GridControl"_ustr,
+ u"com.sun.star.awt.UnoControl"_ustr };
}
@@ -96,7 +87,7 @@ css::uno::Sequence<OUString> SAL_CALL SbaXGridControl::getSupportedServiceNames(
OUString SAL_CALL SbaXGridControl::getImplementationName()
{
- return "com.sun.star.comp.dbu.SbaXGridControl";
+ return u"com.sun.star.comp.dbu.SbaXGridControl"_ustr;
}
SbaXGridControl::SbaXGridControl(const Reference< XComponentContext >& _rM)
@@ -108,9 +99,9 @@ SbaXGridControl::~SbaXGridControl()
{
}
-FmXGridPeer* SbaXGridControl::imp_CreatePeer(vcl::Window* pParent)
+rtl::Reference<FmXGridPeer> SbaXGridControl::imp_CreatePeer(vcl::Window* pParent)
{
- FmXGridPeer* pReturn = new SbaXGridPeer(m_xContext);
+ rtl::Reference<FmXGridPeer> pReturn = new SbaXGridPeer(m_xContext);
// translate properties into WinBits
WinBits nStyle = WB_TABSTOP;
@@ -132,9 +123,9 @@ 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));
}
@@ -163,7 +154,7 @@ void SAL_CALL SbaXGridControl::createPeer(const Reference< css::awt::XToolkit >
for (auto const& elem : m_aStatusMultiplexer)
{
if (elem.second.is() && elem.second->getLength())
- xDisp->addStatusListener(elem.second.get(), elem.first);
+ xDisp->addStatusListener(elem.second, elem.first);
}
}
@@ -192,7 +183,7 @@ void SAL_CALL SbaXGridControl::addStatusListener( const Reference< XStatusListen
if ( 1 == xMultiplexer->getLength() )
{ // the first external listener for this URL
Reference< XDispatch > xDisp( getPeer(), UNO_QUERY );
- xDisp->addStatusListener( xMultiplexer.get(), _rURL );
+ xDisp->addStatusListener( xMultiplexer, _rURL );
}
else
{ // already have other listeners for this URL
@@ -214,7 +205,7 @@ void SAL_CALL SbaXGridControl::removeStatusListener(const Reference< css::frame:
if (getPeer().is() && xMultiplexer->getLength() == 1)
{
Reference< css::frame::XDispatch > xDisp(getPeer(), UNO_QUERY);
- xDisp->removeStatusListener(xMultiplexer.get(), _rURL);
+ xDisp->removeStatusListener(xMultiplexer, _rURL);
}
xMultiplexer->removeInterface( _rxListener );
}
@@ -242,7 +233,6 @@ void SAL_CALL SbaXGridControl::dispose()
// SbaXGridPeer
SbaXGridPeer::SbaXGridPeer(const Reference< XComponentContext >& _rM)
: FmXGridPeer(_rM)
-,m_aStatusListeners(m_aMutex)
{
}
@@ -252,10 +242,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();
}
@@ -280,13 +271,13 @@ void SbaXGridPeer::NotifyStatusChanged(const css::util::URL& _rUrl, const Refere
xControl->statusChanged(aEvt);
else
{
- ::cppu::OInterfaceContainerHelper * pIter = m_aStatusListeners.getContainer(_rUrl);
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4<css::frame::XStatusListener> * pIter
+ = m_aStatusListeners.getContainer(g, _rUrl);
if (pIter)
{
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while (aListIter.hasMoreElements())
- static_cast< css::frame::XStatusListener*>(aListIter.next())->statusChanged(aEvt);
+ pIter->notifyEach( g, &XStatusListener::statusChanged, aEvt );
}
}
}
@@ -445,19 +436,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)
{
- ::cppu::OInterfaceContainerHelper* 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)
{
- ::cppu::OInterfaceContainerHelper* 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()
@@ -467,8 +463,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);
@@ -523,7 +517,7 @@ void SbaGridHeader::ImplStartColumnDrag(sal_Int8 _nAction, const Point& _rMouseP
tools::Rectangle aColRect = GetItemRect(nId);
aColRect.AdjustLeft(nId ? 3 : 0 ); // the handle col (nId == 0) does not have a left margin for resizing
aColRect.AdjustRight( -3 );
- bResizingCol = !aColRect.IsInside(_rMousePos);
+ bResizingCol = !aColRect.Contains(_rMousePos);
}
if (bResizingCol)
return;
@@ -544,31 +538,26 @@ void SbaGridHeader::ImplStartColumnDrag(sal_Int8 _nAction, const Point& _rMouseP
);
}
-void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu)
+void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rMenu,
+ weld::Menu& rInsertMenu, weld::Menu& rChangeMenu,
+ weld::Menu& rShowMenu)
{
- FmGridHeader::PreExecuteColumnContextMenu(nColId, rMenu);
+ FmGridHeader::PreExecuteColumnContextMenu(nColId, rMenu, rInsertMenu, rChangeMenu, rShowMenu);
// some items are valid only if the db isn't readonly
bool bDBIsReadOnly = static_cast<SbaGridControl*>(GetParent())->IsReadOnlyDB();
if (bDBIsReadOnly)
{
- rMenu.EnableItem(rMenu.GetItemId("hide"), false);
- PopupMenu* pShowColsMenu = rMenu.GetPopupMenu(rMenu.GetItemId("show"));
- if (pShowColsMenu)
- {
- // at most 16 items which mean "show column <name>"
- for (sal_uInt16 i=1; i<16; ++i)
- pShowColsMenu->EnableItem(i, false);
- // "show cols/more..." and "show cols/all"
- pShowColsMenu->EnableItem(pShowColsMenu->GetItemId("more"), false);
- pShowColsMenu->EnableItem(pShowColsMenu->GetItemId("all"), false);
- }
+ rMenu.set_visible(u"hide"_ustr, false);
+ rMenu.set_sensitive(u"hide"_ustr, false);
+ rMenu.set_visible(u"show"_ustr, false);
+ rMenu.set_sensitive(u"show"_ustr, false);
}
// prepend some new items
bool bColAttrs = (nColId != sal_uInt16(-1)) && (nColId != 0);
- if ( !(bColAttrs && !bDBIsReadOnly))
+ if ( !bColAttrs || bDBIsReadOnly)
return;
sal_uInt16 nPos = 0;
@@ -589,45 +578,25 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM
case DataType::REF:
break;
default:
- rMenu.InsertItem(ID_BROWSER_COLATTRSET, DBA_RES(RID_STR_COLUMN_FORMAT), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COLATTRSET, HID_BROWSER_COLUMNFORMAT);
- rMenu.InsertSeparator(OString(), nPos++);
+ rMenu.insert(nPos++, u"colattrset"_ustr, DBA_RES(RID_STR_COLUMN_FORMAT),
+ nullptr, nullptr, nullptr, TRISTATE_INDET);
+ rMenu.insert_separator(nPos++, u"separator1"_ustr);
}
}
- rMenu.InsertItem(ID_BROWSER_COLWIDTH, DBA_RES(RID_STR_COLUMN_WIDTH), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COLWIDTH, HID_BROWSER_COLUMNWIDTH);
- rMenu.InsertSeparator(OString(), nPos++);
+ rMenu.insert(nPos++, u"colwidth"_ustr, DBA_RES(RID_STR_COLUMN_WIDTH),
+ nullptr, nullptr, nullptr, TRISTATE_INDET);
+ rMenu.insert_separator(nPos++, u"separator2"_ustr);
}
-void SbaGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult)
+void SbaGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OUString& rExecutionResult)
{
- switch (nExecutionResult)
- {
- case ID_BROWSER_COLWIDTH:
- static_cast<SbaGridControl*>(GetParent())->SetColWidth(nColId);
- break;
-
- case ID_BROWSER_COLATTRSET:
- static_cast<SbaGridControl*>(GetParent())->SetColAttrs(nColId);
- break;
- case ID_BROWSER_COLUMNINFO:
- {
- sal_uInt16 nModelPos = static_cast<SbaGridControl*>(GetParent())->GetModelColumnPos(nColId);
- Reference< XPropertySet > xField = static_cast<SbaGridControl*>(GetParent())->getField(nModelPos);
-
- if(!xField.is())
- break;
- std::vector< std::shared_ptr<OTableRow> > vClipboardList;
- // send it to the clipboard
- vClipboardList.push_back(std::make_shared<OTableRow>(xField));
- rtl::Reference<OTableRowExchange> pData = new OTableRowExchange(vClipboardList);
- pData->CopyToClipboard(GetParent());
- }
- break;
-
- default: FmGridHeader::PostExecuteColumnContextMenu(nColId, rMenu, nExecutionResult);
- }
+ if (rExecutionResult == "colwidth")
+ static_cast<SbaGridControl*>(GetParent())->SetColWidth(nColId);
+ else if (rExecutionResult == "colattrset")
+ static_cast<SbaGridControl*>(GetParent())->SetColAttrs(nColId);
+ else
+ FmGridHeader::PostExecuteColumnContextMenu(nColId, rMenu, rExecutionResult);
}
// SbaGridControl
@@ -658,7 +627,7 @@ VclPtr<BrowserHeader> SbaGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
return VclPtr<SbaGridHeader>::Create(pParent);
}
-CellController* SbaGridControl::GetController(long nRow, sal_uInt16 nCol)
+CellController* SbaGridControl::GetController(sal_Int32 nRow, sal_uInt16 nCol)
{
if ( m_bActivatingForDrop )
return nullptr;
@@ -666,26 +635,26 @@ CellController* SbaGridControl::GetController(long nRow, sal_uInt16 nCol)
return FmGridControl::GetController(nRow, nCol);
}
-void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu)
+void SbaGridControl::PreExecuteRowContextMenu(weld::Menu& rMenu)
{
- FmGridControl::PreExecuteRowContextMenu(nRow, rMenu);
+ FmGridControl::PreExecuteRowContextMenu(rMenu);
sal_uInt16 nPos = 0;
if (!IsReadOnlyDB())
{
- rMenu.InsertItem(ID_BROWSER_TABLEATTR, DBA_RES(RID_STR_TABLE_FORMAT), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_TABLEATTR, HID_BROWSER_TABLEFORMAT);
-
- rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, DBA_RES(RID_STR_ROW_HEIGHT), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, HID_BROWSER_ROWHEIGHT);
- rMenu.InsertSeparator(OString(), nPos++);
+ rMenu.insert(nPos++, u"tableattr"_ustr, DBA_RES(RID_STR_TABLE_FORMAT),
+ nullptr, nullptr, nullptr, TRISTATE_INDET);
+ rMenu.insert(nPos++, u"rowheight"_ustr, DBA_RES(RID_STR_ROW_HEIGHT),
+ nullptr, nullptr, nullptr, TRISTATE_INDET);
+ rMenu.insert_separator(nPos++, u"separator1"_ustr);
}
if ( GetSelectRowCount() > 0 )
{
- rMenu.InsertItem(ID_BROWSER_COPY, DBA_RES(RID_STR_COPY), MenuItemBits::NONE, OString(), nPos++);
- rMenu.InsertSeparator(OString(), nPos++);
+ rMenu.insert(nPos++, u"copy"_ustr, DBA_RES(RID_STR_COPY),
+ nullptr, nullptr, nullptr, TRISTATE_INDET);
+ rMenu.insert_separator(nPos++, u"separator2"_ustr);
}
}
@@ -693,7 +662,7 @@ SvNumberFormatter* SbaGridControl::GetDatasourceFormatter()
{
Reference< css::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)), true, getContext());
- SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
+ SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
if ( !pSupplierImpl )
return nullptr;
@@ -771,7 +740,7 @@ void SbaGridControl::SetRowHeight()
}
catch(Exception&)
{
- OSL_FAIL("setPropertyValue: PROPERTY_ROW_HEIGHT throws an exception");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "setPropertyValue: PROPERTY_ROW_HEIGHT throws an exception");
}
}
@@ -791,7 +760,7 @@ void SbaGridControl::SetColAttrs(sal_uInt16 nColId)
// get the field the column is bound to
Reference< XPropertySet > xField = getField(nModelPos);
- ::dbaui::callColumnFormatDialog(xAffectedCol,xField,pFormatter,this);//(Window::GetSettings().GetLanguage());
+ ::dbaui::callColumnFormatDialog(xAffectedCol,xField,pFormatter,GetFrameWeld());
}
void SbaGridControl::SetBrowserAttrs()
@@ -803,15 +772,11 @@ void SbaGridControl::SetBrowserAttrs()
try
{
Reference< XComponentContext > xContext = getContext();
- css::beans::PropertyValue aArg;
- css::uno::Sequence<css::uno::Any> aArguments(2);
- aArg.Name = "IntrospectedObject";
- aArg.Value <<= xGridModel;
- aArguments[0] <<= aArg;
- aArg.Name = "ParentWindow";
- aArg.Value <<= VCLUnoHelper::GetInterface(this);
- aArguments[1] <<= aArg;
- Reference<XExecutableDialog> xExecute(xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.form.ControlFontDialog",
+ css::uno::Sequence<css::uno::Any> aArguments{
+ Any(comphelper::makePropertyValue(u"IntrospectedObject"_ustr, xGridModel)),
+ Any(comphelper::makePropertyValue(u"ParentWindow"_ustr, VCLUnoHelper::GetInterface(this)))
+ };
+ Reference<XExecutableDialog> xExecute(xContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.form.ControlFontDialog"_ustr,
aArguments, xContext), css::uno::UNO_QUERY_THROW);
xExecute->execute();
}
@@ -821,24 +786,16 @@ void SbaGridControl::SetBrowserAttrs()
}
}
-void SbaGridControl::PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu& rMenu, sal_uInt16 nExecutionResult)
+void SbaGridControl::PostExecuteRowContextMenu(const OUString& rExecutionResult)
{
- switch (nExecutionResult)
- {
- case ID_BROWSER_TABLEATTR:
- SetBrowserAttrs();
- break;
- case ID_BROWSER_ROWHEIGHT:
- SetRowHeight();
- break;
- case ID_BROWSER_COPY:
- CopySelectedRowsToClipboard();
- break;
-
- default:
- FmGridControl::PostExecuteRowContextMenu(nRow, rMenu, nExecutionResult);
- break;
- }
+ if (rExecutionResult == "tableattr")
+ SetBrowserAttrs();
+ else if (rExecutionResult == "rowheight")
+ SetRowHeight();
+ else if (rExecutionResult == "copy")
+ CopySelectedRowsToClipboard();
+ else
+ FmGridControl::PostExecuteRowContextMenu(rExecutionResult);
}
void SbaGridControl::Select()
@@ -850,7 +807,7 @@ void SbaGridControl::Select()
m_pMasterListener->SelectionChanged();
}
-void SbaGridControl::ActivateCell(long nRow, sal_uInt16 nCol, bool bSetCellFocus /*= sal_True*/ )
+void SbaGridControl::ActivateCell(sal_Int32 nRow, sal_uInt16 nCol, bool bSetCellFocus /*= sal_True*/ )
{
FmGridControl::ActivateCell(nRow, nCol, bSetCellFocus);
if (m_pMasterListener)
@@ -937,9 +894,9 @@ bool SbaGridControl::IsReadOnlyDB() const
void SbaGridControl::MouseButtonDown( const BrowserMouseEvent& rMEvt)
{
- long nRow = GetRowAtYPosPixel(rMEvt.GetPosPixel().Y());
+ sal_Int32 nRow = GetRowAtYPosPixel(rMEvt.GetPosPixel().Y());
sal_uInt16 nColPos = GetColumnAtXPosPixel(rMEvt.GetPosPixel().X());
- sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) : nColPos-1;
+ sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) : sal_uInt16(nColPos - 1);
// 'the handle column' and 'no valid column' will both result in a view position of -1 !
bool bHitEmptySpace = (nRow > GetRowCount()) || (nViewPos == sal_uInt16(-1));
@@ -963,16 +920,16 @@ void SbaGridControl::StartDrag( sal_Int8 _nAction, const Point& _rPosPixel )
// (Yes, this is controller (not view) functionality. But collecting and evaluating all the
// information necessary via UNO would be quite difficult (if not impossible) so
// my laziness says 'do it here'...)
- long nRow = GetRowAtYPosPixel(_rPosPixel.Y());
+ sal_Int32 nRow = GetRowAtYPosPixel(_rPosPixel.Y());
sal_uInt16 nColPos = GetColumnAtXPosPixel(_rPosPixel.X());
- sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) : nColPos-1;
+ sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) : sal_uInt16(nColPos-1);
// 'the handle column' and 'no valid column' will both result in a view position of -1 !
bool bCurrentRowVirtual = IsCurrentAppending() && IsModified();
// the current row doesn't really exist: the user's appending a new one and already has entered some data,
// so the row contains data which has no counter part within the data source
- long nCorrectRowCount = GetRowCount();
+ sal_Int32 nCorrectRowCount = GetRowCount();
if (GetOptions() & DbGridControlOptions::Insert)
--nCorrectRowCount; // there is an empty row for inserting records
if (bCurrentRowVirtual)
@@ -1047,6 +1004,7 @@ void SbaGridControl::DoColumnDrag(sal_uInt16 nColumnPos)
{
Reference< XPropertySet > xDataSource = getDataSource();
OSL_ENSURE(xDataSource.is(), "SbaGridControl::DoColumnDrag : invalid data source !");
+ ::dbtools::ensureRowSetConnection(Reference< XRowSet >(getDataSource(),UNO_QUERY), getContext(), nullptr);
Reference< XPropertySet > xAffectedCol;
Reference< XPropertySet > xAffectedField;
@@ -1096,8 +1054,7 @@ void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfC
// collect the affected rows
if ((GetSelectRowCount() == 0) && (nRowPos >= 0))
{
- aSelectedRows.realloc( 1 );
- aSelectedRows[0] <<= static_cast<sal_Int32>(nRowPos + 1);
+ aSelectedRows = { Any(static_cast<sal_Int32>(nRowPos + 1)) };
bSelectionBookmarks = false;
}
else if ( !IsAllSelected() && GetSelectRowCount() )
@@ -1126,15 +1083,15 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos)
// the old implementation copied a SBA_FIELDDATAEXCHANGE_FORMAT, too, (which was rather expensive to obtain),
// but we have no client for this DnD format anymore (the mail part of SO 5.2 was the only client)
- OUString sCellText;
try
{
- Reference< XGridFieldDataSupplier > xFieldData(static_cast< XGridPeer* >(GetPeer()), UNO_QUERY);
+ OUString sCellText;
+ Reference< XGridFieldDataSupplier > xFieldData(GetPeer());
Sequence<sal_Bool> aSupportingText = xFieldData->queryFieldDataType(cppu::UnoType<decltype(sCellText)>::get());
- if (aSupportingText.getConstArray()[nColumnPos])
+ if (aSupportingText[nColumnPos])
{
Sequence< Any> aCellContents = xFieldData->queryFieldData(nRowPos, cppu::UnoType<decltype(sCellText)>::get());
- sCellText = ::comphelper::getString(aCellContents.getConstArray()[nColumnPos]);
+ sCellText = ::comphelper::getString(aCellContents[nColumnPos]);
::svt::OStringTransfer::StartStringDrag(sCellText, this, DND_ACTION_COPY);
}
}
@@ -1175,82 +1132,83 @@ sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt )
if (!::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)).is())
return nAction;
- if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) do
- { // odd construction, but spares us a lot of (explicit ;) goto's
+ if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) )
+ do
+ { // odd construction, but spares us a lot of (explicit ;) goto's
- if (!GetEmptyRow().is())
- // without an empty row we're not in update mode
- break;
+ if (!GetEmptyRow().is())
+ // without an empty row we're not in update mode
+ break;
- const long nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false);
- const sal_uInt16 nCol = GetColumnId(GetColumnAtXPosPixel(rEvt.maPosPixel.X()));
+ const sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false);
+ const sal_uInt16 nCol = GetColumnId(GetColumnAtXPosPixel(rEvt.maPosPixel.X()));
- long nCorrectRowCount = GetRowCount();
- if (GetOptions() & DbGridControlOptions::Insert)
- --nCorrectRowCount; // there is an empty row for inserting records
- if (IsCurrentAppending())
- --nCorrectRowCount; // the current data record doesn't really exist, we are appending a new one
+ sal_Int32 nCorrectRowCount = GetRowCount();
+ if (GetOptions() & DbGridControlOptions::Insert)
+ --nCorrectRowCount; // there is an empty row for inserting records
+ if (IsCurrentAppending())
+ --nCorrectRowCount; // the current data record doesn't really exist, we are appending a new one
- if ( (nCol == BROWSER_INVALIDID) || (nRow >= nCorrectRowCount) || (nCol == 0) )
- // no valid cell under the mouse cursor
- break;
+ if ( (nCol == BROWSER_INVALIDID) || (nRow >= nCorrectRowCount) || (nCol == 0) )
+ // no valid cell under the mouse cursor
+ break;
- tools::Rectangle aRect = GetCellRect(nRow, nCol, false);
- if (!aRect.IsInside(rEvt.maPosPixel))
- // not dropped within a cell (a cell isn't as wide as the column - the are small spaces)
- break;
+ tools::Rectangle aRect = GetCellRect(nRow, nCol, false);
+ if (!aRect.Contains(rEvt.maPosPixel))
+ // not dropped within a cell (a cell isn't as wide as the column - the are small spaces)
+ break;
- if ((IsModified() || (GetCurrentRow().is() && GetCurrentRow()->IsModified())) && (GetCurrentPos() != nRow))
- // there is a current and modified row or cell and he text is to be dropped into another one
- break;
+ if ((IsModified() || (GetCurrentRow().is() && GetCurrentRow()->IsModified())) && (GetCurrentPos() != nRow))
+ // there is a current and modified row or cell and he text is to be dropped into another one
+ break;
- CellControllerRef xCurrentController = Controller();
- if (xCurrentController.is() && xCurrentController->IsValueChangedFromSaved() && ((nRow != GetCurRow()) || (nCol != GetCurColumnId())))
- // the current controller is modified and the user wants to drop in another cell -> no chance
- // (when leaving the modified cell an error may occur - this is deadly while dragging)
- break;
+ CellControllerRef xCurrentController = Controller();
+ if (xCurrentController.is() && xCurrentController->IsValueChangedFromSaved() && ((nRow != GetCurRow()) || (nCol != GetCurColumnId())))
+ // the current controller is modified and the user wants to drop in another cell -> no chance
+ // (when leaving the modified cell an error may occur - this is deadly while dragging)
+ break;
- Reference< XPropertySet > xField = getField(GetModelColumnPos(nCol));
- if (!xField.is())
- // the column is not valid bound (for instance a binary field)
- break;
+ Reference< XPropertySet > xField = getField(GetModelColumnPos(nCol));
+ if (!xField.is())
+ // the column is not valid bound (for instance a binary field)
+ break;
- try
- {
- if (::comphelper::getBOOL(xField->getPropertyValue(PROPERTY_ISREADONLY)))
+ try
+ {
+ if (::comphelper::getBOOL(xField->getPropertyValue(PROPERTY_ISREADONLY)))
+ break;
+ }
+ catch (const Exception& )
+ {
+ // assume RO
break;
- }
- catch (const Exception& )
- {
- // assume RO
- break;
- }
+ }
- try
- {
- // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface
- Reference< XIndexAccess > xColumnControls(static_cast<css::form::XGridPeer*>(GetPeer()), UNO_QUERY);
- if (xColumnControls.is())
+ try
{
- Reference< css::awt::XTextComponent > xColControl(
- xColumnControls->getByIndex(GetViewColumnPos(nCol)),
- css::uno::UNO_QUERY);
- if (xColControl.is())
+ // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface
+ Reference< XIndexAccess > xColumnControls(GetPeer());
+ if (xColumnControls.is())
{
- m_bActivatingForDrop = true;
- GoToRowColumnId(nRow, nCol);
- m_bActivatingForDrop = false;
-
- nAction = DND_ACTION_COPY;
+ Reference< css::awt::XTextComponent > xColControl(
+ xColumnControls->getByIndex(GetViewColumnPos(nCol)),
+ css::uno::UNO_QUERY);
+ if (xColControl.is())
+ {
+ m_bActivatingForDrop = true;
+ GoToRowColumnId(nRow, nCol);
+ m_bActivatingForDrop = false;
+
+ nAction = DND_ACTION_COPY;
+ }
}
}
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
- } while (false);
+ } while (false);
if(nAction != DND_ACTION_COPY && GetEmptyRow().is())
{
@@ -1275,10 +1233,10 @@ sal_Int8 SbaGridControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) )
{
- long nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false);
+ sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false);
sal_uInt16 nCol = GetColumnAtXPosPixel(rEvt.maPosPixel.X());
- long nCorrectRowCount = GetRowCount();
+ sal_Int32 nCorrectRowCount = GetRowCount();
if (GetOptions() & DbGridControlOptions::Insert)
--nCorrectRowCount; // there is an empty row for inserting records
if (IsCurrentAppending())
@@ -1389,10 +1347,10 @@ IMPL_LINK_NOARG(SbaGridControl, AsynchDropEvent, void*, void)
m_aDataDescriptor.clear();
}
-OUString SbaGridControl::GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const
+OUString SbaGridControl::GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const
{
OUString sRet;
- if ( ::vcl::BBTYPE_BROWSEBOX == eObjType )
+ if ( AccessibleBrowseBoxObjType::BrowseBox == eObjType )
{
SolarMutexGuard aGuard;
sRet = DBA_RES(STR_DATASOURCE_GRIDCONTROL_DESC);
diff --git a/dbaccess/source/ui/browser/sbamultiplex.cxx b/dbaccess/source/ui/browser/sbamultiplex.cxx
index 68673fd06ff2..8bf7ed747c03 100644
--- a/dbaccess/source/ui/browser/sbamultiplex.cxx
+++ b/dbaccess/source/ui/browser/sbamultiplex.cxx
@@ -18,79 +18,511 @@
*/
#include <sbamultiplex.hxx>
+#include <cppuhelper/queryinterface.hxx>
+
using namespace dbaui;
// the listener multiplexers
// XStatusListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXStatusMultiplexer, css::frame::XStatusListener)
+SbaXStatusMultiplexer::SbaXStatusMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXStatusMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::frame::XStatusListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::frame::XStatusListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXStatusMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
void SAL_CALL SbaXStatusMultiplexer::statusChanged(const css::frame::FeatureStateEvent& e)
{
m_aLastKnownStatus = e;
m_aLastKnownStatus.Source = &m_rParent;
- ::comphelper::OInterfaceIteratorHelper2 aIt( *this );
- while ( aIt.hasMoreElements() )
- static_cast< css::frame::XStatusListener* >( aIt.next() )->statusChanged( m_aLastKnownStatus );
+ notifyEach( &XStatusListener::statusChanged, m_aLastKnownStatus );
}
// LoadListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXLoadMultiplexer, css::form::XLoadListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXLoadMultiplexer, css::form::XLoadListener, loaded, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXLoadMultiplexer, css::form::XLoadListener, unloaded, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXLoadMultiplexer, css::form::XLoadListener, unloading, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXLoadMultiplexer, css::form::XLoadListener, reloading, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXLoadMultiplexer, css::form::XLoadListener, reloaded, css::lang::EventObject)
+SbaXLoadMultiplexer::SbaXLoadMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXLoadMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::form::XLoadListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::form::XLoadListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXLoadMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+void SAL_CALL SbaXLoadMultiplexer::loaded(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XLoadListener::loaded, aMulti );
+}
+void SAL_CALL SbaXLoadMultiplexer::unloaded(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XLoadListener::unloaded, aMulti );
+}
+
+void SAL_CALL SbaXLoadMultiplexer::unloading(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XLoadListener::unloading, aMulti );
+}
+
+void SAL_CALL SbaXLoadMultiplexer::reloading(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XLoadListener::reloading, aMulti );
+}
+
+void SAL_CALL SbaXLoadMultiplexer::reloaded(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XLoadListener::reloaded, aMulti );
+}
+
// css::sdbc::XRowSetListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXRowSetMultiplexer, css::sdbc::XRowSetListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXRowSetMultiplexer, css::sdbc::XRowSetListener, cursorMoved, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXRowSetMultiplexer, css::sdbc::XRowSetListener, rowChanged, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXRowSetMultiplexer, css::sdbc::XRowSetListener, rowSetChanged, css::lang::EventObject)
+SbaXRowSetMultiplexer::SbaXRowSetMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXRowSetMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::sdbc::XRowSetListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::sdbc::XRowSetListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXRowSetMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+void SAL_CALL SbaXRowSetMultiplexer::cursorMoved(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XRowSetListener::cursorMoved, aMulti );
+}
+
+void SAL_CALL SbaXRowSetMultiplexer::rowChanged(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XRowSetListener::rowChanged, aMulti );
+}
+
+void SAL_CALL SbaXRowSetMultiplexer::rowSetChanged(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XRowSetListener::rowSetChanged, aMulti );
+}
// css::sdb::XRowSetApproveListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXRowSetApproveMultiplexer, css::sdb::XRowSetApproveListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(SbaXRowSetApproveMultiplexer, css::sdb::XRowSetApproveListener, approveCursorMove, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(SbaXRowSetApproveMultiplexer, css::sdb::XRowSetApproveListener, approveRowChange, css::sdb::RowChangeEvent)
-IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(SbaXRowSetApproveMultiplexer, css::sdb::XRowSetApproveListener, approveRowSetChange, css::lang::EventObject)
+SbaXRowSetApproveMultiplexer::SbaXRowSetApproveMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXRowSetApproveMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::sdb::XRowSetApproveListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::sdb::XRowSetApproveListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXRowSetApproveMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+sal_Bool SAL_CALL SbaXRowSetApproveMultiplexer::approveCursorMove(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this);
+ bool bResult = true;
+ while (bResult && aIt.hasMoreElements())
+ bResult = aIt.next()->approveCursorMove(aMulti);
+ return bResult;
+}
+
+sal_Bool SAL_CALL SbaXRowSetApproveMultiplexer::approveRowChange(const css::sdb::RowChangeEvent& e)
+{
+ css::sdb::RowChangeEvent aMulti(e);
+ aMulti.Source = &m_rParent;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this);
+ bool bResult = true;
+ while (bResult && aIt.hasMoreElements())
+ bResult = aIt.next()->approveRowChange(aMulti);
+ return bResult;
+}
+
+sal_Bool SAL_CALL SbaXRowSetApproveMultiplexer::approveRowSetChange(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this);
+ bool bResult = true;
+ while (bResult && aIt.hasMoreElements())
+ bResult = aIt.next()->approveRowSetChange(aMulti);
+ return bResult;
+}
// css::sdb::XSQLErrorListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXSQLErrorMultiplexer, css::sdb::XSQLErrorListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXSQLErrorMultiplexer, css::sdb::XSQLErrorListener, errorOccured, css::sdb::SQLErrorEvent)
+SbaXSQLErrorMultiplexer::SbaXSQLErrorMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXSQLErrorMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::sdb::XSQLErrorListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::sdb::XSQLErrorListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXSQLErrorMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+void SAL_CALL SbaXSQLErrorMultiplexer::errorOccured(const css::sdb::SQLErrorEvent& e)
+{
+ css::sdb::SQLErrorEvent aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XSQLErrorListener::errorOccured, aMulti );
+}
// css::form::XDatabaseParameterListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXParameterMultiplexer, css::form::XDatabaseParameterListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(SbaXParameterMultiplexer, css::form::XDatabaseParameterListener, approveParameter, css::form::DatabaseParameterEvent)
+SbaXParameterMultiplexer::SbaXParameterMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXParameterMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::form::XDatabaseParameterListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::form::XDatabaseParameterListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXParameterMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+sal_Bool SAL_CALL SbaXParameterMultiplexer::approveParameter(const css::form::DatabaseParameterEvent& e)
+{
+ css::form::DatabaseParameterEvent aMulti(e);
+ aMulti.Source = &m_rParent;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this);
+ bool bResult = true;
+ while (bResult && aIt.hasMoreElements())
+ bResult = aIt.next()->approveParameter(aMulti);
+ return bResult;
+}
// css::form::XSubmitListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXSubmitMultiplexer, css::form::XSubmitListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(SbaXSubmitMultiplexer, css::form::XSubmitListener, approveSubmit, css::lang::EventObject)
+SbaXSubmitMultiplexer::SbaXSubmitMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXSubmitMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::form::XSubmitListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::form::XSubmitListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXSubmitMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+
+
+sal_Bool SAL_CALL SbaXSubmitMultiplexer::approveSubmit(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this);
+ bool bResult = true;
+ while (bResult && aIt.hasMoreElements())
+ bResult = aIt.next()->approveSubmit(aMulti);
+ return bResult;
+}
// css::form::XResetListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXResetMultiplexer, css::form::XResetListener)
-IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(SbaXResetMultiplexer, css::form::XResetListener, approveReset, css::lang::EventObject)
-IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(SbaXResetMultiplexer, css::form::XResetListener, resetted, css::lang::EventObject)
+SbaXResetMultiplexer::SbaXResetMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXResetMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::form::XResetListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::form::XResetListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXResetMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
+
+sal_Bool SAL_CALL SbaXResetMultiplexer::approveReset(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(*this);
+ bool bResult = true;
+ while (bResult && aIt.hasMoreElements())
+ bResult = aIt.next()->approveReset(aMulti);
+ return bResult;
+}
+
+void SAL_CALL SbaXResetMultiplexer::resetted(const css::lang::EventObject& e)
+{
+ css::lang::EventObject aMulti(e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XResetListener::resetted, aMulti );
+}
// css::beans::XPropertyChangeListener
-IMPLEMENT_PROPERTY_MULTIPLEXER(SbaXPropertyChangeMultiplexer, css::beans::XPropertyChangeListener, propertyChange, css::beans::PropertyChangeEvent)
+SbaXPropertyChangeMultiplexer::SbaXPropertyChangeMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,m_aListeners(rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXPropertyChangeMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::beans::XPropertyChangeListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::beans::XPropertyChangeListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXPropertyChangeMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+void SAL_CALL SbaXPropertyChangeMultiplexer::propertyChange(const css::beans::PropertyChangeEvent& e)
+{
+ ::comphelper::OInterfaceContainerHelper3<XPropertyChangeListener>* pListeners = m_aListeners.getContainer(e.PropertyName);
+ if (pListeners)
+ Notify(*pListeners, e);
+
+ /* do the notification for the unspecialized listeners, too */
+ pListeners = m_aListeners.getContainer(OUString());
+ if (pListeners)
+ Notify(*pListeners, e);
+}
+
+void SbaXPropertyChangeMultiplexer::addInterface(const OUString& rName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener > & rListener)
+{
+ m_aListeners.addInterface(rName, rListener);
+}
+
+void SbaXPropertyChangeMultiplexer::removeInterface(const OUString& rName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener > & rListener)
+{
+ m_aListeners.removeInterface(rName, rListener);
+}
+
+void SbaXPropertyChangeMultiplexer::disposeAndClear()
+{
+ css::lang::EventObject aEvt(m_rParent);
+ m_aListeners.disposeAndClear(aEvt);
+}
+
+sal_Int32 SbaXPropertyChangeMultiplexer::getOverallLen() const
+{
+ sal_Int32 nLen = 0;
+ const std::vector< OUString > aContained = m_aListeners.getContainedTypes();
+ for ( OUString const & s : aContained)
+ {
+ ::comphelper::OInterfaceContainerHelper3<XPropertyChangeListener>* pListeners = m_aListeners.getContainer(s);
+ if (!pListeners)
+ continue;
+ nLen += pListeners->getLength();
+ }
+ return nLen;
+}
+
+void SbaXPropertyChangeMultiplexer::Notify(::comphelper::OInterfaceContainerHelper3<XPropertyChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e)
+{
+ css::beans::PropertyChangeEvent aMulti(e);
+ aMulti.Source = &m_rParent;
+ rListeners.notifyEach( &XPropertyChangeListener::propertyChange, aMulti );
+}
// css::beans::XVetoableChangeListener
-IMPLEMENT_PROPERTY_MULTIPLEXER(SbaXVetoableChangeMultiplexer, css::beans::XVetoableChangeListener, vetoableChange, css::beans::PropertyChangeEvent)
+SbaXVetoableChangeMultiplexer::SbaXVetoableChangeMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,m_aListeners(rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXVetoableChangeMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::beans::XVetoableChangeListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::beans::XVetoableChangeListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXVetoableChangeMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+void SAL_CALL SbaXVetoableChangeMultiplexer::vetoableChange(const css::beans::PropertyChangeEvent& e)
+{
+ ::comphelper::OInterfaceContainerHelper3<css::beans::XVetoableChangeListener>* pListeners = m_aListeners.getContainer(e.PropertyName);
+ if (pListeners)
+ Notify(*pListeners, e);
+
+ /* do the notification for the unspecialized listeners, too */
+ pListeners = m_aListeners.getContainer(OUString());
+ if (pListeners)
+ Notify(*pListeners, e);
+}
+
+void SbaXVetoableChangeMultiplexer::addInterface(const OUString& rName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener > & rListener)
+{
+ m_aListeners.addInterface(rName, rListener);
+}
+
+void SbaXVetoableChangeMultiplexer::removeInterface(const OUString& rName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener > & rListener)
+{
+ m_aListeners.removeInterface(rName, rListener);
+}
+
+void SbaXVetoableChangeMultiplexer::disposeAndClear()
+{
+ css::lang::EventObject aEvt(m_rParent);
+ m_aListeners.disposeAndClear(aEvt);
+}
+
+sal_Int32 SbaXVetoableChangeMultiplexer::getOverallLen() const
+{
+ sal_Int32 nLen = 0;
+ const std::vector< OUString > aContained = m_aListeners.getContainedTypes();
+ for ( OUString const & s : aContained)
+ {
+ ::comphelper::OInterfaceContainerHelper3<XVetoableChangeListener>* pListeners = m_aListeners.getContainer(s);
+ if (!pListeners)
+ continue;
+ nLen += pListeners->getLength();
+ }
+ return nLen;
+}
+
+void SbaXVetoableChangeMultiplexer::Notify(::comphelper::OInterfaceContainerHelper3<XVetoableChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e)
+{
+ css::beans::PropertyChangeEvent aMulti(e);
+ aMulti.Source = &m_rParent;
+ rListeners.notifyEach( &XVetoableChangeListener::vetoableChange, aMulti );
+}
// css::beans::XPropertiesChangeListener
-IMPLEMENT_LISTENER_MULTIPLEXER_CORE(SbaXPropertiesChangeMultiplexer, css::beans::XPropertiesChangeListener);
+SbaXPropertiesChangeMultiplexer::SbaXPropertiesChangeMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)
+ :OSbaWeakSubObject(rSource)
+ ,OInterfaceContainerHelper3(_rMutex)
+{
+}
+
+css::uno::Any SAL_CALL SbaXPropertiesChangeMultiplexer::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = OSbaWeakSubObject::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< css::beans::XPropertiesChangeListener* >(this),
+ static_cast< css::lang::XEventListener* >(static_cast< css::beans::XPropertiesChangeListener* >(this))
+ );
+
+ return aReturn;
+}
+void SAL_CALL SbaXPropertiesChangeMultiplexer::disposing(const css::lang::EventObject& )
+{
+}
+
void SbaXPropertiesChangeMultiplexer::propertiesChange(const css::uno::Sequence< css::beans::PropertyChangeEvent>& aEvts)
{
// the SbaXPropertiesChangeMultiplexer doesn't care about the property names a listener logs on for, it simply
// forwards _all_ changes to _all_ listeners
css::uno::Sequence< css::beans::PropertyChangeEvent> aMulti(aEvts);
- for (css::beans::PropertyChangeEvent & rEvent : aMulti)
+ for (css::beans::PropertyChangeEvent & rEvent : asNonConstRange(aMulti))
rEvent.Source = &m_rParent;
- ::comphelper::OInterfaceIteratorHelper2 aIt(*this);
- while (aIt.hasMoreElements())
- static_cast< css::beans::XPropertiesChangeListener*>(aIt.next())->propertiesChange(aMulti);
+ notifyEach( &css::beans::XPropertiesChangeListener::propertiesChange, aMulti );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 43a7006fe40e..6a5ea3a1aea7 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -22,7 +22,6 @@
#include <helpids.h>
#include <dbtreelistbox.hxx>
#include "dbtreemodel.hxx"
-#include "dbtreeview.hxx"
#include <strings.hrc>
#include <imageprovider.hxx>
#include <sbagrid.hxx>
@@ -71,9 +70,7 @@
#include <com/sun/star/util/XNumberFormatter.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
-#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
-#include <comphelper/processfactory.hxx>
#include <comphelper/extract.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
@@ -81,18 +78,16 @@
#include <cppuhelper/exc_hlp.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <svl/filenotation.hxx>
-#include <vcl/svlbitm.hxx>
-#include <vcl/treelistbox.hxx>
-#include <vcl/treelistentry.hxx>
#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>
@@ -115,7 +110,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;
@@ -156,12 +150,12 @@ static void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, c
OUString SAL_CALL SbaTableQueryBrowser::getImplementationName()
{
- return "org.openoffice.comp.dbu.ODatasourceBrowser";
+ return u"org.openoffice.comp.dbu.ODatasourceBrowser"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL SbaTableQueryBrowser::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.DataSourceBrowser" };
+ return { u"com.sun.star.sdb.DataSourceBrowser"_ustr };
}
SbaTableQueryBrowser::SbaTableQueryBrowser(const Reference< XComponentContext >& _rM)
@@ -171,7 +165,6 @@ SbaTableQueryBrowser::SbaTableQueryBrowser(const Reference< XComponentContext >&
,m_aTableCopyHelper(this)
,m_pTreeView(nullptr)
,m_pSplitter(nullptr)
- ,m_pCurrentlyDisplayed(nullptr)
,m_nAsyncDrop(nullptr)
,m_bQueryEscapeProcessing( false )
,m_bShowMenu(false)
@@ -198,9 +191,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();
}
@@ -217,13 +210,14 @@ 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 newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
+ auto [begin, end] = asNonConstRange(aTypes);
+ auto newEnd = std::remove_if( begin, end,
[](const Type& type)
{ return type == cppu::UnoType<XScriptInvocationContext>::get(); } );
- aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
+ aTypes.realloc( std::distance(begin, newEnd) );
}
return aTypes;
}
@@ -245,7 +239,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
if (getBrowserView())
{
- // Need to do some cleaup of the data pointed to the tree view entries before we remove the treeview
+ // Need to do some cleanup of the data pointed to the tree view entries before we remove the treeview
clearTreeModel();
m_pTreeView = nullptr;
getBrowserView()->setTreeView(nullptr);
@@ -254,6 +248,11 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
// remove ourself as status listener
implRemoveStatusListeners();
+ // check out from all the objects we are listening
+ // the frame
+ if (m_xCurrentFrameParent.is())
+ m_xCurrentFrameParent->removeFrameActionListener(static_cast<css::frame::XFrameActionListener*>(this));
+
// remove the container listener from the database context
try
{
@@ -265,10 +264,6 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- // check out from all the objects we are listening
- // the frame
- if (m_xCurrentFrameParent.is())
- m_xCurrentFrameParent->removeFrameActionListener(static_cast<css::frame::XFrameActionListener*>(this));
SbaXDataBrowserController::disposing();
}
@@ -290,44 +285,49 @@ bool SbaTableQueryBrowser::Construct(vcl::Window* pParent)
{
SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::Construct: could not create (or start listening at) the database context!");
}
+
// some help ids
- if (getBrowserView() && getBrowserView()->getVclControl())
- {
+ if (!getBrowserView() || !getBrowserView()->getVclControl())
+ return true;
- // create controls and set sizes
- const long nFrameWidth = getBrowserView()->LogicToPixel(::Size(3, 0), MapMode(MapUnit::MapAppFont)).Width();
+ // create controls and set sizes
+ const tools::Long nFrameWidth = getBrowserView()->LogicToPixel(::Size(3, 0), MapMode(MapUnit::MapAppFont)).Width();
- m_pSplitter = VclPtr<Splitter>::Create(getBrowserView(),WB_HSCROLL);
- m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) );
- m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
+ m_pSplitter = VclPtr<Splitter>::Create(getBrowserView(),WB_HSCROLL);
+ m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) );
+ m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
- m_pTreeView = VclPtr<DBTreeView>::Create(getBrowserView(), WB_TABSTOP | WB_BORDER);
- m_pTreeView->SetPreExpandHandler(LINK(this, SbaTableQueryBrowser, OnExpandEntry));
+ m_pTreeView = VclPtr<InterimDBTreeListBox>::Create(getBrowserView());
- m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry));
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ rTreeView.connect_expanding(LINK(this, SbaTableQueryBrowser, OnExpandEntry));
- m_pTreeView->getListBox().setContextMenuProvider( this );
- m_pTreeView->getListBox().setControlActionListener( this );
- m_pTreeView->SetHelpId(HID_CTL_TREEVIEW);
+ m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry));
- // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide
- m_pSplitter->SetSplitPosPixel(getBrowserView()->LogicToPixel(::Size(80, 0), MapMode(MapUnit::MapAppFont)).Width());
+ m_pTreeView->setContextMenuProvider( this );
+ m_pTreeView->setControlActionListener( this );
+ m_pTreeView->SetHelpId(HID_CTL_TREEVIEW);
- getBrowserView()->setSplitter(m_pSplitter);
- getBrowserView()->setTreeView(m_pTreeView);
+ // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide
+ m_pSplitter->SetSplitPosPixel(getBrowserView()->LogicToPixel(::Size(80, 0), MapMode(MapUnit::MapAppFont)).Width());
- // fill view with data
- auto pTreeModel = m_pTreeView->GetTreeModel();
- pTreeModel->SetSortMode(SortAscending);
- pTreeModel->SetCompareHdl(LINK(this, SbaTableQueryBrowser, OnTreeEntryCompare));
- m_pTreeView->setSelChangeHdl( LINK( this, SbaTableQueryBrowser, OnSelectionChange ) );
+ getBrowserView()->setSplitter(m_pSplitter);
+ getBrowserView()->setTreeView(m_pTreeView);
- // TODO
- getBrowserView()->getVclControl()->SetHelpId(HID_CTL_TABBROWSER);
- if (getBrowserView()->getVclControl()->GetHeaderBar())
- getBrowserView()->getVclControl()->GetHeaderBar()->SetHelpId(HID_DATABROWSE_HEADER);
- InvalidateFeature(ID_BROWSER_EXPLORER);
- }
+ // fill view with data
+ rTreeView.set_sort_order(true);
+ rTreeView.set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
+ return OnTreeEntryCompare(rLeft, rRight);
+ });
+ rTreeView.make_sorted();
+ m_pTreeView->SetSelChangeHdl(LINK(this, SbaTableQueryBrowser, OnSelectionChange));
+ m_pTreeView->show_container();
+
+ // TODO
+ getBrowserView()->getVclControl()->SetHelpId(HID_CTL_TABBROWSER);
+ if (getBrowserView()->getVclControl()->GetHeaderBar())
+ getBrowserView()->getVclControl()->GetHeaderBar()->SetHelpId(HID_DATABROWSE_HEADER);
+ InvalidateFeature(ID_BROWSER_EXPLORER);
return true;
}
@@ -415,8 +415,8 @@ 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() ) );
- xComposer->setOrder( "" );
+ xRowSetProps->setPropertyValue( PROPERTY_ORDER, Any( OUString() ) );
+ xComposer->setOrder( u""_ustr );
}
// check if the columns participating in the filter refer to existing tables
@@ -461,13 +461,14 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_formProperties )
{
- if(!m_pCurrentlyDisplayed)
+ if (!m_xCurrentlyDisplayed)
return true;
// this method set all format settings from the original table or query
try
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ 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!" );
@@ -477,16 +478,16 @@ 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 & aTransferPropertie : aTransferProperties)
+ for (const auto & aTransferProperty : aTransferProperties)
{
- if ( !xPSI->hasPropertyByName( aTransferPropertie ) )
+ if ( !xPSI->hasPropertyByName( aTransferProperty ) )
continue;
- aPropertyValues.put( aTransferPropertie, pData->xObjectProperties->getPropertyValue( aTransferPropertie ) );
+ aPropertyValues.put( aTransferProperty, pData->xObjectProperties->getPropertyValue( aTransferProperty ) );
}
std::vector< OUString > aNames( aPropertyValues.getNames() );
@@ -521,9 +522,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(u"AllowInserts"_ustr,Any(false));
+ xDataSourceSet->setPropertyValue(u"AllowUpdates"_ustr,Any(false));
+ xDataSourceSet->setPropertyValue(u"AllowDeletes"_ustr,Any(false));
}
}
@@ -541,12 +542,13 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
if (xFormAsLoadable.is() && xFormAsLoadable->isLoaded())
{
// set the formats from the table
- if(m_pCurrentlyDisplayed)
+ 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 ));
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ 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;
@@ -638,14 +640,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);
@@ -654,7 +656,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:
@@ -672,19 +674,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 );
@@ -731,7 +733,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)
@@ -741,7 +743,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));
}
}
}
@@ -751,16 +753,18 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
}
}
-static Reference<XPropertySet> getColumnHelper(SvTreeListEntry const * _pCurrentlyDisplayed, const Reference<XPropertySet>& _rxSource)
+static Reference<XPropertySet> getColumnHelper(const weld::TreeView& rTreeView,
+ const weld::TreeIter* pCurrentlyDisplayed,
+ const Reference<XPropertySet>& rxSource)
{
Reference<XPropertySet> xRet;
- if(_pCurrentlyDisplayed)
+ if (pCurrentlyDisplayed)
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pCurrentlyDisplayed->GetUserData());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pCurrentlyDisplayed));
Reference<XColumnsSupplier> xColumnsSup(pData->xObjectProperties,UNO_QUERY);
Reference<XNameAccess> xNames = xColumnsSup->getColumns();
OUString aName;
- _rxSource->getPropertyValue(PROPERTY_NAME) >>= aName;
+ rxSource->getPropertyValue(PROPERTY_NAME) >>= aName;
if(xNames.is() && xNames->hasByName(aName))
xRet.set(xNames->getByName(aName),UNO_QUERY);
}
@@ -769,9 +773,10 @@ static Reference<XPropertySet> getColumnHelper(SvTreeListEntry const * _pCurrent
void SbaTableQueryBrowser::transferChangedControlProperty(const OUString& _rProperty, const Any& _rNewValue)
{
- if(m_pCurrentlyDisplayed)
+ if (m_xCurrentlyDisplayed)
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ 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())
@@ -783,22 +788,23 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
{
SbaXDataBrowserController::propertyChange(evt);
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+
try
{
Reference< XPropertySet > xSource(evt.Source, UNO_QUERY);
if (!xSource.is())
return;
-
// one of the many properties which require us to update the definition ?
// a column's width ?
else if (evt.PropertyName == PROPERTY_WIDTH)
{ // a column width has changed -> update the model
// (the update of the view is done elsewhere)
- Reference<XPropertySet> xProp = getColumnHelper(m_pCurrentlyDisplayed,xSource);
+ Reference<XPropertySet> xProp = getColumnHelper(rTreeView, m_xCurrentlyDisplayed.get(), xSource);
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);
}
@@ -807,7 +813,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
// a column's 'visible' state ?
else if (evt.PropertyName == PROPERTY_HIDDEN)
{
- Reference<XPropertySet> xProp = getColumnHelper(m_pCurrentlyDisplayed,xSource);
+ Reference<XPropertySet> xProp = getColumnHelper(rTreeView, m_xCurrentlyDisplayed.get(), xSource);
if(xProp.is())
xProp->setPropertyValue(PROPERTY_HIDDEN,evt.NewValue);
}
@@ -815,7 +821,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
// a columns alignment ?
else if (evt.PropertyName == PROPERTY_ALIGN)
{
- Reference<XPropertySet> xProp = getColumnHelper(m_pCurrentlyDisplayed,xSource);
+ Reference<XPropertySet> xProp = getColumnHelper(rTreeView, m_xCurrentlyDisplayed.get(), xSource);
try
{
if(xProp.is())
@@ -824,12 +830,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& )
@@ -844,7 +850,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
)
{
// update the model (means the definition object)
- Reference<XPropertySet> xProp = getColumnHelper(m_pCurrentlyDisplayed,xSource);
+ Reference<XPropertySet> xProp = getColumnHelper(rTreeView, m_xCurrentlyDisplayed.get(), xSource);
if(xProp.is())
xProp->setPropertyValue(PROPERTY_FORMATKEY,evt.NewValue);
}
@@ -853,14 +859,14 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
// the height of the rows in the grid ?
else if (evt.PropertyName == PROPERTY_ROW_HEIGHT)
{
- if(m_pCurrentlyDisplayed)
+ if (m_xCurrentlyDisplayed)
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
+ 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);
}
@@ -959,17 +965,20 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
void SbaTableQueryBrowser::checkDocumentDataSource()
{
- SvTreeListEntry* pDataSourceEntry = nullptr;
- SvTreeListEntry* pContainerEntry = nullptr;
- SvTreeListEntry* pObjectEntry = getObjectEntry( m_aDocumentDataSource, &pDataSourceEntry, &pContainerEntry );
- bool bKnownDocDataSource = (nullptr != pObjectEntry);
+ std::unique_ptr<weld::TreeIter> xDataSourceEntry;
+ std::unique_ptr<weld::TreeIter> xContainerEntry;
+ std::unique_ptr<weld::TreeIter> xObjectEntry = getObjectEntry(m_aDocumentDataSource, &xDataSourceEntry, &xContainerEntry);
+ bool bKnownDocDataSource = static_cast<bool>(xObjectEntry);
if (!bKnownDocDataSource)
{
- if (nullptr != pDataSourceEntry)
- { // at least the data source is known
- if (nullptr != pContainerEntry)
+ if (xDataSourceEntry)
+ {
+ // at least the data source is known
+ if (xContainerEntry)
+ {
bKnownDocDataSource = true; // assume we know it.
// TODO: should we expand the object container? This may be too expensive just for checking...
+ }
else
{
if (m_aDocumentDataSource.has(DataAccessDescriptorProperty::CommandType)
@@ -1027,7 +1036,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() {}
@@ -1041,26 +1050,25 @@ namespace
}
}
-OUString SbaTableQueryBrowser::getDataSourceAccessor( SvTreeListEntry* _pDataSourceEntry ) const
+OUString SbaTableQueryBrowser::getDataSourceAccessor(const weld::TreeIter& rDataSourceEntry) const
{
- OSL_ENSURE( _pDataSourceEntry, "SbaTableQueryBrowser::getDataSourceAccessor: invalid entry!" );
-
- DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( _pDataSourceEntry->GetUserData() );
- OSL_ENSURE( pData, "SbaTableQueryBrowser::getDataSourceAccessor: invalid entry data!" );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry));
+ assert(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( _pDataSourceEntry );
+ return !pData->sAccessor.isEmpty() ? pData->sAccessor : GetEntryText(rDataSourceEntry);
}
-SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSource, const OUString& _rCommand, sal_Int32 _nCommandType,
- SvTreeListEntry** _ppDataSourceEntry, SvTreeListEntry** _ppContainerEntry, bool _bExpandAncestors,
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSource, const OUString& _rCommand, sal_Int32 nCommandType,
+ std::unique_ptr<weld::TreeIter>* ppDataSourceEntry, std::unique_ptr<weld::TreeIter>* ppContainerEntry, bool bExpandAncestors,
const SharedConnection& _rxConnection )
{
- if (_ppDataSourceEntry)
- *_ppDataSourceEntry = nullptr;
- if (_ppContainerEntry)
- *_ppContainerEntry = nullptr;
+ if (ppDataSourceEntry)
+ ppDataSourceEntry->reset();
+ if (ppContainerEntry)
+ ppContainerEntry->reset();
- SvTreeListEntry* pObject = nullptr;
+ std::unique_ptr<weld::TreeIter> xObject;
if ( m_pTreeView )
{
// look for the data source entry
@@ -1070,50 +1078,64 @@ SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSour
// #i33699#
FilterByEntryDataId aFilter( sDataSourceId );
- SvTreeListEntry* pDataSource = m_pTreeView->getListBox().GetEntryPosByName( sDisplayName, nullptr, &aFilter );
- if ( !pDataSource ) // check if the data source name is a file location
+ std::unique_ptr<weld::TreeIter> xDataSource = m_pTreeView->GetEntryPosByName( sDisplayName, nullptr, &aFilter );
+ if (!xDataSource) // check if the data source name is a file location
{
if ( bIsDataSourceURL )
{
// special case, the data source is a URL
// add new entries to the list box model
implAddDatasource( _rDataSource, _rxConnection );
- pDataSource = m_pTreeView->getListBox().GetEntryPosByName( sDisplayName, nullptr, &aFilter );
- OSL_ENSURE( pDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
+ xDataSource = m_pTreeView->GetEntryPosByName( sDisplayName, nullptr, &aFilter );
+ OSL_ENSURE( xDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
}
}
- if (_ppDataSourceEntry)
- // (caller wants to have it...)
- *_ppDataSourceEntry = pDataSource;
- if (pDataSource)
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+
+ if (xDataSource)
{
+ if (ppDataSourceEntry)
+ {
+ // (caller wants to have it...)
+ *ppDataSourceEntry = rTreeView.make_iterator(xDataSource.get());
+ }
+
// expand if required so
- if (_bExpandAncestors)
- m_pTreeView->getListBox().Expand(pDataSource);
+ if (bExpandAncestors)
+ rTreeView.expand_row(*xDataSource);
// look for the object container
- SvTreeListEntry* pCommandType = nullptr;
- switch (_nCommandType)
+ std::unique_ptr<weld::TreeIter> xCommandType;
+ if (nCommandType == CommandType::QUERY || nCommandType == CommandType::TABLE)
{
- case CommandType::TABLE:
- pCommandType = m_pTreeView->getListBox().GetModel()->GetEntry(pDataSource, CONTAINER_TABLES);
- break;
+ xCommandType = rTreeView.make_iterator(xDataSource.get());
+ if (!rTreeView.iter_children(*xCommandType))
+ xCommandType.reset();
+ else
+ {
+ // 1st child is queries, so we're already done if looking for CommandType::QUERY
- case CommandType::QUERY:
- pCommandType = m_pTreeView->getListBox().GetModel()->GetEntry(pDataSource, CONTAINER_QUERIES);
- break;
+ // 2nd child is tables
+ if (nCommandType == CommandType::TABLE && !rTreeView.iter_next_sibling(*xCommandType))
+ xCommandType.reset();
+ }
}
- if (_ppContainerEntry)
- *_ppContainerEntry = pCommandType;
-
- if (pCommandType)
+ if (xCommandType)
{
+ if (ppContainerEntry)
+ {
+ // (caller wants to have it...)
+ *ppContainerEntry = rTreeView.make_iterator(xCommandType.get());
+ }
+
+ rTreeView.make_unsorted();
+
// expand if required so
- if (_bExpandAncestors)
+ if (bExpandAncestors)
{
- m_pTreeView->getListBox().Expand(pCommandType);
+ rTreeView.expand_row(*xCommandType);
}
// look for the object
@@ -1121,7 +1143,7 @@ SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSour
do
{
OUString sPath;
- switch (_nCommandType)
+ switch (nCommandType)
{
case CommandType::TABLE:
sPath = _rCommand;
@@ -1135,13 +1157,16 @@ SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSour
default:
assert(false);
}
- pObject = m_pTreeView->getListBox().GetEntryPosByName(sPath, pCommandType);
- pCommandType = pObject;
+ xObject = m_pTreeView->GetEntryPosByName(sPath, xCommandType.get());
+ if (xObject)
+ rTreeView.copy_iterator(*xObject, *xCommandType);
+ else
+ xCommandType.reset();
if ( nIndex >= 0 )
{
- if (ensureEntryObject(pObject))
+ if (ensureEntryObject(*xObject))
{
- DBTreeListUserData* pParentData = static_cast< DBTreeListUserData* >( pObject->GetUserData() );
+ 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 );
@@ -1149,7 +1174,7 @@ SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSour
{
if ( xCollection->hasByName(sPath) )
{
- if(!m_pTreeView->getListBox().GetEntryPosByName(sPath,pObject))
+ if(!m_pTreeView->GetEntryPosByName(sPath, xObject.get()))
{
Reference<XNameAccess> xChild(xCollection->getByName(sPath),UNO_QUERY);
DBTreeListUserData* pEntryData = new DBTreeListUserData;
@@ -1158,7 +1183,7 @@ SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSour
{
pEntryData->eType = etQueryContainer;
}
- implAppendEntry( pObject, sPath, pEntryData, pEntryData->eType );
+ implAppendEntry(xObject.get(), sPath, pEntryData);
}
}
}
@@ -1170,23 +1195,25 @@ SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const OUString& _rDataSour
}
}
while ( nIndex >= 0 );
+
+ rTreeView.make_sorted();
}
}
}
- return pObject;
+ return xObject;
}
-SvTreeListEntry* SbaTableQueryBrowser::getObjectEntry(const svx::ODataAccessDescriptor& _rDescriptor,
- SvTreeListEntry** _ppDataSourceEntry, SvTreeListEntry** _ppContainerEntry)
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getObjectEntry(const svx::ODataAccessDescriptor& rDescriptor,
+ std::unique_ptr<weld::TreeIter>* ppDataSourceEntry, std::unique_ptr<weld::TreeIter>* ppContainerEntry)
{
// extract the props from the descriptor
OUString sDataSource;
OUString sCommand;
sal_Int32 nCommandType = CommandType::COMMAND;
bool bEscapeProcessing = true;
- extractDescriptorProps(_rDescriptor, sDataSource, sCommand, nCommandType, bEscapeProcessing);
+ extractDescriptorProps(rDescriptor, sDataSource, sCommand, nCommandType, bEscapeProcessing);
- return getObjectEntry( sDataSource, sCommand, nCommandType, _ppDataSourceEntry, _ppContainerEntry, false/*_bExpandAncestors*/ );
+ return getObjectEntry(sDataSource, sCommand, nCommandType, ppDataSourceEntry, ppContainerEntry, false /*bExpandAncestors*/);
}
void SbaTableQueryBrowser::connectExternalDispatches()
@@ -1198,33 +1225,33 @@ void SbaTableQueryBrowser::connectExternalDispatches()
if ( m_aExternalFeatures.empty() )
{
- const char* pURLs[] = {
- ".uno:DataSourceBrowser/DocumentDataSource",
- ".uno:DataSourceBrowser/FormLetter",
- ".uno:DataSourceBrowser/InsertColumns",
- ".uno:DataSourceBrowser/InsertContent",
+ static constexpr OUString aURLs[] {
+ u".uno:DataSourceBrowser/DocumentDataSource"_ustr,
+ u".uno:DataSourceBrowser/FormLetter"_ustr,
+ u".uno:DataSourceBrowser/InsertColumns"_ustr,
+ u".uno:DataSourceBrowser/InsertContent"_ustr,
};
- const sal_uInt16 nIds[] = {
+ static constexpr sal_uInt16 nIds[] = {
ID_BROWSER_DOCUMENT_DATASOURCE,
ID_BROWSER_FORMLETTER,
ID_BROWSER_INSERTCOLUMNS,
ID_BROWSER_INSERTCONTENT
};
- for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i )
+ for ( size_t i=0; i < std::size( aURLs ); ++i )
{
URL aURL;
- aURL.Complete = OUString::createFromAscii( pURLs[i] );
+ aURL.Complete = aURLs[i];
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aURL );
- m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( aURL );
+ m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( std::move(aURL) );
}
}
for (auto & externalFeature : m_aExternalFeatures)
{
externalFeature.second.xDispatcher = xProvider->queryDispatch(
- externalFeature.second.aURL, "_parent", FrameSearchFlag::PARENT
+ externalFeature.second.aURL, u"_parent"_ustr, FrameSearchFlag::PARENT
);
if ( externalFeature.second.xDispatcher.get() == static_cast< XDispatch* >( this ) )
@@ -1264,8 +1291,8 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
if ( pToolbox )
{
bool bHaveDispatcher = m_aExternalFeatures[ _nId ].xDispatcher.is();
- if ( bHaveDispatcher != pToolbox->IsItemVisible( _nId ) )
- bHaveDispatcher ? pToolbox->ShowItem( _nId ) : pToolbox->HideItem( _nId );
+ if ( bHaveDispatcher != pToolbox->IsItemVisible( ToolBoxItemId(_nId) ) )
+ bHaveDispatcher ? pToolbox->ShowItem( ToolBoxItemId(_nId) ) : pToolbox->HideItem( ToolBoxItemId(_nId) );
}
// and invalidate this feature in general
@@ -1307,22 +1334,26 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const css::lang::EventObject& _rS
{
Reference<XConnection> xCon(_rSource.Source, UNO_QUERY);
if ( xCon.is() && m_pTreeView )
- { // our connection is in dispose so we have to find the entry equal with this connection
+ {
+ // our connection is in dispose so we have to find the entry equal with this connection
// and close it what means to collapse the entry
// get the top-level representing the removed data source
- SvTreeListEntry* pDSLoop = m_pTreeView->getListBox().FirstChild(nullptr);
- while (pDSLoop)
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xDSLoop(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xDSLoop))
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pDSLoop->GetUserData());
- if ( pData && pData->xConnection == xCon )
+ do
{
- // we set the connection to null to avoid a second disposing of the connection
- pData->xConnection.clear();
- closeConnection(pDSLoop,false);
- break;
+ 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
+ pData->xConnection.clear();
+ closeConnection(*xDSLoop, false);
+ break;
+ }
}
-
- pDSLoop = pDSLoop->NextSibling();
+ while (rTreeView.iter_next_sibling(*xDSLoop));
}
}
else
@@ -1427,7 +1458,7 @@ void SbaTableQueryBrowser::attachFrame(const Reference< css::frame::XFrame > & _
Reference< XFrame > xCurrentFrame( getFrame() );
if ( xCurrentFrame.is() )
{
- m_xCurrentFrameParent = xCurrentFrame->findFrame("_parent",FrameSearchFlag::PARENT);
+ m_xCurrentFrameParent = xCurrentFrame->findFrame(u"_parent"_ustr,FrameSearchFlag::PARENT);
if ( m_xCurrentFrameParent.is() )
m_xCurrentFrameParent->addFrameActionListener(static_cast<css::frame::XFrameActionListener*>(this));
@@ -1436,13 +1467,13 @@ void SbaTableQueryBrowser::attachFrame(const Reference< css::frame::XFrame > & _
{
Reference< XPropertySet > xFrameProps( m_aCurrentFrame.getFrame(), UNO_QUERY_THROW );
Reference< XLayoutManager > xLayouter(
- xFrameProps->getPropertyValue("LayoutManager"),
+ xFrameProps->getPropertyValue(u"LayoutManager"_ustr),
UNO_QUERY );
if ( xLayouter.is() )
{
Reference< XUIElement > xUI(
- xLayouter->getElement( "private:resource/toolbar/toolbar" ),
+ xLayouter->getElement( u"private:resource/toolbar/toolbar"_ustr ),
UNO_SET_THROW );
m_xMainToolbar.set(xUI->getRealInterface(), css::uno::UNO_QUERY);
OSL_ENSURE( m_xMainToolbar.is(), "SbaTableQueryBrowser::attachFrame: where's my toolbox?" );
@@ -1601,15 +1632,19 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
case ID_TREE_CLOSE_CONN:
case ID_TREE_EDIT_DATABASE:
{
- SvTreeListEntry* pCurrentEntry( m_pTreeView->getListBox().GetCurEntry() );
- EntryType eType = getEntryType( pCurrentEntry );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xCurrentEntry(rTreeView.make_iterator());
+ if (!rTreeView.get_cursor(xCurrentEntry.get()))
+ return aReturn;
+
+ EntryType eType = getEntryType(*xCurrentEntry);
if ( eType == etUnknown )
return aReturn;
- SvTreeListEntry* pDataSourceEntry = m_pTreeView->getListBox().GetRootLevelParent( pCurrentEntry );
+ std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(xCurrentEntry.get());
DBTreeListUserData* pDSData
- = pDataSourceEntry
- ? static_cast< DBTreeListUserData* >( pDataSourceEntry->GetUserData() )
+ = xDataSourceEntry
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry))
: nullptr;
if ( nId == ID_TREE_CLOSE_CONN )
@@ -1619,14 +1654,14 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
else if ( nId == ID_TREE_EDIT_DATABASE )
{
::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithComponentContext( getORB(),
- "/org.openoffice.Office.DataAccess/Policies/Features/Common" ) );
+ u"/org.openoffice.Office.DataAccess/Policies/Features/Common"_ustr ) );
bool bHaveEditDatabase( true );
- OSL_VERIFY( aConfig.getNodeValue( "EditDatabaseFromDataSourceView" ) >>= bHaveEditDatabase );
- aReturn.bEnabled = getORB().is() && ( pDataSourceEntry != nullptr ) && bHaveEditDatabase;
+ OSL_VERIFY( aConfig.getNodeValue( u"EditDatabaseFromDataSourceView"_ustr ) >>= bHaveEditDatabase );
+ aReturn.bEnabled = getORB().is() && xDataSourceEntry && bHaveEditDatabase;
}
else if ( nId == ID_BROWSER_COPY )
{
- aReturn.bEnabled = isEntryCopyAllowed( pCurrentEntry );
+ aReturn.bEnabled = isEntryCopyAllowed(*xCurrentEntry);
}
return aReturn;
@@ -1769,13 +1804,24 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
break;
case ID_TREE_EDIT_DATABASE:
- implAdministrate( m_pTreeView->getListBox().GetCurEntry() );
+ {
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_cursor(xIter.get()))
+ implAdministrate(*xIter);
break;
-
+ }
case ID_TREE_CLOSE_CONN:
- closeConnection( m_pTreeView->getListBox().GetRootLevelParent( m_pTreeView->getListBox().GetCurEntry() ) );
+ {
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
+ if (rTreeView.get_cursor(xIter.get()))
+ {
+ xIter = m_pTreeView->GetRootLevelParent(xIter.get());
+ closeConnection(*xIter);
+ }
break;
-
+ }
case ID_TREE_ADMINISTRATE:
svx::administrateDatabaseRegistration( getFrameWeld() );
break;
@@ -1814,14 +1860,17 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
// nothing to do
break;
- SvTreeListEntry* pSelected = m_pCurrentlyDisplayed;
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xSelected = m_xCurrentlyDisplayed ?
+ rTreeView.make_iterator(m_xCurrentlyDisplayed.get()) : nullptr;
+
// unload
unloadAndCleanup( false );
// reselect the entry
- if ( pSelected )
+ if ( xSelected )
{
- implSelect( pSelected );
+ implSelect(xSelected.get());
}
else
{
@@ -1866,7 +1915,7 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
if (pSelection != nullptr)
{
aSelection.realloc(pSelection->GetSelectCount());
- long nIdx = pSelection->FirstSelected();
+ tools::Long nIdx = pSelection->FirstSelected();
Any* pSelectionNos = aSelection.getArray();
while (nIdx != SFX_ENDOFSELECTION)
{
@@ -1932,7 +1981,10 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
case ID_BROWSER_COPY:
if(m_pTreeView->HasChildPathFocus())
{
- copyEntry(m_pTreeView->getListBox().GetCurEntry());
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xCursor(rTreeView.make_iterator());
+ if (rTreeView.get_cursor(xCursor.get()))
+ copyEntry(*xCursor);
}
else if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing() && getBrowserView()->getVclControl()->GetSelectRowCount() < 1)
{
@@ -1947,13 +1999,12 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
void SbaTableQueryBrowser::implAddDatasource( const OUString& _rDataSourceName, const SharedConnection& _rxConnection )
{
- Image a, b, c;
- OUString d, e;
+ OUString a, b, c, d, e;
implAddDatasource( _rDataSourceName, a, d, b, e, c, _rxConnection );
}
-void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, Image& _rDbImage,
- OUString& _rQueryName, Image& _rQueryImage, OUString& _rTableName, Image& _rTableImage,
+void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString& _rDbImage,
+ OUString& _rQueryName, OUString& _rQueryImage, OUString& _rTableName, OUString& _rTableImage,
const SharedConnection& _rxConnection)
{
SolarMutexGuard aGuard;
@@ -1963,12 +2014,12 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, Image& _r
if (_rTableName.isEmpty())
_rTableName = DBA_RES(RID_STR_TABLES_CONTAINER);
- if (!_rQueryImage)
- _rQueryImage = ImageProvider::getFolderImage( DatabaseObject::QUERY );
- if (!_rTableImage)
- _rTableImage = ImageProvider::getFolderImage( DatabaseObject::TABLE );
+ if (_rQueryImage.isEmpty())
+ _rQueryImage = ImageProvider::getFolderImageId(DatabaseObject::QUERY);
+ if (_rTableImage.isEmpty())
+ _rTableImage = ImageProvider::getFolderImageId(DatabaseObject::TABLE);
- if (!_rDbImage)
+ if (_rDbImage.isEmpty())
_rDbImage = ImageProvider::getDatabaseImage();
// add the entry for the data source
@@ -1977,40 +2028,50 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, Image& _r
OUString sDSDisplayName, sDataSourceId;
getDataSourceDisplayName_isURL( _rDbName, sDSDisplayName, sDataSourceId );
- SvTreeListEntry* pDatasourceEntry = m_pTreeView->getListBox().InsertEntry( sDSDisplayName, _rDbImage, _rDbImage );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData = new DBTreeListUserData;
pDSData->eType = etDatasource;
pDSData->sAccessor = sDataSourceId;
pDSData->xConnection = _rxConnection;
- pDatasourceEntry->SetUserData(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());
+ rTreeView.set_image(*xDatasourceEntry, _rDbImage);
+ rTreeView.set_text_emphasis(*xDatasourceEntry, false, 0);
// the child for the queries container
{
DBTreeListUserData* pQueriesData = new DBTreeListUserData;
pQueriesData->eType = etQueryContainer;
+ sId = weld::toId(pQueriesData);
- m_pTreeView->getListBox().InsertEntry(
- _rQueryName, _rQueryImage, _rQueryImage, pDatasourceEntry,
- true /*ChildrenOnDemand*/, TREELIST_APPEND, pQueriesData );
+ std::unique_ptr<weld::TreeIter> xRet(rTreeView.make_iterator());
+ rTreeView.insert(xDatasourceEntry.get(), -1, &_rQueryName, &sId,
+ nullptr, nullptr, true /*ChildrenOnDemand*/, xRet.get());
+ rTreeView.set_image(*xRet, _rQueryImage);
+ rTreeView.set_text_emphasis(*xRet, false, 0);
}
// the child for the tables container
{
DBTreeListUserData* pTablesData = new DBTreeListUserData;
pTablesData->eType = etTableContainer;
+ sId = weld::toId(pTablesData);
- m_pTreeView->getListBox().InsertEntry(
- _rTableName, _rTableImage, _rTableImage, pDatasourceEntry,
- true /*ChildrenOnDemand*/, TREELIST_APPEND, pTablesData );
+ std::unique_ptr<weld::TreeIter> xRet(rTreeView.make_iterator());
+ rTreeView.insert(xDatasourceEntry.get(), -1, &_rTableName, &sId,
+ nullptr, nullptr, true /*ChildrenOnDemand*/, xRet.get());
+ rTreeView.set_image(*xRet, _rTableImage);
+ rTreeView.set_text_emphasis(*xRet, false, 0);
}
-
}
void SbaTableQueryBrowser::initializeTreeModel()
{
if (m_xDatabaseContext.is())
{
- Image aDBImage, aQueriesImage, aTablesImage;
+ OUString aDBImage, aQueriesImage, aTablesImage;
OUString sQueriesName, sTablesName;
// fill the model with the names of the registered datasources
@@ -2021,11 +2082,14 @@ void SbaTableQueryBrowser::initializeTreeModel()
}
void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAccess,
- SvTreeListEntry* _pParent,
- EntryType _eEntryType)
+ const weld::TreeIter& rParent,
+ EntryType eEntryType)
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pParent->GetUserData());
- if(pData) // don't ask if the nameaccess is already set see OnExpandEntry views and tables
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ rTreeView.make_unsorted();
+
+ 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;
try
@@ -2033,17 +2097,17 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
const Sequence<OUString> aNames = _xNameAccess->getElementNames();
for (const OUString& rName : aNames)
{
- if( !m_pTreeView->getListBox().GetEntryPosByName(rName,_pParent))
+ if( !m_pTreeView->GetEntryPosByName(rName, &rParent))
{
DBTreeListUserData* pEntryData = new DBTreeListUserData;
- pEntryData->eType = _eEntryType;
- if ( _eEntryType == etQuery )
+ pEntryData->eType = eEntryType;
+ if ( eEntryType == etQuery )
{
Reference<XNameAccess> xChild(_xNameAccess->getByName(rName),UNO_QUERY);
if ( xChild.is() )
pEntryData->eType = etQueryContainer;
}
- implAppendEntry( _pParent, rName, pEntryData, pEntryData->eType );
+ implAppendEntry(&rParent, rName, pEntryData);
}
}
}
@@ -2051,38 +2115,42 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
{
SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::populateTree: could not fill the tree");
}
+
+ rTreeView.make_sorted();
}
-SvTreeListEntry* SbaTableQueryBrowser::implAppendEntry( SvTreeListEntry* _pParent, const OUString& _rName, void* _pUserData, EntryType _eEntryType )
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implAppendEntry(const weld::TreeIter* pParent, const OUString& rName, const DBTreeListUserData* pUserData)
{
- std::unique_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) );
+ EntryType eEntryType = pUserData->eType;
- Image aImage;
- pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), aImage );
+ std::unique_ptr<ImageProvider> xImageProvider(getImageProviderFor(pParent));
- SvTreeListEntry* pNewEntry = m_pTreeView->getListBox().InsertEntry( _rName, _pParent, _eEntryType == etQueryContainer , TREELIST_APPEND, _pUserData );
+ OUString aImage = xImageProvider->getImageId(rName, getDatabaseObjectType(eEntryType));
- m_pTreeView->getListBox().SetExpandedEntryBmp( pNewEntry, aImage );
- m_pTreeView->getListBox().SetCollapsedEntryBmp( pNewEntry, aImage );
+ 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());
+ rTreeView.set_image(*xNewEntry, aImage);
+ rTreeView.set_text_emphasis(*xNewEntry, false, 0);
- return pNewEntry;
+ return xNewEntry;
}
-IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvTreeListEntry*, _pParent, bool)
+IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, const weld::TreeIter&, rParent, bool)
{
- if (_pParent->HasChildren())
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ if (rTreeView.iter_has_child(rParent))
+ {
// nothing to do...
return true;
+ }
- SvTreeListEntry* pFirstParent = m_pTreeView->getListBox().GetRootLevelParent(_pParent);
- OSL_ENSURE(pFirstParent,"SbaTableQueryBrowser::OnExpandEntry: No rootlevelparent!");
+ std::unique_ptr<weld::TreeIter> xFirstParent = m_pTreeView->GetRootLevelParent(&rParent);
+ OSL_ENSURE(xFirstParent,"SbaTableQueryBrowser::OnExpandEntry: No rootlevelparent!");
- DBTreeListUserData* pData = static_cast< DBTreeListUserData* >(_pParent->GetUserData());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
assert(pData && "SbaTableQueryBrowser::OnExpandEntry: No user data!");
-#if OSL_DEBUG_LEVEL > 0
- SvLBoxString* pString = static_cast<SvLBoxString*>(pFirstParent->GetFirstItem(SvLBoxItemType::String));
- OSL_ENSURE(pString,"SbaTableQueryBrowser::OnExpandEntry: No string item!");
-#endif
if (etTableContainer == pData->eType)
{
@@ -2090,9 +2158,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvTreeListEntry*, _pParent, bool)
// it could be that we already have a connection
SharedConnection xConnection;
- ensureConnection( pFirstParent, xConnection );
-
- if ( xConnection.is() )
+ if (ensureConnection(xFirstParent.get(), xConnection) && xConnection.is())
{
SQLExceptionInfo aInfo;
try
@@ -2106,12 +2172,12 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvTreeListEntry*, _pParent, bool)
// the nameaccess will be overwritten in populateTree
Reference<XViewsSupplier> xViewSup(xConnection,UNO_QUERY);
if(xViewSup.is())
- populateTree( xViewSup->getViews(), _pParent, etTableOrView );
+ populateTree( xViewSup->getViews(), rParent, etTableOrView );
Reference<XTablesSupplier> xTabSup(xConnection,UNO_QUERY);
if(xTabSup.is())
{
- populateTree( xTabSup->getTables(), _pParent, etTableOrView );
+ populateTree( xTabSup->getTables(), rParent, etTableOrView );
Reference<XContainer> xCont(xTabSup->getTables(),UNO_QUERY);
if(xCont.is())
// add as listener to know when elements are inserted or removed
@@ -2165,35 +2231,34 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvTreeListEntry*, _pParent, bool)
// 0 indicates that an error occurred
}
else
- { // we have to expand the queries or bookmarks
- if (ensureEntryObject(_pParent))
+ {
+ // we have to expand the queries or bookmarks
+ if (ensureEntryObject(rParent))
{
- DBTreeListUserData* pParentData = static_cast< DBTreeListUserData* >( _pParent->GetUserData() );
+ DBTreeListUserData* pParentData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY );
- populateTree( xCollection, _pParent, etQuery );
+ populateTree(xCollection, rParent, etQuery);
}
}
return true;
}
-bool SbaTableQueryBrowser::ensureEntryObject( SvTreeListEntry* _pEntry )
+bool SbaTableQueryBrowser::ensureEntryObject(const weld::TreeIter& rEntry)
{
- OSL_ENSURE(_pEntry, "SbaTableQueryBrowser::ensureEntryObject: invalid argument!");
- if (!_pEntry)
- return false;
-
- EntryType eType = getEntryType( _pEntry );
+ EntryType eType = getEntryType(rEntry);
// the user data of the entry
- DBTreeListUserData* pEntryData = static_cast<DBTreeListUserData*>(_pEntry->GetUserData());
- OSL_ENSURE(pEntryData,"ensureEntryObject: user data should already be set!");
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
+ assert(pEntryData && "ensureEntryObject: user data should already be set!");
- SvTreeListEntry* pDataSourceEntry = m_pTreeView->getListBox().GetRootLevelParent(_pEntry);
+ std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(&rEntry);
bool bSuccess = false;
switch (eType)
{
case etQueryContainer:
+ {
if ( pEntryData->xContainer.is() )
{
// nothing to do
@@ -2201,14 +2266,13 @@ bool SbaTableQueryBrowser::ensureEntryObject( SvTreeListEntry* _pEntry )
break;
}
+ std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
+ if (rTreeView.iter_parent(*xParent))
{
- SvTreeListEntry* pParent = m_pTreeView->getListBox().GetParent(_pEntry);
- if ( pParent != pDataSourceEntry )
+ if (rTreeView.iter_compare(*xParent, *xDataSourceEntry) != 0)
{
- SvLBoxString* pString = static_cast<SvLBoxString*>(_pEntry->GetFirstItem(SvLBoxItemType::String));
- OSL_ENSURE(pString,"There must be a string item!");
- OUString aName(pString->GetText());
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pParent->GetUserData());
+ OUString aName(rTreeView.get_text(rEntry));
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xParent));
try
{
Reference< XNameAccess > xNameAccess(pData->xContainer,UNO_QUERY);
@@ -2227,7 +2291,7 @@ bool SbaTableQueryBrowser::ensureEntryObject( SvTreeListEntry* _pEntry )
try
{
Reference< XQueryDefinitionsSupplier > xQuerySup;
- m_xDatabaseContext->getByName( getDataSourceAccessor( pDataSourceEntry ) ) >>= xQuerySup;
+ m_xDatabaseContext->getByName(getDataSourceAccessor(*xDataSourceEntry)) >>= xQuerySup;
if (xQuerySup.is())
{
Reference< XNameAccess > xQueryDefs = xQuerySup->getQueryDefinitions();
@@ -2250,13 +2314,12 @@ bool SbaTableQueryBrowser::ensureEntryObject( SvTreeListEntry* _pEntry )
}
}
break;
-
+ }
default:
SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::ensureEntryObject: ooops ... missing some implementation here!");
// TODO ...
break;
}
-
return bSuccess;
}
@@ -2274,24 +2337,24 @@ bool SbaTableQueryBrowser::implSelect(const svx::ODataAccessDescriptor& _rDescri
}
bool SbaTableQueryBrowser::implLoadAnything(const OUString& _rDataSourceName, const OUString& _rCommand,
- const sal_Int32 _nCommandType, const bool _bEscapeProcessing, const SharedConnection& _rxConnection)
+ const sal_Int32 nCommandType, const bool _bEscapeProcessing, const SharedConnection& _rxConnection)
{
try
{
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 ...
@@ -2357,72 +2420,81 @@ bool SbaTableQueryBrowser::implLoadAnything(const OUString& _rDataSourceName, co
}
bool SbaTableQueryBrowser::implSelect(const OUString& _rDataSourceName, const OUString& _rCommand,
- const sal_Int32 _nCommandType, const bool _bEscapeProcessing,
+ const sal_Int32 nCommandType, const bool _bEscapeProcessing,
const SharedConnection& _rxConnection,
bool _bSelectDirect)
{
- if (_rDataSourceName.getLength() && _rCommand.getLength() && (-1 != _nCommandType))
+ if (!_rDataSourceName.getLength() || !_rCommand.getLength() || (-1 == nCommandType))
+ return false;
+
+ std::unique_ptr<weld::TreeIter> xDataSource;
+ std::unique_ptr<weld::TreeIter> xCommandType;
+ std::unique_ptr<weld::TreeIter> xCommand = getObjectEntry( _rDataSourceName, _rCommand, nCommandType, &xDataSource, &xCommandType, true, _rxConnection );
+
+ if (xCommand)
{
- SvTreeListEntry* pDataSource = nullptr;
- SvTreeListEntry* pCommandType = nullptr;
- SvTreeListEntry* pCommand = getObjectEntry( _rDataSourceName, _rCommand, _nCommandType, &pDataSource, &pCommandType, true, _rxConnection );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- if (pCommand)
+ bool bSuccess = true;
+ if ( _bSelectDirect )
{
- bool bSuccess = true;
- if ( _bSelectDirect )
- {
- bSuccess = implSelect( pCommand );
- }
- else
- {
- m_pTreeView->getListBox().Select( pCommand );
- }
-
- if ( bSuccess )
- {
- m_pTreeView->getListBox().MakeVisible(pCommand);
- m_pTreeView->getListBox().SetCursor(pCommand);
- }
+ bSuccess = implSelect(xCommand.get());
}
- else if (!pCommandType)
+ else
{
- if ( m_pCurrentlyDisplayed )
- { // tell the old entry (if any) it has been deselected
- selectPath(m_pCurrentlyDisplayed, false);
- m_pCurrentlyDisplayed = nullptr;
- }
+ rTreeView.select(*xCommand);
+ }
- // we have a command and need to display this in the rowset
- return implLoadAnything(_rDataSourceName, _rCommand, _nCommandType, _bEscapeProcessing, _rxConnection);
+ if ( bSuccess )
+ {
+ rTreeView.scroll_to_row(*xCommand);
+ rTreeView.set_cursor(*xCommand);
+ }
+ }
+ else if (!xCommandType)
+ {
+ if (m_xCurrentlyDisplayed)
+ {
+ // tell the old entry (if any) it has been deselected
+ selectPath(m_xCurrentlyDisplayed.get(), false);
+ m_xCurrentlyDisplayed.reset();
}
+
+ // we have a command and need to display this in the rowset
+ return implLoadAnything(_rDataSourceName, _rCommand, nCommandType, _bEscapeProcessing, _rxConnection);
}
return false;
}
IMPL_LINK_NOARG(SbaTableQueryBrowser, OnSelectionChange, LinkParamNone*, void)
{
- implSelect( m_pTreeView->getListBox().FirstSelected() );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xSelection(rTreeView.make_iterator());
+ if (!rTreeView.get_selected(xSelection.get()))
+ xSelection.reset();
+ implSelect(xSelection.get());
}
-SvTreeListEntry* SbaTableQueryBrowser::implGetConnectionEntry(SvTreeListEntry* _pEntry) const
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implGetConnectionEntry(const weld::TreeIter& rEntry) const
{
- SvTreeListEntry* pCurrentEntry = _pEntry;
- DBTreeListUserData* pEntryData = static_cast< DBTreeListUserData* >( pCurrentEntry->GetUserData() );
- while(pEntryData->eType != etDatasource )
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xCurrentEntry(rTreeView.make_iterator(&rEntry));
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry));
+ while (pEntryData->eType != etDatasource)
{
- pCurrentEntry = m_pTreeView->GetTreeModel()->GetParent(pCurrentEntry);
- pEntryData = static_cast< DBTreeListUserData* >( pCurrentEntry->GetUserData() );
+ rTreeView.iter_parent(*xCurrentEntry);
+ pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry));
}
- return pCurrentEntry;
+ return xCurrentEntry;
}
-bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
+bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
{
- if ( !_pEntry )
+ if ( !pEntry )
return false;
- DBTreeListUserData* pEntryData = static_cast< DBTreeListUserData* >( _pEntry->GetUserData() );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pEntry));
switch (pEntryData->eType)
{
case etTableOrView:
@@ -2433,16 +2505,16 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
return false;
}
- OSL_ENSURE(m_pTreeView->GetTreeModel()->HasParent(_pEntry), "SbaTableQueryBrowser::implSelect: invalid entry (1)!");
- OSL_ENSURE(m_pTreeView->GetTreeModel()->HasParent(m_pTreeView->GetTreeModel()->GetParent(_pEntry)), "SbaTableQueryBrowser::implSelect: invalid entry (2)!");
+ OSL_ENSURE(rTreeView.get_iter_depth(*pEntry) >= 2, "SbaTableQueryBrowser::implSelect: invalid entry!");
// get the entry for the tables or queries
- SvTreeListEntry* pContainer = m_pTreeView->GetTreeModel()->GetParent(_pEntry);
- DBTreeListUserData* pContainerData = static_cast<DBTreeListUserData*>(pContainer->GetUserData());
+ std::unique_ptr<weld::TreeIter> xContainer = rTreeView.make_iterator(pEntry);
+ rTreeView.iter_parent(*xContainer);
+ DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
// get the entry for the datasource
- SvTreeListEntry* pConnection = implGetConnectionEntry(pContainer);
- DBTreeListUserData* pConData = static_cast<DBTreeListUserData*>(pConnection->GetUserData());
+ std::unique_ptr<weld::TreeIter> xConnection = implGetConnectionEntry(*xContainer);
+ DBTreeListUserData* pConData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xConnection));
// reinitialize the rowset
// but first check if it is necessary
@@ -2455,20 +2527,21 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
Reference<XConnection> xOldConnection(xRowSetProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
// the name of the table or query
- SvLBoxString* pString = static_cast<SvLBoxString*>(_pEntry->GetFirstItem(SvLBoxItemType::String));
- OSL_ENSURE(pString,"There must be a string item!");
- const OUString sSimpleName = pString->GetText();
+ const OUString sSimpleName = rTreeView.get_text(*pEntry);
OUStringBuffer sNameBuffer(sSimpleName);
if ( etQueryContainer == pContainerData->eType )
{
- SvTreeListEntry* pTemp = pContainer;
- while( m_pTreeView->GetTreeModel()->GetParent(pTemp) != pConnection )
+ std::unique_ptr<weld::TreeIter> xTemp = rTreeView.make_iterator(xContainer.get());
+ std::unique_ptr<weld::TreeIter> xNextTemp = rTreeView.make_iterator(xTemp.get());
+ if (rTreeView.iter_parent(*xNextTemp))
{
- sNameBuffer.insert(0,'/');
- pString = static_cast<SvLBoxString*>(pTemp->GetFirstItem(SvLBoxItemType::String));
- OSL_ENSURE(pString,"There must be a string item!");
- sNameBuffer.insert(0,pString->GetText());
- pTemp = m_pTreeView->GetTreeModel()->GetParent(pTemp);
+ while (rTreeView.iter_compare(*xNextTemp, *xConnection) != 0)
+ {
+ sNameBuffer.insert(0, rTreeView.get_text(*xTemp) + "/");
+ rTreeView.copy_iterator(*xNextTemp, *xTemp);
+ if (!rTreeView.iter_parent(*xNextTemp))
+ break;
+ }
}
}
OUString aName = sNameBuffer.makeStringAndClear();
@@ -2492,16 +2565,16 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
weld::WaitObject aWaitCursor(getFrameWeld());
// tell the old entry it has been deselected
- selectPath(m_pCurrentlyDisplayed, false);
- m_pCurrentlyDisplayed = nullptr;
+ selectPath(m_xCurrentlyDisplayed.get(), false);
+ m_xCurrentlyDisplayed.reset();
// not really loaded
- m_pCurrentlyDisplayed = _pEntry;
+ m_xCurrentlyDisplayed = rTreeView.make_iterator(pEntry);
// tell the new entry it has been selected
- selectPath(m_pCurrentlyDisplayed);
+ selectPath(m_xCurrentlyDisplayed.get());
// get the name of the data source currently selected
- ensureConnection( m_pCurrentlyDisplayed, pConData->xConnection );
+ (void)ensureConnection(m_xCurrentlyDisplayed.get(), pConData->xConnection);
if ( !pConData->xConnection.is() )
{
@@ -2547,7 +2620,7 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
bool bEscapeProcessing = true;
if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName))
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pEntry->GetUserData());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pEntry));
if ( !pData->xObjectProperties.is() )
{
Reference<XInterface> xObject;
@@ -2579,7 +2652,7 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
OUString sReplace = sSql.replaceFirst(sFilter, "");
xAnalyzer->setQuery(sReplace);
Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY);
- xComposer->setFilter("0=1");
+ xComposer->setFilter(u"0=1"_ustr);
aName = xAnalyzer->getQuery();
nCommandType = CommandType::COMMAND;
}
@@ -2596,7 +2669,7 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
}
}
- OUString sDataSourceName( getDataSourceAccessor( pConnection ) );
+ OUString sDataSourceName(getDataSourceAccessor(*xConnection));
bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, bEscapeProcessing, pConData->xConnection );
if ( !bSuccess )
{ // clean up
@@ -2634,72 +2707,93 @@ bool SbaTableQueryBrowser::implSelect( SvTreeListEntry* _pEntry )
return bSuccess;
}
-SvTreeListEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAccess>& _rxNameAccess)
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAccess>& rxNameAccess)
{
- DBTreeListBox& rListBox = m_pTreeView->getListBox();
- SvTreeListEntry* pContainer = nullptr;
- SvTreeListEntry* pDSLoop = rListBox.FirstChild(nullptr);
- while (pDSLoop)
- {
- pContainer = rListBox.GetEntry(pDSLoop, CONTAINER_QUERIES);
- DBTreeListUserData* pQueriesData = static_cast<DBTreeListUserData*>(pContainer->GetUserData());
- if ( pQueriesData && pQueriesData->xContainer == _rxNameAccess )
- break;
+ std::unique_ptr<weld::TreeIter> xContainer;
- pContainer = rListBox.GetEntry(pDSLoop, CONTAINER_TABLES);
- DBTreeListUserData* pTablesData = static_cast<DBTreeListUserData*>(pContainer->GetUserData());
- if ( pTablesData && pTablesData->xContainer == _rxNameAccess )
- break;
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xDSLoop(rTreeView.make_iterator(xContainer.get()));
+ if (rTreeView.get_iter_first(*xDSLoop))
+ {
+ do
+ {
+ xContainer = rTreeView.make_iterator(xDSLoop.get());
+ if (rTreeView.iter_children(*xContainer))
+ {
+ // 1st child is queries
+ DBTreeListUserData* pQueriesData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
+ if (pQueriesData && pQueriesData->xContainer == rxNameAccess)
+ break;
- pDSLoop = pDSLoop->NextSibling();
- pContainer = nullptr;
+ if (rTreeView.iter_next_sibling(*xContainer))
+ {
+ // 2nd child is tables
+ DBTreeListUserData* pTablesData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
+ if (pTablesData && pTablesData->xContainer == rxNameAccess)
+ break;
+ }
+ }
+ xContainer.reset();
+ }
+ while (rTreeView.iter_next_sibling(*xDSLoop));
}
- return pContainer;
+
+ return xContainer;
}
-void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEvent )
+void SAL_CALL SbaTableQueryBrowser::elementInserted(const ContainerEvent& rEvent)
{
SolarMutexGuard aSolarGuard;
- Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
+ Reference< XNameAccess > xNames(rEvent.Source, UNO_QUERY);
// first search for a definition container where we can insert this element
- SvTreeListEntry* pEntry = getEntryFromContainer(xNames);
- if(pEntry) // found one
+ std::unique_ptr<weld::TreeIter> xEntry = getEntryFromContainer(xNames);
+ if (xEntry) // found one
{
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ rTreeView.make_unsorted();
+
// insert the new entry into the tree
- DBTreeListUserData* pContainerData = static_cast<DBTreeListUserData*>(pEntry->GetUserData());
- OSL_ENSURE(pContainerData, "elementInserted: There must be user data for this type!");
+ DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xEntry));
+ assert(pContainerData && "elementInserted: There must be user data for this type!");
DBTreeListUserData* pNewData = new DBTreeListUserData;
bool bIsTable = etTableContainer == pContainerData->eType;
if ( bIsTable )
{
- _rEvent.Element >>= pNewData->xObjectProperties;// remember the new element
+ rEvent.Element >>= pNewData->xObjectProperties;// remember the new element
pNewData->eType = etTableOrView;
}
else
{
- if (static_cast<sal_Int32>(m_pTreeView->getListBox().GetChildCount(pEntry)) < ( xNames->getElementNames().getLength() - 1 ) )
+ if (rTreeView.iter_n_children(*xEntry) < xNames->getElementNames().getLength() - 1)
{
// the item inserts its children on demand, but it has not been expanded yet. So ensure here and
// now that it has all items
- populateTree(xNames, pEntry, etQuery );
+ populateTree(xNames, *xEntry, etQuery);
}
pNewData->eType = etQuery;
}
- implAppendEntry( pEntry, ::comphelper::getString( _rEvent.Accessor ), pNewData, pNewData->eType );
+ implAppendEntry(xEntry.get(), ::comphelper::getString(rEvent.Accessor), pNewData);
+
+ rTreeView.make_sorted();
}
else
- SbaXDataBrowserController::elementInserted(_rEvent);
+ SbaXDataBrowserController::elementInserted(rEvent);
}
-bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const OUString& _sName, SvTreeListEntry const * _pContainer)
+bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(std::u16string_view rName, const weld::TreeIter& rContainer)
{
- return m_pCurrentlyDisplayed
- && getEntryType(m_pCurrentlyDisplayed) == getChildType(_pContainer)
- && m_pTreeView->getListBox().GetParent(m_pCurrentlyDisplayed) == _pContainer
- && m_pTreeView->getListBox().GetEntryText(m_pCurrentlyDisplayed) == _sName;
+ if (!m_xCurrentlyDisplayed)
+ return false;
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ if (getEntryType(*m_xCurrentlyDisplayed) != getChildType(rContainer))
+ return false;
+ if (rTreeView.get_text(*m_xCurrentlyDisplayed) != rName)
+ return false;
+ std::unique_ptr<weld::TreeIter> xParent = rTreeView.make_iterator(m_xCurrentlyDisplayed.get());
+ return rTreeView.iter_parent(*xParent) && rTreeView.iter_compare(*xParent, rContainer) == 0;
}
void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEvent )
@@ -2709,41 +2803,45 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
// get the top-level representing the removed data source
// and search for the queries and tables
- SvTreeListEntry* pContainer = getEntryFromContainer(xNames);
- if ( pContainer )
- { // a query or table has been removed
+ std::unique_ptr<weld::TreeIter> xContainer = getEntryFromContainer(xNames);
+ if (xContainer)
+ {
+ // a query or table has been removed
OUString aName = ::comphelper::getString(_rEvent.Accessor);
- if ( isCurrentlyDisplayedChanged( aName, pContainer) )
- { // the element displayed currently has been replaced
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ if (isCurrentlyDisplayedChanged(aName, *xContainer))
+ {
+ // the element displayed currently has been replaced
// we need to remember the old value
- SvTreeListEntry* pTemp = m_pCurrentlyDisplayed;
+ std::unique_ptr<weld::TreeIter> xTemp = rTreeView.make_iterator(m_xCurrentlyDisplayed.get());
// unload
unloadAndCleanup( false ); // don't dispose the connection
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pTemp->GetUserData());
- pTemp->SetUserData(nullptr);
- delete pData;
- // the data could be null because we have a table which isn't correct
- m_pTreeView->GetTreeModel()->Remove(pTemp);
+ 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);
}
else
{
// remove the entry from the model
- SvTreeListEntry* pChild = m_pTreeView->GetTreeModel()->FirstChild(pContainer);
- while(pChild)
+ std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator(xContainer.get()));
+ if (rTreeView.get_iter_first(*xChild))
{
- if (m_pTreeView->getListBox().GetEntryText(pChild) == aName)
+ do
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pChild->GetUserData());
- pChild->SetUserData(nullptr);
- delete pData;
- m_pTreeView->GetTreeModel()->Remove(pChild);
- break;
- }
- pChild = pChild->NextSibling();
+ if (rTreeView.get_text(*xChild) == aName)
+ {
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xChild));
+ rTreeView.set_id(*xChild, OUString());
+ delete pData;
+ rTreeView.remove(*xChild);
+ break;
+ }
+ } while (rTreeView.iter_next_sibling(*xChild));
}
}
@@ -2759,28 +2857,31 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
SolarMutexGuard aSolarGuard;
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
- SvTreeListEntry* pContainer = getEntryFromContainer(xNames);
- if ( pContainer )
- { // a table or query as been replaced
+ std::unique_ptr<weld::TreeIter> xContainer = getEntryFromContainer(xNames);
+ if (xContainer)
+ {
+ // a table or query has been replaced
OUString aName = ::comphelper::getString(_rEvent.Accessor);
- if ( isCurrentlyDisplayedChanged( aName, pContainer) )
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ if (isCurrentlyDisplayedChanged(aName, *xContainer))
{ // the element displayed currently has been replaced
// we need to remember the old value
- SvTreeListEntry* pTemp = m_pCurrentlyDisplayed;
+ std::unique_ptr<weld::TreeIter> xTemp = rTreeView.make_iterator(m_xCurrentlyDisplayed.get());
unloadAndCleanup( false ); // don't dispose the connection
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pTemp->GetUserData());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xTemp));
if (pData)
{
if ( etTableOrView == pData->eType )
- { // only insert userdata when we have a table because the query is only a commanddefinition object and not a query
- _rEvent.Element >>= pData->xObjectProperties; // remember the new element
+ {
+ // only insert userdata when we have a table because the query is only a commanddefinition object and not a query
+ _rEvent.Element >>= pData->xObjectProperties; // remember the new element
}
else
{
- pTemp->SetUserData(nullptr);
+ rTreeView.set_id(*xTemp, OUString());
delete pData;
}
}
@@ -2788,27 +2889,30 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
else
{
// find the entry for this name
- SvTreeListEntry* pChild = m_pTreeView->GetTreeModel()->FirstChild(pContainer);
- while(pChild)
+ std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator(xContainer.get()));
+ if (rTreeView.get_iter_first(*xChild))
{
- if (m_pTreeView->getListBox().GetEntryText(pChild) == aName)
+ do
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pChild->GetUserData());
- if (pData)
+ if (rTreeView.get_text(*xChild) == aName)
{
- if ( etTableOrView == pData->eType )
- { // only insert userdata when we have a table because the query is only a commanddefinition object and not a query
- _rEvent.Element >>= pData->xObjectProperties; // remember the new element
- }
- else
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xChild));
+ if (pData)
{
- pChild->SetUserData(nullptr);
- delete pData;
+ if ( etTableOrView == pData->eType )
+ {
+ // only insert userdata when we have a table because the query is only a commanddefinition object and not a query
+ _rEvent.Element >>= pData->xObjectProperties; // remember the new element
+ }
+ else
+ {
+ rTreeView.set_id(*xChild, OUString());
+ delete pData;
+ }
}
+ break;
}
- break;
- }
- pChild = pChild->NextSibling();
+ } while (rTreeView.iter_next_sibling(*xChild));
}
}
@@ -2852,68 +2956,79 @@ void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnecti
// will implicitly dispose if we have the ownership, since xConnection is a SharedConnection
}
-void SbaTableQueryBrowser::disposeConnection( SvTreeListEntry* _pDSEntry )
+void SbaTableQueryBrowser::disposeConnection(const weld::TreeIter* pDSEntry)
{
- OSL_ENSURE( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" );
- OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" );
+ OSL_ENSURE( pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" );
+ OSL_ENSURE( impl_isDataSourceEntry( pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" );
- if ( _pDSEntry )
+ if (pDSEntry)
{
- DBTreeListUserData* pTreeListData = static_cast< DBTreeListUserData* >( _pDSEntry->GetUserData() );
- if ( pTreeListData )
- impl_releaseConnection( pTreeListData->xConnection );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ DBTreeListUserData* pTreeListData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pDSEntry));
+ if (pTreeListData)
+ impl_releaseConnection(pTreeListData->xConnection);
}
}
-void SbaTableQueryBrowser::closeConnection(SvTreeListEntry* _pDSEntry, bool _bDisposeConnection)
+void SbaTableQueryBrowser::closeConnection(const weld::TreeIter& rDSEntry, bool _bDisposeConnection)
{
- OSL_ENSURE(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid entry (NULL)!");
- OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
+ OSL_ENSURE(impl_isDataSourceEntry(&rDSEntry), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
+
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
// if one of the entries of the given DS is displayed currently, unload the form
- if (m_pCurrentlyDisplayed && (m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed) == _pDSEntry))
- unloadAndCleanup(_bDisposeConnection);
+ if (m_xCurrentlyDisplayed)
+ {
+ std::unique_ptr<weld::TreeIter> xRoot = m_pTreeView->GetRootLevelParent(m_xCurrentlyDisplayed.get());
+ if (rTreeView.iter_compare(*xRoot, rDSEntry) == 0)
+ unloadAndCleanup(_bDisposeConnection);
+ }
// collapse the query/table container
- for (SvTreeListEntry* pContainers = m_pTreeView->GetTreeModel()->FirstChild(_pDSEntry); pContainers; pContainers = pContainers->NextSibling())
- {
- SvTreeListEntry* pElements = m_pTreeView->GetTreeModel()->FirstChild(pContainers);
- if ( pElements )
- m_pTreeView->getListBox().Collapse(pContainers);
- m_pTreeView->getListBox().EnableExpandHandler(pContainers);
- // and delete their children (they are connection-relative)
- for (; pElements; )
- {
- SvTreeListEntry* pRemove = pElements;
- pElements = pElements->NextSibling();
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pRemove->GetUserData());
- pRemove->SetUserData(nullptr);
- delete pData;
- m_pTreeView->GetTreeModel()->Remove(pRemove);
+ std::unique_ptr<weld::TreeIter> xContainers(rTreeView.make_iterator(&rDSEntry));
+ if (rTreeView.iter_children(*xContainers))
+ {
+ do
+ {
+ std::unique_ptr<weld::TreeIter> xElements(rTreeView.make_iterator(xContainers.get()));
+ if (rTreeView.iter_children(*xElements))
+ {
+ rTreeView.collapse_row(*xContainers);
+ // and delete their children (they are connection-relative)
+ bool bElements = true;
+ while (bElements)
+ {
+ std::unique_ptr<weld::TreeIter> xRemove(rTreeView.make_iterator(xElements.get()));
+ bElements = rTreeView.iter_next_sibling(*xElements);
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xRemove));
+ rTreeView.set_id(*xRemove, OUString());
+ delete pData;
+ rTreeView.remove(*xRemove);
+ }
+ }
}
+ while (rTreeView.iter_next_sibling(*xContainers));
}
+
// collapse the entry itself
- m_pTreeView->getListBox().Collapse(_pDSEntry);
+ rTreeView.collapse_row(rDSEntry);
// dispose/reset the connection
if ( _bDisposeConnection )
- disposeConnection( _pDSEntry );
+ disposeConnection(&rDSEntry);
}
void SbaTableQueryBrowser::unloadAndCleanup( bool _bDisposeConnection )
{
- if (!m_pCurrentlyDisplayed)
+ if (!m_xCurrentlyDisplayed)
// nothing to do
return;
- SvTreeListEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed);
+ std::unique_ptr<weld::TreeIter> xDSEntry = m_pTreeView->GetRootLevelParent(m_xCurrentlyDisplayed.get());
// de-select the path for the currently displayed table/query
- if (m_pCurrentlyDisplayed)
- {
- selectPath(m_pCurrentlyDisplayed, false);
- }
- m_pCurrentlyDisplayed = nullptr;
+ selectPath(m_xCurrentlyDisplayed.get(), false);
+ m_xCurrentlyDisplayed.reset();
try
{
@@ -2930,7 +3045,7 @@ void SbaTableQueryBrowser::unloadAndCleanup( bool _bDisposeConnection )
// dispose the connection
if(_bDisposeConnection)
- disposeConnection( pDSEntry );
+ disposeConnection(xDSEntry.get());
}
catch(SQLException& e)
{
@@ -2972,17 +3087,17 @@ namespace
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- return xDataSource.get();
+ return xDataSource;
}
}
-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;
@@ -2994,8 +3109,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 );
@@ -3004,22 +3117,22 @@ void SbaTableQueryBrowser::impl_initialize()
rArguments.get_ensureType( PROPERTY_UPDATE_SCHEMANAME, aSchemaName );
rArguments.get_ensureType( PROPERTY_UPDATE_TABLENAME, aTableName );
rArguments.get_ensureType( PROPERTY_ESCAPE_PROCESSING, bEscapeProcessing );
- rArguments.get_ensureType( "Frame", xFrame );
+ rArguments.get_ensureType( u"Frame"_ustr, xFrame );
rArguments.get_ensureType( PROPERTY_SHOWMENU, m_bShowMenu );
// disable the browser if either of ShowTreeViewButton (compatibility name) or EnableBrowser
// is present and set to FALSE
- bool bDisableBrowser = !rArguments.getOrDefault( "ShowTreeViewButton", true ) // compatibility name
+ bool bDisableBrowser = !rArguments.getOrDefault( u"ShowTreeViewButton"_ustr, true ) // compatibility name
|| !rArguments.getOrDefault( PROPERTY_ENABLE_BROWSER, true );
- OSL_ENSURE( !rArguments.has( "ShowTreeViewButton" ),
+ OSL_ENSURE( !rArguments.has( u"ShowTreeViewButton"_ustr ),
"SbaTableQueryBrowser::impl_initialize: ShowTreeViewButton is superseded by EnableBrowser!" );
m_bEnableBrowser = !bDisableBrowser;
// hide the tree view it is disabled in general, or if the settings tell to hide it initially
bool bHideTreeView = ( !m_bEnableBrowser )
- || !rArguments.getOrDefault( "ShowTreeView", true ) // compatibility name
+ || !rArguments.getOrDefault( u"ShowTreeView"_ustr, true ) // compatibility name
|| !rArguments.getOrDefault( PROPERTY_SHOW_BROWSER, true );
- OSL_ENSURE( !rArguments.has( "ShowTreeView" ),
+ OSL_ENSURE( !rArguments.has( u"ShowTreeView"_ustr ),
"SbaTableQueryBrowser::impl_initialize: ShowTreeView is superseded by ShowBrowser!" );
if ( bHideTreeView )
@@ -3031,24 +3144,14 @@ void SbaTableQueryBrowser::impl_initialize()
{
try
{
- Sequence< OUString> aProperties(5);
- Sequence< Any> aValues(5);
-
- OUString* pStringIter = aProperties.getArray();
- Any* pValueIter = aValues.getArray();
- *pStringIter++ = "AlwaysShowCursor";
- *pValueIter++ <<= false;
- *pStringIter++ = PROPERTY_BORDER;
- *pValueIter++ <<= sal_Int16(0);
-
- *pStringIter++ = "HasNavigationBar";
- *pValueIter++ <<= false;
- *pStringIter++ = "HasRecordMarker";
- *pValueIter++ <<= false;
-
- *pStringIter++ = "Tabstop";
- *pValueIter++ <<= false;
-
+ Sequence< OUString> aProperties
+ {
+ u"AlwaysShowCursor"_ustr, PROPERTY_BORDER, u"HasNavigationBar"_ustr, u"HasRecordMarker"_ustr, u"Tabstop"_ustr
+ };
+ Sequence< Any> aValues
+ {
+ Any(false), Any(sal_Int16(0)), Any(false), Any(false), Any(false)
+ };
Reference< XMultiPropertySet > xFormMultiSet(getFormComponent(), UNO_QUERY);
if ( xFormMultiSet.is() )
xFormMultiSet->setPropertyValues(aProperties, aValues);
@@ -3084,6 +3187,9 @@ void SbaTableQueryBrowser::impl_initialize()
// which was given as initial selection
bLimitedTreeEntries |= !m_bEnableBrowser;
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ rTreeView.make_unsorted();
+
if ( bLimitedTreeEntries )
{
if ( xConnection.is() )
@@ -3112,11 +3218,16 @@ void SbaTableQueryBrowser::impl_initialize()
}
implAddDatasource( sInitialDataSourceName, xConnection );
- m_pTreeView->getListBox().Expand( m_pTreeView->getListBox().First() );
+
+ std::unique_ptr<weld::TreeIter> xFirst(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xFirst))
+ rTreeView.expand_row(*xFirst);
}
else
initializeTreeModel();
+ rTreeView.make_sorted();
+
if ( m_bEnableBrowser )
{
m_aDocScriptSupport = ::std::optional< bool >( false );
@@ -3135,9 +3246,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&)
@@ -3183,55 +3294,62 @@ void SbaTableQueryBrowser::showExplorer()
InvalidateFeature(ID_BROWSER_EXPLORER);
}
-bool SbaTableQueryBrowser::ensureConnection(SvTreeListEntry* _pAnyEntry, SharedConnection& _rConnection)
+bool SbaTableQueryBrowser::ensureConnection(const weld::TreeIter* pAnyEntry, SharedConnection& rConnection)
{
- SvTreeListEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent(_pAnyEntry);
+ std::unique_ptr<weld::TreeIter> xDSEntry = m_pTreeView->GetRootLevelParent(pAnyEntry);
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData =
- pDSEntry
- ? static_cast<DBTreeListUserData*>(pDSEntry->GetUserData())
+ xDSEntry
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry))
: nullptr;
- return ensureConnection( pDSEntry, pDSData, _rConnection );
+ return ensureConnection(xDSEntry.get(), pDSData, rConnection);
}
-std::unique_ptr< ImageProvider > SbaTableQueryBrowser::getImageProviderFor( SvTreeListEntry* _pAnyEntry )
+std::unique_ptr< ImageProvider > SbaTableQueryBrowser::getImageProviderFor(const weld::TreeIter* pAnyEntry)
{
- std::unique_ptr< ImageProvider > pImageProvider( new ImageProvider );
+ std::unique_ptr<ImageProvider> xImageProvider(new ImageProvider);
SharedConnection xConnection;
- if ( getExistentConnectionFor( _pAnyEntry, xConnection ) )
- pImageProvider.reset( new ImageProvider( xConnection ) );
- return pImageProvider;
+ if (getExistentConnectionFor(pAnyEntry, xConnection))
+ xImageProvider.reset(new ImageProvider(xConnection));
+ return xImageProvider;
}
-bool SbaTableQueryBrowser::getExistentConnectionFor( SvTreeListEntry* _pAnyEntry, SharedConnection& _rConnection )
+bool SbaTableQueryBrowser::getExistentConnectionFor(const weld::TreeIter* pAnyEntry, SharedConnection& rConnection)
{
- SvTreeListEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent( _pAnyEntry );
+ std::unique_ptr<weld::TreeIter> xDSEntry = m_pTreeView->GetRootLevelParent(pAnyEntry);
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData =
- pDSEntry
- ? static_cast< DBTreeListUserData* >( pDSEntry->GetUserData() )
+ xDSEntry
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry))
: nullptr;
- if ( pDSData )
- _rConnection = pDSData->xConnection;
- return _rConnection.is();
+ if (pDSData)
+ rConnection = pDSData->xConnection;
+ return rConnection.is();
}
-bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvTreeListEntry* _pEntry ) const
+bool SbaTableQueryBrowser::impl_isDataSourceEntry(const weld::TreeIter* pEntry) const
{
- return m_pTreeView->GetTreeModel()->GetRootLevelParent( _pEntry ) == _pEntry;
+ if (!pEntry)
+ return false;
+ std::unique_ptr<weld::TreeIter> xRoot(m_pTreeView->GetRootLevelParent(pEntry));
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ return rTreeView.iter_compare(*xRoot, *pEntry) == 0;
}
-bool SbaTableQueryBrowser::ensureConnection( SvTreeListEntry* _pDSEntry, void* pDSData, SharedConnection& _rConnection )
+bool SbaTableQueryBrowser::ensureConnection(const weld::TreeIter* pDSEntry, void* pDSData, SharedConnection& rConnection)
{
- OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" );
- if(_pDSEntry)
+ OSL_ENSURE( impl_isDataSourceEntry( pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" );
+ if (pDSEntry)
{
- DBTreeListUserData* pTreeListData = static_cast<DBTreeListUserData*>(pDSData);
- OUString aDSName = GetEntryText(_pDSEntry);
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ OUString aDSName = rTreeView.get_text(*pDSEntry);
+ DBTreeListUserData* pTreeListData = static_cast<DBTreeListUserData*>(pDSData);
if ( pTreeListData )
- _rConnection = pTreeListData->xConnection;
+ rConnection = pTreeListData->xConnection;
- if ( !_rConnection.is() && pTreeListData )
+ if ( !rConnection.is() && pTreeListData )
{
// show the "connecting to ..." status
OUString sConnecting(DBA_RES(STR_CONNECTING_DATASOURCE));
@@ -3243,37 +3361,33 @@ bool SbaTableQueryBrowser::ensureConnection( SvTreeListEntry* _pDSEntry, void* p
sConnectingContext = sConnectingContext.replaceFirst("$name$", aDSName);
// connect
- _rConnection.reset(
- connect( getDataSourceAccessor( _pDSEntry ), sConnectingContext, nullptr ),
- SharedConnection::TakeOwnership
- );
+ rConnection.reset(
+ connect(getDataSourceAccessor(*pDSEntry), sConnectingContext, nullptr),
+ SharedConnection::TakeOwnership);
// remember the connection
- pTreeListData->xConnection = _rConnection;
+ pTreeListData->xConnection = rConnection;
}
}
-
- return _rConnection.is();
+ return rConnection.is();
}
-IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData&, _rSortData, sal_Int32 )
+int SbaTableQueryBrowser::OnTreeEntryCompare(const weld::TreeIter& rLHS, const weld::TreeIter& rRHS)
{
- const SvTreeListEntry* pLHS = _rSortData.pLeft;
- const SvTreeListEntry* pRHS = _rSortData.pRight;
- OSL_ENSURE(pLHS && pRHS, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid tree entries!");
- // we want the table entry and the end so we have to do a check
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- if (isContainer(pRHS))
+ // we want the table entry and the end so we have to do a check
+ if (isContainer(rRHS))
{
- // don't use getEntryType (directly or indirecly) for the LHS:
+ // don't use getEntryType (directly or indirectly) for the LHS:
// LHS is currently being inserted, so it is not "completely valid" at the moment
- const EntryType eRight = getEntryType(pRHS);
+ const EntryType eRight = getEntryType(rRHS);
if (etTableContainer == eRight)
// every other container should be placed _before_ the bookmark container
return -1;
- const OUString sLeft = m_pTreeView->getListBox().GetEntryText(const_cast<SvTreeListEntry*>(pLHS));
+ const OUString sLeft = rTreeView.get_text(rLHS);
EntryType eLeft = etTableContainer;
if (DBA_RES(RID_STR_TABLES_CONTAINER) == sLeft)
@@ -3294,12 +3408,8 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData&, _rSortDa
return 0;
}
- const SvLBoxString* pLeftTextItem = static_cast<const SvLBoxString*>(pLHS->GetFirstItem(SvLBoxItemType::String));
- const SvLBoxString* pRightTextItem = static_cast<const SvLBoxString*>(pRHS->GetFirstItem(SvLBoxItemType::String));
- OSL_ENSURE(pLeftTextItem && pRightTextItem, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid text items!");
-
- OUString sLeftText = pLeftTextItem->GetText();
- OUString sRightText = pRightTextItem->GetText();
+ OUString sLeftText = rTreeView.get_text(rLHS);
+ OUString sRightText = rTreeView.get_text(rRHS);
sal_Int32 nCompareResult = 0; // equal by default
@@ -3320,24 +3430,21 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData&, _rSortDa
return nCompareResult;
}
-void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo )
+void SbaTableQueryBrowser::implAdministrate(const weld::TreeIter& rApplyTo)
{
- OSL_PRECOND( _pApplyTo, "SbaTableQueryBrowser::implAdministrate: illegal entry!" );
- if ( !_pApplyTo )
- return;
-
try
{
// get the desktop object
Reference< XDesktop2 > xFrameLoader = Desktop::create( getORB() );
// the initial selection
- SvTreeListEntry* pTopLevelSelected = _pApplyTo;
- while (pTopLevelSelected && m_pTreeView->getListBox().GetParent(pTopLevelSelected))
- pTopLevelSelected = m_pTreeView->getListBox().GetParent(pTopLevelSelected);
- OUString sInitialSelection;
- if (pTopLevelSelected)
- sInitialSelection = getDataSourceAccessor( pTopLevelSelected );
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xTopLevelSelected(rTreeView.make_iterator(&rApplyTo));
+
+ while (rTreeView.get_iter_depth(*xTopLevelSelected))
+ rTreeView.iter_parent(*xTopLevelSelected);
+
+ OUString sInitialSelection = getDataSourceAccessor(*xTopLevelSelected);
Reference< XDataSource > xDataSource( getDataSourceByName( sInitialSelection, getFrameWeld(), getORB(), nullptr ) );
Reference< XModel > xDocumentModel( getDataSourceOrModel( xDataSource ), UNO_QUERY );
@@ -3348,16 +3455,16 @@ void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo )
InteractionHandler::createWithParent(getORB(), nullptr) );
::comphelper::NamedValueCollection aLoadArgs;
- aLoadArgs.put( "Model", xDocumentModel );
- aLoadArgs.put( "InteractionHandler", xInteractionHandler );
- aLoadArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
+ aLoadArgs.put( u"Model"_ustr, xDocumentModel );
+ aLoadArgs.put( u"InteractionHandler"_ustr, xInteractionHandler );
+ aLoadArgs.put( u"MacroExecutionMode"_ustr, MacroExecMode::USE_CONFIG );
Sequence< PropertyValue > aLoadArgPV;
aLoadArgs >>= aLoadArgPV;
xFrameLoader->loadComponentFromURL(
xDocumentModel->getURL(),
- "_default",
+ u"_default"_ustr,
FrameSearchFlag::ALL | FrameSearchFlag::GLOBAL,
aLoadArgPV
);
@@ -3369,25 +3476,20 @@ void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo )
}
}
-bool SbaTableQueryBrowser::requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const
+bool SbaTableQueryBrowser::requestQuickHelp(const void* pUserData, OUString& rText) const
{
- const DBTreeListUserData* pData = static_cast< const DBTreeListUserData* >( _pEntry->GetUserData() );
- if ( ( pData->eType == etDatasource ) && !pData->sAccessor.isEmpty() )
+ const DBTreeListUserData* pData = static_cast<const DBTreeListUserData*>(pUserData);
+ if (pData->eType == etDatasource && !pData->sAccessor.isEmpty())
{
- _rText = ::svt::OFileNotation( pData->sAccessor ).get( ::svt::OFileNotation::N_SYSTEM );
+ rText = ::svt::OFileNotation(pData->sAccessor).get( ::svt::OFileNotation::N_SYSTEM);
return true;
}
return false;
}
-OUString SbaTableQueryBrowser::getContextMenuResourceName( Control& _rControl ) const
+OUString SbaTableQueryBrowser::getContextMenuResourceName() const
{
- OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
- "SbaTableQueryBrowser::getContextMenuResourceName: where does this come from?" );
- if ( &m_pTreeView->getListBox() != &_rControl )
- return OUString();
-
- return "explorer";
+ return u"explorer"_ustr;
}
IController& SbaTableQueryBrowser::getCommandController()
@@ -3400,36 +3502,35 @@ IController& SbaTableQueryBrowser::getCommandController()
return &m_aContextMenuInterceptors;
}
-Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
+Any SbaTableQueryBrowser::getCurrentSelection(weld::TreeView& rControl) const
{
- OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+
+ OSL_PRECOND( &rTreeView == &rControl,
"SbaTableQueryBrowser::getCurrentSelection: where does this come from?" );
- if ( &m_pTreeView->getListBox() != &_rControl )
+ if (&rTreeView != &rControl)
return Any();
- SvTreeListEntry* pSelected = m_pTreeView->getListBox().FirstSelected();
- if ( !pSelected )
+ std::unique_ptr<weld::TreeIter> xSelected(rTreeView.make_iterator());
+ if (!rTreeView.get_selected(xSelected.get()))
return Any();
- OSL_ENSURE( m_pTreeView->getListBox().NextSelected( pSelected ) == nullptr,
- "SbaTableQueryBrowser::getCurrentSelection: single-selection is expected here!" );
-
NamedDatabaseObject aSelectedObject;
- DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pSelected->GetUserData() );
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xSelected));
aSelectedObject.Type = static_cast< sal_Int32 >( pData->eType );
switch ( aSelectedObject.Type )
{
case DatabaseObject::QUERY:
case DatabaseObject::TABLE:
- aSelectedObject.Name = m_pTreeView->getListBox().GetEntryText( pSelected );
+ aSelectedObject.Name = rTreeView.get_text(*xSelected);
break;
case DatabaseObjectContainer::DATA_SOURCE:
case DatabaseObjectContainer::QUERIES:
case DatabaseObjectContainer::TABLES:
- aSelectedObject.Name = getDataSourceAccessor( pSelected );
+ aSelectedObject.Name = getDataSourceAccessor(*xSelected);
break;
default:
@@ -3437,7 +3538,16 @@ Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
break;
}
- return makeAny( aSelectedObject );
+ return Any( aSelectedObject );
+}
+
+vcl::Window* SbaTableQueryBrowser::getMenuParent() const
+{
+ return m_pTreeView;
+}
+
+void SbaTableQueryBrowser::adjustMenuPosition(const weld::TreeView&, ::Point&) const
+{
}
bool SbaTableQueryBrowser::implGetQuerySignature( OUString& _rCommand, bool& _bEscapeProcessing )
@@ -3528,7 +3638,7 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
if ( xLayoutManager.is() )
{
xLayoutManager->lock();
- xLayoutManager->createElement( "private:resource/toolbar/toolbar" );
+ xLayoutManager->createElement( u"private:resource/toolbar/toolbar"_ustr );
xLayoutManager->unlock();
xLayoutManager->doLayout();
}
@@ -3539,13 +3649,16 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
OUString SbaTableQueryBrowser::getPrivateTitle() const
{
OUString sTitle;
- if ( m_pCurrentlyDisplayed )
+ if (m_xCurrentlyDisplayed)
{
- SvTreeListEntry* pContainer = m_pTreeView->GetTreeModel()->GetParent(m_pCurrentlyDisplayed);
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xContainer = rTreeView.make_iterator(m_xCurrentlyDisplayed.get());
+ if (!rTreeView.iter_parent(*xContainer))
+ return OUString();
// get the entry for the datasource
- SvTreeListEntry* pConnection = implGetConnectionEntry(pContainer);
- OUString sName = m_pTreeView->getListBox().GetEntryText(m_pCurrentlyDisplayed);
- sTitle = GetEntryText( pConnection );
+ std::unique_ptr<weld::TreeIter> xConnection = implGetConnectionEntry(*xContainer);
+ OUString sName = rTreeView.get_text(*m_xCurrentlyDisplayed);
+ sTitle = GetEntryText(*xConnection);
INetURLObject aURL(sTitle);
if ( aURL.GetProtocol() != INetProtocol::NotValid )
sTitle = aURL.getBase(INetURLObject::LAST_SEGMENT,true,INetURLObject::DecodeMechanism::WithCharset);
@@ -3562,7 +3675,7 @@ OUString SbaTableQueryBrowser::getPrivateTitle() const
bool SbaTableQueryBrowser::preReloadForm()
{
bool bIni = false;
- if ( !m_pCurrentlyDisplayed )
+ if (!m_xCurrentlyDisplayed)
{
// switch the grid to design mode while loading
getBrowserView()->getGridControl()->setDesignMode(true);
@@ -3577,9 +3690,7 @@ bool SbaTableQueryBrowser::preReloadForm()
extractDescriptorProps(aDesc, sDataSource, sCommand, nCommandType, bEscapeProcessing);
if ( !sDataSource.isEmpty() && !sCommand.isEmpty() && (-1 != nCommandType) )
{
- SvTreeListEntry* pDataSource = nullptr;
- SvTreeListEntry* pCommandType = nullptr;
- m_pCurrentlyDisplayed = getObjectEntry( sDataSource, sCommand, nCommandType, &pDataSource, &pCommandType );
+ m_xCurrentlyDisplayed = getObjectEntry(sDataSource, sCommand, nCommandType, nullptr, nullptr);
bIni = true;
}
}
@@ -3635,53 +3746,46 @@ void SAL_CALL SbaTableQueryBrowser::registeredDatabaseLocation( const DatabaseRe
implAddDatasource( Event.Name, SharedConnection() );
}
-void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const OUString& _rDataSourceName )
+void SbaTableQueryBrowser::impl_cleanupDataSourceEntry(std::u16string_view rDataSourceName)
{
// get the top-level representing the removed data source
- SvTreeListEntry* pDataSourceEntry = m_pTreeView->getListBox().FirstChild( nullptr );
- while ( pDataSourceEntry )
+ weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xDataSourceEntry(rTreeView.make_iterator());
+ bool bDataSourceEntry = rTreeView.get_iter_first(*xDataSourceEntry);
+ while (bDataSourceEntry)
{
- if ( m_pTreeView->getListBox().GetEntryText( pDataSourceEntry ) == _rDataSourceName )
+ if (rTreeView.get_text(*xDataSourceEntry) == rDataSourceName)
break;
-
- pDataSourceEntry = pDataSourceEntry->NextSibling();
+ bDataSourceEntry = rTreeView.iter_next_sibling(*xDataSourceEntry);
}
- OSL_ENSURE( pDataSourceEntry, "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: do not know this data source!" );
- if ( !pDataSourceEntry )
+ OSL_ENSURE( bDataSourceEntry, "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: do not know this data source!" );
+ if (!bDataSourceEntry)
return;
- if ( isSelected( pDataSourceEntry ) )
- { // a table or query belonging to the deleted data source is currently being displayed.
- OSL_ENSURE( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) == pDataSourceEntry,
- "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (1)!" );
+ if (isSelected(*xDataSourceEntry))
+ {
+ // a table or query belonging to the deleted data source is currently being displayed.
unloadAndCleanup();
}
- else
- OSL_ENSURE(
- ( nullptr == m_pCurrentlyDisplayed )
- || ( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) != pDataSourceEntry ),
- "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (2)!");
-
- // delete any user data of the child entries of the to-be-removed entry
- std::pair<SvTreeListEntries::const_iterator, SvTreeListEntries::const_iterator> aIters =
- m_pTreeView->GetTreeModel()->GetChildIterators(pDataSourceEntry);
- SvTreeListEntries::const_iterator it = aIters.first, itEnd = aIters.second;
-
- for (; it != itEnd; ++it)
+ std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator(xDataSourceEntry.get()));
+ if (rTreeView.iter_children(*xChild))
{
- SvTreeListEntry* pEntry = (*it).get();
- const DBTreeListUserData* pData = static_cast<const DBTreeListUserData*>(pEntry->GetUserData());
- pEntry->SetUserData(nullptr);
- delete pData;
+ do
+ {
+ // delete any user data of the child entries of the to-be-removed entry
+ 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 = static_cast< DBTreeListUserData* >( pDataSourceEntry->GetUserData() );
- pDataSourceEntry->SetUserData( nullptr );
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry));
+ rTreeView.set_id(*xDataSourceEntry, OUString());
delete pData;
- m_pTreeView->GetTreeModel()->Remove( pDataSourceEntry );
+ rTreeView.remove(*xDataSourceEntry);
}
void SAL_CALL SbaTableQueryBrowser::revokedDatabaseLocation( const DatabaseRegistrationEvent& Event )
diff --git a/dbaccess/source/ui/control/ColumnControlWindow.cxx b/dbaccess/source/ui/control/ColumnControlWindow.cxx
index 28a77291ce13..c17d0952215b 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>
@@ -34,10 +35,28 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
+OColumnControlTopLevel::OColumnControlTopLevel(vcl::Window* pParent,
+ const Reference<XComponentContext>& _rxContext)
+ : InterimItemWindow(pParent, u"dbaccess/ui/colcontrolbox.ui"_ustr, u"ColControlBox"_ustr)
+ , m_xControl(new OColumnControlWindow(m_xContainer.get(), _rxContext))
+{
+}
+
+void OColumnControlTopLevel::dispose()
+{
+ m_xControl.reset();
+ InterimItemWindow::dispose();
+}
+
+void OColumnControlTopLevel::GetFocus()
+{
+ m_xControl->GrabFocus();
+}
+
// OColumnControlWindow
-OColumnControlWindow::OColumnControlWindow(vcl::Window* pParent
- ,const Reference<XComponentContext>& _rxContext)
- : OFieldDescControl(nullptr, pParent, nullptr)
+OColumnControlWindow::OColumnControlWindow(weld::Container* pParent,
+ const Reference<XComponentContext>& _rxContext)
+ : OFieldDescControl(pParent, nullptr)
, m_xContext(_rxContext)
, m_sTypeNames(DBA_RES(STR_TABLEDESIGN_DBFIELDTYPES))
, m_bAutoIncrementEnabled(true)
@@ -71,7 +90,7 @@ void OColumnControlWindow::DeactivateAggregate( EControlType eType )
}
}
-void OColumnControlWindow::CellModified(long /*nRow*/, sal_uInt16 /*nColId*/ )
+void OColumnControlWindow::CellModified(sal_Int32 /*nRow*/, sal_uInt16 /*nColId*/ )
{
saveCurrentFieldDescData();
}
@@ -103,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/FieldControls.cxx b/dbaccess/source/ui/control/FieldControls.cxx
index 866014a99f2d..3f3553d56ee9 100644
--- a/dbaccess/source/ui/control/FieldControls.cxx
+++ b/dbaccess/source/ui/control/FieldControls.cxx
@@ -25,7 +25,7 @@ namespace dbaui {
OPropColumnEditCtrl::OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry,
OUString const & _rAllowedChars,
- const char* pHelpId,
+ TranslateId pHelpId,
short nPosition)
: OSQLNameEntry(std::move(xEntry), _rAllowedChars)
, m_nPos(nPosition)
@@ -33,7 +33,7 @@ OPropColumnEditCtrl::OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry,
m_strHelpText = DBA_RES(pHelpId);
}
-OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pHelpId, short nPosition)
+OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition)
: OWidgetBase(xEntry.get())
, m_xEntry(std::move(xEntry))
, m_nPos(nPosition)
@@ -41,7 +41,7 @@ OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pH
m_strHelpText = DBA_RES(pHelpId);
}
-OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, const char* pHelpId, short nPosition)
+OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition)
: OWidgetBase(xSpinButton.get())
, m_xSpinButton(std::move(xSpinButton))
, m_nPos(nPosition)
@@ -49,7 +49,7 @@ OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSp
m_strHelpText = DBA_RES(pHelpId);
}
-OPropListBoxCtrl::OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, const char* pHelpId, short nPosition)
+OPropListBoxCtrl::OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition)
: OWidgetBase(xComboBox.get())
, m_xComboBox(std::move(xComboBox))
, m_nPos(nPosition)
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 578574d933a5..2e9a33a50bfe 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -20,11 +20,10 @@
#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>
-#include <svl/zforlist.hxx>
#include <svl/numuno.hxx>
#include <vcl/transfer.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
@@ -65,70 +64,29 @@ namespace
}
}
-OFieldDescControl::OFieldDescControl(weld::Container* pPage, vcl::Window* pParent, OTableDesignHelpBar* pHelpBar)
- :TabPage(pPage ? Application::GetDefDialogParent() : pParent, WB_3DLOOK | WB_DIALOGCONTROL)
- ,pHelp( pHelpBar )
- ,m_pLastFocusWindow(nullptr)
- ,m_pActFocusWindow(nullptr)
- ,m_pPreviousType()
- ,m_nPos(-1)
- ,aYes(DBA_RES(STR_VALUE_YES))
- ,aNo(DBA_RES(STR_VALUE_NO))
- ,m_nEditWidth(50)
- ,m_bAdded(false)
- ,pActFieldDescr(nullptr)
+OFieldDescControl::OFieldDescControl(weld::Container* pPage, OTableDesignHelpBar* pHelpBar)
+ : m_xBuilder(Application::CreateBuilder(pPage, u"dbaccess/ui/fielddescpage.ui"_ustr))
+ , m_xContainer(m_xBuilder->weld_container(u"FieldDescPage"_ustr))
+ , m_pHelp( pHelpBar )
+ , m_pLastFocusWindow(nullptr)
+ , m_pActFocusWindow(nullptr)
+ , m_nPos(-1)
+ , aYes(DBA_RES(STR_VALUE_YES))
+ , aNo(DBA_RES(STR_VALUE_NO))
+ , m_nEditWidth(50)
+ , pActFieldDescr(nullptr)
{
- if (pPage)
- m_xBuilder.reset(Application::CreateBuilder(pPage, "dbaccess/ui/fielddescpage.ui"));
- else
- {
- m_xVclContentArea = VclPtr<VclVBox>::Create(this);
- m_xVclContentArea->Show();
- m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, "dbaccess/ui/fielddescpage.ui"));
-
- m_aLayoutIdle.SetPriority(TaskPriority::RESIZE);
- m_aLayoutIdle.SetInvokeHandler( LINK( this, OFieldDescControl, ImplHandleLayoutTimerHdl ) );
- m_aLayoutIdle.SetDebugName( "OFieldDescControl m_aLayoutIdle" );
- }
-
- m_xContainer = m_xBuilder->weld_container("FieldDescPage");
-}
-
-void OFieldDescControl::queue_resize(StateChangedType eReason)
-{
- TabPage::queue_resize(eReason);
- if (!m_xVclContentArea)
- return;
- if (m_aLayoutIdle.IsActive())
- return;
- m_aLayoutIdle.Start();
-}
-
-void OFieldDescControl::Resize()
-{
- TabPage::Resize();
- if (!m_xVclContentArea)
- return;
- queue_resize();
-}
-
-IMPL_LINK_NOARG(OFieldDescControl, ImplHandleLayoutTimerHdl, Timer*, void)
-{
- m_xVclContentArea->SetPosSizePixel(Point(0,0), GetSizePixel());
+ if (m_pHelp)
+ m_pHelp->connect_focus_out(LINK(this, OFieldDescControl, HelpFocusOut));
}
OFieldDescControl::~OFieldDescControl()
{
- disposeOnce();
+ dispose();
}
void OFieldDescControl::dispose()
{
- m_aLayoutIdle.Stop();
-
- if ( m_bAdded )
- ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
-
// Destroy children
DeactivateAggregate( tpDefault );
DeactivateAggregate( tpRequired );
@@ -142,7 +100,7 @@ void OFieldDescControl::dispose()
DeactivateAggregate( tpColumnName );
DeactivateAggregate( tpType );
DeactivateAggregate( tpAutoIncrementValue );
- pHelp.clear();
+ m_pHelp = nullptr;
m_pLastFocusWindow = nullptr;
m_pActFocusWindow = nullptr;
m_xDefaultText.reset();
@@ -172,11 +130,9 @@ void OFieldDescControl::dispose()
m_xFormat.reset();
m_xContainer.reset();
m_xBuilder.reset();
- m_xVclContentArea.disposeAndClear();
- TabPage::dispose();
}
-OUString OFieldDescControl::BoolStringPersistent(const OUString& rUIString) const
+OUString OFieldDescControl::BoolStringPersistent(std::u16string_view rUIString) const
{
if (rUIString == aNo)
return OUString('0');
@@ -208,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
+ {
+ 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 ( ppAggregatesText[i] )
- ppAggregatesText[i]->set_sensitive( !bReadOnly );
- if ( ppAggregates[i] )
- ppAggregates[i]->set_sensitive( !bReadOnly );
+ if (aggregate.text)
+ aggregate.text->set_sensitive(!bReadOnly);
+ if (aggregate.aggregate)
+ aggregate.aggregate->set_sensitive(!bReadOnly);
}
if (m_xFormat)
@@ -324,12 +281,12 @@ IMPL_LINK_NOARG(OFieldDescControl, FormatClickHdl, weld::Button&, void)
sal_Int32 nOldFormatKey(pActFieldDescr->GetFormatKey());
SvxCellHorJustify rOldJustify = pActFieldDescr->GetHorJustify();
Reference< XNumberFormatsSupplier > xSupplier = GetFormatter()->getNumberFormatsSupplier();
- SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
+ SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
if (!pSupplierImpl)
return;
SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
- if(!::dbaui::callColumnFormatDialog(this,pFormatter,pActFieldDescr->GetType(),nOldFormatKey,rOldJustify,true))
+ if(!::dbaui::callColumnFormatDialog(m_xContainer.get(),pFormatter,pActFieldDescr->GetType(),nOldFormatKey,rOldJustify,true))
return;
bool bModified = false;
@@ -432,10 +389,10 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if (m_xDefault)
return;
m_nPos++;
- m_xDefaultText = m_xBuilder->weld_label("DefaultValueText");
+ m_xDefaultText = m_xBuilder->weld_label(u"DefaultValueText"_ustr);
m_xDefaultText->show();
m_xDefault = std::make_unique<OPropEditCtrl>(
- m_xBuilder->weld_entry("DefaultValue"), STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT);
+ m_xBuilder->weld_entry(u"DefaultValue"_ustr), STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT);
InitializeControl(m_xDefault->GetWidget(),HID_TAB_ENT_DEFAULT);
m_xDefault->show();
break;
@@ -443,10 +400,10 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if (m_xAutoIncrementValue || !isAutoIncrementValueEnabled())
return;
m_nPos++;
- m_xAutoIncrementValueText = m_xBuilder->weld_label("AutoIncrementValueText");
+ m_xAutoIncrementValueText = m_xBuilder->weld_label(u"AutoIncrementValueText"_ustr);
m_xAutoIncrementValueText->show();
m_xAutoIncrementValue = std::make_unique<OPropEditCtrl>(
- m_xBuilder->weld_spin_button("AutoIncrementValue"), STR_HELP_AUTOINCREMENT_VALUE,
+ m_xBuilder->weld_spin_button(u"AutoIncrementValue"_ustr), STR_HELP_AUTOINCREMENT_VALUE,
FIELD_PROPERTY_AUTOINCREMENT);
m_xAutoIncrementValue->set_text( getAutoIncrementValue() );
InitializeControl(m_xAutoIncrementValue->GetWidget(),HID_TAB_AUTOINCREMENTVALUE);
@@ -462,10 +419,10 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if(xMetaData.is() && xMetaData->supportsNonNullableColumns())
{
m_nPos++;
- m_xRequiredText = m_xBuilder->weld_label("RequiredText");
+ m_xRequiredText = m_xBuilder->weld_label(u"RequiredText"_ustr);
m_xRequiredText->show();
m_xRequired = std::make_unique<OPropListBoxCtrl>(
- m_xBuilder->weld_combo_box("Required"), STR_HELP_AUTOINCREMENT_VALUE,
+ m_xBuilder->weld_combo_box(u"Required"_ustr), STR_HELP_AUTOINCREMENT_VALUE,
FIELD_PROPERTY_AUTOINCREMENT);
m_xRequired->append_text(aYes);
m_xRequired->append_text(aNo);
@@ -481,10 +438,10 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if (m_xAutoIncrement)
return;
m_nPos++;
- m_xAutoIncrementText = m_xBuilder->weld_label("AutoIncrementText");
+ m_xAutoIncrementText = m_xBuilder->weld_label(u"AutoIncrementText"_ustr);
m_xAutoIncrementText->show();
m_xAutoIncrement = std::make_unique<OPropListBoxCtrl>(
- m_xBuilder->weld_combo_box("AutoIncrement"), STR_HELP_AUTOINCREMENT,
+ m_xBuilder->weld_combo_box(u"AutoIncrement"_ustr), STR_HELP_AUTOINCREMENT,
FIELD_PROPERTY_AUTOINC);
m_xAutoIncrement->append_text(aYes);
m_xAutoIncrement->append_text(aNo);
@@ -497,19 +454,19 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if (m_xTextLen)
return;
m_nPos++;
- m_xTextLenText = m_xBuilder->weld_label("TextLengthText");
+ m_xTextLenText = m_xBuilder->weld_label(u"TextLengthText"_ustr);
m_xTextLenText->show();
- m_xTextLen = CreateNumericControl("TextLength", STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN,HID_TAB_ENT_TEXT_LEN);
+ m_xTextLen = CreateNumericControl(u"TextLength"_ustr, STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN,HID_TAB_ENT_TEXT_LEN);
break;
case tpType:
if (m_xType)
return;
m_nPos++;
- m_xTypeText = m_xBuilder->weld_label("TypeText");
+ m_xTypeText = m_xBuilder->weld_label(u"TypeText"_ustr);
m_xTypeText->show();
m_xType = std::make_unique<OPropListBoxCtrl>(
- m_xBuilder->weld_combo_box("Type"), STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE);
+ m_xBuilder->weld_combo_box(u"Type"_ustr), STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE);
{
const OTypeInfoMap* pTypeInfo = getTypeInfo();
for (auto const& elem : *pTypeInfo)
@@ -539,10 +496,10 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xColumnNameText = m_xBuilder->weld_label("ColumnNameText");
+ m_xColumnNameText = m_xBuilder->weld_label(u"ColumnNameText"_ustr);
m_xColumnNameText->show();
m_xColumnName = std::make_unique<OPropColumnEditCtrl>(
- m_xBuilder->weld_entry("ColumnName"), aTmpString,
+ m_xBuilder->weld_entry(u"ColumnName"_ustr), aTmpString,
STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_COLUMNNAME);
m_xColumnName->set_max_length(nMax);
m_xColumnName->setCheck( isSQL92CheckEnabled(getConnection()) );
@@ -555,15 +512,15 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if (m_xNumType)
return;
m_nPos++;
- m_xNumTypeText = m_xBuilder->weld_label("NumTypeText");
+ m_xNumTypeText = m_xBuilder->weld_label(u"NumTypeText"_ustr);
m_xNumTypeText->show();
m_xNumType = std::make_unique<OPropListBoxCtrl>(
- m_xBuilder->weld_combo_box("NumType"), STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE);
- m_xNumType->append_text("Byte");
- m_xNumType->append_text("SmallInt");
- m_xNumType->append_text("Integer");
- m_xNumType->append_text("Single");
- m_xNumType->append_text("Double");
+ m_xBuilder->weld_combo_box(u"NumType"_ustr), STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE);
+ m_xNumType->append_text(u"Byte"_ustr);
+ m_xNumType->append_text(u"SmallInt"_ustr);
+ m_xNumType->append_text(u"Integer"_ustr);
+ m_xNumType->append_text(u"Single"_ustr);
+ m_xNumType->append_text(u"Double"_ustr);
m_xNumType->set_active(2);
InitializeControl(m_xNumType.get(),HID_TAB_ENT_NUMTYP, true);
m_xNumType->show();
@@ -573,35 +530,35 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
if (m_xLength)
return;
m_nPos++;
- m_xLengthText = m_xBuilder->weld_label("LengthText");
+ m_xLengthText = m_xBuilder->weld_label(u"LengthText"_ustr);
m_xLengthText->show();
- m_xLength = CreateNumericControl("Length", STR_HELP_LENGTH, FIELD_PROPERTY_LENGTH,HID_TAB_ENT_LEN);
+ m_xLength = CreateNumericControl(u"Length"_ustr, STR_HELP_LENGTH, FIELD_PROPERTY_LENGTH,HID_TAB_ENT_LEN);
break;
case tpScale:
if (m_xScale)
return;
m_nPos++;
- m_xScaleText = m_xBuilder->weld_label("ScaleText");
+ m_xScaleText = m_xBuilder->weld_label(u"ScaleText"_ustr);
m_xScaleText->show();
- m_xScale = CreateNumericControl("Scale", STR_HELP_SCALE, FIELD_PROPERTY_SCALE,HID_TAB_ENT_SCALE);
+ m_xScale = CreateNumericControl(u"Scale"_ustr, STR_HELP_SCALE, FIELD_PROPERTY_SCALE,HID_TAB_ENT_SCALE);
break;
case tpFormat:
if (!m_xFormat)
{
m_nPos++;
- m_xFormatText = m_xBuilder->weld_label("FormatTextText");
+ m_xFormatText = m_xBuilder->weld_label(u"FormatTextText"_ustr);
m_xFormatText->show();
m_xFormatSample = std::make_unique<OPropEditCtrl>(
- m_xBuilder->weld_entry("FormatText"), STR_HELP_FORMAT_CODE, -1);
+ m_xBuilder->weld_entry(u"FormatText"_ustr), STR_HELP_FORMAT_CODE, -1);
m_xFormatSample->set_editable(false);
m_xFormatSample->set_sensitive(false);
InitializeControl(m_xFormatSample->GetWidget(),HID_TAB_ENT_FORMAT_SAMPLE);
m_xFormatSample->show();
- m_xFormat = m_xBuilder->weld_button("FormatButton");
+ m_xFormat = m_xBuilder->weld_button(u"FormatButton"_ustr);
m_xFormat->connect_clicked( LINK( this, OFieldDescControl, FormatClickHdl ) );
InitializeControl(m_xFormat.get(),HID_TAB_ENT_FORMAT);
m_xFormat->show();
@@ -614,10 +571,10 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
return;
m_nPos++;
- m_xBoolDefaultText = m_xBuilder->weld_label("BoolDefaultText");
+ m_xBoolDefaultText = m_xBuilder->weld_label(u"BoolDefaultText"_ustr);
m_xBoolDefaultText->show();
m_xBoolDefault = std::make_unique<OPropListBoxCtrl>(
- m_xBuilder->weld_combo_box("BoolDefault"), STR_HELP_BOOL_DEFAULT,
+ m_xBuilder->weld_combo_box(u"BoolDefault"_ustr), STR_HELP_BOOL_DEFAULT,
FIELD_PROPERTY_BOOL_DEFAULT);
m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
m_xBoolDefault->append_text(aYes);
@@ -626,11 +583,9 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
m_xBoolDefault->show();
break;
}
-
- queue_resize();
}
-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));
@@ -638,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));
@@ -646,12 +601,12 @@ void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString&
if (dynamic_cast<weld::Entry*>(pControl))
{
- int nWidthRequest = LogicToPixel(Size(m_nEditWidth, 0), MapMode(MapUnit::MapAppFont)).Width();
+ int nWidthRequest = Application::GetDefaultDevice()->LogicToPixel(Size(m_nEditWidth, 0), MapMode(MapUnit::MapAppFont)).Width();
pControl->set_size_request(nWidthRequest, -1);
}
}
-std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, const char* 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);
@@ -723,8 +678,6 @@ void OFieldDescControl::DeactivateAggregate( EControlType eType )
lcl_HideAndDeleteControl(m_nPos,m_xBoolDefault,m_xBoolDefaultText);
break;
}
-
- queue_resize();
}
void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
@@ -732,6 +685,8 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
pActFieldDescr = pFieldDescr;
if(!pFieldDescr)
{
+ if (m_pHelp)
+ m_pHelp->SetHelpText( OUString() );
DeactivateAggregate( tpDefault );
DeactivateAggregate( tpRequired );
DeactivateAggregate( tpTextLen );
@@ -747,20 +702,9 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
m_pPreviousType = TOTypeInfoSP();
// Reset the saved focus' pointer
m_pLastFocusWindow = nullptr;
- if ( m_bAdded )
- {
- ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- m_bAdded = false;
- }
return;
}
- if ( !m_bAdded )
- {
- ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::AddWindow));
- m_bAdded = true;
- }
-
TOTypeInfoSP pFieldType(pFieldDescr->getTypeInfo());
ActivateAggregate( tpColumnName );
@@ -845,6 +789,8 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
case DataType::DATE:
case DataType::TIME:
case DataType::TIMESTAMP:
+ case DataType::TIME_WITH_TIMEZONE:
+ case DataType::TIMESTAMP_WITH_TIMEZONE:
DeactivateAggregate( tpLength ); // we don't need a length for date types
DeactivateAggregate( tpTextLen );
DeactivateAggregate( tpBoolDefault );
@@ -971,7 +917,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)
{
@@ -1113,10 +1059,12 @@ IMPL_LINK(OFieldDescControl, OnControlFocusGot, weld::Widget&, rControl, void )
else if (m_xFormat && &rControl == m_xFormat.get())
strHelpText = DBA_RES(STR_HELP_FORMAT_BUTTON);
- if (!strHelpText.isEmpty() && (pHelp != nullptr))
- pHelp->SetHelpText(strHelpText);
+ if (!strHelpText.isEmpty() && m_pHelp)
+ m_pHelp->SetHelpText(strHelpText);
m_pActFocusWindow = &rControl;
+
+ m_aControlFocusIn.Call(rControl);
}
IMPL_LINK(OFieldDescControl, OnControlFocusLost, weld::Widget&, rControl, void )
@@ -1160,7 +1108,9 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
OUString sDefault;
if (m_xDefault)
{
- sDefault = m_xDefault->get_text();
+ // tdf#138409 take the control default in the UI Locale format, e.g. 12,34 and return a string
+ // suitable as the database default, e.g. 12.34
+ sDefault = CanonicalizeToControlDefault(pFieldDescr, m_xDefault->get_text());
}
else if (m_xBoolDefault)
{
@@ -1168,7 +1118,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
}
if ( !sDefault.isEmpty() )
- pFieldDescr->SetControlDefault(makeAny(sDefault));
+ pFieldDescr->SetControlDefault(Any(sDefault));
else
pFieldDescr->SetControlDefault(Any());
@@ -1200,10 +1150,11 @@ void OFieldDescControl::UpdateFormatSample(OFieldDescription const * pFieldDescr
m_xFormatSample->set_text(getControlDefault(pFieldDescr,false));
}
-void OFieldDescControl::GetFocus()
+void OFieldDescControl::GrabFocus()
{
+ m_xContainer->grab_focus();
+
// Set the Focus to the Control that has been active last
- TabPage::GetFocus();
if (m_pLastFocusWindow)
{
m_pLastFocusWindow->grab_focus();
@@ -1218,15 +1169,13 @@ void OFieldDescControl::implFocusLost(weld::Widget* _pWhich)
m_pLastFocusWindow = _pWhich;
// Reset HelpText
- if (pHelp && !pHelp->HasChildPathFocus())
- pHelp->SetHelpText( OUString() );
+ if (m_pHelp && !m_pHelp->HasFocus())
+ m_pHelp->SetHelpText( OUString() );
}
-void OFieldDescControl::LoseFocus()
+IMPL_LINK_NOARG(OFieldDescControl, HelpFocusOut, weld::Widget&, void)
{
- implFocusLost(nullptr);
-
- TabPage::LoseFocus();
+ m_pHelp->SetHelpText(OUString());
}
bool OFieldDescControl::IsFocusInEditableWidget() const
@@ -1248,7 +1197,12 @@ bool OFieldDescControl::IsFocusInEditableWidget() const
return false;
}
-bool OFieldDescControl::isCopyAllowed() const
+bool OFieldDescControl::HasChildPathFocus() const
+{
+ return m_xContainer && m_xContainer->has_child_focus();
+}
+
+bool OFieldDescControl::isCopyAllowed()
{
int nStartPos, nEndPos;
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget() &&
@@ -1256,7 +1210,7 @@ bool OFieldDescControl::isCopyAllowed() const
return bAllowed;
}
-bool OFieldDescControl::isCutAllowed() const
+bool OFieldDescControl::isCutAllowed()
{
int nStartPos, nEndPos;
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget() &&
@@ -1264,12 +1218,12 @@ bool OFieldDescControl::isCutAllowed() const
return bAllowed;
}
-bool OFieldDescControl::isPasteAllowed() const
+bool OFieldDescControl::isPasteAllowed()
{
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget();
if ( bAllowed )
{
- TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
+ TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromClipboard(m_pActFocusWindow->get_clipboard()));
bAllowed = aTransferData.HasFormat(SotClipboardFormatId::STRING);
}
return bAllowed;
@@ -1328,11 +1282,10 @@ OUString OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldD
bool bCheck = !_bCheck || _pFieldDescr->GetControlDefault().hasValue();
if ( bCheck )
{
- sal_uInt32 nFormatKey;
-
try
{
double nValue = 0.0;
+ sal_uInt32 nFormatKey;
bool bTextFormat = isTextFormat(_pFieldDescr,nFormatKey);
if ( _pFieldDescr->GetControlDefault() >>= sDefault )
{
@@ -1358,18 +1311,27 @@ OUString OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldD
Reference<XPropertySet> xFormSet = xNumberFormatter->getNumberFormatsSupplier()->getNumberFormats()->getByKey(nFormatKey);
OSL_ENSURE(xFormSet.is(),"XPropertySet is null!");
OUString sFormat;
- xFormSet->getPropertyValue("FormatString") >>= sFormat;
+ xFormSet->getPropertyValue(u"FormatString"_ustr) >>= sFormat;
if ( !bTextFormat )
{
Locale aLocale;
- ::comphelper::getNumberFormatProperty(xNumberFormatter,nFormatKey,"Locale") >>= aLocale;
+ ::comphelper::getNumberFormatProperty(xNumberFormatter,nFormatKey,u"Locale"_ustr) >>= aLocale;
sal_Int32 nNumberFormat = ::comphelper::getNumberFormatType(xNumberFormatter,nFormatKey);
- if( (nNumberFormat & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE
- || (nNumberFormat & css::util::NumberFormat::DATETIME) == css::util::NumberFormat::DATETIME )
+ if (nNumberFormat & css::util::NumberFormat::DATE)
{
- nValue = DBTypeConversion::toNullDate(DBTypeConversion::getNULLDate(xNumberFormatter->getNumberFormatsSupplier()),nValue);
+ bool bDoCorrect = true;
+ if (!sDefault.isEmpty())
+ {
+ // nValue was converted from that string. If that string was a date, nValue
+ // is already in the required epoch, and we should not try to correct it
+ sal_Int32 nFormatKeyOf_sDefault = xNumberFormatter->detectNumberFormat(nFormatKey, sDefault);
+ sal_Int16 nNumberFormatType = comphelper::getNumberFormatType(xNumberFormatter, nFormatKeyOf_sDefault);
+ bDoCorrect = (nNumberFormatType & css::util::NumberFormat::DATE) == 0;
+ }
+ if (bDoCorrect)
+ nValue = DBTypeConversion::toNullDate(DBTypeConversion::getNULLDate(xNumberFormatter->getNumberFormatsSupplier()),nValue);
}
Reference< css::util::XNumberFormatPreviewer> xPreviewer(xNumberFormatter,UNO_QUERY);
@@ -1388,4 +1350,47 @@ OUString OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldD
return sDefault;
}
+// tdf#138409 intended to be effectively the reverse of getControlDefault to
+// turn a user's possibly 12,34 format into 12.34 format for numerical types
+OUString OFieldDescControl::CanonicalizeToControlDefault(const OFieldDescription* pFieldDescr, const OUString& rDefault) const
+{
+ if (rDefault.isEmpty())
+ return rDefault;
+
+ bool bIsNumericalType = false;
+ switch (pFieldDescr->GetType())
+ {
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ bIsNumericalType = true;
+ break;
+ }
+
+ if (!bIsNumericalType)
+ return rDefault;
+
+ try
+ {
+ sal_uInt32 nFormatKey;
+ bool bTextFormat = isTextFormat(pFieldDescr, nFormatKey);
+ if (bTextFormat)
+ return rDefault;
+ double nValue = GetFormatter()->convertStringToNumber(nFormatKey, rDefault);
+ return OUString::number(nValue);
+ }
+ catch(const Exception&)
+ {
+ }
+
+ return rDefault;
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index d9de91ba494b..4856b0c3b188 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;
@@ -59,7 +58,7 @@ namespace dbaui
VclPtr< ::svt::ListBoxControl> m_pListCell;
TTableConnectionData::value_type m_pConnData;
OTableListBoxControl* m_pBoxControl;
- long m_nDataPos;
+ tools::Long m_nDataPos;
Reference< XPropertySet> m_xSourceDef;
Reference< XPropertySet> m_xDestDef;
enum opcode { DELETE, INSERT, MODIFY };
@@ -108,12 +107,12 @@ namespace dbaui
void Init(const TTableConnectionData::value_type& _pConnData);
using ORelationControl_Base::Init;
- virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) override;
- virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) override;
+ virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
+ virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
- virtual bool SeekRow( long nRow ) override;
+ virtual bool SeekRow( sal_Int32 nRow ) override;
virtual bool SaveModified() override;
- virtual OUString GetCellText( long nRow, sal_uInt16 nColId ) const override;
+ virtual OUString GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const override;
virtual void CellModified() override;
@@ -177,16 +176,16 @@ namespace dbaui
void ORelationControl::Resize()
{
EditBrowseBox::Resize();
- long nOutputWidth = GetOutputSizePixel().Width() - 1;
+ tools::Long nOutputWidth = GetOutputSizePixel().Width() - 1;
SetColumnWidth(1, (nOutputWidth / 2));
SetColumnWidth(2, (nOutputWidth / 2));
}
bool ORelationControl::PreNotify(NotifyEvent& rNEvt)
{
- if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() )
+ 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);
@@ -204,7 +203,7 @@ namespace dbaui
bool ORelationControl::IsTabAllowed(bool bForward) const
{
- long nRow = GetCurRow();
+ sal_Int32 nRow = GetCurRow();
sal_uInt16 nCol = GetCurColumnId();
bool bRet = !( ( bForward && (nCol == DEST_COLUMN) && (nRow == GetRowCount() - 1))
@@ -215,7 +214,7 @@ namespace dbaui
bool ORelationControl::SaveModified()
{
- long nRow = GetCurRow();
+ sal_Int32 nRow = GetCurRow();
if ( nRow != BROWSER_ENDOFSELECTION )
{
weld::ComboBox& rListBox = m_pListCell->get_widget();
@@ -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));
@@ -263,7 +262,7 @@ namespace dbaui
return nId;
}
- OUString ORelationControl::GetCellText( long nRow, sal_uInt16 nColId ) const
+ OUString ORelationControl::GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const
{
OUString sText;
if ( m_pConnData->GetConnLineDataList().size() > o3tl::make_unsigned(nRow) )
@@ -282,10 +281,10 @@ namespace dbaui
return sText;
}
- void ORelationControl::InitController( CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColumnId )
+ 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) )
@@ -319,12 +318,12 @@ namespace dbaui
rList.set_help_id(sHelpId);
}
- CellController* ORelationControl::GetController( long /*nRow*/, sal_uInt16 /*nColumnId*/ )
+ CellController* ORelationControl::GetController( sal_Int32 /*nRow*/, sal_uInt16 /*nColumnId*/ )
{
return new ListBoxCellController( m_pListCell.get() );
}
- bool ORelationControl::SeekRow( long nRow )
+ bool ORelationControl::SeekRow( sal_Int32 nRow )
{
m_nDataPos = nRow;
return true;
@@ -359,12 +358,9 @@ namespace dbaui
//sal_Int32 nRows = GetRowCount();
Reference<XColumnsSupplier> xSup(_xDest,UNO_QUERY);
Reference<XNameAccess> xColumns = xSup->getColumns();
- Sequence< OUString> aNames = xColumns->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& text : xColumns->getElementNames())
{
- rList.append_text(*pIter);
+ rList.append_text(text);
}
rList.insert_text(0, OUString());
}
@@ -437,9 +433,9 @@ namespace dbaui
OTableListBoxControl::OTableListBoxControl(weld::Builder* _pParent,
const OJoinTableView::OTableWindowMap* _pTableMap,
IRelationControlInterface* _pParentDialog)
- : m_xLeftTable(_pParent->weld_combo_box("table1"))
- , m_xRightTable(_pParent->weld_combo_box("table2"))
- , m_xTable(_pParent->weld_container("relations"))
+ : m_xLeftTable(_pParent->weld_combo_box(u"table1"_ustr))
+ , m_xRightTable(_pParent->weld_combo_box(u"table2"_ustr))
+ , m_xTable(_pParent->weld_container(u"relations"_ustr))
, m_xTableCtrlParent(m_xTable->CreateChildFrame())
, m_xRC_Tables(VclPtr<ORelationControl>::Create(m_xTableCtrlParent))
, m_pTableMap(_pTableMap)
diff --git a/dbaccess/source/ui/control/SqlNameEdit.cxx b/dbaccess/source/ui/control/SqlNameEdit.cxx
index 2b280a82c325..9ac58cfda851 100644
--- a/dbaccess/source/ui/control/SqlNameEdit.cxx
+++ b/dbaccess/source/ui/control/SqlNameEdit.cxx
@@ -21,63 +21,64 @@
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.copy(nMatch, i - nMatch);
+ _rsCorrected += _sToCheck.substr(nMatch, i - nMatch);
bCorrected = true;
nMatch = i + 1;
}
}
- _rsCorrected += _sToCheck.copy( nMatch );
+ _rsCorrected += _sToCheck.substr( nMatch );
}
return bCorrected;
}
- void OSQLNameEdit::Modify()
+
+ namespace
{
- OUString sCorrected;
- if ( checkString( GetText(),sCorrected ) )
+ void checkName(OSQLNameChecker& rChecker, weld::Entry& rEntry)
{
- Selection aSel = GetSelection();
- aSel.setMax( aSel.getMin() );
- SetText( sCorrected, aSel );
+ OUString sCorrected;
+ if (rChecker.checkString(rEntry.get_text(), sCorrected))
+ {
+ int nStartPos, nEndPos;
+ rEntry.get_selection_bounds(nStartPos, nEndPos);
+ int nMin = std::min(nStartPos, nEndPos);
+ rEntry.set_text(sCorrected);
+ rEntry.select_region(nMin, nMin);
- SaveValue();
+ rEntry.save_value();
+ }
}
- Edit::Modify();
}
- IMPL_LINK_NOARG(OSQLNameEntry, ModifyHdl, weld::Entry&, void)
+ IMPL_LINK(OSQLNameEditControl, ModifyHdl, weld::Entry&, rEntry, void)
{
- OUString sCorrected;
- if (checkString(m_xEntry->get_text(), sCorrected))
- {
- int nStartPos, nEndPos;
- m_xEntry->get_selection_bounds(nStartPos, nEndPos);
- int nMin = std::min(nStartPos, nEndPos);
- m_xEntry->select_region(nMin, nMin);
- m_xEntry->replace_selection(sCorrected);
+ checkName(*this, rEntry);
+ m_ChainChangedHdl.Call(rEntry);
+ }
- m_xEntry->save_value();
- }
+ IMPL_LINK(OSQLNameEntry, ModifyHdl, weld::Entry&, rEntry, void)
+ {
+ checkName(*this, rEntry);
}
}
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index 6aba975d6b8a..c19b945854aa 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);
@@ -181,7 +181,7 @@ IMPL_LINK_NOARG(OTableGrantControl, AsynchDeactivate, void*, void)
bool OTableGrantControl::IsTabAllowed(bool bForward) const
{
- long nRow = GetCurRow();
+ sal_Int32 nRow = GetCurRow();
sal_uInt16 nCol = GetCurColumnId();
if (bForward && (nCol == 2) && (nRow == GetRowCount() - 1))
@@ -193,12 +193,6 @@ bool OTableGrantControl::IsTabAllowed(bool bForward) const
return EditBrowseBox::IsTabAllowed(bForward);
}
-#define GRANT_REVOKE_RIGHT(what) \
- if (m_pCheckCell->GetBox().get_active()) \
- xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,what);\
- else \
- xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,what)
-
bool OTableGrantControl::SaveModified()
{
@@ -219,25 +213,46 @@ bool OTableGrantControl::SaveModified()
switch( GetCurColumnId() )
{
case COL_INSERT:
- GRANT_REVOKE_RIGHT(Privilege::INSERT);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::INSERT);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::INSERT);
break;
case COL_DELETE:
- GRANT_REVOKE_RIGHT(Privilege::DELETE);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::DELETE);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::DELETE);
break;
case COL_UPDATE:
- GRANT_REVOKE_RIGHT(Privilege::UPDATE);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::UPDATE);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::UPDATE);
break;
case COL_ALTER:
- GRANT_REVOKE_RIGHT(Privilege::ALTER);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::ALTER);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::ALTER);
break;
case COL_SELECT:
- GRANT_REVOKE_RIGHT(Privilege::SELECT);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::SELECT);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::SELECT);
break;
case COL_REF:
- GRANT_REVOKE_RIGHT(Privilege::REFERENCE);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::REFERENCE);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::REFERENCE);
break;
case COL_DROP:
- GRANT_REVOKE_RIGHT(Privilege::DROP);
+ if (m_pCheckCell->GetBox().get_active())
+ xAuth->grantPrivileges(sTableName,PrivilegeObject::TABLE,Privilege::DROP);
+ else
+ xAuth->revokePrivileges(sTableName,PrivilegeObject::TABLE,Privilege::DROP);
break;
}
fillPrivilege(nRow);
@@ -257,7 +272,7 @@ bool OTableGrantControl::SaveModified()
return bErg;
}
-OUString OTableGrantControl::GetCellText( long nRow, sal_uInt16 nColId ) const
+OUString OTableGrantControl::GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const
{
if(COL_TABLE_NAME == nColId)
return m_aTableNames[nRow];
@@ -270,7 +285,7 @@ OUString OTableGrantControl::GetCellText( long nRow, sal_uInt16 nColId ) const
return OUString::number(isAllowed(nColId,nPriv) ? 1 :0);
}
-void OTableGrantControl::InitController( CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColumnId )
+void OTableGrantControl::InitController( CellControllerRef& /*rController*/, sal_Int32 nRow, sal_uInt16 nColumnId )
{
OUString sTablename = m_aTableNames[nRow];
// special case for tablename
@@ -357,7 +372,7 @@ void OTableGrantControl::setGrantUser(const Reference< XAuthorizable>& _xGrantUs
m_xGrantUser = _xGrantUser;
}
-CellController* OTableGrantControl::GetController( long nRow, sal_uInt16 nColumnId )
+CellController* OTableGrantControl::GetController( sal_Int32 nRow, sal_uInt16 nColumnId )
{
CellController* pController = nullptr;
@@ -384,7 +399,7 @@ CellController* OTableGrantControl::GetController( long nRow, sal_uInt16 nColumn
return pController;
}
-bool OTableGrantControl::SeekRow( long nRow )
+bool OTableGrantControl::SeekRow( sal_Int32 nRow )
{
m_nDataPos = nRow;
@@ -439,7 +454,8 @@ OTableGrantControl::TTablePrivilegeMap::const_iterator OTableGrantControl::findP
return aFind;
}
-Reference< XAccessible > OTableGrantControl::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible>
+OTableGrantControl::CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos)
{
sal_uInt16 nColumnId = GetColumnId( _nColumnPos );
if(nColumnId != COL_TABLE_NAME)
diff --git a/dbaccess/source/ui/control/VertSplitView.cxx b/dbaccess/source/ui/control/VertSplitView.cxx
deleted file mode 100644
index 35616d3302ed..000000000000
--- a/dbaccess/source/ui/control/VertSplitView.cxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <VertSplitView.hxx>
-
-#include <vcl/split.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/event.hxx>
-#include <osl/diagnose.h>
-
-#define SPLITTER_WIDTH 80
-
-using namespace ::dbaui;
-
-OSplitterView::OSplitterView(vcl::Window* _pParent) : Window(_pParent,WB_DIALOGCONTROL) // ,WB_BORDER
- ,m_pSplitter( nullptr )
- ,m_pLeft(nullptr)
- ,m_pRight(nullptr)
- ,m_pResizeId(nullptr)
-{
- ImplInitSettings();
-}
-
-OSplitterView::~OSplitterView()
-{
- disposeOnce();
-}
-
-void OSplitterView::dispose()
-{
- if (m_pResizeId)
- {
- RemoveUserEvent(m_pResizeId);
- m_pResizeId = nullptr;
- }
- m_pSplitter.clear();
- m_pLeft.clear();
- m_pRight.clear();
- vcl::Window::dispose();
-}
-
-IMPL_LINK_NOARG( OSplitterView, SplitHdl, Splitter*, void )
-{
- OSL_ENSURE(m_pSplitter, "Splitter is NULL!");
- m_pSplitter->SetPosPixel( Point( m_pSplitter->GetPosPixel().X(),m_pSplitter->GetSplitPosPixel() ) );
-
- Resize();
-}
-
-void OSplitterView::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- vcl::Font aFont = rStyleSettings.GetAppFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetPointFont(*this, aFont);
-// Set/*Zoomed*/PointFont( aFont );
-
- Color aTextColor = rStyleSettings.GetButtonTextColor();
- if ( IsControlForeground() )
- aTextColor = GetControlForeground();
- SetTextColor( aTextColor );
-
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFaceColor() );
-}
-
-void OSplitterView::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OSplitterView::GetFocus()
-{
- Window::GetFocus();
-
- // forward the focus to the current cell of the editor control
- if ( m_pLeft )
- m_pLeft->GrabFocus();
- else if ( m_pRight )
- m_pRight->GrabFocus();
-}
-
-IMPL_LINK_NOARG(OSplitterView, ResizeHdl, void*, void)
-{
- m_pResizeId = nullptr;
-
- OSL_ENSURE( m_pRight, "No init called!");
-
- Point aSplitPos;
- Size aSplitSize;
- Point aPlaygroundPos( 0,0 );
- Size aPlaygroundSize( GetOutputSizePixel() );
-
- if ( m_pLeft && m_pLeft->IsVisible() && m_pSplitter )
- {
- aSplitPos = m_pSplitter->GetPosPixel();
- aSplitSize = m_pSplitter->GetOutputSizePixel();
- aSplitPos.setX( aPlaygroundPos.X() );
- aSplitSize.setWidth( aPlaygroundSize.Width() );
-
- if( ( aSplitPos.Y() + aSplitSize.Height() ) > ( aPlaygroundSize.Height() ))
- aSplitPos.setY( aPlaygroundSize.Height() - aSplitSize.Height() );
-
- if( aSplitPos.Y() <= aPlaygroundPos.Y() )
- aSplitPos.setY( aPlaygroundPos.Y() + sal_Int32(aPlaygroundSize.Height() * 0.3) );
-
- // the tree pos and size
- Point aTreeViewPos( aPlaygroundPos );
- Size aTreeViewSize( aPlaygroundSize.Width() ,aSplitPos.Y());
-
- // set the size of treelistbox
- m_pLeft->SetPosSizePixel( aTreeViewPos, aTreeViewSize );
-
- //set the size of the splitter
- m_pSplitter->SetPosSizePixel( aSplitPos, Size( aPlaygroundSize.Width(), aSplitSize.Height() ) );
- m_pSplitter->SetDragRectPixel( tools::Rectangle(aPlaygroundPos,aPlaygroundSize) );
- }
-
- if ( m_pRight )
- {
- m_pRight->setPosSizePixel( aSplitPos.X(), aPlaygroundPos.Y() + aSplitPos.Y() + aSplitSize.Height(),
- aPlaygroundSize.Width() , aPlaygroundSize.Height() - aSplitSize.Height() - aSplitPos.Y());
- }
-}
-
-void OSplitterView::Resize()
-{
- Window::Resize();
- if (m_pResizeId)
- RemoveUserEvent(m_pResizeId);
- m_pResizeId = PostUserEvent(LINK(this, OSplitterView, ResizeHdl), this, true);
-}
-
-void OSplitterView::set(vcl::Window* _pRight,Window* _pLeft)
-{
- m_pLeft = _pLeft;
- m_pRight = _pRight;
-}
-
-void OSplitterView::setSplitter(Splitter* _pSplitter)
-{
- m_pSplitter = _pSplitter;
- if ( m_pSplitter )
- {
- m_pSplitter->SetSplitPosPixel(LogicToPixel(Size(SPLITTER_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width());
- m_pSplitter->SetSplitHdl( LINK(this, OSplitterView, SplitHdl) );
- m_pSplitter->Show();
- LINK( this, OSplitterView, SplitHdl ).Call(m_pSplitter);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/charsetlistbox.cxx b/dbaccess/source/ui/control/charsetlistbox.cxx
index 8915b65c9455..ba2f2943fcdb 100644
--- a/dbaccess/source/ui/control/charsetlistbox.cxx
+++ b/dbaccess/source/ui/control/charsetlistbox.cxx
@@ -28,13 +28,13 @@ namespace dbaui
CharSetListBox::CharSetListBox(std::unique_ptr<weld::ComboBox> xControl)
: m_xControl(std::move(xControl))
{
- for (auto const& charset : m_aCharSets)
+ for (auto const charset : m_aCharSets)
{
m_xControl->append_text(charset.getDisplayName());
}
}
- 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 4fbb3485e263..92e6f2e7d659 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -18,24 +18,28 @@
*/
#include <dbtreelistbox.hxx>
-#include <listviewitems.hxx>
+#include <dbexchange.hxx>
#include <callbacks.hxx>
+#include <com/sun/star/awt/PopupMenuDirection.hpp>
#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <cppuhelper/implbase.hxx>
#include <comphelper/interfacecontainer2.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
-#include <vcl/help.hxx>
#include <dbaccess/IController.hxx>
#include <framework/actiontriggerhelper.hxx>
#include <toolkit/awt/vclxmenu.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/treelistentry.hxx>
+#include <svx/dbaobjectex.hxx>
+#include <utility>
+#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
+#include <vcl/svapp.hxx>
#include <memory>
@@ -50,361 +54,251 @@ using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::ui;
using namespace ::com::sun::star::view;
-#define SPACEBETWEENENTRIES 4
-DBTreeListBox::DBTreeListBox( vcl::Window* pParent, WinBits nWinStyle )
- :SvTreeListBox(pParent,nWinStyle)
- ,m_pDragedEntry(nullptr)
- ,m_pActionListener(nullptr)
- ,m_pContextMenuProvider(nullptr)
- ,m_pResetEvent(nullptr)
+InterimDBTreeListBox::InterimDBTreeListBox(vcl::Window* pParent)
+ : InterimItemWindow(pParent, u"dbaccess/ui/dbtreelist.ui"_ustr, u"DBTreeList"_ustr)
+ , TreeListBox(m_xBuilder->weld_tree_view(u"treeview"_ustr), true)
+ , m_xStatusBar(m_xBuilder->weld_label(u"statusbar"_ustr))
{
- init();
+ InitControlBase(&GetWidget());
}
-void DBTreeListBox::init()
+InterimDBTreeListBox::~InterimDBTreeListBox()
{
- SetSpaceBetweenEntries(SPACEBETWEENENTRIES);
-
- m_aTimer.SetTimeout(900);
- m_aTimer.SetInvokeHandler(LINK(this, DBTreeListBox, OnTimeOut));
-
- m_aScrollHelper.setUpScrollMethod( LINK(this, DBTreeListBox, ScrollUpHdl) );
- m_aScrollHelper.setDownScrollMethod( LINK(this, DBTreeListBox, ScrollDownHdl) );
-
- SetNodeDefaultImages( );
+ disposeOnce();
+}
- EnableContextMenuHandling();
+void InterimDBTreeListBox::dispose()
+{
+ implStopSelectionTimer();
+ m_xStatusBar.reset();
+ m_xTreeView.reset();
+ InterimItemWindow::dispose();
+}
- SetQuickSearch( true );
+bool InterimDBTreeListBox::DoChildKeyInput(const KeyEvent& rKEvt)
+{
+ return ChildKeyInput(rKEvt);
}
-DBTreeListBox::~DBTreeListBox()
+TreeListBoxDropTarget::TreeListBoxDropTarget(TreeListBox& rTreeView)
+ : DropTargetHelper(rTreeView.GetWidget().get_drop_target())
+ , m_rTreeView(rTreeView)
{
- assert(!m_xMenuController.is());
- disposeOnce();
}
-void DBTreeListBox::dispose()
+sal_Int8 TreeListBoxDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
{
- if (m_pResetEvent)
+ sal_Int8 nAccept = m_rTreeView.AcceptDrop(rEvt);
+
+ if (nAccept != DND_ACTION_NONE)
{
- RemoveUserEvent(m_pResetEvent);
- m_pResetEvent = nullptr;
+ // to enable the autoscroll when we're close to the edges
+ weld::TreeView& rWidget = m_rTreeView.GetWidget();
+ rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
}
- implStopSelectionTimer();
- SvTreeListBox::dispose();
+
+ return nAccept;
}
-SvTreeListEntry* DBTreeListBox::GetEntryPosByName( const OUString& aName, SvTreeListEntry* pStart, const IEntryFilter* _pFilter ) const
+sal_Int8 TreeListBoxDropTarget::ExecuteDrop(const ExecuteDropEvent& rEvt)
{
- SvTreeList* myModel = GetModel();
- std::pair<SvTreeListEntries::const_iterator,SvTreeListEntries::const_iterator> aIters =
- myModel->GetChildIterators(pStart);
+ return m_rTreeView.ExecuteDrop(rEvt);
+}
- SvTreeListEntry* pEntry = nullptr;
- SvTreeListEntries::const_iterator it = aIters.first, itEnd = aIters.second;
- for (; it != itEnd; ++it)
- {
- pEntry = (*it).get();
- const SvLBoxString* pItem = static_cast<const SvLBoxString*>(
- pEntry->GetFirstItem(SvLBoxItemType::String));
+TreeListBox::TreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bSQLType)
+ : m_xTreeView(std::move(xTreeView))
+ , m_aDropTargetHelper(*this)
+ , m_pActionListener(nullptr)
+ , m_pContextMenuProvider(nullptr)
+ , m_aTimer("dbaccess TreeListBox m_aTimer")
+{
+ m_xTreeView->connect_key_press(LINK(this, TreeListBox, KeyInputHdl));
+ m_xTreeView->connect_selection_changed(LINK(this, TreeListBox, SelectHdl));
+ m_xTreeView->connect_query_tooltip(LINK(this, TreeListBox, QueryTooltipHdl));
+ m_xTreeView->connect_popup_menu(LINK(this, TreeListBox, CommandHdl));
- if (pItem && pItem->GetText() == aName)
- {
- if (!_pFilter || _pFilter->includeEntry(pEntry->GetUserData()))
- // found
- break;
- }
- pEntry = nullptr;
- }
+ if (bSQLType)
+ m_xHelper.set(new ODataClipboard);
+ else
+ m_xHelper.set(new svx::OComponentTransferable);
+ m_xTreeView->enable_drag_source(m_xHelper, DND_ACTION_COPY);
+ m_xTreeView->connect_drag_begin(LINK(this, TreeListBox, DragBeginHdl));
- return pEntry;
+ m_aTimer.SetTimeout(900);
+ m_aTimer.SetInvokeHandler(LINK(this, TreeListBox, OnTimeOut));
}
-void DBTreeListBox::RequestingChildren( SvTreeListEntry* pParent )
+bool TreeListBox::DoChildKeyInput(const KeyEvent& /*rKEvt*/)
{
- if (m_aPreExpandHandler.IsSet() && !m_aPreExpandHandler.Call(pParent))
- {
- // an error occurred. The method calling us will reset the entry flags, so it can't be expanded again.
- // But we want that the user may do a second try (i.e. because he mistypes a password in this try), so
- // we have to reset these flags controlling the expand ability
- m_pResetEvent = PostUserEvent(LINK(this, DBTreeListBox, OnResetEntryHdl), pParent, true);
- }
+ // nothing by default
+ return false;
}
-void DBTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& aStr, const Image& _rCollEntryBmp, const Image& _rExpEntryBmp)
+IMPL_LINK(TreeListBox, KeyInputHdl, const KeyEvent&, rKEvt, bool)
{
- SvTreeListBox::InitEntry( _pEntry, aStr, _rCollEntryBmp,_rExpEntryBmp);
- SvLBoxItem* pTextItem(_pEntry->GetFirstItem(SvLBoxItemType::String));
- _pEntry->ReplaceItem(std::make_unique<OBoldListboxString>(aStr), _pEntry->GetPos(pTextItem));
+ KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
+ bool bHandled = false;
+
+ switch (eFunc)
+ {
+ case KeyFuncType::COPY:
+ bHandled = m_aCopyHandler.IsSet() && !m_xTreeView->get_selected(nullptr);
+ if (bHandled)
+ m_aCopyHandler.Call(nullptr);
+ break;
+ case KeyFuncType::PASTE:
+ bHandled = m_aPasteHandler.IsSet() && !m_xTreeView->get_selected(nullptr);
+ if (bHandled)
+ m_aPasteHandler.Call(nullptr);
+ break;
+ case KeyFuncType::DELETE:
+ bHandled = m_aDeleteHandler.IsSet() && !m_xTreeView->get_selected(nullptr);
+ if (bHandled)
+ m_aDeleteHandler.Call(nullptr);
+ break;
+ default:
+ break;
+ }
+
+ return bHandled || DoChildKeyInput(rKEvt);
}
-void DBTreeListBox::implStopSelectionTimer()
+void TreeListBox::implStopSelectionTimer()
{
if ( m_aTimer.IsActive() )
m_aTimer.Stop();
}
-void DBTreeListBox::implStartSelectionTimer()
+void TreeListBox::implStartSelectionTimer()
{
implStopSelectionTimer();
m_aTimer.Start();
}
-void DBTreeListBox::DeselectHdl()
+IMPL_LINK_NOARG(TreeListBox, SelectHdl, weld::TreeView&, void)
{
- m_aSelectedEntries.erase( GetHdlEntry() );
- SvTreeListBox::DeselectHdl();
implStartSelectionTimer();
}
-void DBTreeListBox::SelectHdl()
+TreeListBox::~TreeListBox()
{
- m_aSelectedEntries.insert( GetHdlEntry() );
- SvTreeListBox::SelectHdl();
- implStartSelectionTimer();
}
-void DBTreeListBox::MouseButtonDown( const MouseEvent& rMEvt )
+std::unique_ptr<weld::TreeIter> TreeListBox::GetEntryPosByName(std::u16string_view aName, const weld::TreeIter* pStart, const IEntryFilter* _pFilter) const
{
- bool bHitEmptySpace = (nullptr == GetEntry(rMEvt.GetPosPixel(), true));
- if (bHitEmptySpace && (rMEvt.GetClicks() == 2) && rMEvt.IsMod1())
- Control::MouseButtonDown(rMEvt);
+ auto xEntry(m_xTreeView->make_iterator(pStart));
+ if (pStart)
+ {
+ if (!m_xTreeView->iter_children(*xEntry))
+ return nullptr;
+ }
else
- SvTreeListBox::MouseButtonDown(rMEvt);
-}
+ {
+ if (!m_xTreeView->get_iter_first(*xEntry))
+ return nullptr;
+ }
-void DBTreeListBox::EnableExpandHandler(SvTreeListEntry* pEntry)
-{
- // set the flag which allows if the entry can be expanded
- pEntry->SetFlags( (pEntry->GetFlags() & ~SvTLEntryFlags(SvTLEntryFlags::NO_NODEBMP | SvTLEntryFlags::HAD_CHILDREN)) | SvTLEntryFlags::CHILDREN_ON_DEMAND );
- // redraw the entry
- GetModel()->InvalidateEntry(pEntry);
-}
+ do
+ {
+ if (m_xTreeView->get_text(*xEntry) == aName)
+ {
+ if (!_pFilter || _pFilter->includeEntry(weld::fromId<void*>(m_xTreeView->get_id(*xEntry))))
+ {
+ // found
+ return xEntry;
+ }
+ }
+ } while (m_xTreeView->iter_next_sibling(*xEntry));
-IMPL_LINK(DBTreeListBox, OnResetEntryHdl, void*, p, void)
-{
- m_pResetEvent = nullptr;
- EnableExpandHandler(static_cast<SvTreeListEntry*>(p));
+ return nullptr;
}
-void DBTreeListBox::ModelHasEntryInvalidated( SvTreeListEntry* _pEntry )
+IMPL_LINK(TreeListBox, DragBeginHdl, bool&, rUnsetDragIcon, bool)
{
- SvTreeListBox::ModelHasEntryInvalidated( _pEntry );
+ rUnsetDragIcon = false;
- if (m_aSelectedEntries.find(_pEntry) != m_aSelectedEntries.end())
+ if (m_pActionListener)
{
- SvLBoxItem* pTextItem = _pEntry->GetFirstItem(SvLBoxItemType::String);
- if ( pTextItem && !static_cast< OBoldListboxString* >( pTextItem )->isEmphasized() )
+ m_xDragedEntry = m_xTreeView->make_iterator();
+ if (!m_xTreeView->get_selected(m_xDragedEntry.get()))
+ m_xDragedEntry.reset();
+ if (m_xDragedEntry && m_pActionListener->requestDrag(*m_xDragedEntry))
{
+ // if the (asynchronous) drag started, stop the selection timer
implStopSelectionTimer();
- m_aSelectedEntries.erase(_pEntry);
- // ehm - why?
+ return false;
}
}
-}
-void DBTreeListBox::ModelHasRemoved( SvTreeListEntry* _pEntry )
-{
- SvTreeListBox::ModelHasRemoved(_pEntry);
- if (m_aSelectedEntries.find(_pEntry) != m_aSelectedEntries.end())
- {
- implStopSelectionTimer();
- m_aSelectedEntries.erase(_pEntry);
- }
+ return true;
}
-sal_Int8 DBTreeListBox::AcceptDrop( const AcceptDropEvent& _rEvt )
+sal_Int8 TreeListBox::AcceptDrop(const AcceptDropEvent& rEvt)
{
sal_Int8 nDropOption = DND_ACTION_NONE;
if ( m_pActionListener )
{
- SvTreeListEntry* pDroppedEntry = GetEntry(_rEvt.maPosPixel);
+ ::Point aDropPos = rEvt.maPosPixel;
+ std::unique_ptr<weld::TreeIter> xDropTarget(m_xTreeView->make_iterator());
+ if (!m_xTreeView->get_dest_row_at_pos(aDropPos, xDropTarget.get(), true))
+ xDropTarget.reset();
+
// check if drag is on child entry, which is not allowed
- SvTreeListEntry* pParent = nullptr;
- if ( _rEvt.mnAction & DND_ACTION_MOVE )
+ std::unique_ptr<weld::TreeIter> xParent;
+ if (rEvt.mnAction & DND_ACTION_MOVE)
{
- if ( !m_pDragedEntry ) // no entry to move
+ if (!m_xDragedEntry) // no entry to move
+ return m_pActionListener->queryDrop(rEvt, m_aDropTargetHelper.GetDataFlavorExVector());
+
+ if (xDropTarget)
{
- nDropOption = m_pActionListener->queryDrop( _rEvt, GetDataFlavorExVector() );
- m_aMousePos = _rEvt.maPosPixel;
- m_aScrollHelper.scroll(m_aMousePos,GetOutputSizePixel());
- return nDropOption;
+ xParent = m_xTreeView->make_iterator(xDropTarget.get());
+ if (!m_xTreeView->iter_parent(*xParent))
+ xParent.reset();
+ }
+ while (xParent && m_xTreeView->iter_compare(*xParent, *m_xDragedEntry) != 0)
+ {
+ if (!m_xTreeView->iter_parent(*xParent))
+ xParent.reset();
}
-
- pParent = pDroppedEntry ? GetParent(pDroppedEntry) : nullptr;
- while ( pParent && pParent != m_pDragedEntry )
- pParent = GetParent(pParent);
}
- if ( !pParent )
+ if (!xParent)
{
- nDropOption = m_pActionListener->queryDrop( _rEvt, GetDataFlavorExVector() );
+ nDropOption = m_pActionListener->queryDrop(rEvt, m_aDropTargetHelper.GetDataFlavorExVector());
// check if move is allowed
if ( nDropOption & DND_ACTION_MOVE )
{
- if ( m_pDragedEntry == pDroppedEntry || GetEntryPosByName(GetEntryText(m_pDragedEntry),pDroppedEntry) )
+ if (!m_xDragedEntry || !xDropTarget ||
+ m_xTreeView->iter_compare(*m_xDragedEntry, *xDropTarget) == 0 ||
+ GetEntryPosByName(m_xTreeView->get_text(*m_xDragedEntry), xDropTarget.get()))
+ {
nDropOption = nDropOption & ~DND_ACTION_MOVE;//DND_ACTION_NONE;
+ }
}
- m_aMousePos = _rEvt.maPosPixel;
- m_aScrollHelper.scroll(m_aMousePos,GetOutputSizePixel());
}
}
return nDropOption;
}
-sal_Int8 DBTreeListBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
+sal_Int8 TreeListBox::ExecuteDrop(const ExecuteDropEvent& rEvt)
{
- if ( m_pActionListener )
- return m_pActionListener->executeDrop( _rEvt );
-
+ if (m_pActionListener)
+ m_pActionListener->executeDrop(rEvt);
+ m_xTreeView->unset_drag_dest_row();
return DND_ACTION_NONE;
}
-void DBTreeListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& _rPosPixel )
+IMPL_LINK(TreeListBox, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
{
- if ( m_pActionListener )
+ OUString sQuickHelpText;
+ if (m_pActionListener &&
+ m_pActionListener->requestQuickHelp(weld::fromId<void*>(m_xTreeView->get_id(rIter)), sQuickHelpText))
{
- m_pDragedEntry = GetEntry(_rPosPixel);
- if ( m_pDragedEntry && m_pActionListener->requestDrag( _rPosPixel ) )
- {
- // if the (asynchronous) drag started, stop the selection timer
- implStopSelectionTimer();
- // and stop selecting entries by simply moving the mouse
- EndSelection();
- }
+ return sQuickHelpText;
}
-}
-
-void DBTreeListBox::RequestHelp( const HelpEvent& rHEvt )
-{
- if ( !m_pActionListener )
- {
- SvTreeListBox::RequestHelp( rHEvt );
- return;
- }
-
- if( rHEvt.GetMode() & HelpEventMode::QUICK )
- {
- Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
- SvTreeListEntry* pEntry = GetEntry( aPos );
- if( pEntry )
- {
- OUString sQuickHelpText;
- if ( m_pActionListener->requestQuickHelp( pEntry, sQuickHelpText ) )
- {
- Size aSize( GetOutputSizePixel().Width(), GetEntryHeight() );
- tools::Rectangle aScreenRect( OutputToScreenPixel( GetEntryPosition( pEntry ) ), aSize );
-
- Help::ShowQuickHelp( this, aScreenRect,
- sQuickHelpText, QuickHelpFlags::Left | QuickHelpFlags::VCenter );
- return;
- }
- }
- }
-
- SvTreeListBox::RequestHelp( rHEvt );
-}
-
-void DBTreeListBox::KeyInput( const KeyEvent& rKEvt )
-{
- KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
- sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- bool bHandled = false;
-
- if(eFunc != KeyFuncType::DONTKNOW)
- {
- switch(eFunc)
- {
- case KeyFuncType::COPY:
- bHandled = ( m_aCopyHandler.IsSet() && !m_aSelectedEntries.empty() );
- if ( bHandled )
- m_aCopyHandler.Call( nullptr );
- break;
- case KeyFuncType::PASTE:
- bHandled = ( m_aPasteHandler.IsSet() && !m_aSelectedEntries.empty() );
- if ( bHandled )
- m_aPasteHandler.Call( nullptr );
- break;
- case KeyFuncType::DELETE:
- bHandled = ( m_aDeleteHandler.IsSet() && !m_aSelectedEntries.empty() );
- if ( bHandled )
- m_aDeleteHandler.Call( nullptr );
- break;
- default:
- break;
- }
- }
-
- if ( KEY_RETURN == nCode )
- {
- bHandled = false;
- m_aEnterKeyHdl.Call(this);
- // this is a HACK. If the data source browser is opened in the "beamer", while the main frame
- //
- // contains a writer document, then pressing enter in the DSB would be rerouted to the writer
- //
- // document if we would not do this hack here.
- // The problem is that the Writer uses RETURN as _accelerator_ (which is quite weird itself),
- //
- // so the SFX framework is _obligated_ to pass it to the Writer if nobody else handled it. There
- //
- // is no chance to distinguish between
- // "accelerators which are to be executed if the main document has the focus"
- // and
- // "accelerators which are always to be executed"
- //
- // Thus we cannot prevent the handling of this key in the writer without declaring the key event
- // as "handled" herein.
- //
- // The bad thing about this approach is that it does not scale. Every other accelerator which
- // is used by the document will raise a similar bug once somebody discovers it.
- // If this is the case, we should discuss a real solution with the framework (SFX) and the
- // applications.
- }
-
- if ( !bHandled )
- SvTreeListBox::KeyInput(rKEvt);
-}
-
-bool DBTreeListBox::EditingEntry( SvTreeListEntry* /*pEntry*/, Selection& /*_aSelection*/)
-{
- return false;
-}
-
-bool DBTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText )
-{
- DBTreeEditedEntry aEntry;
- aEntry.aNewText = rNewText;
- SetEntryText(pEntry,aEntry.aNewText);
-
- return false; // we never want that the base change our text
-}
-
-bool DBTreeListBox::DoubleClickHdl()
-{
- // continue default processing if the DoubleClickHandler didn't handle it
- return !aDoubleClickHdl.Call( this );
-}
-
-static void scrollWindow(DBTreeListBox* _pListBox, const Point& _rPos,bool _bUp)
-{
- SvTreeListEntry* pEntry = _pListBox->GetEntry( _rPos );
- if( pEntry && pEntry != _pListBox->Last() )
- {
- _pListBox->ScrollOutputArea( _bUp ? -1 : 1 );
- }
-}
-
-IMPL_LINK_NOARG( DBTreeListBox, ScrollUpHdl, LinkParamNone*, void )
-{
- scrollWindow(this,m_aMousePos,true);
-}
-
-IMPL_LINK_NOARG( DBTreeListBox, ScrollDownHdl, LinkParamNone*, void )
-{
- scrollWindow(this,m_aMousePos,false);
+ return m_xTreeView->get_tooltip_text();
}
namespace
@@ -415,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 ))
{
}
@@ -458,121 +352,160 @@ namespace
}
}
-VclPtr<PopupMenu> DBTreeListBox::CreateContextMenu()
+IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool)
{
- if ( !m_pContextMenuProvider )
- return nullptr;
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
+ return false;
- OUString aResourceName( m_pContextMenuProvider->getContextMenuResourceName( *this ) );
- if ( aResourceName.isEmpty() )
- return nullptr;
+ ::Point aPos = rCEvt.GetMousePosPixel();
- css::uno::Sequence< css::uno::Any > aArgs( 3 );
- aArgs[0] <<= comphelper::makePropertyValue( "Value", aResourceName );
- aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_pContextMenuProvider->getCommandController().getXController()->getFrame() );
- aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true );
+ std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
+ if (m_xTreeView->get_dest_row_at_pos(aPos, xIter.get(), false) && !m_xTreeView->is_selected(*xIter))
+ {
+ m_xTreeView->unselect_all();
+ m_xTreeView->set_cursor(*xIter);
+ m_xTreeView->select(*xIter);
+ SelectHdl(*m_xTreeView);
+ }
- css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- m_xMenuController.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
- "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext ), css::uno::UNO_QUERY );
+ if (!m_pContextMenuProvider)
+ return false;
- if ( !m_xMenuController.is() )
- return nullptr;
+ OUString aResourceName(m_pContextMenuProvider->getContextMenuResourceName());
+ if (aResourceName.isEmpty())
+ return false;
+
+ css::uno::Sequence< css::uno::Any > aArgs{
+ css::uno::Any(comphelper::makePropertyValue( u"Value"_ustr, aResourceName )),
+ css::uno::Any(comphelper::makePropertyValue( u"Frame"_ustr, m_pContextMenuProvider->getCommandController().getXController()->getFrame() )),
+ css::uno::Any(comphelper::makePropertyValue( u"IsContextMenu"_ustr, true ))
+ };
+
+ const css::uno::Reference< css::uno::XComponentContext >& xContext = comphelper::getProcessComponentContext();
+ css::uno::Reference<css::frame::XPopupMenuController> xMenuController
+ (xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ u"com.sun.star.comp.framework.ResourceMenuController"_ustr, aArgs, xContext), css::uno::UNO_QUERY);
+
+ if (!xMenuController.is())
+ return false;
+
+ VclPtr<vcl::Window> xMenuParent = m_pContextMenuProvider->getMenuParent();
+
+ css::uno::Reference< css::awt::XWindow> xSourceWindow = VCLUnoHelper::GetInterface(xMenuParent);
rtl::Reference xPopupMenu( new VCLXPopupMenu );
- m_xMenuController->setPopupMenu( xPopupMenu.get() );
- VclPtr<PopupMenu> pContextMenu( static_cast< PopupMenu* >( xPopupMenu->GetMenu() ) );
- pContextMenu->AddEventListener( LINK( this, DBTreeListBox, MenuEventListener ) );
+ xMenuController->setPopupMenu( xPopupMenu );
// allow context menu interception
::comphelper::OInterfaceContainerHelper2* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors();
- if ( !pInterceptors || !pInterceptors->getLength() )
- return pContextMenu;
-
- OUString aMenuIdentifier( "private:resource/popupmenu/" + aResourceName );
-
- ContextMenuExecuteEvent aEvent;
- aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
- aEvent.ExecutePosition.X = -1;
- aEvent.ExecutePosition.Y = -1;
- aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu(
- pContextMenu.get(), &aMenuIdentifier );
- aEvent.Selection = new SelectionSupplier( m_pContextMenuProvider->getCurrentSelection( *this ) );
-
- ::comphelper::OInterfaceIteratorHelper2 aIter( *pInterceptors );
- bool bModifiedMenu = false;
- bool bAskInterceptors = true;
- while ( aIter.hasMoreElements() && bAskInterceptors )
+ if (pInterceptors && pInterceptors->getLength())
{
- Reference< XContextMenuInterceptor > xInterceptor( aIter.next(), UNO_QUERY );
- if ( !xInterceptor.is() )
- continue;
-
- try
+ OUString aMenuIdentifier( "private:resource/popupmenu/" + aResourceName );
+
+ ContextMenuExecuteEvent aEvent;
+ aEvent.SourceWindow = xSourceWindow;
+ aEvent.ExecutePosition.X = -1;
+ aEvent.ExecutePosition.Y = -1;
+ aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu(
+ xPopupMenu, &aMenuIdentifier );
+ aEvent.Selection = new SelectionSupplier(m_pContextMenuProvider->getCurrentSelection(*m_xTreeView));
+
+ ::comphelper::OInterfaceIteratorHelper2 aIter( *pInterceptors );
+ bool bModifiedMenu = false;
+ bool bAskInterceptors = true;
+ while ( aIter.hasMoreElements() && bAskInterceptors )
{
- ContextMenuInterceptorAction eAction = xInterceptor->notifyContextMenuExecute( aEvent );
- switch ( eAction )
+ Reference< XContextMenuInterceptor > xInterceptor( aIter.next(), UNO_QUERY );
+ if ( !xInterceptor.is() )
+ continue;
+
+ try
+ {
+ ContextMenuInterceptorAction eAction = xInterceptor->notifyContextMenuExecute( aEvent );
+ switch ( eAction )
+ {
+ case ContextMenuInterceptorAction_CANCELLED:
+ return false;
+
+ case ContextMenuInterceptorAction_EXECUTE_MODIFIED:
+ bModifiedMenu = true;
+ bAskInterceptors = false;
+ break;
+
+ case ContextMenuInterceptorAction_CONTINUE_MODIFIED:
+ bModifiedMenu = true;
+ bAskInterceptors = true;
+ break;
+
+ default:
+ OSL_FAIL( "DBTreeListBox::CreateContextMenu: unexpected return value of the interceptor call!" );
+ [[fallthrough]];
+ case ContextMenuInterceptorAction_IGNORED:
+ break;
+ }
+ }
+ catch( const DisposedException& e )
{
- case ContextMenuInterceptorAction_CANCELLED:
- return nullptr;
-
- case ContextMenuInterceptorAction_EXECUTE_MODIFIED:
- bModifiedMenu = true;
- bAskInterceptors = false;
- break;
-
- case ContextMenuInterceptorAction_CONTINUE_MODIFIED:
- bModifiedMenu = true;
- bAskInterceptors = true;
- break;
-
- default:
- OSL_FAIL( "DBTreeListBox::CreateContextMenu: unexpected return value of the interceptor call!" );
- [[fallthrough]];
- case ContextMenuInterceptorAction_IGNORED:
- break;
+ if ( e.Context == xInterceptor )
+ aIter.remove();
}
}
- catch( const DisposedException& e )
+
+ if ( bModifiedMenu )
{
- if ( e.Context == xInterceptor )
- aIter.remove();
+ xPopupMenu->clear();
+ ::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer(
+ xPopupMenu, aEvent.ActionTriggerContainer );
+ aEvent.ActionTriggerContainer.clear();
}
}
- if ( bModifiedMenu )
- {
- pContextMenu->Clear();
- ::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer(
- pContextMenu, aEvent.ActionTriggerContainer );
- aEvent.ActionTriggerContainer.clear();
- }
+ // adjust pos relative to m_xTreeView to relative to xMenuParent
+ m_pContextMenuProvider->adjustMenuPosition(*m_xTreeView, aPos);
- return pContextMenu;
-}
+ // do action for selected entry in popup menu
+ css::uno::Reference<css::awt::XWindowPeer> xParent(xSourceWindow, css::uno::UNO_QUERY);
+ xPopupMenu->execute(xParent, css::awt::Rectangle(aPos.X(), aPos.Y(), 1, 1), css::awt::PopupMenuDirection::EXECUTE_DOWN);
-IMPL_LINK( DBTreeListBox, MenuEventListener, VclMenuEvent&, rMenuEvent, void )
-{
- if ( rMenuEvent.GetId() == VclEventId::ObjectDying )
- {
- css::uno::Reference< css::lang::XComponent > xComponent( m_xMenuController, css::uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
- m_xMenuController.clear();
- }
+ css::uno::Reference<css::lang::XComponent> xComponent(xMenuController, css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ xMenuController.clear();
+
+ return true;
}
-IMPL_LINK_NOARG(DBTreeListBox, OnTimeOut, Timer*, void)
+IMPL_LINK_NOARG(TreeListBox, OnTimeOut, Timer*, void)
{
implStopSelectionTimer();
m_aSelChangeHdl.Call( nullptr );
}
-void DBTreeListBox::StateChanged( StateChangedType nStateChange )
+std::unique_ptr<weld::TreeIter> TreeListBox::GetRootLevelParent(const weld::TreeIter* pEntry) const
+{
+ if (!pEntry)
+ return nullptr;
+ std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pEntry));
+ while (m_xTreeView->get_iter_depth(*xEntry))
+ m_xTreeView->iter_parent(*xEntry);
+ return xEntry;
+}
+
+DBTreeViewBase::DBTreeViewBase(weld::Container* pContainer)
+ : m_xBuilder(Application::CreateBuilder(pContainer, u"dbaccess/ui/dbtreelist.ui"_ustr))
+ , m_xContainer(m_xBuilder->weld_container(u"DBTreeList"_ustr))
+{
+}
+
+DBTreeViewBase::~DBTreeViewBase()
+{
+}
+
+DBTreeView::DBTreeView(weld::Container* pContainer, bool bSQLType)
+ : DBTreeViewBase(pContainer)
{
- if ( nStateChange == StateChangedType::Visible )
- implStopSelectionTimer();
+ m_xTreeListBox.reset(new TreeListBox(m_xBuilder->weld_tree_view(u"treeview"_ustr), bSQLType));
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx
deleted file mode 100644
index 1036ed3b36df..000000000000
--- a/dbaccess/source/ui/control/listviewitems.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <listviewitems.hxx>
-#include <vcl/viewdataentry.hxx>
-
-namespace dbaui
-{
-
- void OBoldListboxString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* _pViewData)
- {
- SvLBoxString::InitViewData( pView, pEntry, _pViewData );
- if ( !m_bEmphasized )
- return;
- if (!_pViewData)
- _pViewData = pView->GetViewDataItem( pEntry, this );
- pView->Push();
- vcl::Font aFont( pView->GetFont());
- aFont.SetWeight(WEIGHT_BOLD);
- pView->Control::SetFont( aFont );
- _pViewData->mnWidth = pView->GetTextWidth(GetText());
- _pViewData->mnHeight = pView->GetTextHeight();
- pView->Pop();
- }
-
- SvLBoxItemType OBoldListboxString::GetType() const
- {
- return SvLBoxItemType::String;
- }
-
- void OBoldListboxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry& rEntry)
- {
- if (m_bEmphasized)
- {
- rRenderContext.Push();
- vcl::Font aFont(rRenderContext.GetFont());
- aFont.SetWeight(WEIGHT_BOLD);
- rRenderContext.SetFont(aFont);
- Point aPos(rPos);
- rRenderContext.DrawText(aPos, GetText());
- rRenderContext.Pop();
- }
- else
- {
- SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, rEntry);
- }
- }
-
-} // namespace dbaui
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/marktree.cxx b/dbaccess/source/ui/control/marktree.cxx
deleted file mode 100644
index 9bf664fa6e87..000000000000
--- a/dbaccess/source/ui/control/marktree.cxx
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <marktree.hxx>
-#include <vcl/treelistentry.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/event.hxx>
-
-namespace dbaui
-{
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
-
-
-OMarkableTreeListBox::OMarkableTreeListBox( vcl::Window* pParent, WinBits nWinStyle )
- : DBTreeListBox(pParent, nWinStyle)
-{
-
- InitButtonData();
-}
-
-OMarkableTreeListBox::~OMarkableTreeListBox()
-{
- disposeOnce();
-}
-
-void OMarkableTreeListBox::dispose()
-{
- m_pCheckButton.reset();
- DBTreeListBox::dispose();
-}
-
-void OMarkableTreeListBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect)
-{
- if (!IsEnabled())
- {
- vcl::Font aOldFont = rRenderContext.GetFont();
- vcl::Font aNewFont(aOldFont);
-
- StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
- aNewFont.SetColor(aSystemStyle.GetDisableColor());
-
- rRenderContext.SetFont(aNewFont);
- DBTreeListBox::Paint(rRenderContext, _rRect);
- rRenderContext.SetFont(aOldFont);
- }
- else
- DBTreeListBox::Paint(rRenderContext, _rRect);
-}
-
-void OMarkableTreeListBox::InitButtonData()
-{
- m_pCheckButton.reset( new SvLBoxButtonData( this ) );
- EnableCheckButton( m_pCheckButton.get() );
-}
-
-void OMarkableTreeListBox::KeyInput( const KeyEvent& rKEvt )
-{
- // only if there are spaces
- if (rKEvt.GetKeyCode().GetCode() == KEY_SPACE && !rKEvt.GetKeyCode().IsShift() && !rKEvt.GetKeyCode().IsMod1())
- {
- SvTreeListEntry* pCurrentHandlerEntry = GetHdlEntry();
- if(pCurrentHandlerEntry)
- {
- SvButtonState eState = GetCheckButtonState( pCurrentHandlerEntry);
- if(eState == SvButtonState::Checked)
- SetCheckButtonState( pCurrentHandlerEntry, SvButtonState::Unchecked);
- else
- SetCheckButtonState( pCurrentHandlerEntry, SvButtonState::Checked);
-
- CheckButtonHdl();
- }
- else
- DBTreeListBox::KeyInput(rKEvt);
- }
- else
- DBTreeListBox::KeyInput(rKEvt);
-}
-
-SvButtonState OMarkableTreeListBox::implDetermineState(SvTreeListEntry* _pEntry)
-{
- SvButtonState eState = GetCheckButtonState(_pEntry);
- if (!GetModel()->HasChildren(_pEntry))
- // nothing to do in this bottom-up routine if there are no children ...
- return eState;
-
- // loop through the children and check their states
- sal_uInt16 nCheckedChildren = 0;
- sal_uInt16 nChildrenOverall = 0;
-
- SvTreeListEntry* pChildLoop = GetModel()->FirstChild(_pEntry);
- while (pChildLoop)
- {
- SvButtonState eChildState = implDetermineState(pChildLoop);
- if (SvButtonState::Tristate == eChildState)
- break;
-
- if (SvButtonState::Checked == eChildState)
- ++nCheckedChildren;
- ++nChildrenOverall;
-
- pChildLoop = pChildLoop->NextSibling();
- }
-
- if (pChildLoop)
- {
- // we did not finish the loop because at least one of the children is in tristate
- eState = SvButtonState::Tristate;
-
- // but this means that we did not finish all the siblings of pChildLoop,
- // so their checking may be incorrect at the moment
- // -> correct this
- while (pChildLoop)
- {
- implDetermineState(pChildLoop);
- pChildLoop = pChildLoop->NextSibling();
- }
- }
- else
- // none if the children are in tristate
- if (nCheckedChildren)
- // we have at least one child checked
- if (nCheckedChildren != nChildrenOverall)
- // not all children are checked
- eState = SvButtonState::Tristate;
- else
- // all children are checked
- eState = SvButtonState::Checked;
- else
- // no children are checked
- eState = SvButtonState::Unchecked;
-
- // finally set the entry to the state we just determined
- SetCheckButtonState(_pEntry, eState);
-
- return eState;
-}
-
-void OMarkableTreeListBox::CheckButtons()
-{
- SvTreeListEntry* pEntry = GetModel()->First();
- while (pEntry)
- {
- implDetermineState(pEntry);
- pEntry = pEntry->NextSibling();
- }
-}
-
-void OMarkableTreeListBox::CheckButtonHdl()
-{
- checkedButton_noBroadcast(GetHdlEntry());
-}
-
-void OMarkableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry)
-{
- SvButtonState eState = GetCheckButtonState( _pEntry);
- if (GetModel()->HasChildren(_pEntry)) // if it has children, check those too
- {
- SvTreeListEntry* pChildEntry = GetModel()->Next(_pEntry);
- SvTreeListEntry* pSiblingEntry = _pEntry->NextSibling();
- while(pChildEntry && pChildEntry != pSiblingEntry)
- {
- SetCheckButtonState(pChildEntry, eState);
- pChildEntry = GetModel()->Next(pChildEntry);
- }
- }
-
- SvTreeListEntry* pEntry = IsSelected(_pEntry) ? FirstSelected() : nullptr;
- while(pEntry)
- {
- SetCheckButtonState(pEntry,eState);
- if(GetModel()->HasChildren(pEntry)) // if it has children, check those too
- {
- SvTreeListEntry* pChildEntry = GetModel()->Next(pEntry);
- SvTreeListEntry* pSiblingEntry = pEntry->NextSibling();
- while(pChildEntry && pChildEntry != pSiblingEntry)
- {
- SetCheckButtonState(pChildEntry,eState);
- pChildEntry = GetModel()->Next(pChildEntry);
- }
- }
- pEntry = NextSelected(pEntry);
- }
- CheckButtons();
-}
-
-} // namespace
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index a80ed3ede422..2b1fe7b80181 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -25,7 +25,6 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <comphelper/processfactory.hxx>
@@ -52,18 +51,14 @@ namespace dbaui
using ::com::sun::star::ui::XImageManager;
using ::com::sun::star::graphic::XGraphic;
- Reference< XGraphic> GetCommandIcon( const char* _pCommandURL, const OUString& _rModuleName )
+ Reference< XGraphic> GetCommandIcon( const OUString& sCommandURL, const OUString& _rModuleName )
{
- if ( !_pCommandURL || !*_pCommandURL )
- return nullptr;
-
- OUString sCommandURL = OUString::createFromAscii( _pCommandURL );
try
{
do
{
// Retrieve popup menu labels
- Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ const Reference< css::uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() );
if ( !xContext.is() )
break;
@@ -94,24 +89,16 @@ namespace dbaui
// OpenButton
- OpenDocumentButton::OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const char* _pAsciiModuleName)
+ OpenDocumentButton::OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const OUString& _rAsciiModuleName)
: m_xControl(std::move(xControl))
{
- impl_init( _pAsciiModuleName );
- }
-
- void OpenDocumentButton::impl_init( const char* _pAsciiModuleName )
- {
- OSL_ENSURE( _pAsciiModuleName, "OpenDocumentButton::impl_init: invalid module name!" );
- m_sModule = OUString::createFromAscii( _pAsciiModuleName );
-
// our label should equal the UI text of the "Open" command
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:Open", m_sModule);
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(u".uno:Open"_ustr, _rAsciiModuleName);
OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
m_xControl->set_label(" " + sLabel.replaceAll("~", ""));
// Place icon left of text and both centered in the button.
- m_xControl->set_image(GetCommandIcon(".uno:Open", m_sModule));
+ m_xControl->set_image(GetCommandIcon(u".uno:Open"_ustr, _rAsciiModuleName));
}
// OpenDocumentListBox
@@ -130,39 +117,33 @@ namespace dbaui
{
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentListBox::impl_init: invalid module name!" );
- Sequence< Sequence< PropertyValue> > aHistory = SvtHistoryOptions().GetList( ePICKLIST );
+ std::vector< SvtHistoryOptions::HistoryItem > aHistory = SvtHistoryOptions::GetList( EHistoryType::PickList );
Reference< XNameAccess > xFilterFactory;
xFilterFactory.set(::comphelper::getProcessServiceFactory()->createInstance(
- "com.sun.star.document.FilterFactory" ), css::uno::UNO_QUERY);
+ u"com.sun.star.document.FilterFactory"_ustr ), css::uno::UNO_QUERY);
- sal_uInt32 nCount = aHistory.getLength();
- for ( sal_uInt32 nItem = 0; nItem < nCount; ++nItem )
+ for ( const SvtHistoryOptions::HistoryItem& rHistoryItem : aHistory )
{
try
{
// Get the current history item's properties.
- ::comphelper::SequenceAsHashMap aItemProperties( aHistory[ nItem ] );
- OUString sURL = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_URL, OUString() );
- OUString sFilter = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_FILTER, OUString() );
- OUString sTitle = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_TITLE, OUString() );
- OUString sPassword = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_PASSWORD, OUString() );
+ OUString sURL = rHistoryItem.sURL;
+ OUString sFilter = rHistoryItem.sFilter;
+ OUString sTitle = rHistoryItem.sTitle;
- // 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;
::comphelper::SequenceAsHashMap aFilterProperties( aProps );
OUString sDocumentService = aFilterProperties.getUnpackedValueOrDefault(
- "DocumentService", OUString() );
+ u"DocumentService"_ustr, OUString() );
if ( sDocumentService.equalsAscii( _pAsciiModuleName ) )
{
// 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 );
@@ -170,7 +151,7 @@ namespace dbaui
OUString sDecodedURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
m_xControl->append_text(sTitle);
- m_aURLs.emplace_back(StringPair(sDecodedURL, sFilter));
+ m_aURLs.emplace_back(sDecodedURL, sFilter);
}
}
catch( Exception& ) {}
@@ -186,7 +167,7 @@ namespace dbaui
return sURL;
}
- OpenDocumentListBox::StringPair OpenDocumentListBox::impl_getDocumentAtIndex( sal_uInt16 _nListIndex ) const
+ const OpenDocumentListBox::StringPair & OpenDocumentListBox::impl_getDocumentAtIndex( sal_uInt16 _nListIndex ) const
{
return m_aURLs[_nListIndex];
}
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index ccbe210afd5f..791d5b3d3860 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -25,33 +25,36 @@
#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <officecfg/Office/Common.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/wghtitem.hxx>
#include <sqledit.hxx>
-#include <QueryTextView.hxx>
-#include <querycontainerwindow.hxx>
-#include <helpids.h>
-#include <undosqledit.hxx>
-#include <QueryDesignView.hxx>
-#include <svx/svxids.hrc>
-#include <vcl/settings.hxx>
#include <cppuhelper/implbase.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/specialchars.hxx>
#include <vcl/svapp.hxx>
using namespace dbaui;
-class OSqlEdit::ChangesListener:
+class SQLEditView::ChangesListener:
public cppu::WeakImplHelper< css::beans::XPropertiesChangeListener >
{
public:
- explicit ChangesListener(OSqlEdit & editor): editor_(editor) {}
+ explicit ChangesListener(SQLEditView& editor): editor_(editor) {}
private:
virtual ~ChangesListener() override {}
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();
}
@@ -62,26 +65,78 @@ private:
editor_.ImplSetFont();
}
- OSqlEdit & editor_;
+ SQLEditView& editor_;
};
-OSqlEdit::OSqlEdit( OQueryTextView* pParent ) :
- MultiLineEditSyntaxHighlight( pParent, WB_LEFT | WB_VSCROLL | WB_BORDER )
- ,m_pView(pParent)
- ,m_bAccelAction( false )
- ,m_bStopTimer(false )
+SQLEditView::SQLEditView(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow)
+ : m_xScrolledWindow(std::move(xScrolledWindow))
+ , m_aUpdateDataTimer("dbaccess SQLEditView m_aUpdateDataTimer")
+ , m_aHighlighter(HighlighterLanguage::SQL)
+ , m_bInUpdate(false)
+ , m_bDisableInternalUndo(false)
+{
+ m_xScrolledWindow->connect_vadjustment_value_changed(LINK(this, SQLEditView, ScrollHdl));
+}
+
+void SQLEditView::DisableInternalUndo()
+{
+ GetEditEngine()->EnableUndo(false);
+ m_bDisableInternalUndo = true;
+}
+
+void SQLEditView::SetItemPoolFont(SfxItemPool* pItemPool)
+{
+ OUString sFontName(officecfg::Office::Common::Font::SourceViewFont::FontName::get().value_or(OUString()));
+ if (sFontName.isEmpty())
+ {
+ vcl::Font aTmpFont(OutputDevice::GetDefaultFont(DefaultFontType::FIXED, Application::GetSettings().GetUILanguageTag().getLanguageType(), GetDefaultFontFlags::OnlyOne));
+ sFontName = aTmpFont.GetFamilyName();
+ }
+
+ Size aFontSize(0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get());
+ vcl::Font aAppFont(sFontName, aFontSize);
+
+ pItemPool->SetUserDefaultItem(SvxFontItem(aAppFont.GetFamilyTypeMaybeAskConfig(), aAppFont.GetFamilyName(),
+ u""_ustr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
+ EE_CHAR_FONTINFO));
+ pItemPool->SetUserDefaultItem(SvxFontItem(aAppFont.GetFamilyTypeMaybeAskConfig(), aAppFont.GetFamilyName(),
+ u""_ustr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
+ EE_CHAR_FONTINFO_CJK));
+ pItemPool->SetUserDefaultItem(SvxFontItem(aAppFont.GetFamilyTypeMaybeAskConfig(), aAppFont.GetFamilyName(),
+ u""_ustr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
+ EE_CHAR_FONTINFO_CTL));
+
+ pItemPool->SetUserDefaultItem(
+ SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT));
+ pItemPool->SetUserDefaultItem(
+ SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT_CJK));
+ pItemPool->SetUserDefaultItem(
+ SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT_CTL));
+}
+
+void SQLEditView::makeEditEngine()
+{
+ assert(!m_pItemPool);
+ m_pItemPool = EditEngine::CreatePool();
+ SetItemPoolFont(m_pItemPool.get());
+ m_xEditEngine.reset(new EditEngine(m_pItemPool.get()));
+}
+
+void SQLEditView::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
- SetHelpId( HID_CTL_QRYSQLEDIT );
- SetModifyHdl( LINK(this, OSqlEdit, ModifyHdl) );
+ WeldEditView::SetDrawingArea(pDrawingArea);
- m_timerUndoActionCreation.SetTimeout(1000);
- m_timerUndoActionCreation.SetInvokeHandler(LINK(this, OSqlEdit, OnUndoActionTimer));
+ EditEngine& rEditEngine = *GetEditEngine();
- m_timerInvalidate.SetTimeout(200);
- m_timerInvalidate.SetInvokeHandler(LINK(this, OSqlEdit, OnInvalidateTimer));
- m_timerInvalidate.Start();
+ rEditEngine.SetDefaultHorizontalTextDirection(EEHorizontalTextDirection::L2R);
+ rEditEngine.SetModifyHdl(LINK(this, SQLEditView, ModifyHdl));
+ rEditEngine.SetStatusEventHdl(LINK(this, SQLEditView, EditStatusHdl));
+
+ m_aUpdateDataTimer.SetTimeout(150);
+ m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SQLEditView, ImplUpdateDataHdl));
ImplSetFont();
+
// Listen for change of Font and Color Settings:
// Using "this" in ctor is a little fishy, but should work here at least as
// long as there are no derivations:
@@ -90,159 +145,369 @@ OSqlEdit::OSqlEdit( OQueryTextView* pParent ) :
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(2);
- s[0] = "FontHeight";
- s[1] = "FontName";
- n->addPropertiesChangeListener(s, m_listener.get());
+ css::uno::Sequence< OUString > s { u"FontHeight"_ustr, u"FontName"_ustr };
+ n->addPropertiesChangeListener(s, m_listener);
m_ColorConfig.AddListener(this);
-
- //#i97044#
- EnableFocusSelectionHide( false );
}
-OSqlEdit::~OSqlEdit()
+SQLEditView::~SQLEditView()
{
- disposeOnce();
-}
-
-void OSqlEdit::dispose()
-{
- if (m_timerUndoActionCreation.IsActive())
- m_timerUndoActionCreation.Stop();
css::uno::Reference< css::beans::XMultiPropertySet > n;
{
- osl::MutexGuard g(m_mutex);
+ std::unique_lock g(m_mutex);
n = m_notifier;
}
if (n.is()) {
- n->removePropertiesChangeListener(m_listener.get());
+ n->removePropertiesChangeListener(m_listener);
}
m_ColorConfig.RemoveListener(this);
- m_pView.clear();
- MultiLineEditSyntaxHighlight::dispose();
}
-void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
+void SQLEditView::SetTextAndUpdate(const OUString& rNewText)
{
- OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- rController.InvalidateFeature(SID_CUT);
- rController.InvalidateFeature(SID_COPY);
-
- // Is this a cut, copy, paste event?
- KeyFuncType aKeyFunc = rKEvt.GetKeyCode().GetFunction();
- if( (aKeyFunc==KeyFuncType::CUT)||(aKeyFunc==KeyFuncType::COPY)||(aKeyFunc==KeyFuncType::PASTE) )
- m_bAccelAction = true;
+ SetText(rNewText);
+ UpdateData();
+}
- MultiLineEditSyntaxHighlight::KeyInput( rKEvt );
+IMPL_LINK_NOARG(SQLEditView, ModifyHdl, LinkParamNone*, void)
+{
+ if (m_bInUpdate)
+ return;
+ m_aUpdateDataTimer.Start();
+}
- if( m_bAccelAction )
- m_bAccelAction = false;
+IMPL_LINK_NOARG(SQLEditView, ImplUpdateDataHdl, Timer*, void)
+{
+ UpdateData();
}
+Color SQLEditView::GetColorValue(TokenType aToken)
+{
+ return GetSyntaxHighlightColor(m_aColorConfig, m_aHighlighter.GetLanguage(), aToken);
+}
-void OSqlEdit::GetFocus()
+void SQLEditView::UpdateData()
{
- m_strOrigText =GetText();
- MultiLineEditSyntaxHighlight::GetFocus();
+ m_bInUpdate = true;
+ EditEngine& rEditEngine = *GetEditEngine();
+
+ bool bModified = rEditEngine.IsModified();
+ bool bUndoEnabled = rEditEngine.IsUndoEnabled();
+ rEditEngine.EnableUndo(false);
+
+ // syntax highlighting
+ for (sal_Int32 nLine=0; nLine < rEditEngine.GetParagraphCount(); ++nLine)
+ {
+ OUString aLine( rEditEngine.GetText( nLine ) );
+
+ ESelection aAllLine(nLine, 0, nLine, EE_TEXTPOS_MAX);
+ rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_COLOR);
+ rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT);
+ rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT_CJK);
+ rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT_CTL);
+
+ std::vector<HighlightPortion> aPortions;
+ m_aHighlighter.getHighlightPortions( aLine, aPortions );
+ for (auto const& portion : aPortions)
+ {
+ SfxItemSet aSet(rEditEngine.GetEmptyItemSet());
+ aSet.Put(SvxColorItem(GetColorValue(portion.tokenType), EE_CHAR_COLOR));
+ rEditEngine.QuickSetAttribs(aSet, ESelection(nLine, portion.nBegin, nLine, portion.nEnd));
+ }
+ }
+
+ rEditEngine.ClearModifyFlag();
+
+ m_bInUpdate = false;
+
+ rEditEngine.EnableUndo(bUndoEnabled);
+
+ if (bModified)
+ m_aModifyLink.Call(nullptr);
+
+ Invalidate();
}
-IMPL_LINK_NOARG(OSqlEdit, OnUndoActionTimer, Timer *, void)
+void SQLEditView::DoBracketHilight(sal_uInt16 nKey)
{
- OUString aText = GetText();
- if(aText == m_strOrigText)
- return;
+ ESelection aCurrentPos = m_xEditView->GetSelection();
+ sal_Int32 nStartPos = aCurrentPos.start.nIndex;
+ const sal_uInt32 nStartPara = aCurrentPos.start.nPara;
+ sal_uInt16 nCount = 0;
+ int nChar = -1;
- OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- SfxUndoManager& rUndoMgr = rController.GetUndoManager();
- std::unique_ptr<OSqlEditUndoAct> pUndoAct(new OSqlEditUndoAct( this ));
+ switch (nKey)
+ {
+ case '\'': // no break
+ case '"':
+ {
+ nChar = nKey;
+ break;
+ }
+ case '}' :
+ {
+ nChar = '{';
+ break;
+ }
+ case ')':
+ {
+ nChar = '(';
+ break;
+ }
+ case ']':
+ {
+ nChar = '[';
+ break;
+ }
+ }
- pUndoAct->SetOriginalText( m_strOrigText );
- rUndoMgr.AddUndoAction( std::move(pUndoAct) );
+ if (nChar == -1)
+ return;
- rController.InvalidateFeature(SID_UNDO);
- rController.InvalidateFeature(SID_REDO);
+ bool bUndoEnabled = m_xEditEngine->IsUndoEnabled();
+ m_xEditEngine->EnableUndo(false);
- m_strOrigText =aText;
+ sal_uInt32 nPara = nStartPara;
+ do
+ {
+ if (nPara == nStartPara && nStartPos == 0)
+ continue;
+
+ OUString aLine( m_xEditEngine->GetText( nPara ) );
+
+ if (aLine.isEmpty())
+ continue;
+
+ for (sal_Int32 i = (nPara==nStartPara) ? nStartPos-1 : aLine.getLength()-1; i>0; --i)
+ {
+ if (aLine[i] == nChar)
+ {
+ if (!nCount)
+ {
+ SfxItemSet aSet(m_xEditEngine->GetEmptyItemSet());
+ aSet.Put(SvxColorItem(Color(0,0,0), EE_CHAR_COLOR));
+ aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT));
+ aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT_CJK));
+ aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT_CTL));
+
+ m_xEditEngine->QuickSetAttribs(aSet, ESelection(nPara, i, nPara, i + 1));
+ m_xEditEngine->QuickSetAttribs(aSet, ESelection(nStartPara, nStartPos));
+ return;
+ }
+ else
+ --nCount;
+ }
+ if (aLine[i] == nKey)
+ ++nCount;
+ }
+ } while (nPara--);
+
+ m_xEditEngine->EnableUndo(bUndoEnabled);
}
-IMPL_LINK_NOARG(OSqlEdit, OnInvalidateTimer, Timer *, void)
+Color SQLEditView::GetSyntaxHighlightColor(const svtools::ColorConfig& rColorConfig, HighlighterLanguage eLanguage, TokenType aToken)
{
- OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- rController.InvalidateFeature(SID_CUT);
- rController.InvalidateFeature(SID_COPY);
- if(!m_bStopTimer)
- m_timerInvalidate.Start();
+ Color aColor;
+ switch (eLanguage)
+ {
+ case HighlighterLanguage::SQL:
+ {
+ switch (aToken)
+ {
+ case TokenType::Identifier: aColor = rColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break;
+ case TokenType::Number: aColor = rColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break;
+ case TokenType::String: aColor = rColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break;
+ case TokenType::Operator: aColor = rColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break;
+ case TokenType::Keywords: aColor = rColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break;
+ case TokenType::Parameter: aColor = rColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break;
+ case TokenType::Comment: aColor = rColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break;
+ default: aColor = Color(0,0,0);
+ }
+ break;
+ }
+ case HighlighterLanguage::Basic:
+ {
+ switch (aToken)
+ {
+ case TokenType::Identifier: aColor = Color(255,0,0); break;
+ case TokenType::Comment: aColor = Color(0,0,45); break;
+ case TokenType::Number: aColor = Color(204,102,204); break;
+ case TokenType::String: aColor = Color(0,255,45); break;
+ case TokenType::Operator: aColor = Color(0,0,100); break;
+ case TokenType::Keywords: aColor = Color(0,0,255); break;
+ case TokenType::Error : aColor = Color(0,255,255); break;
+ default: aColor = Color(0,0,0);
+ }
+ break;
+ }
+ default: aColor = Color(0,0,0);
+
+ }
+ return aColor;
}
-IMPL_LINK_NOARG(OSqlEdit, ModifyHdl, Edit&, void)
+bool SQLEditView::KeyInput(const KeyEvent& rKEvt)
{
- if (m_timerUndoActionCreation.IsActive())
- m_timerUndoActionCreation.Stop();
- m_timerUndoActionCreation.Start();
+ DoBracketHilight(rKEvt.GetCharCode());
- OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- if (!rController.isModified())
- rController.setModified( true );
+ if (m_bDisableInternalUndo)
+ {
+ KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
+ if (eFunc == KeyFuncType::UNDO || eFunc == KeyFuncType::REDO)
+ return false;
+ }
- rController.InvalidateFeature(SID_SBA_QRY_EXECUTE);
- rController.InvalidateFeature(SID_CUT);
- rController.InvalidateFeature(SID_COPY);
+ return WeldEditView::KeyInput(rKEvt);
}
-void OSqlEdit::SetText(const OUString& rNewText)
+bool SQLEditView::Command(const CommandEvent& rCEvt)
{
- if (m_timerUndoActionCreation.IsActive())
- { // create the trailing undo-actions
- m_timerUndoActionCreation.Stop();
- LINK(this, OSqlEdit, OnUndoActionTimer).Call(nullptr);
+ if (rCEvt.GetCommand() == CommandEventId::ContextMenu)
+ {
+ ::tools::Rectangle aRect(rCEvt.GetMousePosPixel(), Size(1, 1));
+ weld::Widget* pPopupParent = GetDrawingArea();
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"vcl/ui/editmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+
+ bool bEnableCut = true;
+ bool bEnableCopy = true;
+ bool bEnableDelete = true;
+ bool bEnablePaste = true;
+ bool bEnableSpecialChar = true;
+
+ EditView* pEditView = GetEditView();
+
+ if (!pEditView->HasSelection())
+ {
+ bEnableCut = false;
+ bEnableCopy = false;
+ bEnableDelete = false;
+ }
+
+ if (pEditView->IsReadOnly())
+ {
+ bEnableCut = false;
+ bEnablePaste = false;
+ bEnableDelete = false;
+ bEnableSpecialChar = false;
+ }
+
+ xContextMenu->set_sensitive(u"cut"_ustr, bEnableCut);
+ xContextMenu->set_sensitive(u"copy"_ustr, bEnableCopy);
+ xContextMenu->set_sensitive(u"delete"_ustr, bEnableDelete);
+ xContextMenu->set_sensitive(u"paste"_ustr, bEnablePaste);
+ xContextMenu->set_sensitive(u"specialchar"_ustr, bEnableSpecialChar);
+ xContextMenu->set_visible(u"undo"_ustr, false);
+ xContextMenu->set_visible(u"specialchar"_ustr, vcl::GetGetSpecialCharsFunction() != nullptr);
+
+ OUString sCommand = xContextMenu->popup_at_rect(pPopupParent, aRect);
+
+ if (sCommand == "cut")
+ pEditView->Cut();
+ else if (sCommand == "copy")
+ pEditView->Copy();
+ else if (sCommand == "paste")
+ pEditView->Paste();
+ else if (sCommand == "delete")
+ pEditView->DeleteSelected();
+ else if (sCommand == "selectall")
+ {
+ if (m_xEditEngine->GetParagraphCount())
+ {
+ pEditView->SetSelection(ESelection::All());
+ }
+ }
+ else if (sCommand == "specialchar")
+ {
+ OUString aChars = vcl::GetGetSpecialCharsFunction()(pPopupParent, m_xEditEngine->GetStandardFont(0));
+ if (!aChars.isEmpty())
+ {
+ pEditView->InsertText(aChars);
+ }
+ }
+
+ return true;
}
+ return WeldEditView::Command(rCEvt);
+}
- MultiLineEditSyntaxHighlight::SetText(rNewText);
- m_strOrigText =rNewText;
+void SQLEditView::EditViewScrollStateChange()
+{
+ // editengine height has changed or editview scroll pos has changed
+ SetScrollBarRange();
}
-void OSqlEdit::stopTimer()
+void SQLEditView::SetScrollBarRange()
{
- m_bStopTimer = true;
- if (m_timerInvalidate.IsActive())
- m_timerInvalidate.Stop();
+ EditEngine *pEditEngine = GetEditEngine();
+ if (!pEditEngine)
+ return;
+ if (!m_xScrolledWindow)
+ return;
+ EditView* pEditView = GetEditView();
+ if (!pEditView)
+ return;
+
+ int nVUpper = pEditEngine->GetTextHeight();
+ int nVCurrentDocPos = pEditView->GetVisArea().Top();
+ const Size aOut(pEditView->GetOutputArea().GetSize());
+ int nVStepIncrement = aOut.Height() * 2 / 10;
+ int nVPageIncrement = aOut.Height() * 8 / 10;
+ int nVPageSize = aOut.Height();
+
+ /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
+ effectively...
+
+ lower = gtk_adjustment_get_lower
+ upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
+
+ and requires that upper > lower or the deceleration animation never ends
+ */
+ nVPageSize = std::min(nVPageSize, nVUpper);
+
+ m_xScrolledWindow->vadjustment_configure(nVCurrentDocPos, nVUpper, nVStepIncrement,
+ nVPageIncrement, nVPageSize);
}
-void OSqlEdit::startTimer()
+IMPL_LINK_NOARG(SQLEditView, ScrollHdl, weld::ScrolledWindow&, void)
{
- m_bStopTimer = false;
- if (!m_timerInvalidate.IsActive())
- m_timerInvalidate.Start();
+ DoScroll();
}
-void OSqlEdit::ConfigurationChanged( utl::ConfigurationBroadcaster* pOption, ConfigurationHints )
+IMPL_LINK_NOARG(SQLEditView, EditStatusHdl, EditStatus&, void)
{
- assert( pOption == &m_ColorConfig );
- (void) pOption; // avoid warnings
- MultiLineEditSyntaxHighlight::UpdateData();
+ Resize();
}
-void OSqlEdit::ImplSetFont()
+void SQLEditView::DoScroll()
{
- AllSettings aSettings = GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- OUString sFontName(
- officecfg::Office::Common::Font::SourceViewFont::FontName::get().
- value_or( OUString() ) );
- if ( sFontName.isEmpty() )
+ if (m_xEditView)
{
- vcl::Font aTmpFont( OutputDevice::GetDefaultFont( DefaultFontType::FIXED, Application::GetSettings().GetUILanguageTag().getLanguageType(), GetDefaultFontFlags::NONE, this ) );
- sFontName = aTmpFont.GetFamilyName();
+ auto currentDocPos = m_xEditView->GetVisArea().Top();
+ auto nDiff = currentDocPos - m_xScrolledWindow->vadjustment_get_value();
+ // we expect SetScrollBarRange callback to be triggered by Scroll
+ // to set where we ended up
+ m_xEditView->Scroll(0, nDiff);
}
- Size aFontSize(
- 0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get() );
- vcl::Font aFont( sFontName, aFontSize );
- aStyleSettings.SetFieldFont(aFont);
- aSettings.SetStyleSettings(aStyleSettings);
- SetSettings(aSettings);
+}
+
+void SQLEditView::ConfigurationChanged(utl::ConfigurationBroadcaster*, ConfigurationHints)
+{
+ UpdateData();
+}
+
+void SQLEditView::ImplSetFont()
+{
+ // see SmEditWindow::DataChanged for a similar case
+ SetItemPoolFont(m_pItemPool.get()); // change default font
+ // re-create with the new font
+ EditEngine& rEditEngine = *GetEditEngine();
+ OUString aTxt(rEditEngine.GetText());
+ rEditEngine.Clear();
+ SetTextAndUpdate(aTxt);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 2ec45c9b756a..d1090a9aae0f 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -28,12 +28,9 @@
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <listviewitems.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <connectivity/dbmetadata.hxx>
-#include <vcl/treelistentry.hxx>
#include <algorithm>
@@ -42,10 +39,8 @@ 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::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdb::application;
@@ -56,84 +51,31 @@ namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
// OTableTreeListBox
-OTableTreeListBox::OTableTreeListBox(vcl::Window* pParent, WinBits nWinStyle)
- :OMarkableTreeListBox(pParent, nWinStyle)
- ,m_xImageProvider( new ImageProvider )
-{
- implSetDefaultImages();
-}
-
-TableTreeListBox::TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView)
- : m_xImageProvider(new ImageProvider)
+OTableTreeListBox::OTableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bShowToggles)
+ : TreeListBox(std::move(xTreeView), true)
+ , m_xImageProvider(new ImageProvider)
, m_bVirtualRoot(false)
, m_bNoEmptyFolders(false)
- , m_bShowToggles(true)
- , m_xTreeView(std::move(xTreeView))
-{
- m_xTreeView->enable_toggle_buttons(weld::ColumnToggleType::Check);
-}
-
-void OTableTreeListBox::implSetDefaultImages()
+ , m_bShowToggles(bShowToggles)
{
- SetDefaultExpandedEntryBmp( ImageProvider::getFolderImage( DatabaseObject::TABLE ) );
- SetDefaultCollapsedEntryBmp( ImageProvider::getFolderImage( DatabaseObject::TABLE ) );
+ if (m_bShowToggles)
+ m_xTreeView->enable_toggle_buttons(weld::ColumnToggleType::Check);
}
-bool OTableTreeListBox::isFolderEntry( const SvTreeListEntry* _pEntry )
+bool OTableTreeListBox::isFolderEntry(const weld::TreeIter& rEntry) const
{
- sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() );
+ sal_Int32 nEntryType = m_xTreeView->get_id(rEntry).toInt32();
return ( nEntryType == DatabaseObjectContainer::TABLES )
|| ( nEntryType == DatabaseObjectContainer::CATALOG )
|| ( nEntryType == DatabaseObjectContainer::SCHEMA );
}
-void OTableTreeListBox::notifyHiContrastChanged()
-{
- implSetDefaultImages();
-
- SvTreeListEntry* pEntryLoop = First();
- while (pEntryLoop)
- {
- size_t nCount = pEntryLoop->ItemCount();
- for (size_t i=0;i<nCount;++i)
- {
- SvLBoxItem& rItem = pEntryLoop->GetItem(i);
- if (rItem.GetType() == SvLBoxItemType::ContextBmp)
- {
- SvLBoxContextBmp& rContextBitmapItem = static_cast< SvLBoxContextBmp& >( rItem );
-
- Image aImage;
- if ( isFolderEntry( pEntryLoop ) )
- {
- aImage = ImageProvider::getFolderImage( DatabaseObject::TABLE );
- }
- else
- {
- OUString sCompleteName( getQualifiedTableName( pEntryLoop ) );
- m_xImageProvider->getImages( sCompleteName, DatabaseObject::TABLE, aImage );
- }
-
- rContextBitmapItem.SetBitmap1( aImage );
- rContextBitmapItem.SetBitmap2( aImage );
- break;
- }
- }
- pEntryLoop = Next(pEntryLoop);
- }
-}
-
void OTableTreeListBox::implOnNewConnection( const Reference< XConnection >& _rxConnection )
{
m_xConnection = _rxConnection;
m_xImageProvider.reset( new ImageProvider( m_xConnection ) );
}
-void TableTreeListBox::implOnNewConnection( const Reference< XConnection >& _rxConnection )
-{
- m_xConnection = _rxConnection;
- m_xImageProvider.reset( new ImageProvider( m_xConnection ) );
-}
-
void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection )
{
Sequence< OUString > sTables, sViews;
@@ -160,49 +102,7 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
}
catch(RuntimeException&)
{
- OSL_FAIL("OTableTreeListBox::UpdateTableList : caught a RuntimeException!");
- }
- catch ( const SQLException& )
- {
- throw;
- }
- catch(Exception&)
- {
- css::uno::Any anyEx = cppu::getCaughtException();
- // a non-SQLException exception occurred ... simply throw an SQLException
- throw SQLException(sCurrentActionError, nullptr, "", 0, anyEx);
- }
-
- UpdateTableList( _rxConnection, sTables, sViews );
-}
-
-void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection )
-{
- Sequence< OUString > sTables, sViews;
-
- OUString sCurrentActionError;
- try
- {
- Reference< XTablesSupplier > xTableSupp( _rxConnection, UNO_QUERY_THROW );
- sCurrentActionError = DBA_RES(STR_NOTABLEINFO);
-
- Reference< XNameAccess > xTables,xViews;
-
- Reference< XViewsSupplier > xViewSupp( _rxConnection, UNO_QUERY );
- if ( xViewSupp.is() )
- {
- xViews = xViewSupp->getViews();
- if (xViews.is())
- sViews = xViews->getElementNames();
- }
-
- xTables = xTableSupp->getTables();
- if (xTables.is())
- sTables = xTables->getElementNames();
- }
- catch(RuntimeException&)
- {
- OSL_FAIL("OTableTreeListBox::UpdateTableList : caught a RuntimeException!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OTableTreeListBox::UpdateTableList");
}
catch ( const SQLException& )
{
@@ -212,7 +112,7 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
{
css::uno::Any anyEx = cppu::getCaughtException();
// a non-SQLException exception occurred ... simply throw an SQLException
- throw SQLException(sCurrentActionError, nullptr, "", 0, anyEx);
+ throw SQLException(sCurrentActionError, nullptr, u""_ustr, 0, anyEx);
}
UpdateTableList( _rxConnection, sTables, sViews );
@@ -261,27 +161,6 @@ void OTableTreeListBox::UpdateTableList(
UpdateTableList( _rxConnection, aTables );
}
-void TableTreeListBox::UpdateTableList(
- const Reference< XConnection >& _rxConnection,
- const Sequence< OUString>& _rTables,
- const Sequence< OUString>& _rViews
- )
-{
- TNames aTables;
- aTables.resize(_rTables.getLength());
- try
- {
- Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData(), UNO_SET_THROW );
- std::transform( _rTables.begin(), _rTables.end(),
- aTables.begin(), OViewSetter( _rViews, xMeta->supportsMixedCaseQuotedIdentifiers() ) );
- }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- UpdateTableList( _rxConnection, aTables );
-}
-
namespace
{
std::vector< OUString > lcl_getMetaDataStrings_throw( const Reference< XResultSet >& _rxMetaDataResult, sal_Int32 _nColumnIndex )
@@ -305,67 +184,6 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
implOnNewConnection( _rxConnection );
// throw away all the old stuff
- Clear();
-
- try
- {
- if ( _rTables.empty() )
- // nothing to do (besides inserting the root entry)
- return;
-
- // get the table/view names
- Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData(), UNO_SET_THROW );
- for (auto const& table : _rTables)
- {
- // add the entry
- implAddEntry(
- xMeta,
- table.first,
- false
- );
- }
-
- if ( lcl_shouldDisplayEmptySchemasAndCatalogs( _rxConnection ) )
- {
- bool bSupportsCatalogs = xMeta->supportsCatalogsInDataManipulation();
- bool bSupportsSchemas = xMeta->supportsSchemasInDataManipulation();
-
- if ( bSupportsCatalogs || bSupportsSchemas )
- {
- // we display empty catalogs if the DB supports catalogs, and they're noted at the beginning of a
- // composed name. Otherwise, we display empty schematas. (also see the tree structure explained in
- // implAddEntry)
- bool bCatalogs = bSupportsCatalogs && xMeta->isCatalogAtStart();
-
- std::vector< OUString > aFolderNames( lcl_getMetaDataStrings_throw(
- bCatalogs ? xMeta->getCatalogs() : xMeta->getSchemas(), 1 ) );
- sal_Int32 nFolderType = bCatalogs ? DatabaseObjectContainer::CATALOG : DatabaseObjectContainer::SCHEMA;
-
- for (auto const& folderName : aFolderNames)
- {
- SvTreeListEntry* pFolder = GetEntryPosByName( folderName, nullptr );
- if ( !pFolder )
- InsertEntry( folderName, nullptr, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderType ) );
- }
- }
- }
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
-}
-
-void TableTreeListBox::DisableCheckButtons()
-{
- m_bShowToggles = false;
-}
-
-void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection, const TNames& _rTables )
-{
- implOnNewConnection( _rxConnection );
-
- // throw away all the old stuff
m_xTreeView->clear();
m_xTreeView->make_unsorted();
@@ -402,7 +220,7 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
for (auto const& table : _rTables)
{
// add the entry
- implAddEntry(xMeta, table.first);
+ implAddEntry(xMeta, table.first, false);
}
if ( !m_bNoEmptyFolders && lcl_shouldDisplayEmptySchemasAndCatalogs( _rxConnection ) )
@@ -450,12 +268,12 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
m_xTreeView->make_sorted();
}
-bool TableTreeListBox::isWildcardChecked(const weld::TreeIter& rEntry)
+bool OTableTreeListBox::isWildcardChecked(const weld::TreeIter& rEntry)
{
return m_xTreeView->get_text_emphasis(rEntry, 0);
}
-void TableTreeListBox::checkWildcard(weld::TreeIter& rEntry)
+void OTableTreeListBox::checkWildcard(const weld::TreeIter& rEntry)
{
if (!m_bShowToggles)
return;
@@ -463,7 +281,7 @@ void TableTreeListBox::checkWildcard(weld::TreeIter& rEntry)
checkedButton_noBroadcast(rEntry);
}
-std::unique_ptr<weld::TreeIter> TableTreeListBox::getAllObjectsEntry() const
+std::unique_ptr<weld::TreeIter> OTableTreeListBox::getAllObjectsEntry() const
{
if (!haveVirtualRoot())
return nullptr;
@@ -473,20 +291,7 @@ std::unique_ptr<weld::TreeIter> TableTreeListBox::getAllObjectsEntry() const
return xRet;
}
-void OTableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry)
-{
- OMarkableTreeListBox::checkedButton_noBroadcast(_pEntry);
-
- // if an entry has children, it makes a difference if the entry is checked
- // because all children are checked or if the user checked it explicitly.
- // So we track explicit (un)checking
-
- SvButtonState eState = GetCheckButtonState(_pEntry);
- OSL_ENSURE(SvButtonState::Tristate != eState, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?");
- implEmphasize(_pEntry, SvButtonState::Checked == eState);
-}
-
-void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
+void OTableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
{
if (!m_bShowToggles)
return;
@@ -534,38 +339,7 @@ void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
implEmphasize(rEntry, eState == TRISTATE_TRUE);
}
-void OTableTreeListBox::implEmphasize(SvTreeListEntry* _pEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors)
-{
- OSL_ENSURE(_pEntry, "OTableTreeListBox::implEmphasize: invalid entry (NULL)!");
-
- if ( GetModel()->HasChildren(_pEntry) ) // the entry has children
- {
- OBoldListboxString* pTextItem = static_cast<OBoldListboxString*>(_pEntry->GetFirstItem(SvLBoxItemType::String));
- if (pTextItem)
- pTextItem->emphasize(_bChecked);
- }
-
- if (_bUpdateDescendants)
- {
- // remove the mark for all children of the checked entry
- SvTreeListEntry* pChildLoop = FirstChild(_pEntry);
- while (pChildLoop)
- {
- if (GetModel()->HasChildren(pChildLoop))
- implEmphasize(pChildLoop, false, true, false);
- pChildLoop = pChildLoop->NextSibling();
- }
- }
-
- if (_bUpdateAncestors)
- {
- // remove the mark for all ancestors of the entry
- if (GetModel()->HasParent(_pEntry))
- implEmphasize(GetParent(_pEntry), false, false);
- }
-}
-
-void TableTreeListBox::implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors)
+void OTableTreeListBox::implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors)
{
// special emphasizing handling for the "all objects" entry
bool bAllObjectsEntryAffected = haveVirtualRoot() && (getAllObjectsEntry()->equal(rEntry));
@@ -598,20 +372,7 @@ void TableTreeListBox::implEmphasize(const weld::TreeIter& rEntry, bool _bChecke
}
}
-void OTableTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap)
-{
- OMarkableTreeListBox::InitEntry(_pEntry, _rString, _rCollapsedBitmap, _rExpandedBitmap);
-
- // replace the text item with our own one
- SvLBoxItem* pTextItem = _pEntry->GetFirstItem(SvLBoxItemType::String);
- OSL_ENSURE(pTextItem, "OTableTreeListBox::InitEntry: no text item!?");
- size_t nTextPos = _pEntry->GetPos(pTextItem);
- OSL_ENSURE(SvTreeListEntry::ITEM_NOT_FOUND != nTextPos, "OTableTreeListBox::InitEntry: no text item pos!");
-
- _pEntry->ReplaceItem(std::make_unique<OBoldListboxString>(_rString), nTextPos);
-}
-
-SvTreeListEntry* OTableTreeListBox::implAddEntry(
+std::unique_ptr<weld::TreeIter> OTableTreeListBox::implAddEntry(
const Reference< XDatabaseMetaData >& _rxMeta,
const OUString& _rTableName,
bool _bCheckName
@@ -625,65 +386,6 @@ SvTreeListEntry* OTableTreeListBox::implAddEntry(
OUString sCatalog, sSchema, sName;
qualifiedNameComponents( _rxMeta, _rTableName, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
- SvTreeListEntry* pParentEntry = nullptr;
-
- // if the DB uses catalog at the start of identifiers, then our hierarchy is
- // catalog
- // +- schema
- // +- table
- // else it is
- // schema
- // +- catalog
- // +- table
- bool bCatalogAtStart = _rxMeta->isCatalogAtStart();
- const OUString& rFirstName = bCatalogAtStart ? sCatalog : sSchema;
- const sal_Int32 nFirstFolderType = bCatalogAtStart ? DatabaseObjectContainer::CATALOG : DatabaseObjectContainer::SCHEMA;
- const OUString& rSecondName = bCatalogAtStart ? sSchema : sCatalog;
- const sal_Int32 nSecondFolderType = bCatalogAtStart ? DatabaseObjectContainer::SCHEMA : DatabaseObjectContainer::CATALOG;
-
- if ( !rFirstName.isEmpty() )
- {
- SvTreeListEntry* pFolder = GetEntryPosByName( rFirstName, pParentEntry );
- if ( !pFolder )
- pFolder = InsertEntry( rFirstName, pParentEntry, false, TREELIST_APPEND, reinterpret_cast< void* >( nFirstFolderType ) );
- pParentEntry = pFolder;
- }
-
- if ( !rSecondName.isEmpty() )
- {
- SvTreeListEntry* pFolder = GetEntryPosByName( rSecondName, pParentEntry );
- if ( !pFolder )
- pFolder = InsertEntry( rSecondName, pParentEntry, false, TREELIST_APPEND, reinterpret_cast< void* >( nSecondFolderType ) );
- pParentEntry = pFolder;
- }
-
- SvTreeListEntry* pRet = nullptr;
- if ( !_bCheckName || !GetEntryPosByName( sName, pParentEntry ) )
- {
- pRet = InsertEntry( sName, pParentEntry );
-
- Image aImage;
- m_xImageProvider->getImages( _rTableName, DatabaseObject::TABLE, aImage );
-
- SetExpandedEntryBmp( pRet, aImage );
- SetCollapsedEntryBmp( pRet, aImage );
- }
- return pRet;
-}
-
-void TableTreeListBox::implAddEntry(
- const Reference< XDatabaseMetaData >& _rxMeta,
- const OUString& _rTableName
- )
-{
- OSL_PRECOND( _rxMeta.is(), "OTableTreeListBox::implAddEntry: invalid meta data!" );
- if ( !_rxMeta.is() )
- return;
-
- // split the complete name into its components
- OUString sCatalog, sSchema, sName;
- qualifiedNameComponents( _rxMeta, _rTableName, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
-
std::unique_ptr<weld::TreeIter> xParentEntry(getAllObjectsEntry());
// if the DB uses catalog at the start of identifiers, then our hierarchy is
@@ -736,28 +438,35 @@ void TableTreeListBox::implAddEntry(
xParentEntry = std::move(xFolder);
}
- std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
- m_xTreeView->insert(xParentEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get());
-
- auto xGraphic = m_xImageProvider->getXGraphic(_rTableName, DatabaseObject::TABLE);
- if (xGraphic.is())
- m_xTreeView->set_image(*xEntry, xGraphic, -1);
- else
+ if (!_bCheckName || !GetEntryPosByName(sName, xParentEntry.get()))
{
- OUString sImageId(m_xImageProvider->getImageId(_rTableName, DatabaseObject::TABLE));
- m_xTreeView->set_image(*xEntry, sImageId, -1);
+ std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
+ m_xTreeView->insert(xParentEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get());
+
+ auto xGraphic = m_xImageProvider->getXGraphic(_rTableName, DatabaseObject::TABLE);
+ if (xGraphic.is())
+ m_xTreeView->set_image(*xEntry, xGraphic, -1);
+ else
+ {
+ OUString sImageId(m_xImageProvider->getImageId(_rTableName, DatabaseObject::TABLE));
+ m_xTreeView->set_image(*xEntry, sImageId, -1);
+ }
+ if (m_bShowToggles)
+ m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE);
+ m_xTreeView->set_text(*xEntry, sName, 0);
+ m_xTreeView->set_text_emphasis(*xEntry, false, 0);
+
+ return xEntry;
}
- if (m_bShowToggles)
- m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE);
- m_xTreeView->set_text(*xEntry, sName, 0);
- m_xTreeView->set_text_emphasis(*xEntry, false, 0);
+
+ return nullptr;
}
-NamedDatabaseObject OTableTreeListBox::describeObject( SvTreeListEntry* _pEntry )
+NamedDatabaseObject OTableTreeListBox::describeObject(const weld::TreeIter& rEntry)
{
NamedDatabaseObject aObject;
- sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() );
+ sal_Int32 nEntryType = m_xTreeView->get_id(rEntry).toInt32();
if ( nEntryType == DatabaseObjectContainer::TABLES )
{
@@ -772,19 +481,19 @@ NamedDatabaseObject OTableTreeListBox::describeObject( SvTreeListEntry* _pEntry
else
{
aObject.Type = DatabaseObject::TABLE;
- aObject.Name = getQualifiedTableName( _pEntry );
+ aObject.Name = getQualifiedTableName(rEntry);
}
return aObject;
}
-SvTreeListEntry* OTableTreeListBox::addedTable( const OUString& _rName )
+std::unique_ptr<weld::TreeIter> OTableTreeListBox::addedTable(const OUString& rName)
{
try
{
Reference< XDatabaseMetaData > xMeta;
if ( impl_getAndAssertMetaData( xMeta ) )
- return implAddEntry( xMeta, _rName );
+ return implAddEntry( xMeta, rName );
}
catch( const Exception& )
{
@@ -801,9 +510,9 @@ bool OTableTreeListBox::impl_getAndAssertMetaData( Reference< XDatabaseMetaData
return _out_rMetaData.is();
}
-OUString OTableTreeListBox::getQualifiedTableName( SvTreeListEntry* _pEntry ) const
+OUString OTableTreeListBox::getQualifiedTableName(const weld::TreeIter& rEntry) const
{
- OSL_PRECOND( !isFolderEntry( _pEntry ), "OTableTreeListBox::getQualifiedTableName: folder entries not allowed here!" );
+ OSL_PRECOND( !isFolderEntry(rEntry), "OTableTreeListBox::getQualifiedTableName: folder entries not allowed here!" );
try
{
@@ -815,27 +524,29 @@ OUString OTableTreeListBox::getQualifiedTableName( SvTreeListEntry* _pEntry ) co
OUString sSchema;
OUString sTable;
- SvTreeListEntry* pSchema = GetParent( _pEntry );
- if ( pSchema )
+ std::unique_ptr<weld::TreeIter> xSchema(m_xTreeView->make_iterator(&rEntry));
+ bool bSchema = m_xTreeView->iter_parent(*xSchema);
+ if (bSchema)
{
- SvTreeListEntry* pCatalog = GetParent( pSchema );
- if ( pCatalog
+ std::unique_ptr<weld::TreeIter> xCatalog(m_xTreeView->make_iterator(xSchema.get()));
+ bool bCatalog = m_xTreeView->iter_parent(*xCatalog);
+ if ( bCatalog
|| ( xMeta->supportsCatalogsInDataManipulation()
&& !xMeta->supportsSchemasInDataManipulation()
) // here we support catalog but no schema
)
{
- if ( pCatalog == nullptr )
+ if (!bCatalog)
{
- pCatalog = pSchema;
- pSchema = nullptr;
+ xCatalog = std::move(xSchema);
+ bSchema = false;
}
- sCatalog = GetEntryText( pCatalog );
+ sCatalog = m_xTreeView->get_text(*xCatalog);
}
- if ( pSchema )
- sSchema = GetEntryText(pSchema);
+ if (bSchema)
+ sSchema = m_xTreeView->get_text(*xSchema);
}
- sTable = GetEntryText( _pEntry );
+ sTable = m_xTreeView->get_text(rEntry);
return ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sTable, false, ::dbtools::EComposeRule::InDataManipulation );
}
@@ -846,7 +557,7 @@ OUString OTableTreeListBox::getQualifiedTableName( SvTreeListEntry* _pEntry ) co
return OUString();
}
-SvTreeListEntry* OTableTreeListBox::getEntryByQualifiedName( const OUString& _rName )
+std::unique_ptr<weld::TreeIter> OTableTreeListBox::getEntryByQualifiedName(const OUString& rName)
{
try
{
@@ -856,26 +567,26 @@ SvTreeListEntry* OTableTreeListBox::getEntryByQualifiedName( const OUString& _rN
// split the complete name into its components
OUString sCatalog, sSchema, sName;
- qualifiedNameComponents(xMeta, _rName, sCatalog, sSchema, sName,::dbtools::EComposeRule::InDataManipulation);
+ qualifiedNameComponents(xMeta, rName, sCatalog, sSchema, sName,::dbtools::EComposeRule::InDataManipulation);
- SvTreeListEntry* pParent = nullptr;
- SvTreeListEntry* pCat = nullptr;
- SvTreeListEntry* pSchema = nullptr;
- if ( !sCatalog.isEmpty() )
+ std::unique_ptr<weld::TreeIter> xParent(getAllObjectsEntry());
+ std::unique_ptr<weld::TreeIter> xCat;
+ std::unique_ptr<weld::TreeIter> xSchema;
+ if (!sCatalog.isEmpty())
{
- pCat = GetEntryPosByName(sCatalog, pParent);
- if ( pCat )
- pParent = pCat;
+ xCat = GetEntryPosByName(sCatalog);
+ if (xCat)
+ xParent = std::move(xCat);
}
- if ( !sSchema.isEmpty() )
+ if (!sSchema.isEmpty())
{
- pSchema = GetEntryPosByName(sSchema, pParent);
- if ( pSchema )
- pParent = pSchema;
+ xSchema = GetEntryPosByName(sSchema, xParent.get());
+ if (xSchema)
+ xParent = std::move(xSchema);
}
- return GetEntryPosByName(sName, pParent);
+ return GetEntryPosByName(sName, xParent.get());
}
catch( const Exception& )
{
@@ -884,13 +595,13 @@ SvTreeListEntry* OTableTreeListBox::getEntryByQualifiedName( const OUString& _rN
return nullptr;
}
-void OTableTreeListBox::removedTable( const OUString& _rName )
+void OTableTreeListBox::removedTable(const OUString& rName)
{
try
{
- SvTreeListEntry* pEntry = getEntryByQualifiedName( _rName );
- if ( pEntry )
- GetModel()->Remove( pEntry );
+ std::unique_ptr<weld::TreeIter> xEntry = getEntryByQualifiedName(rName);
+ if (xEntry)
+ m_xTreeView->remove(*xEntry);
}
catch( const Exception& )
{
@@ -898,28 +609,7 @@ void OTableTreeListBox::removedTable( const OUString& _rName )
}
}
-std::unique_ptr<weld::TreeIter> TableTreeListBox::GetEntryPosByName(const OUString& 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;
-
- do
- {
- if (m_xTreeView->get_text(*xEntry) == aName)
- {
- if (!_pFilter || _pFilter->includeEntry(reinterpret_cast<void*>(m_xTreeView->get_id(*xEntry).toUInt64())))
- {
- // found
- return xEntry;
- }
- }
- } while (m_xTreeView->iter_next(*xEntry));
-
- return nullptr;
-}
-
-void TableTreeListBox::CheckButtons()
+void OTableTreeListBox::CheckButtons()
{
if (!m_bShowToggles)
return;
@@ -934,7 +624,7 @@ void TableTreeListBox::CheckButtons()
} while (m_xTreeView->iter_next_sibling(*xEntry));
}
-TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry)
+TriState OTableTreeListBox::implDetermineState(const weld::TreeIter& rEntry)
{
if (!m_bShowToggles)
return TRISTATE_FALSE;
@@ -1005,6 +695,12 @@ TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry)
return eState;
}
+DBTableTreeView::DBTableTreeView(weld::Container* pContainer)
+ : DBTreeViewBase(pContainer)
+{
+ m_xTreeListBox.reset(new OTableTreeListBox(m_xBuilder->weld_tree_view(u"treeview"_ustr), /*bShowToggles*/false));
+}
+
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/control/undosqledit.cxx b/dbaccess/source/ui/control/undosqledit.cxx
index d32774292a98..00a5fd40794d 100644
--- a/dbaccess/source/ui/control/undosqledit.cxx
+++ b/dbaccess/source/ui/control/undosqledit.cxx
@@ -18,14 +18,14 @@
*/
#include <undosqledit.hxx>
-#include <sqledit.hxx>
+#include <QueryTextView.hxx>
namespace dbaui
{
void OSqlEditUndoAct::ToggleText()
{
- OUString strNext = m_pOwner->GetText();
- m_pOwner->SetText(m_strNextText);
+ OUString strNext = m_rOwner.GetSQLText();
+ m_rOwner.SetSQLText(m_strNextText);
m_strNextText = strNext;
}
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index 6b978bc301c4..355b3c9bd46e 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,17 +57,17 @@ using namespace comphelper;
OCollectionView::OCollectionView(weld::Window* pParent,
const Reference< XContent>& _xContent,
const OUString& _sDefaultName,
- const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
- : GenericDialogController(pParent, "dbaccess/ui/collectionviewdialog.ui", "CollectionView")
+ css::uno::Reference< css::uno::XComponentContext > _xContext)
+ : GenericDialogController(pParent, u"dbaccess/ui/collectionviewdialog.ui"_ustr, u"CollectionView"_ustr)
, 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"))
- , m_xUp(m_xBuilder->weld_button("upButton"))
- , m_xView(m_xBuilder->weld_tree_view("viewTreeview"))
- , m_xName(m_xBuilder->weld_entry("fileNameEntry"))
- , m_xPB_OK(m_xBuilder->weld_button("ok"))
+ , m_xFTCurrentPath(m_xBuilder->weld_label(u"currentPathLabel"_ustr))
+ , m_xNewFolder(m_xBuilder->weld_button(u"newFolderButton"_ustr))
+ , m_xUp(m_xBuilder->weld_button(u"upButton"_ustr))
+ , m_xView(m_xBuilder->weld_tree_view(u"viewTreeview"_ustr))
+ , m_xName(m_xBuilder->weld_entry(u"fileNameEntry"_ustr))
+ , m_xPB_OK(m_xBuilder->weld_button(u"ok"_ustr))
{
Reference<XInteractionHandler2> xHandler(
InteractionHandler::createWithParent(m_xContext, m_xDialog->GetXWindow()));
@@ -133,7 +133,7 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click, weld::Button&, void)
Sequence<Any> aValues(comphelper::InitAnyPropertySequence(
{
{"ResourceName", Any(sSubFolder)},
- {"ResourceType", Any(OUString("folder"))}
+ {"ResourceType", Any(u"folder"_ustr)}
}));
InteractiveAugmentedIOException aException(OUString(),Reference<XInterface>(),
InteractionClassification_ERROR,
@@ -141,12 +141,11 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click, weld::Button&, void)
Reference<XInteractionHandler2> xHandler(
InteractionHandler::createWithParent(m_xContext, m_xDialog->GetXWindow()));
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aException));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aException));
- OInteractionApprove* pApprove = new OInteractionApprove;
+ rtl::Reference<OInteractionApprove> pApprove = new OInteractionApprove;
pRequest->addContinuation(pApprove);
- xHandler->handle(xRequest);
+ xHandler->handle(pRequest);
return;
}
@@ -178,7 +177,7 @@ IMPL_LINK_NOARG(OCollectionView, NewFolder_Click, weld::Button&, void)
try
{
Reference<XHierarchicalNameContainer> xNameContainer(m_xContent,UNO_QUERY);
- if ( dbaui::insertHierachyElement(m_xDialog.get(),m_xContext,xNameContainer,OUString(),m_bCreateForm) )
+ if ( dbaui::insertHierarchyElement(m_xDialog.get(),m_xContext,xNameContainer,OUString(),m_bCreateForm) )
Initialize();
}
catch( const SQLException& )
@@ -230,7 +229,7 @@ IMPL_LINK_NOARG(OCollectionView, Dbl_Click_FileView, weld::TreeView&, bool)
xContent.set(xNameAccess->getByName(sSubFolder),UNO_QUERY);
if ( xContent.is() )
{
- m_xContent = xContent;
+ m_xContent = std::move(xContent);
Initialize();
initCurrentPath();
}
@@ -256,10 +255,10 @@ void OCollectionView::initCurrentPath()
static const char s_sFormsCID[] = "private:forms";
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)))
+ OUString sPath(u"/"_ustr);
+ 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);
@@ -291,9 +290,7 @@ void OCollectionView::Initialize()
try
{
::ucbhelper::Content aContent(m_xContent, m_xCmdEnv, comphelper::getProcessComponentContext());
- Sequence<OUString> aProps(2);
- aProps[0] = "Title";
- aProps[1] = "IsFolder";
+ Sequence<OUString> aProps { u"Title"_ustr, u"IsFolder"_ustr };
auto xDynResultSet = aContent.createDynamicCursor(aProps, ucbhelper::INCLUDE_FOLDERS_ONLY);
if (!xDynResultSet.is())
return;
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 063c5320e566..54da4c0cf7b0 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -36,7 +36,7 @@
#include "dsselect.hxx"
#include <svl/filenotation.hxx>
#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/lang/SystemDependent.hpp>
#include <com/sun/star/mozilla/MozillaBootstrap.hpp>
@@ -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,21 +65,17 @@ 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)
- , m_xFT_Connection(m_xBuilder->weld_label("browseurllabel"))
- , m_xPB_Connection(m_xBuilder->weld_button("browse"))
- , m_xPB_CreateDB(m_xBuilder->weld_button("create"))
- , m_xConnectionURL(new OConnectionURLEdit(m_xBuilder->weld_entry("browseurl"), m_xBuilder->weld_label("browselabel")))
+ , m_xFT_Connection(m_xBuilder->weld_label(u"browseurllabel"_ustr))
+ , m_xPB_Connection(m_xBuilder->weld_button(u"browse"_ustr))
+ , m_xPB_CreateDB(m_xBuilder->weld_button(u"create"_ustr))
+ , m_xConnectionURL(new OConnectionURLEdit(m_xBuilder->weld_entry(u"browseurl"_ustr), m_xBuilder->weld_label(u"browselabel"_ustr)))
{
// extract the datasource type collection from the item set
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rCoreAttrs.GetItem(DSID_TYPECOLLECTION) );
@@ -151,7 +147,7 @@ namespace dbaui
{
try
{
- Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(m_xORB);
+ Reference< XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(m_xORB, GetFrameWeld());
bool bDoBrowse = false;
OUString sOldPath = getURLNoPrefix();
@@ -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,u"*.accdb;*.accde;*.mdb;*.mde"_ustr);
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:
{
@@ -272,7 +257,7 @@ namespace dbaui
hWnd = reinterpret_cast<HWND>(tmp);
}
- sNewDataSource = getAdoDatalink(reinterpret_cast<LONG_PTR>(hWnd),sOldDataSource);
+ sNewDataSource = getAdoDatalink(reinterpret_cast<sal_IntPtr>(hWnd),sOldDataSource);
if ( !sNewDataSource.isEmpty() )
{
setURLNoPrefix(sNewDataSource);
@@ -289,20 +274,15 @@ namespace dbaui
if (eType == ::dbaccess::DST_THUNDERBIRD)
profileType = MozillaProductType_Thunderbird;
- Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ const Reference<XComponentContext>& xContext = ::comphelper::getProcessComponentContext();
Reference<XMozillaBootstrap> xMozillaBootstrap = MozillaBootstrap::create(xContext);
// collect all Mozilla Profiles
css::uno::Sequence< OUString > list;
xMozillaBootstrap->getProfileList( profileType, list );
- const OUString * pArray = list.getConstArray();
- sal_Int32 count = list.getLength();
-
- std::set<OUString> aProfiles;
- for (sal_Int32 index=0; index < count; index++)
- aProfiles.insert(pArray[index]);
+ std::set<OUString> aProfiles(list.begin(), list.end());
// execute the select dialog
ODatasourceSelectDialog aSelector(GetFrameWeld(), aProfiles);
@@ -323,7 +303,7 @@ namespace dbaui
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
FileDialogFlags::NONE, GetFrameWeld());
- aFileDlg.AddFilter(sFilterName,"*.fdb");
+ aFileDlg.AddFilter(sFilterName,u"*.fdb"_ustr);
aFileDlg.SetCurrentFilter(sFilterName);
askForFileName(aFileDlg);
break;
@@ -347,7 +327,7 @@ namespace dbaui
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
FileDialogFlags::NONE, GetFrameWeld());
- aFileDlg.AddFilter(sFilterName,"*.fdb");
+ aFileDlg.AddFilter(sFilterName,u"*.fdb"_ustr);
aFileDlg.SetCurrentFilter(sFilterName);
askForFileName(aFileDlg);
break;
@@ -364,7 +344,7 @@ namespace dbaui
return true;
}
- void OConnectionHelper::impl_setURL( const OUString& _rURL, bool _bPrefix )
+ void OConnectionHelper::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!" );
@@ -436,7 +416,7 @@ namespace dbaui
return sURL;
}
- void OConnectionHelper::setURL( const OUString& _rURL )
+ void OConnectionHelper::setURL( std::u16string_view _rURL )
{
impl_setURL( _rURL, true );
}
@@ -446,7 +426,7 @@ namespace dbaui
return impl_getURL();
}
- void OConnectionHelper::setURLNoPrefix( const OUString& _rURL )
+ void OConnectionHelper::setURLNoPrefix( std::u16string_view _rURL )
{
impl_setURL( _rURL, false );
}
@@ -533,7 +513,7 @@ namespace dbaui
IS_PATH_EXIST eExists = PATH_NOT_EXIST;
Reference< css::task::XInteractionHandler > xInteractionHandler =
task::InteractionHandler::createWithParent(m_xORB, nullptr);
- OFilePickerInteractionHandler* pHandler = new OFilePickerInteractionHandler(xInteractionHandler);
+ rtl::Reference<OFilePickerInteractionHandler> pHandler = new OFilePickerInteractionHandler(xInteractionHandler);
xInteractionHandler = pHandler;
Reference< XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
@@ -570,7 +550,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;
@@ -607,15 +587,12 @@ namespace dbaui
}
else
{
- Any aContentType = aParent.getPropertyValue("ContentType");
+ Any aContentType = aParent.getPropertyValue(u"ContentType"_ustr);
aContentType >>= sContentType;
}
// the properties which need to be set on the new content
- Sequence< OUString > aNewDirectoryProperties { "Title" };
-
- // the values to be set
- Sequence< Any > aNewDirectoryAttributes(1);
+ Sequence< OUString > aNewDirectoryProperties { u"Title"_ustr };
// loop
for ( std::vector< OUString >::const_reverse_iterator aLocalName = aToBeCreated.rbegin();
@@ -623,7 +600,8 @@ namespace dbaui
++aLocalName
)
{
- aNewDirectoryAttributes[0] <<= *aLocalName;
+ // the values to be set
+ Sequence< Any > aNewDirectoryAttributes{ Any(* aLocalName) };
if (!aParent.insertNewContent(sContentType, aNewDirectoryProperties, aNewDirectoryAttributes, aParent))
return false;
}
@@ -665,7 +643,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 ed58eac076c1..bbcf24783355 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONHELPER_HXX
+#pragma once
#include "adminpages.hxx"
#include <curledit.hxx>
@@ -39,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.
@@ -66,7 +65,7 @@ namespace dbaui
//void setURL( const OUString& _rURL, OConnectionURLEdit* _m_pConnection );
OUString getURLNoPrefix( ) const;
- void setURLNoPrefix( const OUString& _rURL );
+ void setURLNoPrefix( std::u16string_view _rURL );
/** checks if the path is existence
@param _rURL
@@ -75,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
@@ -85,7 +84,7 @@ namespace dbaui
void askForFileName(::sfx2::FileDialogHelper& _aFileOpen);
protected:
- void setURL( const OUString& _rURL );
+ void setURL( std::u16string_view _rURL );
virtual bool checkTestConnection();
private:
@@ -94,13 +93,11 @@ namespace dbaui
DECL_LINK(GetFocusHdl, weld::Widget&, void);
DECL_LINK(LoseFocusHdl, weld::Widget&, void);
OUString impl_getURL() const;
- void impl_setURL( const OUString& _rURL, bool _bPrefix );
+ void impl_setURL( std::u16string_view _rURL, bool _bPrefix );
void implUpdateURLDependentStates() const;
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 5082abf9ed98..7ce288a076c0 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -32,21 +32,13 @@
#include <dsitems.hxx>
#include <helpids.h>
#include <sqlmessage.hxx>
-#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)
{
@@ -55,16 +47,16 @@ namespace dbaui
// OConnectionTabPage
OConnectionTabPage::OConnectionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs)
- : OConnectionHelper(pPage, pController, "dbaccess/ui/connectionpage.ui", "ConnectionPage", _rCoreAttrs)
- , m_xFL2(m_xBuilder->weld_label("userlabel"))
- , m_xUserNameLabel(m_xBuilder->weld_label("userNameLabel"))
- , m_xUserName(m_xBuilder->weld_entry("userNameEntry"))
- , m_xPasswordRequired(m_xBuilder->weld_check_button("passCheckbutton"))
- , m_xFL3(m_xBuilder->weld_label("JDBCLabel"))
- , m_xJavaDriverLabel(m_xBuilder->weld_label("javaDriverLabel"))
- , m_xJavaDriver(m_xBuilder->weld_entry("driverEntry"))
- , m_xTestJavaDriver(m_xBuilder->weld_button("driverButton"))
- , m_xTestConnection(m_xBuilder->weld_button("connectionButton"))
+ : OConnectionHelper(pPage, pController, u"dbaccess/ui/connectionpage.ui"_ustr, u"ConnectionPage"_ustr, _rCoreAttrs)
+ , m_xFL2(m_xBuilder->weld_label(u"userlabel"_ustr))
+ , m_xUserNameLabel(m_xBuilder->weld_label(u"userNameLabel"_ustr))
+ , m_xUserName(m_xBuilder->weld_entry(u"userNameEntry"_ustr))
+ , m_xPasswordRequired(m_xBuilder->weld_check_button(u"passCheckbutton"_ustr))
+ , m_xFL3(m_xBuilder->weld_label(u"JDBCLabel"_ustr))
+ , m_xJavaDriverLabel(m_xBuilder->weld_label(u"javaDriverLabel"_ustr))
+ , m_xJavaDriver(m_xBuilder->weld_entry(u"driverEntry"_ustr))
+ , m_xTestJavaDriver(m_xBuilder->weld_button(u"driverButton"_ustr))
+ , m_xTestConnection(m_xBuilder->weld_button(u"connectionButton"_ustr))
{
m_xConnectionURL->connect_changed(LINK(this, OConnectionTabPage, OnEditModified));
m_xJavaDriver->connect_changed(LINK(this, OConnectionTabPage, OnEditModified));
@@ -107,11 +99,7 @@ namespace dbaui
m_xFT_Connection->set_label(DBA_RES(STR_WRITER_PATH_OR_FILE));
m_xConnectionURL->set_help_id(HID_DSADMIN_WRITER_PATH);
break;
- case ::dbaccess::DST_ADO:
- 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;
@@ -157,6 +145,7 @@ namespace dbaui
}
m_xConnectionURL->hide();
break;
+ case ::dbaccess::DST_ADO:
case ::dbaccess::DST_JDBC:
default:
m_xFT_Connection->set_label(DBA_RES(STR_COMMONURL));
@@ -203,7 +192,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();
@@ -238,16 +227,16 @@ namespace dbaui
}
IMPL_LINK_NOARG(OConnectionTabPage, OnTestJavaClickHdl, weld::Button&, void)
{
- OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
+ assert(m_pAdminDialog && "No Admin dialog set! ->GPF");
bool bSuccess = false;
#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&)
@@ -255,24 +244,24 @@ namespace dbaui
}
#endif
- const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
+ TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error;
OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt);
aMsg.run();
}
bool OConnectionTabPage::checkTestConnection()
{
- OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
+ assert(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/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx
index 3b514f86677e..19e76946254a 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONPAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONPAGE_HXX
+#pragma once
#include "ConnectionHelper.hxx"
@@ -70,6 +69,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONPAGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index bee1b1f11493..33bb8f01c6fc 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -23,19 +23,9 @@
#include <IItemSetHelper.hxx>
#include <svl/itemset.hxx>
#include <dsitems.hxx>
-#include <svl/filenotation.hxx>
-#include <com/sun/star/ucb/XProgressHandler.hpp>
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 );
@@ -58,16 +48,16 @@ namespace dbaui
std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet)
{
- return std::make_unique<OConnectionTabPageSetup>(pPage, pController, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, nullptr, nullptr, STR_COMMONURL);
+ 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, const char* pHelpTextResId, const char* pHeaderResId, const char* 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"))
+ , m_xHelpText(m_xBuilder->weld_label(u"helptext"_ustr))
+ , m_xHeaderText(m_xBuilder->weld_label(u"header"_ustr))
{
- if (pHelpTextResId != nullptr)
+ if (pHelpTextResId)
{
OUString sHelpText = DBA_RES(pHelpTextResId);
m_xHelpText->set_label(sHelpText);
@@ -75,10 +65,10 @@ namespace dbaui
else
m_xHelpText->hide();
- if (pHeaderResId != nullptr)
+ if (pHeaderResId)
m_xHeaderText->set_label(DBA_RES(pHeaderResId));
- if (pUrlResId != nullptr)
+ if (pUrlResId)
{
OUString sLabelText = DBA_RES(pUrlResId);
m_xFT_Connection->set_label(sLabelText);
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
index f7cfe37ad2d6..27b8eab284ae 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONPAGESETUP_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_CONNECTIONPAGESETUP_HXX
-#include "ConnectionHelper.hxx"
+#pragma once
+#include "ConnectionHelper.hxx"
#include "adminpages.hxx"
+#include <unotools/resmgr.hxx>
namespace dbaui
{
@@ -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, const char* pHelpTextResId, const char* pHeaderResId, const char* 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);
@@ -60,6 +60,4 @@ namespace dbaui
} // namespace dbaui
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 9c8d0fdd8e91..2a3824bec6a4 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;
@@ -50,9 +53,9 @@ using namespace ::com::sun::star;
// OTextConnectionPageSetup
OTextConnectionPageSetup::OTextConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OConnectionTabPageSetup(pPage, pController, "dbaccess/ui/dbwiztextpage.ui", "DBWizTextPage",
+ : OConnectionTabPageSetup(pPage, pController, u"dbaccess/ui/dbwiztextpage.ui"_ustr, u"DBWizTextPage"_ustr,
rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
- , m_xSubContainer(m_xBuilder->weld_widget("TextPageContainer"))
+ , m_xSubContainer(m_xBuilder->weld_widget(u"TextPageContainer"_ustr))
, m_xTextConnectionHelper(new OTextConnectionHelper(m_xSubContainer.get(), TC_EXTENSION | TC_SEPARATORS))
{
m_xTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
@@ -116,16 +119,16 @@ using namespace ::com::sun::star;
// OLDAPPageSetup
OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs )
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/ldapconnectionpage.ui", "LDAPConnectionPage", _rCoreAttrs)
- , m_xFTHelpText(m_xBuilder->weld_label("helpLabel"))
- , m_xFTHostServer(m_xBuilder->weld_label("hostNameLabel"))
- , m_xETHostServer(m_xBuilder->weld_entry("hostNameEntry"))
- , m_xFTBaseDN(m_xBuilder->weld_label("baseDNLabel"))
- , m_xETBaseDN(m_xBuilder->weld_entry("baseDNEntry"))
- , m_xFTPortNumber(m_xBuilder->weld_label("portNumLabel"))
- , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumEntry"))
- , m_xFTDefaultPortNumber(m_xBuilder->weld_label("portNumDefLabel"))
- , m_xCBUseSSL(m_xBuilder->weld_check_button("useSSLCheckbutton"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/ldapconnectionpage.ui"_ustr, u"LDAPConnectionPage"_ustr, _rCoreAttrs)
+ , m_xFTHelpText(m_xBuilder->weld_label(u"helpLabel"_ustr))
+ , m_xFTHostServer(m_xBuilder->weld_label(u"hostNameLabel"_ustr))
+ , m_xETHostServer(m_xBuilder->weld_entry(u"hostNameEntry"_ustr))
+ , m_xFTBaseDN(m_xBuilder->weld_label(u"baseDNLabel"_ustr))
+ , m_xETBaseDN(m_xBuilder->weld_entry(u"baseDNEntry"_ustr))
+ , m_xFTPortNumber(m_xBuilder->weld_label(u"portNumLabel"_ustr))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button(u"portNumEntry"_ustr))
+ , m_xFTDefaultPortNumber(m_xBuilder->weld_label(u"portNumDefLabel"_ustr))
+ , m_xCBUseSSL(m_xBuilder->weld_check_button(u"useSSLCheckbutton"_ustr))
{
m_xETHostServer->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
m_xETBaseDN->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
@@ -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;
}
@@ -167,7 +170,7 @@ using namespace ::com::sun::star;
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETHostServer.get()));
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETBaseDN.get()));
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xCBUseSSL.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xCBUseSSL.get()));
}
void OLDAPConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
{
@@ -208,10 +211,10 @@ using namespace ::com::sun::star;
}
OMySQLIntroPageSetup::OMySQLIntroPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs)
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/dbwizmysqlintropage.ui", "DBWizMysqlIntroPage", _rCoreAttrs)
- , m_xODBCDatabase(m_xBuilder->weld_radio_button("odbc"))
- , m_xJDBCDatabase(m_xBuilder->weld_radio_button("jdbc"))
- , m_xNATIVEDatabase(m_xBuilder->weld_radio_button("directly"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/dbwizmysqlintropage.ui"_ustr, u"DBWizMysqlIntroPage"_ustr, _rCoreAttrs)
+ , m_xODBCDatabase(m_xBuilder->weld_radio_button(u"odbc"_ustr))
+ , m_xJDBCDatabase(m_xBuilder->weld_radio_button(u"jdbc"_ustr))
+ , m_xNATIVEDatabase(m_xBuilder->weld_radio_button(u"directly"_ustr))
{
m_xODBCDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
m_xJDBCDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
@@ -223,7 +226,7 @@ using namespace ::com::sun::star;
{
}
- IMPL_LINK_NOARG(OMySQLIntroPageSetup, OnSetupModeSelected, weld::ToggleButton&, void)
+ IMPL_LINK_NOARG(OMySQLIntroPageSetup, OnSetupModeSelected, weld::Toggleable&, void)
{
maClickHdl.Call( this );
}
@@ -232,13 +235,17 @@ using namespace ::com::sun::star;
{
// show the "Connect directly" option only if the driver is installed
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rSet.GetItem(DSID_TYPECOLLECTION) );
- bool bHasMySQLNative = ( pCollectionItem != nullptr ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysql:mysqlc:" );
+ bool bHasMySQLNative = ( pCollectionItem != nullptr ) && pCollectionItem->getCollection()->hasDriver( u"sdbc:mysql:mysqlc:" );
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 )
@@ -273,9 +280,9 @@ using namespace ::com::sun::star;
// MySQLNativeSetupPage
MySQLNativeSetupPage::MySQLNativeSetupPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs )
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/dbwizmysqlnativepage.ui", "DBWizMysqlNativePage", rCoreAttrs)
- , m_xHelpText(m_xBuilder->weld_label("helptext"))
- , m_xSettingsContainer(m_xBuilder->weld_container("MySQLSettingsContainer"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/dbwizmysqlnativepage.ui"_ustr, u"DBWizMysqlNativePage"_ustr, rCoreAttrs)
+ , m_xHelpText(m_xBuilder->weld_label(u"helptext"_ustr))
+ , m_xSettingsContainer(m_xBuilder->weld_container(u"MySQLSettingsContainer"_ustr))
, m_xMySQLSettings(new MySQLNativeSettings(m_xSettingsContainer.get(), LINK(this, OGenericAdministrationPage, OnControlModified)))
{
SetRoadmapStateValue(false);
@@ -324,21 +331,21 @@ using namespace ::com::sun::star;
}
// OMySQLJDBCConnectionPageSetup
- OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, const char* pDefaultPortResId, const char* pHelpTextResId, const char* pHeaderTextResId, const char* pDriverClassId)
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/specialjdbcconnectionpage.ui", "SpecialJDBCConnectionPage", _rCoreAttrs)
+ OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, TranslateId pDefaultPortResId, TranslateId pHelpTextResId, TranslateId pHeaderTextResId, TranslateId pDriverClassId)
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/specialjdbcconnectionpage.ui"_ustr, u"SpecialJDBCConnectionPage"_ustr, _rCoreAttrs)
, m_nPortId(_nPortId)
- , m_xHeaderText(m_xBuilder->weld_label("header"))
- , m_xFTHelpText(m_xBuilder->weld_label("helpLabel"))
- , m_xFTDatabasename(m_xBuilder->weld_label("dbNameLabel"))
- , m_xETDatabasename(m_xBuilder->weld_entry("dbNameEntry"))
- , m_xFTHostname(m_xBuilder->weld_label("hostNameLabel"))
- , m_xETHostname(m_xBuilder->weld_entry("hostNameEntry"))
- , m_xFTPortNumber(m_xBuilder->weld_label("portNumLabel"))
- , m_xFTDefaultPortNumber(m_xBuilder->weld_label("portNumDefLabel"))
- , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumEntry"))
- , m_xFTDriverClass(m_xBuilder->weld_label("jdbcDriverLabel"))
- , m_xETDriverClass(m_xBuilder->weld_entry("jdbcDriverEntry"))
- , m_xPBTestJavaDriver(m_xBuilder->weld_button("testDriverButton"))
+ , m_xHeaderText(m_xBuilder->weld_label(u"header"_ustr))
+ , m_xFTHelpText(m_xBuilder->weld_label(u"helpLabel"_ustr))
+ , m_xFTDatabasename(m_xBuilder->weld_label(u"dbNameLabel"_ustr))
+ , m_xETDatabasename(m_xBuilder->weld_entry(u"dbNameEntry"_ustr))
+ , m_xFTHostname(m_xBuilder->weld_label(u"hostNameLabel"_ustr))
+ , m_xETHostname(m_xBuilder->weld_entry(u"hostNameEntry"_ustr))
+ , m_xFTPortNumber(m_xBuilder->weld_label(u"portNumLabel"_ustr))
+ , m_xFTDefaultPortNumber(m_xBuilder->weld_label(u"portNumDefLabel"_ustr))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button(u"portNumEntry"_ustr))
+ , m_xFTDriverClass(m_xBuilder->weld_label(u"jdbcDriverLabel"_ustr))
+ , m_xETDriverClass(m_xBuilder->weld_entry(u"jdbcDriverEntry"_ustr))
+ , m_xPBTestJavaDriver(m_xBuilder->weld_button(u"testDriverButton"_ustr))
{
m_xFTDriverClass->set_label(DBA_RES(pDriverClassId));
@@ -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();
@@ -461,13 +468,13 @@ using namespace ::com::sun::star;
IMPL_LINK_NOARG(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, weld::Button&, void)
{
- OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
+ assert(m_pAdminDialog && "No Admin dialog set! ->GPF");
bool bSuccess = false;
#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() );
@@ -479,7 +486,7 @@ using namespace ::com::sun::star;
{
}
#endif
- const char *pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
+ TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error;
OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt);
aMsg.run();
@@ -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,13 +506,136 @@ 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, u"dbaccess/ui/postgrespage.ui"_ustr, u"SpecialPostgresPage"_ustr, _rCoreAttrs)
+ , m_nPortId(_nPortId)
+ , m_xETDatabasename(m_xBuilder->weld_entry(u"dbNameEntry"_ustr))
+ , m_xETHostname(m_xBuilder->weld_entry(u"hostNameEntry"_ustr))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button(u"portNumEntry"_ustr))
+ , m_xConnectionURL(new OConnectionURLEdit(m_xBuilder->weld_entry(u"browseurl"_ustr), m_xBuilder->weld_label(u"browselabel"_ustr)))
+ {
+ 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,
+ : OConnectionTabPageSetup(pPage, pController, u"dbaccess/ui/jdbcconnectionpage.ui"_ustr, u"JDBCConnectionPage"_ustr, rCoreAttrs,
STR_JDBC_HELPTEXT, STR_JDBC_HEADERTEXT, STR_COMMONURL)
- , m_xFTDriverClass(m_xBuilder->weld_label("jdbcLabel"))
- , m_xETDriverClass(m_xBuilder->weld_entry("jdbcEntry"))
- , m_xPBTestJavaDriver(m_xBuilder->weld_button("jdbcButton"))
+ , m_xFTDriverClass(m_xBuilder->weld_label(u"jdbcLabel"_ustr))
+ , m_xETDriverClass(m_xBuilder->weld_entry(u"jdbcEntry"_ustr))
+ , m_xPBTestJavaDriver(m_xBuilder->weld_button(u"jdbcButton"_ustr))
{
m_xETDriverClass->connect_changed(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
m_xPBTestJavaDriver->connect_clicked(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
@@ -574,7 +704,7 @@ using namespace ::com::sun::star;
IMPL_LINK_NOARG(OJDBCConnectionPageSetup, OnTestJavaClickHdl, weld::Button&, void)
{
- OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
+ assert(m_pAdminDialog && "No Admin dialog set! ->GPF");
bool bSuccess = false;
#if HAVE_FEATURE_JAVA
try
@@ -591,7 +721,7 @@ using namespace ::com::sun::star;
{
}
#endif
- const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
+ TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error;
OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt);
aMsg.run();
@@ -612,9 +742,9 @@ using namespace ::com::sun::star;
}
OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OConnectionTabPageSetup(pPage, pController, "dbaccess/ui/dbwizspreadsheetpage.ui", "DBWizSpreadsheetPage",
+ : OConnectionTabPageSetup(pPage, pController, u"dbaccess/ui/dbwizspreadsheetpage.ui"_ustr, u"DBWizSpreadsheetPage"_ustr,
rCoreAttrs, STR_SPREADSHEET_HELPTEXT, STR_SPREADSHEET_HEADERTEXT, STR_SPREADSHEETPATH)
- , m_xPasswordrequired(m_xBuilder->weld_check_button("passwordrequired"))
+ , m_xPasswordrequired(m_xBuilder->weld_check_button(u"passwordrequired"_ustr))
{
m_xPasswordrequired->connect_toggled(LINK(this, OGenericAdministrationPage, OnControlModifiedButtonClick));
}
@@ -630,7 +760,7 @@ using namespace ::com::sun::star;
void OSpreadSheetConnectionPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
{
OConnectionTabPageSetup::fillControls(_rControlList);
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xPasswordrequired.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xPasswordrequired.get()));
}
@@ -647,12 +777,12 @@ using namespace ::com::sun::star;
}
OAuthentificationPageSetup::OAuthentificationPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs)
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/authentificationpage.ui", "AuthentificationPage", _rCoreAttrs)
- , m_xFTHelpText(m_xBuilder->weld_label("helptext"))
- , m_xFTUserName(m_xBuilder->weld_label("generalUserNameLabel"))
- , m_xETUserName(m_xBuilder->weld_entry("generalUserNameEntry"))
- , m_xCBPasswordRequired(m_xBuilder->weld_check_button("passRequiredCheckbutton"))
- , m_xPBTestConnection(m_xBuilder->weld_button("testConnectionButton"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/authentificationpage.ui"_ustr, u"AuthentificationPage"_ustr, _rCoreAttrs)
+ , m_xFTHelpText(m_xBuilder->weld_label(u"helptext"_ustr))
+ , m_xFTUserName(m_xBuilder->weld_label(u"generalUserNameLabel"_ustr))
+ , m_xETUserName(m_xBuilder->weld_entry(u"generalUserNameEntry"_ustr))
+ , m_xCBPasswordRequired(m_xBuilder->weld_check_button(u"passRequiredCheckbutton"_ustr))
+ , m_xPBTestConnection(m_xBuilder->weld_button(u"testConnectionButton"_ustr))
{
m_xETUserName->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
m_xCBPasswordRequired->connect_toggled(LINK(this,OGenericAdministrationPage,OnControlModifiedButtonClick));
@@ -673,7 +803,7 @@ using namespace ::com::sun::star;
void OAuthentificationPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
{
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETUserName.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xCBPasswordRequired.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xCBPasswordRequired.get()));
}
void OAuthentificationPageSetup::implInitControls(const SfxItemSet& _rSet, bool /*_bSaveValue*/)
@@ -710,15 +840,15 @@ using namespace ::com::sun::star;
}
OFinalDBPageSetup::OFinalDBPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs)
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/finalpagewizard.ui", "PageFinal", _rCoreAttrs)
- , m_xFTFinalHeader(m_xBuilder->weld_label("headerText"))
- , m_xFTFinalHelpText(m_xBuilder->weld_label("helpText"))
- , m_xRBRegisterDataSource(m_xBuilder->weld_radio_button("yesregister"))
- , m_xRBDontregisterDataSource(m_xBuilder->weld_radio_button("noregister"))
- , m_xFTAdditionalSettings(m_xBuilder->weld_label("additionalText"))
- , m_xCBOpenAfterwards(m_xBuilder->weld_check_button("openediting"))
- , m_xCBStartTableWizard(m_xBuilder->weld_check_button("usewizard"))
- , m_xFTFinalText(m_xBuilder->weld_label("finishText"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/finalpagewizard.ui"_ustr, u"PageFinal"_ustr, _rCoreAttrs)
+ , m_xFTFinalHeader(m_xBuilder->weld_label(u"headerText"_ustr))
+ , m_xFTFinalHelpText(m_xBuilder->weld_label(u"helpText"_ustr))
+ , m_xRBRegisterDataSource(m_xBuilder->weld_radio_button(u"yesregister"_ustr))
+ , m_xRBDontregisterDataSource(m_xBuilder->weld_radio_button(u"noregister"_ustr))
+ , m_xFTAdditionalSettings(m_xBuilder->weld_label(u"additionalText"_ustr))
+ , m_xCBOpenAfterwards(m_xBuilder->weld_check_button(u"openediting"_ustr))
+ , m_xCBStartTableWizard(m_xBuilder->weld_check_button(u"usewizard"_ustr))
+ , m_xFTFinalText(m_xBuilder->weld_label(u"finishText"_ustr))
{
m_xCBOpenAfterwards->connect_toggled(LINK(this, OFinalDBPageSetup, OnOpenSelected));
m_xRBRegisterDataSource->set_active(true);
@@ -754,10 +884,10 @@ using namespace ::com::sun::star;
void OFinalDBPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
{
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xCBOpenAfterwards.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xCBStartTableWizard.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xRBRegisterDataSource.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xRBDontregisterDataSource.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xCBOpenAfterwards.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xCBStartTableWizard.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xRBRegisterDataSource.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xRBDontregisterDataSource.get()));
}
void OFinalDBPageSetup::implInitControls(const SfxItemSet& /*_rSet*/, bool /*_bSaveValue*/)
@@ -775,7 +905,7 @@ using namespace ::com::sun::star;
return true;
}
- IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, weld::ToggleButton&, rBox, void)
+ IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, weld::Toggleable&, rBox, void)
{
m_xCBStartTableWizard->set_sensitive(rBox.get_sensitive() && rBox.get_active());
}
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 057e7e584afd..909cfede5806 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DBSETUPCONNECTIONPAGES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DBSETUPCONNECTIONPAGES_HXX
+#pragma once
#include "ConnectionPageSetup.hxx"
@@ -26,6 +25,8 @@
#include "admincontrols.hxx"
#include "TextConnectionHelper.hxx"
+#include <curledit.hxx>
+
namespace dbaui
{
class ODbTypeWizDialogSetup;
@@ -124,10 +125,10 @@ namespace dbaui
OGeneralSpecialJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController
, const SfxItemSet& _rCoreAttrs
, sal_uInt16 _nPortId
- , const char* pDefaultPortResId
- , const char* pHelpTextResId
- , const char* pHeaderTextResId
- , const char* pDriverClassId );
+ , TranslateId pDefaultPortResId
+ , TranslateId pHelpTextResId
+ , TranslateId pHeaderTextResId
+ , TranslateId pDriverClassId );
virtual ~OGeneralSpecialJDBCConnectionPageSetup() override;
static std::unique_ptr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
static std::unique_ptr<OGenericAdministrationPage> CreateOracleJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
@@ -142,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;
@@ -212,9 +213,45 @@ namespace dbaui
std::unique_ptr<weld::RadioButton> m_xNATIVEDatabase;
Link<OMySQLIntroPageSetup *, void> maClickHdl;
- DECL_LINK(OnSetupModeSelected, weld::ToggleButton&, void);
+ 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
{
@@ -250,7 +287,7 @@ namespace dbaui
bool IsTableWizardToBeStarted() const;
void enableTableWizardCheckBox( bool _bSupportsTableCreation);
- DECL_LINK(OnOpenSelected, weld::ToggleButton&, void);
+ DECL_LINK(OnOpenSelected, weld::Toggleable&, void);
protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
@@ -268,6 +305,4 @@ namespace dbaui
} // namespace dbaui
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 2437196f14e3..428f5b0a06df 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -43,7 +43,6 @@
#include <com/sun/star/sdbc/ConnectionPool.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
-#include <com/sun/star/task/XInteractionRequest.hpp>
#include <com/sun/star/ucb/AuthenticationRequest.hpp>
#include <comphelper/interaction.hxx>
@@ -51,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>
@@ -63,6 +62,7 @@
#include <iterator>
#include <functional>
#include <o3tl/functional.hxx>
+#include <comphelper/string.hxx>
namespace dbaui
{
@@ -73,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;
@@ -89,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;
@@ -163,30 +162,30 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
m_aIndirectPropTranslator.emplace( DSID_AS_BEFORE_CORRNAME, INFO_AS_BEFORE_CORRELATION_NAME );
m_aIndirectPropTranslator.emplace( DSID_CHECK_REQUIRED_FIELDS, INFO_FORMS_CHECK_REQUIRED_FIELDS );
m_aIndirectPropTranslator.emplace( DSID_ESCAPE_DATETIME, INFO_ESCAPE_DATETIME );
- m_aIndirectPropTranslator.emplace( DSID_PRIMARY_KEY_SUPPORT, OUString("PrimaryKeySupport") );
+ m_aIndirectPropTranslator.emplace( DSID_PRIMARY_KEY_SUPPORT, u"PrimaryKeySupport"_ustr );
m_aIndirectPropTranslator.emplace( DSID_PARAMETERNAMESUBST, INFO_PARAMETERNAMESUBST );
m_aIndirectPropTranslator.emplace( DSID_IGNOREDRIVER_PRIV, INFO_IGNOREDRIVER_PRIV );
m_aIndirectPropTranslator.emplace( DSID_BOOLEANCOMPARISON, PROPERTY_BOOLEANCOMPARISONMODE );
m_aIndirectPropTranslator.emplace( DSID_ENABLEOUTERJOIN, PROPERTY_ENABLEOUTERJOIN );
m_aIndirectPropTranslator.emplace( DSID_CATALOG, PROPERTY_USECATALOGINSELECT );
m_aIndirectPropTranslator.emplace( DSID_SCHEMA, PROPERTY_USESCHEMAINSELECT );
- m_aIndirectPropTranslator.emplace( DSID_INDEXAPPENDIX, OUString("AddIndexAppendix") );
- m_aIndirectPropTranslator.emplace( DSID_DOSLINEENDS, OUString("PreferDosLikeLineEnds") );
- m_aIndirectPropTranslator.emplace( DSID_CONN_SOCKET, OUString("LocalSocket") );
- m_aIndirectPropTranslator.emplace( DSID_NAMED_PIPE, OUString("NamedPipe") );
- m_aIndirectPropTranslator.emplace( DSID_RESPECTRESULTSETTYPE, OUString("RespectDriverResultSetType") );
- m_aIndirectPropTranslator.emplace( DSID_MAX_ROW_SCAN, OUString("MaxRowScan") );
+ m_aIndirectPropTranslator.emplace( DSID_INDEXAPPENDIX, u"AddIndexAppendix"_ustr );
+ m_aIndirectPropTranslator.emplace( DSID_DOSLINEENDS, u"PreferDosLikeLineEnds"_ustr );
+ m_aIndirectPropTranslator.emplace( DSID_CONN_SOCKET, u"LocalSocket"_ustr );
+ m_aIndirectPropTranslator.emplace( DSID_NAMED_PIPE, u"NamedPipe"_ustr );
+ m_aIndirectPropTranslator.emplace( DSID_RESPECTRESULTSETTYPE, u"RespectDriverResultSetType"_ustr );
+ m_aIndirectPropTranslator.emplace( DSID_MAX_ROW_SCAN, u"MaxRowScan"_ustr );
// extra settings for ODBC
m_aIndirectPropTranslator.emplace( DSID_USECATALOG, INFO_USECATALOG );
// extra settings for an LDAP address book
m_aIndirectPropTranslator.emplace( DSID_CONN_LDAP_BASEDN, INFO_CONN_LDAP_BASEDN );
m_aIndirectPropTranslator.emplace( DSID_CONN_LDAP_ROWCOUNT, INFO_CONN_LDAP_ROWCOUNT );
- m_aIndirectPropTranslator.emplace( DSID_CONN_LDAP_USESSL, OUString("UseSSL") );
+ m_aIndirectPropTranslator.emplace( DSID_CONN_LDAP_USESSL, u"UseSSL"_ustr );
m_aIndirectPropTranslator.emplace( DSID_DOCUMENT_URL, PROPERTY_URL );
// Oracle
- m_aIndirectPropTranslator.emplace( DSID_IGNORECURRENCY, OUString("IgnoreCurrency") );
+ m_aIndirectPropTranslator.emplace( DSID_IGNORECURRENCY, u"IgnoreCurrency"_ustr );
try
{
@@ -194,7 +193,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
}
catch(const Exception&)
{
- ShowServiceNotAvailableError(pTopParent, "com.sun.star.sdb.DatabaseContext", true);
+ ShowServiceNotAvailableError(pTopParent, u"com.sun.star.sdb.DatabaseContext", true);
}
}
@@ -211,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()))
@@ -227,12 +226,12 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal
Reference< XModel > xModel( getDataSourceOrModel( m_xDatasource ), UNO_QUERY_THROW );
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
+ Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( u"InteractionHandler"_ustr, Reference< XInteractionHandler >() ) );
if ( !xHandler.is() )
{
// instantiate the default SDB interaction handler
- xHandler = task::InteractionHandler::createWithParent(m_xContext, nullptr);
+ xHandler = task::InteractionHandler::createWithParent(m_xContext, m_pParent->GetXWindow());
}
OUString sName = pName ? pName->GetValue() : OUString();
@@ -261,8 +260,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal
aRequest.HasAccount = false;
// aRequest.Account
- comphelper::OInteractionRequest* pRequest = new comphelper::OInteractionRequest(makeAny(aRequest));
- uno::Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<comphelper::OInteractionRequest> pRequest = new comphelper::OInteractionRequest(Any(aRequest));
// build an interaction request
// two continuations (Ok and Cancel)
@@ -272,15 +270,15 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal
pAuthenticate->setRememberPassword( RememberAuthentication_SESSION );
// some knittings
- pRequest->addContinuation(pAbort.get());
- pRequest->addContinuation(pAuthenticate.get());
+ pRequest->addContinuation(pAbort);
+ pRequest->addContinuation(pAuthenticate);
// handle the request
try
{
SolarMutexGuard aSolarGuard;
// release the mutex when calling the handler, it may need to lock the SolarMutex
- xHandler->handle(xRequest);
+ xHandler->handle(pRequest);
}
catch(Exception&)
{
@@ -296,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() )
@@ -322,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));
}
}
}
@@ -382,7 +380,7 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const OUString
{
css::uno::Any anyEx = cppu::getCaughtException();
// wrap the exception into an SQLException
- throw SQLException(sCurrentActionError, getORB(), "S1000", 0, anyEx);
+ throw SQLException(sCurrentActionError, getORB(), u"S1000"_ustr, 0, anyEx);
}
Reference< XDriver > xDriver = xDriverManager->getDriverByURL(_sURL);
@@ -391,7 +389,7 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const OUString
sCurrentActionError = DBA_RES(STR_NOREGISTEREDDRIVER);
sCurrentActionError = sCurrentActionError.replaceFirst("#connurl#", _sURL);
// will be caught and translated into an SQLContext exception
- throw SQLException(sCurrentActionError, getORB(), "S1000", 0, Any());
+ throw SQLException(sCurrentActionError, getORB(), u"S1000"_ustr, 0, Any());
}
return xDriver;
}
@@ -433,9 +431,9 @@ Reference< XPropertySet > const & ODbDataSourceAdministrationHelper::getCurrentD
OUString ODbDataSourceAdministrationHelper::getDatasourceType( const SfxItemSet& _rSet )
{
const SfxStringItem* pConnectURL = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
- OSL_ENSURE( pConnectURL , "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
+ assert(pConnectURL && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
const DbuTypeCollectionItem* pTypeCollection = _rSet.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
- OSL_ENSURE(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
+ assert(pTypeCollection && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
return pCollection->getType(pConnectURL->GetValue());
}
@@ -454,10 +452,10 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
const SfxStringItem* pUrlItem = m_pItemSetHelper->getOutputSet()->GetItem<SfxStringItem>(DSID_CONNECTURL);
const DbuTypeCollectionItem* pTypeCollection = m_pItemSetHelper->getOutputSet()->GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
- OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
- OSL_ENSURE(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
+ assert(pUrlItem && "Connection URL is NULL. -> GPF!");
+ assert(pTypeCollection && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
- OSL_ENSURE(pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
+ assert(pCollection && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
switch( pCollection->determineType(eType) )
{
@@ -467,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;
@@ -525,6 +522,37 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
sNewUrl = pCollection->cutPrefix(pUrlItem->GetValue()) + lcl_createHostWithPort(nullptr,pPortNumber);
}
break;
+ case ::dbaccess::DST_POSTGRES:
+ {
+ 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;
+ }
+ return rURL;
+ }
+ break;
case ::dbaccess::DST_JDBC:
// run through
default:
@@ -532,7 +560,7 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
}
if ( !sNewUrl.isEmpty() )
sNewUrl = pCollection->getPrefix(eType) + sNewUrl;
- else
+ else if (pUrlItem)
sNewUrl = pUrlItem->GetValue();
return sNewUrl;
@@ -581,7 +609,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
@@ -633,7 +661,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r
try { xInfo = _rxDest->getPropertySetInfo(); }
catch(Exception&) { }
- const OUString sUrlProp("URL");
+ static constexpr OUStringLiteral sUrlProp(u"URL");
// transfer the direct properties
for (auto const& elem : m_aDirectPropTranslator)
{
@@ -650,7 +678,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);
}
@@ -673,7 +701,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)
@@ -702,7 +730,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));
@@ -768,11 +796,11 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
}
Sequence< Any> aTypeSettings;
- aTypeSettings = aProperties.getOrDefault("TypeInfoSettings",aTypeSettings);
+ aTypeSettings = aProperties.getOrDefault(u"TypeInfoSettings"_ustr,aTypeSettings);
// 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(u"TypeInfoSettings"_ustr, 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)
@@ -862,14 +890,13 @@ 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;}
void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue )
{
- switch ( _rValue.getValueType().getTypeClass() )
+ switch ( _rValue.getValueTypeClass() )
{
case TypeClass_STRING:
if ( implCheckItemType( _rSet, _nId, checkItemType<SfxStringItem> ) )
@@ -916,7 +943,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 ("
@@ -932,7 +959,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
TypeDescription aTD(_rValue.getValueType());
typelib_IndirectTypeDescription* pSequenceTD =
reinterpret_cast< typelib_IndirectTypeDescription* >(aTD.get());
- OSL_ENSURE(pSequenceTD && pSequenceTD->pType, "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence type!");
+ assert(pSequenceTD && pSequenceTD->pType && "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence type!");
Type aElementType(pSequenceTD->pType);
switch (aElementType.getTypeClass())
@@ -967,7 +994,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
OUString ODbDataSourceAdministrationHelper::getDocumentUrl(SfxItemSet const & _rDest)
{
const SfxStringItem* pUrlItem = _rDest.GetItem<SfxStringItem>(DSID_DOCUMENT_URL);
- OSL_ENSURE(pUrlItem,"Document URL is NULL. -> GPF!");
+ assert(pUrlItem && "Document URL is NULL. -> GPF!");
return pUrlItem->GetValue();
}
@@ -978,12 +1005,12 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
const SfxStringItem* pUrlItem = _rDest.GetItem<SfxStringItem>(DSID_CONNECTURL);
const DbuTypeCollectionItem* pTypeCollection = _rDest.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
- OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
- OSL_ENSURE(pTypeCollection, "ODbAdminDialog::getDatasourceType: invalid items in the source set!");
+ assert(pUrlItem && "Connection URL is NULL. -> GPF!");
+ assert(pTypeCollection && "ODbAdminDialog::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
- OSL_ENSURE(pCollection, "ODbAdminDialog::getDatasourceType: invalid type collection!");
+ assert(pCollection && "ODbAdminDialog::getDatasourceType: invalid type collection!");
- sal_uInt16 nPortNumberId = 0;
+ TypedWhichId<SfxInt32Item> nPortNumberId(0);
sal_Int32 nPortNumber = -1;
OUString sNewHostName;
OUString sUrlPart;
@@ -1003,6 +1030,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;
}
@@ -1023,7 +1053,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));
}
@@ -1049,7 +1079,7 @@ void ODbDataSourceAdministrationHelper::setDataSourceOrName( const Any& _rDataSo
// DbuTypeCollectionItem
DbuTypeCollectionItem::DbuTypeCollectionItem(sal_Int16 _nWhich, ::dbaccess::ODsnTypeCollection* _pCollection)
- :SfxPoolItem(_nWhich)
+ :SfxPoolItem(_nWhich )
,m_pCollection(_pCollection)
{
}
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
index c7fbcdc6da20..dd4adcdc525b 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DBADMINIMPL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DBADMINIMPL_HXX
+#pragma once
#include <sal/config.h>
@@ -41,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;
@@ -165,6 +164,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DBADMINIMPL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/DriverSettings.hxx b/dbaccess/source/ui/dlg/DriverSettings.hxx
index 3fc4e9792653..72ce3d459d3f 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.hxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.hxx
@@ -16,13 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DRIVERSETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DRIVERSETTINGS_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
class SfxTabPage;
-namespace vcl { class Window; }
namespace dbaui
{
/// a collection class for all details a driver needs
@@ -77,6 +75,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DRIVERSETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
index 41ed0e867c4b..5bede295c029 100644
--- a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
+++ b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
@@ -11,23 +11,20 @@
#include <strings.hrc>
#include <core_resource.hxx>
-#define ALL_STRING DBA_RES(STR_QUERY_LIMIT_ALL)
-#define ALL_INT -1
-
namespace dbaui
{
QueryPropertiesDialog::QueryPropertiesDialog(
weld::Window* pParent, const bool bDistinct, const sal_Int64 nLimit )
- : GenericDialogController(pParent, "dbaccess/ui/querypropertiesdialog.ui", "QueryPropertiesDialog")
- , m_xRB_Distinct(m_xBuilder->weld_radio_button("distinct"))
- , m_xRB_NonDistinct(m_xBuilder->weld_radio_button("nondistinct"))
- , m_xLB_Limit(m_xBuilder->weld_combo_box("limitbox"))
+ : GenericDialogController(pParent, u"dbaccess/ui/querypropertiesdialog.ui"_ustr, u"QueryPropertiesDialog"_ustr)
+ , m_xRB_Distinct(m_xBuilder->weld_radio_button(u"distinct"_ustr))
+ , m_xRB_NonDistinct(m_xBuilder->weld_radio_button(u"nondistinct"_ustr))
+ , m_xLB_Limit(m_xBuilder->weld_combo_box(u"limitbox"_ustr))
{
m_xRB_Distinct->set_active(bDistinct);
m_xRB_NonDistinct->set_active(!bDistinct);
- m_xLB_Limit->append(OUString::number(ALL_INT), ALL_STRING);
+ m_xLB_Limit->append(OUString::number(-1), DBA_RES(STR_QUERY_LIMIT_ALL)); // ALL_INT and ALL_STRING
/// Default values
sal_Int64 const aDefLimitAry[] =
{
diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx
index cc449d9b7970..c1bba08df1c5 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;
@@ -42,19 +40,19 @@ ORelationDialog::ORelationDialog( OJoinTableView* pParent,
const TTableConnectionData::value_type& pConnectionData,
bool bAllowTableSelect )
: GenericDialogController(pParent->GetFrameWeld(),
- "dbaccess/ui/relationdialog.ui", "RelationDialog")
+ u"dbaccess/ui/relationdialog.ui"_ustr, u"RelationDialog"_ustr)
, m_pParent(pParent)
, m_pOrigConnData(pConnectionData)
, m_bTriedOneUpdate(false)
- , m_xRB_NoCascUpd(m_xBuilder->weld_radio_button("addaction"))
- , m_xRB_CascUpd(m_xBuilder->weld_radio_button("addcascade"))
- , m_xRB_CascUpdNull(m_xBuilder->weld_radio_button("addnull"))
- , m_xRB_CascUpdDefault(m_xBuilder->weld_radio_button("adddefault"))
- , m_xRB_NoCascDel(m_xBuilder->weld_radio_button("delaction"))
- , m_xRB_CascDel(m_xBuilder->weld_radio_button("delcascade"))
- , m_xRB_CascDelNull(m_xBuilder->weld_radio_button("delnull"))
- , m_xRB_CascDelDefault(m_xBuilder->weld_radio_button("deldefault"))
- , m_xPB_OK(m_xBuilder->weld_button("ok"))
+ , m_xRB_NoCascUpd(m_xBuilder->weld_radio_button(u"addaction"_ustr))
+ , m_xRB_CascUpd(m_xBuilder->weld_radio_button(u"addcascade"_ustr))
+ , m_xRB_CascUpdNull(m_xBuilder->weld_radio_button(u"addnull"_ustr))
+ , m_xRB_CascUpdDefault(m_xBuilder->weld_radio_button(u"adddefault"_ustr))
+ , m_xRB_NoCascDel(m_xBuilder->weld_radio_button(u"delaction"_ustr))
+ , m_xRB_CascDel(m_xBuilder->weld_radio_button(u"delcascade"_ustr))
+ , m_xRB_CascDelNull(m_xBuilder->weld_radio_button(u"delnull"_ustr))
+ , m_xRB_CascDelDefault(m_xBuilder->weld_radio_button(u"deldefault"_ustr))
+ , m_xPB_OK(m_xBuilder->weld_button(u"ok"_ustr))
{
// Copy connection
m_pConnData = pConnectionData->NewInstance();
diff --git a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
index bcf039c5e16d..1e17bf568d2d 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
@@ -35,7 +33,7 @@ OTableSubscriptionDialog::OTableSubscriptionDialog(weld::Window* pParent
,const Reference< XComponentContext >& _rxORB
,const css::uno::Any& _aDataSourceName)
: SfxSingleTabDialogController(pParent, _pItems,
- "dbaccess/ui/tablesfilterdialog.ui", "TablesFilterDialog")
+ u"dbaccess/ui/tablesfilterdialog.ui"_ustr, u"TablesFilterDialog"_ustr)
, m_pImpl(new ODbDataSourceAdministrationHelper(_rxORB, m_xDialog.get(), pParent, this))
, m_bStopExecution(false)
{
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index a494bda4c4ad..e186b139c4e1 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;
}
@@ -54,27 +61,27 @@ namespace dbaui
, m_aTextSeparatorList (STR_AUTOTEXTSEPARATORLIST)
, m_aTextNone (DBA_RES(STR_AUTOTEXT_FIELD_SEP_NONE))
, m_nAvailableSections( _nAvailableSections )
- , m_xBuilder(Application::CreateBuilder(pParent, "dbaccess/ui/textpage.ui"))
- , m_xContainer(m_xBuilder->weld_widget("TextPage"))
- , m_xExtensionHeader(m_xBuilder->weld_widget("extensionframe"))
- , m_xAccessTextFiles(m_xBuilder->weld_radio_button("textfile"))
- , m_xAccessCSVFiles(m_xBuilder->weld_radio_button("csvfile"))
- , m_xAccessOtherFiles(m_xBuilder->weld_radio_button("custom"))
- , m_xOwnExtension(m_xBuilder->weld_entry("extension"))
- , m_xExtensionExample(m_xBuilder->weld_label("example"))
- , m_xFormatHeader(m_xBuilder->weld_widget("formatframe"))
- , m_xFieldSeparatorLabel(m_xBuilder->weld_label("fieldlabel"))
- , m_xFieldSeparator(m_xBuilder->weld_combo_box("fieldseparator"))
- , m_xTextSeparatorLabel(m_xBuilder->weld_label("textlabel"))
- , m_xTextSeparator(m_xBuilder->weld_combo_box("textseparator"))
- , m_xDecimalSeparatorLabel(m_xBuilder->weld_label("decimallabel"))
- , m_xDecimalSeparator(m_xBuilder->weld_combo_box("decimalseparator"))
- , m_xThousandsSeparatorLabel(m_xBuilder->weld_label("thousandslabel"))
- , m_xThousandsSeparator(m_xBuilder->weld_combo_box("thousandsseparator"))
- , m_xRowHeader(m_xBuilder->weld_check_button("containsheaders"))
- , m_xCharSetHeader(m_xBuilder->weld_widget("charsetframe"))
- , m_xCharSetLabel(m_xBuilder->weld_label("charsetlabel"))
- , m_xCharSet(new CharSetListBox(m_xBuilder->weld_combo_box("charset")))
+ , m_xBuilder(Application::CreateBuilder(pParent, u"dbaccess/ui/textpage.ui"_ustr))
+ , m_xContainer(m_xBuilder->weld_widget(u"TextPage"_ustr))
+ , m_xExtensionHeader(m_xBuilder->weld_widget(u"extensionframe"_ustr))
+ , m_xAccessTextFiles(m_xBuilder->weld_radio_button(u"textfile"_ustr))
+ , m_xAccessCSVFiles(m_xBuilder->weld_radio_button(u"csvfile"_ustr))
+ , m_xAccessOtherFiles(m_xBuilder->weld_radio_button(u"custom"_ustr))
+ , m_xOwnExtension(m_xBuilder->weld_entry(u"extension"_ustr))
+ , m_xExtensionExample(m_xBuilder->weld_label(u"example"_ustr))
+ , m_xFormatHeader(m_xBuilder->weld_widget(u"formatframe"_ustr))
+ , m_xFieldSeparatorLabel(m_xBuilder->weld_label(u"fieldlabel"_ustr))
+ , m_xFieldSeparator(m_xBuilder->weld_combo_box(u"fieldseparator"_ustr))
+ , m_xTextSeparatorLabel(m_xBuilder->weld_label(u"textlabel"_ustr))
+ , m_xTextSeparator(m_xBuilder->weld_combo_box(u"textseparator"_ustr))
+ , m_xDecimalSeparatorLabel(m_xBuilder->weld_label(u"decimallabel"_ustr))
+ , m_xDecimalSeparator(m_xBuilder->weld_combo_box(u"decimalseparator"_ustr))
+ , m_xThousandsSeparatorLabel(m_xBuilder->weld_label(u"thousandslabel"_ustr))
+ , m_xThousandsSeparator(m_xBuilder->weld_combo_box(u"thousandsseparator"_ustr))
+ , m_xRowHeader(m_xBuilder->weld_check_button(u"containsheaders"_ustr))
+ , m_xCharSetHeader(m_xBuilder->weld_widget(u"charsetframe"_ustr))
+ , m_xCharSetLabel(m_xBuilder->weld_label(u"charsetlabel"_ustr))
+ , m_xCharSet(new CharSetListBox(m_xBuilder->weld_combo_box(u"charset"_ustr)))
{
for(sal_Int32 nIdx {0}; nIdx>=0;)
m_xFieldSeparator->append_text( lcl_getListEntry(m_aFieldSeparatorList, nIdx) );
@@ -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();
@@ -121,7 +127,7 @@ namespace dbaui
m_aGetExtensionHandler.Call(this);
}
- IMPL_LINK_NOARG(OTextConnectionHelper, OnSetExtensionHdl, weld::ToggleButton&, void)
+ IMPL_LINK_NOARG(OTextConnectionHelper, OnSetExtensionHdl, weld::Toggleable&, void)
{
bool bDoEnable = m_xAccessOtherFiles->get_active();
m_xOwnExtension->set_sensitive(bDoEnable);
@@ -135,7 +141,7 @@ namespace dbaui
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xTextSeparator.get()));
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xDecimalSeparator.get()));
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xThousandsSeparator.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xRowHeader.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xRowHeader.get()));
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xCharSet->get_widget()));
}
@@ -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 e002c77e8ba8..6755a422378e 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
+#pragma once
#include "adminpages.hxx"
#include <charsetlistbox.hxx>
@@ -69,11 +68,11 @@ namespace dbaui
std::unique_ptr<weld::Label> m_xCharSetLabel;
std::unique_ptr<CharSetListBox> m_xCharSet;
- DECL_LINK(OnSetExtensionHdl, weld::ToggleButton&, void);
+ 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:
@@ -87,6 +86,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 3e63f9424fce..21e293d75f07 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
#include <com/sun/star/sdbcx/XDrop.hpp>
-#include <ucbhelper/interactionrequest.hxx>
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdbcx/XUser.hpp>
@@ -46,11 +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 ucbhelper;
-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;
@@ -63,7 +64,7 @@ class OPasswordDialog : public weld::GenericDialogController
DECL_LINK(ModifiedHdl, weld::Entry&, void);
public:
- OPasswordDialog(weld::Window* pParent,const OUString& rUserName);
+ OPasswordDialog(weld::Window* pParent, std::u16string_view rUserName);
OUString GetOldPassword() const { return m_xEDOldPassword->get_text(); }
OUString GetNewPassword() const { return m_xEDPassword->get_text(); }
@@ -71,13 +72,13 @@ public:
}
-OPasswordDialog::OPasswordDialog(weld::Window* _pParent,const OUString& rUserName)
- : GenericDialogController(_pParent, "dbaccess/ui/password.ui", "PasswordDialog")
- , m_xUser(m_xBuilder->weld_frame("userframe"))
- , m_xEDOldPassword(m_xBuilder->weld_entry("oldpassword"))
- , m_xEDPassword(m_xBuilder->weld_entry("newpassword"))
- , m_xEDPasswordRepeat(m_xBuilder->weld_entry("confirmpassword"))
- , m_xOKBtn(m_xBuilder->weld_button("ok"))
+OPasswordDialog::OPasswordDialog(weld::Window* _pParent, std::u16string_view rUserName)
+ : GenericDialogController(_pParent, u"dbaccess/ui/password.ui"_ustr, u"PasswordDialog"_ustr)
+ , m_xUser(m_xBuilder->weld_frame(u"userframe"_ustr))
+ , m_xEDOldPassword(m_xBuilder->weld_entry(u"oldpassword"_ustr))
+ , m_xEDPassword(m_xBuilder->weld_entry(u"newpassword"_ustr))
+ , m_xEDPasswordRepeat(m_xBuilder->weld_entry(u"confirmpassword"_ustr))
+ , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr))
{
OUString sUser = m_xUser->get_label();
sUser = sUser.replaceFirst("$name$: $", rUserName);
@@ -112,21 +113,88 @@ 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)
- , 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"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/useradminpage.ui"_ustr, u"UserAdminPage"_ustr, _rAttrSet)
+ , mxActionBar(m_xBuilder->weld_menu_button(u"action_menu"_ustr))
+ , m_xUSER(m_xBuilder->weld_combo_box(u"user"_ustr))
+ , m_xTable(m_xBuilder->weld_container(u"table"_ustr))
, m_xTableCtrlParent(m_xTable->CreateChildFrame())
, m_xTableCtrl(VclPtr<OTableGrantControl>::Create(m_xTableCtrlParent))
{
+ mxActionBar->append_item(u"" MNI_ACTION_ADD_USER ""_ustr, DBA_RES(STR_ADD_USER));
+ mxActionBar->append_item(u"" MNI_ACTION_DEL_USER ""_ustr, DBA_RES(STR_DELETE_USER));
+ mxActionBar->append_item(u"" MNI_ACTION_CHANGE_PASSWORD ""_ustr, 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()
@@ -154,11 +222,8 @@ void OUserAdmin::FillUserNames()
{
m_xUSER->clear();
- m_aUserNames = m_xUsers->getElementNames();
- const OUString* pBegin = m_aUserNames.getConstArray();
- const OUString* pEnd = pBegin + m_aUserNames.getLength();
- for(;pBegin != pEnd;++pBegin)
- m_xUSER->append_text(*pBegin);
+ for (auto& name : m_xUsers->getElementNames())
+ m_xUSER->append_text(name);
m_xUSER->set_active(0);
if(m_xUsers->hasByName(m_UserName))
@@ -175,11 +240,11 @@ void OUserAdmin::FillUserNames()
}
Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
- m_xNEWUSER->set_sensitive(xAppend.is());
+ mxActionBar->set_item_sensitive(u"" MNI_ACTION_ADD_USER ""_ustr, xAppend.is());
Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
- m_xDELETEUSER->set_sensitive(xDrop.is());
+ mxActionBar->set_item_sensitive(u"" MNI_ACTION_DEL_USER ""_ustr, xDrop.is());
+ mxActionBar->set_item_sensitive(u"" MNI_ACTION_CHANGE_PASSWORD ""_ustr, m_xUsers.is());
- m_xCHANGEPWD->set_sensitive(m_xUsers.is());
m_xTableCtrl->Enable(m_xUsers.is());
}
@@ -188,77 +253,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())
- {
- OUString sNewPassword,sOldPassword;
- OPasswordDialog aDlg(GetFrameWeld(), sName);
- if (aDlg.run() == RET_OK)
- {
- 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 09098e30a428..9c376511351b 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.hxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_USERADMIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_USERADMIN_HXX
+#pragma once
#include <TableGrantCtrl.hxx>
#include "adminpages.hxx"
@@ -33,23 +32,20 @@ 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
css::uno::Reference< css::sdbc::XConnection> m_xConnection;
css::uno::Reference< css::container::XNameAccess > m_xUsers;
- css::uno::Sequence< OUString> m_aUserNames;
OUString m_UserName;
// methods
DECL_LINK(ListDblClickHdl, weld::ComboBox&, void);
- DECL_LINK(UserHdl, weld::Button&, void);
+ DECL_LINK(MenuSelectHdl, const OUString&, void);
void FillUserNames();
@@ -71,6 +67,5 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_USERADMIN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
index ec44c33994b9..a70db89f7c49 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,
@@ -47,7 +45,7 @@ namespace dbaui
const Reference< XComponentContext >& rxORB,
const css::uno::Any& rDataSourceName,
const Reference< XConnection >& xConnection)
- : SfxTabDialogController(pParent, "dbaccess/ui/useradmindialog.ui", "UserAdminDialog", pItems)
+ : SfxTabDialogController(pParent, u"dbaccess/ui/useradmindialog.ui"_ustr, u"UserAdminDialog"_ustr, pItems)
, m_pParent(pParent)
, m_pItemSet(pItems)
, m_xConnection(xConnection)
@@ -61,7 +59,7 @@ namespace dbaui
// propagate this set as our new input set and reset the example set
m_xExampleSet.reset(new SfxItemSet(*GetInputSetImpl()));
- AddTabPage("settings", OUserAdmin::Create, nullptr);
+ AddTabPage(u"settings"_ustr, OUserAdmin::Create, nullptr);
// remove the reset button - it's meaning is much too ambiguous in this dialog
RemoveResetButton();
@@ -91,7 +89,7 @@ namespace dbaui
if ( !aMetaData.supportsUserAdministration( getORB() ) )
{
OUString sError(DBA_RES(STR_USERADMIN_NOT_AVAILABLE));
- throw SQLException(sError, nullptr, "S1000", 0, Any());
+ throw SQLException(sError, nullptr, u"S1000"_ustr, 0, Any());
}
}
catch(const SQLException&)
@@ -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/admincontrols.cxx b/dbaccess/source/ui/dlg/admincontrols.cxx
index 88a3bdc1465f..cc98d6cf96ae 100644
--- a/dbaccess/source/ui/dlg/admincontrols.cxx
+++ b/dbaccess/source/ui/dlg/admincontrols.cxx
@@ -30,20 +30,20 @@ namespace dbaui
// MySQLNativeSettings
MySQLNativeSettings::MySQLNativeSettings(weld::Widget* pParent, const Link<weld::Widget*,void>& rControlModificationLink)
- : m_xBuilder(Application::CreateBuilder(pParent, "dbaccess/ui/mysqlnativesettings.ui"))
- , m_xContainer(m_xBuilder->weld_widget("MysqlNativeSettings"))
- , m_xDatabaseNameLabel(m_xBuilder->weld_label("dbnamelabel"))
- , m_xDatabaseName(m_xBuilder->weld_entry("dbname"))
- , m_xHostPortRadio(m_xBuilder->weld_radio_button("hostport"))
- , m_xSocketRadio(m_xBuilder->weld_radio_button("socketlabel"))
- , m_xNamedPipeRadio(m_xBuilder->weld_radio_button("namedpipelabel"))
- , m_xHostNameLabel(m_xBuilder->weld_label("serverlabel"))
- , m_xHostName(m_xBuilder->weld_entry("server"))
- , m_xPortLabel(m_xBuilder->weld_label("portlabel"))
- , m_xPort(m_xBuilder->weld_spin_button("port"))
- , m_xDefaultPort(m_xBuilder->weld_label("defaultport"))
- , m_xSocket(m_xBuilder->weld_entry("socket"))
- , m_xNamedPipe(m_xBuilder->weld_entry("namedpipe"))
+ : m_xBuilder(Application::CreateBuilder(pParent, u"dbaccess/ui/mysqlnativesettings.ui"_ustr))
+ , m_xContainer(m_xBuilder->weld_widget(u"MysqlNativeSettings"_ustr))
+ , m_xDatabaseNameLabel(m_xBuilder->weld_label(u"dbnamelabel"_ustr))
+ , m_xDatabaseName(m_xBuilder->weld_entry(u"dbname"_ustr))
+ , m_xHostPortRadio(m_xBuilder->weld_radio_button(u"hostport"_ustr))
+ , m_xSocketRadio(m_xBuilder->weld_radio_button(u"socketlabel"_ustr))
+ , m_xNamedPipeRadio(m_xBuilder->weld_radio_button(u"namedpipelabel"_ustr))
+ , m_xHostNameLabel(m_xBuilder->weld_label(u"serverlabel"_ustr))
+ , m_xHostName(m_xBuilder->weld_entry(u"server"_ustr))
+ , m_xPortLabel(m_xBuilder->weld_label(u"portlabel"_ustr))
+ , m_xPort(m_xBuilder->weld_spin_button(u"port"_ustr))
+ , m_xDefaultPort(m_xBuilder->weld_label(u"defaultport"_ustr))
+ , m_xSocket(m_xBuilder->weld_entry(u"socket"_ustr))
+ , m_xNamedPipe(m_xBuilder->weld_entry(u"namedpipe"_ustr))
, m_aControlModificationLink(rControlModificationLink)
{
m_xDatabaseName->connect_changed( LINK(this, MySQLNativeSettings, EditModifyHdl) );
@@ -66,7 +66,7 @@ namespace dbaui
m_xContainer->show();
}
- IMPL_LINK(MySQLNativeSettings, RadioToggleHdl, weld::ToggleButton&, rRadioButton, void)
+ IMPL_LINK(MySQLNativeSettings, RadioToggleHdl, weld::Toggleable&, rRadioButton, void)
{
m_aControlModificationLink.Call(&rRadioButton);
diff --git a/dbaccess/source/ui/dlg/admincontrols.hxx b/dbaccess/source/ui/dlg/admincontrols.hxx
index 219f93f0e6dd..7bd1e5edfc97 100644
--- a/dbaccess/source/ui/dlg/admincontrols.hxx
+++ b/dbaccess/source/ui/dlg/admincontrols.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_ADMINCONTROLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_ADMINCONTROLS_HXX
+#pragma once
#include "adminpages.hxx"
@@ -46,7 +45,7 @@ namespace dbaui
std::unique_ptr<weld::Entry> m_xSocket;
std::unique_ptr<weld::Entry> m_xNamedPipe;
Link<weld::Widget*,void> m_aControlModificationLink;
- DECL_LINK(RadioToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(RadioToggleHdl, weld::Toggleable&, void);
DECL_LINK(SpinModifyHdl, weld::SpinButton&, void);
DECL_LINK(EditModifyHdl, weld::Entry&, void);
@@ -63,6 +62,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ADMINCONTROLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index 4dbdb3d6afad..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)
@@ -103,7 +100,7 @@ namespace dbaui
callModifiedHdl(pCtrl);
}
- IMPL_LINK(OGenericAdministrationPage, OnControlModifiedButtonClick, weld::ToggleButton&, rCtrl, void)
+ IMPL_LINK(OGenericAdministrationPage, OnControlModifiedButtonClick, weld::Toggleable&, rCtrl, void)
{
callModifiedHdl(&rCtrl);
}
@@ -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,19 +213,19 @@ 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())
{
- _rSet.Put(SfxStringItem(_nID, pEdit->get_text()));
+ _rSet.Put(SfxStringItem(_nID, pEdit->get_text().trim()));
_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())
{
- _rSet.Put(SfxStringItem(_nID, pEdit->GetText()));
+ _rSet.Put(SfxStringItem(_nID, pEdit->GetText().trim()));
_bChangedSomething = true;
}
}
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index cbdec09d0ba9..b3bb07274d59 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -17,15 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_ADMINPAGES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_ADMINPAGES_HXX
+#pragma once
+#include <osl/diagnose.h>
#include <sfx2/tabdlg.hxx>
#include <vcl/wizardmachine.hxx>
#include <curledit.hxx>
-class NumericField;
-class Edit;
+class SfxInt32Item;
+class SfxStringItem;
+
namespace dbaui
{
/// helper class to wrap the savevalue and disable call
@@ -48,11 +49,11 @@ namespace dbaui
virtual void Disable() override { m_pSaveValue->set_sensitive(false); }
};
- template <> class OSaveValueWidgetWrapper<weld::ToggleButton> : public ISaveValueWrapper
+ template <> class OSaveValueWidgetWrapper<weld::Toggleable> : public ISaveValueWrapper
{
- weld::ToggleButton* m_pSaveValue;
+ weld::Toggleable* m_pSaveValue;
public:
- explicit OSaveValueWidgetWrapper(weld::ToggleButton* _pSaveValue) : m_pSaveValue(_pSaveValue)
+ explicit OSaveValueWidgetWrapper(weld::Toggleable* _pSaveValue) : m_pSaveValue(_pSaveValue)
{ OSL_ENSURE(m_pSaveValue,"Illegal argument!"); }
virtual void SaveValue() override { m_pSaveValue->save_state(); }
@@ -97,7 +98,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; }
@@ -206,7 +207,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
@@ -218,8 +219,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
@@ -228,11 +229,9 @@ namespace dbaui
DECL_LINK(OnControlModified, weld::Widget*, void);
DECL_LINK(OnControlEntryModifyHdl, weld::Entry&, void);
DECL_LINK(OnControlSpinButtonModifyHdl, weld::SpinButton&, void);
- DECL_LINK(OnControlModifiedButtonClick, weld::ToggleButton&, void);
+ DECL_LINK(OnControlModifiedButtonClick, weld::Toggleable&, void);
DECL_LINK(OnTestConnectionButtonClickHdl, weld::Button&, void);
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ADMINPAGES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index 8ba7610fc854..82af63688cc1 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -26,6 +26,8 @@
#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>
@@ -35,161 +37,94 @@
namespace {
-OUString PromptNew(long hWnd)
+OUString PromptNew(sal_IntPtr hWnd)
{
- HRESULT hr;
- IDataSourceLocator* dlPrompt = nullptr;
- ADOConnection* piTmpConnection = nullptr;
- BSTR _result=nullptr;
-
- // Initialize COM
- hr = ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
- if (FAILED(hr) && hr != RPC_E_CHANGED_MODE)
- std::abort();
- const bool bDoUninit = SUCCEEDED(hr);
- comphelper::ScopeGuard g([bDoUninit] () {
- if (bDoUninit)
- CoUninitialize();
- });
-
- // Instantiate DataLinks object.
- hr = CoCreateInstance(
- CLSID_DataLinks, //clsid -- Data Links UI
- nullptr, //pUnkOuter
- CLSCTX_INPROC_SERVER, //dwClsContext
- IID_IDataSourceLocator, //riid
- reinterpret_cast<void**>(&dlPrompt) //ppvObj
- );
- if( FAILED( hr ) )
+ try
{
- return OUString();
- }
+ // Initialize COM
+ sal::systools::CoInitializeGuard aGuard(COINIT_APARTMENTTHREADED);
- dlPrompt->put_hWnd(hWnd);
- if( FAILED( hr ) )
- {
- dlPrompt->Release( );
- return OUString();
- }
+ // Instantiate DataLinks object.
+ sal::systools::COMReference<IDataSourceLocator> dlPrompt;
+ dlPrompt.CoCreateInstance(CLSID_DataLinks, //clsid -- Data Links UI
+ nullptr, //pUnkOuter
+ CLSCTX_INPROC_SERVER); //dwClsContext
- // Prompt for connection information.
- hr = dlPrompt->PromptNew(reinterpret_cast<IDispatch **>(&piTmpConnection));
+ sal::systools::ThrowIfFailed(dlPrompt->put_hWnd(hWnd), "put_hWnd failed");
- if( FAILED( hr ) || !piTmpConnection )
- {
- dlPrompt->Release( );
- return OUString();
- }
+ // Prompt for connection information.
+ sal::systools::COMReference<IDispatch> piDispatch;
+ sal::systools::ThrowIfFailed(dlPrompt->PromptNew(&piDispatch), "PromptNew failed");
+ sal::systools::COMReference<ADOConnection> piTmpConnection(piDispatch,
+ sal::systools::COM_QUERY_THROW);
+
+ sal::systools::BStr _result;
+ sal::systools::ThrowIfFailed(piTmpConnection->get_ConnectionString(&_result),
+ "get_ConnectionString failed");
- hr = piTmpConnection->get_ConnectionString(&_result);
- if( FAILED( hr ) )
+ return OUString(_result);
+ }
+ catch (const sal::systools::ComError&)
{
- piTmpConnection->Release( );
- dlPrompt->Release( );
return OUString();
}
-
- piTmpConnection->Release( );
- dlPrompt->Release( );
- // Don't we need SysFreeString(_result)?
- return o3tl::toU(_result);
}
-OUString PromptEdit(long hWnd, OUString const & connstr)
+OUString PromptEdit(sal_IntPtr hWnd, OUString const & connstr)
{
- HRESULT hr;
- IDataSourceLocator* dlPrompt = nullptr;
- ADOConnection* piTmpConnection = nullptr;
- BSTR _result=nullptr;
-
- // Initialize COM
- ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
-
- hr = CoCreateInstance(CLSID_CADOConnection,
- nullptr,
- CLSCTX_INPROC_SERVER,
- IID_IADOConnection,
- reinterpret_cast<LPVOID *>(&piTmpConnection));
- if( FAILED( hr ) )
- {
- piTmpConnection->Release( );
- return connstr;
- }
-
-
- hr = piTmpConnection->put_ConnectionString(
- const_cast<BSTR>(o3tl::toW(connstr.getStr())));
- if( FAILED( hr ) )
+ try
{
- piTmpConnection->Release( );
- return connstr;
- }
+ // Initialize COM
+ sal::systools::CoInitializeGuard aGuard(COINIT_APARTMENTTHREADED);
- // Instantiate DataLinks object.
- hr = CoCreateInstance(
- CLSID_DataLinks, //clsid -- Data Links UI
- nullptr, //pUnkOuter
- CLSCTX_INPROC_SERVER, //dwClsContext
- IID_IDataSourceLocator, //riid
- reinterpret_cast<void**>(&dlPrompt) //ppvObj
- );
- if( FAILED( hr ) )
- {
- piTmpConnection->Release( );
- dlPrompt->Release( );
- return connstr;
- }
+ sal::systools::COMReference<ADOConnection> piTmpConnection;
+ piTmpConnection.CoCreateInstance(CLSID_CADOConnection, nullptr, CLSCTX_INPROC_SERVER);
- dlPrompt->put_hWnd(hWnd);
- if( FAILED( hr ) )
- {
- piTmpConnection->Release( );
- dlPrompt->Release( );
- return connstr;
- }
+ sal::systools::ThrowIfFailed(
+ piTmpConnection->put_ConnectionString(sal::systools::BStr(connstr)),
+ "put_ConnectionString failed");
- VARIANT_BOOL pbSuccess;
+ // Instantiate DataLinks object.
+ sal::systools::COMReference<IDataSourceLocator> dlPrompt;
+ dlPrompt.CoCreateInstance(CLSID_DataLinks, //clsid -- Data Links UI
+ nullptr, //pUnkOuter
+ CLSCTX_INPROC_SERVER); //dwClsContext
- // Prompt for connection information.
- hr = dlPrompt->PromptEdit(reinterpret_cast<IDispatch **>(&piTmpConnection),&pbSuccess);
- if( SUCCEEDED( hr ) && !pbSuccess ) //if user press cancel then sal_False == pbSuccess
- {
- piTmpConnection->Release( );
- dlPrompt->Release( );
- return connstr;
- }
+ sal::systools::ThrowIfFailed(dlPrompt->put_hWnd(hWnd), "put_hWnd failed");
- if( FAILED( hr ) )
- {
- // Prompt for new connection information.
- piTmpConnection->Release( );
- piTmpConnection = nullptr;
- hr = dlPrompt->PromptNew(reinterpret_cast<IDispatch **>(&piTmpConnection));
- if( FAILED( hr ) || !piTmpConnection )
+ try
{
- dlPrompt->Release( );
- return connstr;
+ // Prompt for connection information.
+ IDispatch* piDispatch = piTmpConnection.get();
+ VARIANT_BOOL pbSuccess;
+ sal::systools::ThrowIfFailed(dlPrompt->PromptEdit(&piDispatch, &pbSuccess),
+ "PromptEdit failed");
+ if (!pbSuccess) //if user press cancel then sal_False == pbSuccess
+ return connstr;
}
- }
+ catch (const sal::systools::ComError&)
+ {
+ // Prompt for new connection information.
+ sal::systools::COMReference<IDispatch> piDispatch;
+ sal::systools::ThrowIfFailed(dlPrompt->PromptNew(&piDispatch), "PromptNew failed");
+ piTmpConnection.set(piDispatch, sal::systools::COM_QUERY_THROW);
+ }
+
+ sal::systools::BStr _result;
+ sal::systools::ThrowIfFailed(piTmpConnection->get_ConnectionString(&_result),
+ "get_ConnectionString failed");
- hr = piTmpConnection->get_ConnectionString(&_result);
- if( FAILED( hr ) )
+ return OUString(_result);
+ }
+ catch (const sal::systools::ComError&)
{
- piTmpConnection->Release( );
- dlPrompt->Release( );
return connstr;
}
-
- piTmpConnection->Release( );
- dlPrompt->Release( );
- CoUninitialize();
- // Don't we need SysFreeString(_result)?
- return o3tl::toU(_result);
}
}
-OUString getAdoDatalink(long hWnd,OUString const & oldLink)
+OUString getAdoDatalink(sal_IntPtr hWnd,OUString const & oldLink)
{
OUString dataLink;
if (!oldLink.isEmpty())
diff --git a/dbaccess/source/ui/dlg/adodatalinks.hxx b/dbaccess/source/ui/dlg/adodatalinks.hxx
index d13203ad89eb..6b753f62e442 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.hxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.hxx
@@ -17,11 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_ADODATALINKS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_ADODATALINKS_HXX
+#pragma once
#include <rtl/ustring.hxx>
+#include <sal/types.h>
-OUString getAdoDatalink(long hWnd, OUString const& oldLink);
-#endif
+OUString getAdoDatalink(sal_IntPtr hWnd, OUString const& oldLink);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 4ad01555d226..9871db56c898 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>
@@ -31,7 +31,6 @@
#include <imageprovider.hxx>
#include <comphelper/containermultiplexer.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <algorithm>
// slot ids
using namespace dbaui;
@@ -53,14 +52,14 @@ class TableListFacade : public ::cppu::BaseMutex
, public TableObjectListFacade
, public ::comphelper::OContainerListener
{
- TableTreeListBox& m_rTableList;
+ OTableTreeListBox& m_rTableList;
Reference< XConnection > m_xConnection;
::rtl::Reference< comphelper::OContainerListenerAdapter>
m_pContainerListener;
bool m_bAllowViews;
public:
- TableListFacade( TableTreeListBox& _rTableList, const Reference< XConnection >& _rxConnection )
+ TableListFacade(OTableTreeListBox& _rTableList, const Reference< XConnection >& _rxConnection)
: ::comphelper::OContainerListener(m_aMutex)
,m_rTableList( _rTableList )
,m_xConnection( _rxConnection )
@@ -106,12 +105,12 @@ OUString TableListFacade::getSelectedName( OUString& _out_rAliasName ) const
if (rTableList.iter_parent(*xCatalog))
{
if (!xAll || !xCatalog->equal(*xAll))
- aCatalog = rTableList.get_text(*xCatalog);
+ aCatalog = rTableList.get_text(*xCatalog, 0);
}
- aSchema = rTableList.get_text(*xSchema);
+ aSchema = rTableList.get_text(*xSchema, 0);
}
}
- aTableName = rTableList.get_text(*xEntry);
+ aTableName = rTableList.get_text(*xEntry, 0);
OUString aComposedName;
try
@@ -188,18 +187,11 @@ void TableListFacade::updateTableObjectList( bool _bAllowViews )
// if no views are allowed remove the views also out the table name filter
if ( !_bAllowViews )
{
- const OUString* pTableBegin = sTables.getConstArray();
- const OUString* pTableEnd = pTableBegin + sTables.getLength();
- std::vector< OUString > aTables(pTableBegin,pTableEnd);
-
- const OUString* pViewBegin = sViews.getConstArray();
- const OUString* pViewEnd = pViewBegin + sViews.getLength();
- ::comphelper::UStringMixEqual aEqualFunctor;
- for(;pViewBegin != pViewEnd;++pViewBegin)
- aTables.erase(std::remove_if(aTables.begin(),aTables.end(),
- [&aEqualFunctor, pViewBegin](const OUString& lhs)
- { return aEqualFunctor(lhs, *pViewBegin); } )
- , aTables.end());
+ std::vector<OUString> aTables(sTables.begin(), sTables.end());
+
+ for (auto& view : sViews)
+ std::erase_if(aTables, [Equal = comphelper::UStringMixEqual(), &view](auto& s)
+ { return Equal(s, view); });
sTables = Sequence< OUString>(aTables.data(), aTables.size());
sViews = Sequence< OUString>();
}
@@ -274,7 +266,7 @@ void QueryListFacade::_elementInserted( const container::ContainerEvent& _rEvent
if ( _rEvent.Accessor >>= sName )
{
OUString aQueryImage(ImageProvider::getDefaultImageResourceID(css::sdb::application::DatabaseObject::QUERY));
- m_rQueryList.append("", sName, aQueryImage);
+ m_rQueryList.append(u""_ustr, sName, aQueryImage);
}
}
@@ -304,7 +296,7 @@ void QueryListFacade::updateTableObjectList( bool /*_bAllowViews*/ )
const Sequence< OUString > aQueryNames = xQueries->getElementNames();
for ( auto const & name : aQueryNames )
- m_rQueryList.append("", name, aQueryImage);
+ m_rQueryList.append(u""_ustr, name, aQueryImage);
}
catch( const Exception& )
{
@@ -318,7 +310,7 @@ OUString QueryListFacade::getSelectedName( OUString& _out_rAliasName ) const
std::unique_ptr<weld::TreeIter> xEntry(m_rQueryList.make_iterator());
const bool bEntry = m_rQueryList.get_selected(xEntry.get());
if (bEntry)
- sSelected = _out_rAliasName = m_rQueryList.get_text(*xEntry);
+ sSelected = _out_rAliasName = m_rQueryList.get_text(*xEntry, 0);
return sSelected;
}
@@ -331,14 +323,15 @@ bool QueryListFacade::isLeafSelected() const
}
OAddTableDlg::OAddTableDlg(weld::Window* pParent, IAddTableDialogContext& _rContext)
- : GenericDialogController(pParent, "dbaccess/ui/tablesjoindialog.ui", "TablesJoinDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/tablesjoindialog.ui"_ustr, u"TablesJoinDialog"_ustr)
, m_rContext(_rContext)
- , m_xCaseTables(m_xBuilder->weld_radio_button("tables"))
- , m_xCaseQueries(m_xBuilder->weld_radio_button("queries"))
- , m_xTableList(new TableTreeListBox(m_xBuilder->weld_tree_view("tablelist")))
- , m_xQueryList(m_xBuilder->weld_tree_view("querylist"))
- , m_xAddButton(m_xBuilder->weld_button("add"))
- , m_xCloseButton(m_xBuilder->weld_button("close"))
+ , m_xCaseTables(m_xBuilder->weld_radio_button(u"tables"_ustr))
+ , m_xCaseQueries(m_xBuilder->weld_radio_button(u"queries"_ustr))
+ // false means: do not show any buttons
+ , m_xTableList(new OTableTreeListBox(m_xBuilder->weld_tree_view(u"tablelist"_ustr), false))
+ , m_xQueryList(m_xBuilder->weld_tree_view(u"querylist"_ustr))
+ , m_xAddButton(m_xBuilder->weld_button(u"add"_ustr))
+ , m_xCloseButton(m_xBuilder->weld_button(u"close"_ustr))
{
weld::TreeView& rTableList = m_xTableList->GetWidget();
Size aSize(rTableList.get_approximate_digit_width() * 23,
@@ -346,17 +339,15 @@ OAddTableDlg::OAddTableDlg(weld::Window* pParent, IAddTableDialogContext& _rCont
rTableList.set_size_request(aSize.Width(), aSize.Height());
m_xQueryList->set_size_request(aSize.Width(), aSize.Height());
- m_xCaseTables->connect_clicked( LINK( this, OAddTableDlg, OnTypeSelected ) );
- m_xCaseQueries->connect_clicked( LINK( this, OAddTableDlg, OnTypeSelected ) );
+ m_xCaseTables->connect_toggled(LINK(this, OAddTableDlg, OnTypeSelected));
m_xAddButton->connect_clicked( LINK( this, OAddTableDlg, AddClickHdl ) );
m_xCloseButton->connect_clicked( LINK( this, OAddTableDlg, CloseClickHdl ) );
rTableList.connect_row_activated( LINK( this, OAddTableDlg, TableListDoubleClickHdl ) );
- rTableList.connect_changed( LINK( this, OAddTableDlg, TableListSelectHdl ) );
+ rTableList.connect_selection_changed(LINK(this, OAddTableDlg, TableListSelectHdl));
m_xQueryList->connect_row_activated( LINK( this, OAddTableDlg, TableListDoubleClickHdl ) );
- m_xQueryList->connect_changed( LINK( this, OAddTableDlg, TableListSelectHdl ) );
+ m_xQueryList->connect_selection_changed(LINK(this, OAddTableDlg, TableListSelectHdl));
rTableList.set_selection_mode(SelectionMode::Single);
- m_xTableList->DisableCheckButtons(); // do not show any buttons
m_xTableList->SuppressEmptyFolders();
m_xQueryList->set_selection_mode(SelectionMode::Single);
@@ -435,7 +426,7 @@ IMPL_LINK_NOARG( OAddTableDlg, CloseClickHdl, weld::Button&, void )
m_xDialog->response(RET_CLOSE);
}
-IMPL_LINK_NOARG( OAddTableDlg, OnTypeSelected, weld::Button&, void )
+IMPL_LINK_NOARG(OAddTableDlg, OnTypeSelected, weld::Toggleable&, void)
{
if ( m_xCaseTables->get_active() )
impl_switchTo( Tables );
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 6ec06a9dbeb7..12c479b75b03 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
@@ -54,24 +54,24 @@ namespace dbaui
// SpecialSettingsPage
SpecialSettingsPage::SpecialSettingsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta)
- : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/specialsettingspage.ui", "SpecialSettingsPage", _rCoreAttrs)
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/specialsettingspage.ui"_ustr, u"SpecialSettingsPage"_ustr, _rCoreAttrs)
, m_aBooleanSettings {
- { m_xIsSQL92Check, "usesql92", DSID_SQL92CHECK, false, false },
- { m_xAppendTableAlias, "append", DSID_APPEND_TABLE_ALIAS, false, false },
- { m_xAsBeforeCorrelationName, "useas", DSID_AS_BEFORE_CORRNAME, false, false },
- { m_xEnableOuterJoin, "useoj", DSID_ENABLEOUTERJOIN, false, false },
- { m_xIgnoreDriverPrivileges, "ignoreprivs", DSID_IGNOREDRIVER_PRIV, false, false },
- { m_xParameterSubstitution, "replaceparams", DSID_PARAMETERNAMESUBST, false, false },
- { m_xSuppressVersionColumn, "displayver", DSID_SUPPRESSVERSIONCL, true, false },
- { m_xCatalog, "usecatalogname", DSID_CATALOG, false, false },
- { m_xSchema, "useschemaname", DSID_SCHEMA, false, false },
- { m_xIndexAppendix, "createindex", DSID_INDEXAPPENDIX, false, false },
- { m_xDosLineEnds, "eol", DSID_DOSLINEENDS, false, false },
- { m_xCheckRequiredFields, "inputchecks", DSID_CHECK_REQUIRED_FIELDS, false, false },
- { m_xIgnoreCurrency, "ignorecurrency", DSID_IGNORECURRENCY, false, false },
- { m_xEscapeDateTime, "useodbcliterals", DSID_ESCAPE_DATETIME, false, false },
- { m_xPrimaryKeySupport, "primarykeys", DSID_PRIMARY_KEY_SUPPORT, false, false },
- { m_xRespectDriverResultSetType, "resulttype", DSID_RESPECTRESULTSETTYPE, false, false } }
+ { m_xIsSQL92Check, u"usesql92"_ustr, DSID_SQL92CHECK, false, false },
+ { m_xAppendTableAlias, u"append"_ustr, DSID_APPEND_TABLE_ALIAS, false, false },
+ { m_xAsBeforeCorrelationName, u"useas"_ustr, DSID_AS_BEFORE_CORRNAME, false, false },
+ { m_xEnableOuterJoin, u"useoj"_ustr, DSID_ENABLEOUTERJOIN, false, false },
+ { m_xIgnoreDriverPrivileges, u"ignoreprivs"_ustr, DSID_IGNOREDRIVER_PRIV, false, false },
+ { m_xParameterSubstitution, u"replaceparams"_ustr, DSID_PARAMETERNAMESUBST, false, false },
+ { m_xSuppressVersionColumn, u"displayver"_ustr, DSID_SUPPRESSVERSIONCL, true, false },
+ { m_xCatalog, u"usecatalogname"_ustr, DSID_CATALOG, false, false },
+ { m_xSchema, u"useschemaname"_ustr, DSID_SCHEMA, false, false },
+ { m_xIndexAppendix, u"createindex"_ustr, DSID_INDEXAPPENDIX, false, false },
+ { m_xDosLineEnds, u"eol"_ustr, DSID_DOSLINEENDS, false, false },
+ { m_xCheckRequiredFields, u"inputchecks"_ustr, DSID_CHECK_REQUIRED_FIELDS, false, false },
+ { m_xIgnoreCurrency, u"ignorecurrency"_ustr, DSID_IGNORECURRENCY, false, false },
+ { m_xEscapeDateTime, u"useodbcliterals"_ustr, DSID_ESCAPE_DATETIME, false, false },
+ { m_xPrimaryKeySupport, u"primarykeys"_ustr, DSID_PRIMARY_KEY_SUPPORT, false, false },
+ { m_xRespectDriverResultSetType, u"resulttype"_ustr, DSID_RESPECTRESULTSETTYPE, false, false } }
, m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) )
, m_bHasMaxRowScan( _rDSMeta.getFeatureSet().has( DSID_MAX_ROW_SCAN ) )
{
@@ -97,8 +97,8 @@ namespace dbaui
// create the controls for the boolean comparison mode
if ( m_bHasBooleanComparisonMode )
{
- m_xBooleanComparisonModeLabel = m_xBuilder->weld_label("comparisonft");
- m_xBooleanComparisonMode = m_xBuilder->weld_combo_box("comparison");
+ m_xBooleanComparisonModeLabel = m_xBuilder->weld_label(u"comparisonft"_ustr);
+ m_xBooleanComparisonMode = m_xBuilder->weld_combo_box(u"comparison"_ustr);
m_xBooleanComparisonMode->connect_changed(LINK(this, SpecialSettingsPage, BooleanComparisonSelectHdl));
m_xBooleanComparisonModeLabel->show();
m_xBooleanComparisonMode->show();
@@ -106,34 +106,35 @@ namespace dbaui
// create the controls for the max row scan
if ( m_bHasMaxRowScan )
{
- m_xMaxRowScanLabel = m_xBuilder->weld_label("rowsft");
- m_xMaxRowScan = m_xBuilder->weld_spin_button("rows");
+ m_xMaxRowScanLabel = m_xBuilder->weld_label(u"rowsft"_ustr);
+ m_xMaxRowScan = m_xBuilder->weld_spin_button(u"rows"_ustr);
m_xMaxRowScan->connect_value_changed(LINK(this, OGenericAdministrationPage, OnControlSpinButtonModifyHdl));
m_xMaxRowScanLabel->show();
m_xMaxRowScan->show();
}
}
- IMPL_LINK(SpecialSettingsPage, OnTriStateToggleHdl, weld::ToggleButton&, rToggle, void)
+ IMPL_LINK(SpecialSettingsPage, OnTriStateToggleHdl, weld::Toggleable&, rToggle, void)
{
auto eOldState = m_aTriStates[&rToggle];
+ weld::CheckButton& rCheckButton = dynamic_cast<weld::CheckButton&>(rToggle);
switch (eOldState)
{
case TRISTATE_INDET:
- rToggle.set_state(TRISTATE_FALSE);
+ rCheckButton.set_state(TRISTATE_FALSE);
break;
case TRISTATE_TRUE:
- rToggle.set_state(TRISTATE_INDET);
+ rCheckButton.set_state(TRISTATE_INDET);
break;
case TRISTATE_FALSE:
- rToggle.set_state(TRISTATE_TRUE);
+ rCheckButton.set_state(TRISTATE_TRUE);
break;
}
m_aTriStates[&rToggle] = rToggle.get_state();
OnToggleHdl(rToggle);
}
- IMPL_LINK(SpecialSettingsPage, OnToggleHdl, weld::ToggleButton&, rBtn, void)
+ IMPL_LINK(SpecialSettingsPage, OnToggleHdl, weld::Toggleable&, rBtn, void)
{
if (&rBtn == m_xAppendTableAlias.get() && m_xAsBeforeCorrelationName)
{
@@ -170,7 +171,7 @@ namespace dbaui
{
if (booleanSetting.xControl)
{
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(booleanSetting.xControl.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(booleanSetting.xControl.get()));
}
}
@@ -217,7 +218,7 @@ namespace dbaui
else
OSL_FAIL( "SpecialSettingsPage::implInitControls: unknown boolean item type!" );
- if ( !aValue )
+ if ( !aValue.has_value() )
{
booleanSetting.xControl->set_state(TRISTATE_INDET);
}
@@ -284,20 +285,18 @@ namespace dbaui
// GeneratedValuesPage
GeneratedValuesPage::GeneratedValuesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs)
- : 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"))
+ : OGenericAdministrationPage(pPage, pController, u"dbaccess/ui/generatedvaluespage.ui"_ustr, u"GeneratedValuesPage"_ustr, _rCoreAttrs)
+ , m_xAutoRetrievingEnabled(m_xBuilder->weld_check_button(u"autoretrieve"_ustr))
+ , m_xGrid(m_xBuilder->weld_widget(u"grid"_ustr))
+ , m_xAutoIncrement(m_xBuilder->weld_entry(u"statement"_ustr))
+ , m_xAutoRetrieving(m_xBuilder->weld_entry(u"query"_ustr))
{
m_xAutoRetrievingEnabled->connect_toggled(LINK(this, GeneratedValuesPage, OnAutoToggleHdl));
m_xAutoIncrement->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
m_xAutoRetrieving->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
}
- IMPL_LINK(GeneratedValuesPage, OnAutoToggleHdl, weld::ToggleButton&, rBtn, void)
+ IMPL_LINK(GeneratedValuesPage, OnAutoToggleHdl, weld::Toggleable&, rBtn, void)
{
m_xGrid->set_sensitive(rBtn.get_active());
OnControlModifiedButtonClick(rBtn);
@@ -314,7 +313,7 @@ namespace dbaui
void GeneratedValuesPage::fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList )
{
- _rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::ToggleButton>( m_xAutoRetrievingEnabled.get() ) );
+ _rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::Toggleable>( m_xAutoRetrievingEnabled.get() ) );
_rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::Entry>( m_xAutoIncrement.get() ) );
_rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::Entry>( m_xAutoRetrieving.get() ) );
}
@@ -358,7 +357,7 @@ namespace dbaui
// AdvancedSettingsDialog
AdvancedSettingsDialog::AdvancedSettingsDialog(weld::Window* pParent, SfxItemSet* _pItems,
const Reference< XComponentContext >& _rxContext, const Any& _aDataSourceName )
- : SfxTabDialogController(pParent, "dbaccess/ui/advancedsettingsdialog.ui", "AdvancedSettingsDialog", _pItems)
+ : SfxTabDialogController(pParent, u"dbaccess/ui/advancedsettingsdialog.ui"_ustr, u"AdvancedSettingsDialog"_ustr, _pItems)
{
m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext, m_xDialog.get(), pParent, this));
m_pImpl->setDataSourceOrName(_aDataSourceName);
@@ -375,15 +374,15 @@ namespace dbaui
// auto-generated values?
if (rFeatures.supportsGeneratedValues())
- AddTabPage("generated", ODriversSettings::CreateGeneratedValuesPage, nullptr);
+ AddTabPage(u"generated"_ustr, ODriversSettings::CreateGeneratedValuesPage, nullptr);
else
- RemoveTabPage("generated");
+ RemoveTabPage(u"generated"_ustr);
// any "special settings"?
if (rFeatures.supportsAnySpecialSetting())
- AddTabPage("special", ODriversSettings::CreateSpecialSettingsPage, nullptr);
+ AddTabPage(u"special"_ustr, ODriversSettings::CreateSpecialSettingsPage, nullptr);
else
- RemoveTabPage("special");
+ RemoveTabPage(u"special"_ustr);
// remove the reset button - it's meaning is much too ambiguous in this dialog
RemoveResetButton();
@@ -412,7 +411,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 8efc8642863d..9eaca4a41b48 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_ADVANCEDSETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_ADVANCEDSETTINGS_HXX
+#pragma once
#include "adminpages.hxx"
#include <dsmeta.hxx>
@@ -27,7 +26,6 @@
namespace dbaui
{
struct BooleanSettingDesc;
- typedef std::vector< BooleanSettingDesc > BooleanSettingDescs;
// SpecialSettingsPage
// implements the "Special Settings" page of the advanced database settings
@@ -56,16 +54,16 @@ namespace dbaui
std::unique_ptr<weld::Label> m_xMaxRowScanLabel;
std::unique_ptr<weld::SpinButton> m_xMaxRowScan;
- std::map<weld::ToggleButton*, TriState> m_aTriStates;
+ std::map<weld::Toggleable*, TriState> m_aTriStates;
- BooleanSettingDescs m_aBooleanSettings;
+ std::vector< BooleanSettingDesc > m_aBooleanSettings;
bool m_bHasBooleanComparisonMode;
bool m_bHasMaxRowScan;
public:
- DECL_LINK(OnToggleHdl, weld::ToggleButton&, void);
- DECL_LINK(OnTriStateToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(OnToggleHdl, weld::Toggleable&, void);
+ DECL_LINK(OnTriStateToggleHdl, weld::Toggleable&, void);
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
@@ -90,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:
@@ -102,7 +98,7 @@ namespace dbaui
virtual ~GeneratedValuesPage() override;
private:
- DECL_LINK(OnAutoToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(OnAutoToggleHdl, weld::Toggleable&, void);
// subclasses must override this, but it isn't pure virtual
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
@@ -115,6 +111,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ADVANCEDSETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index e37541bfd271..37b0301f4d82 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -32,23 +32,18 @@
#include "optionalboolitem.hxx"
#include <stringlistitem.hxx>
-#include <unotools/confignode.hxx>
-
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,
SfxItemSet const * _pItems,
const Reference< XComponentContext >& _rxContext)
- : SfxTabDialogController(pParent, "dbaccess/ui/admindialog.ui", "AdminDialog", _pItems)
- , m_sMainPageID("advanced")
+ : SfxTabDialogController(pParent, u"dbaccess/ui/admindialog.ui"_ustr, u"AdminDialog"_ustr, _pItems)
+ , m_sMainPageID(u"advanced"_ustr)
{
m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext, m_xDialog.get(), pParent, this));
@@ -71,7 +66,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 +75,7 @@ void ODbAdminDialog::PageCreated(const OString& rId, SfxTabPage& _rPage)
SfxTabDialogController::PageCreated(rId, _rPage);
}
-void ODbAdminDialog::addDetailPage(const OString& rPageId, const char* pTextId, CreateTabPage pCreateFunc)
+void ODbAdminDialog::addDetailPage(const OUString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc)
{
AddTabPage(rPageId, DBA_RES(pTextId), pCreateFunc);
}
@@ -91,43 +86,44 @@ 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
switch ( eType )
{
case ::dbaccess::DST_DBASE:
- addDetailPage("dbase", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateDbase);
+ addDetailPage(u"dbase"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateDbase);
break;
case ::dbaccess::DST_ADO:
- addDetailPage("ado", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdo);
+ addDetailPage(u"ado"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdo);
break;
case ::dbaccess::DST_FLAT:
- addDetailPage("text", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateText);
+ addDetailPage(u"text"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateText);
break;
case ::dbaccess::DST_ODBC:
- addDetailPage("odbc", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateODBC);
+ addDetailPage(u"odbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateODBC);
break;
case ::dbaccess::DST_MYSQL_ODBC:
- addDetailPage("mysqlodbc", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLODBC);
+ addDetailPage(u"mysqlodbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLODBC);
break;
case ::dbaccess::DST_MYSQL_JDBC:
- addDetailPage("mysqljdbc", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLJDBC);
+ addDetailPage(u"mysqljdbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLJDBC);
break;
case ::dbaccess::DST_ORACLE_JDBC:
- addDetailPage("oraclejdbc", STR_PAGETITLE_ADVANCED, ODriversSettings::CreateOracleJDBC);
+ addDetailPage(u"oraclejdbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateOracleJDBC);
break;
case ::dbaccess::DST_LDAP:
- addDetailPage("ldap",STR_PAGETITLE_ADVANCED,ODriversSettings::CreateLDAP);
+ addDetailPage(u"ldap"_ustr,STR_PAGETITLE_ADVANCED,ODriversSettings::CreateLDAP);
break;
case ::dbaccess::DST_USERDEFINE1: /// first user defined driver
case ::dbaccess::DST_USERDEFINE2:
@@ -141,7 +137,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,13 +173,14 @@ 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(u"mysqlnative"_ustr);
AddTabPage(sMySqlNative, DBA_RES(STR_PAGETITLE_CONNECTION), ODriversSettings::CreateMySQLNATIVE);
- RemoveTabPage("advanced");
+ RemoveTabPage(u"advanced"_ustr);
m_sMainPageID = sMySqlNative;
}
@@ -262,169 +259,135 @@ void ODbAdminDialog::clearPassword()
m_pImpl->clearPassword();
}
-void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, 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, u"txt"_ustr), 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(u"DSAItemPool"_ustr);
+
+ // 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, 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
- SfxItemPool::Free(_rpPool);
- _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 84635980b983..77f974648369 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,21 +37,21 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using namespace ::svt;
-const OString aGroupIdent("dBase III");
-
-
-ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, const OUString& aDataSrcName)
- : GenericDialogController(pParent, "dbaccess/ui/dbaseindexdialog.ui", "DBaseIndexDialog")
- , m_aDSN(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"))
- , m_xLB_TableIndexes(m_xBuilder->weld_tree_view("tableindex"))
- , m_xLB_FreeIndexes(m_xBuilder->weld_tree_view("freeindex"))
- , m_xAdd(m_xBuilder->weld_button("add"))
- , m_xRemove(m_xBuilder->weld_button("remove"))
- , m_xAddAll(m_xBuilder->weld_button("addall"))
- , m_xRemoveAll(m_xBuilder->weld_button("removeall"))
+constexpr OString aGroupIdent("dBase III"_ostr);
+
+
+ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, OUString aDataSrcName)
+ : GenericDialogController(pParent, u"dbaccess/ui/dbaseindexdialog.ui"_ustr, u"DBaseIndexDialog"_ustr)
+ , m_aDSN(std::move(aDataSrcName))
+ , m_xPB_OK(m_xBuilder->weld_button(u"ok"_ustr))
+ , m_xCB_Tables(m_xBuilder->weld_combo_box(u"table"_ustr))
+ , m_xIndexes(m_xBuilder->weld_widget(u"frame"_ustr))
+ , m_xLB_TableIndexes(m_xBuilder->weld_tree_view(u"tableindex"_ustr))
+ , m_xLB_FreeIndexes(m_xBuilder->weld_tree_view(u"freeindex"_ustr))
+ , m_xAdd(m_xBuilder->weld_button(u"add"_ustr))
+ , m_xRemove(m_xBuilder->weld_button(u"remove"_ustr))
+ , m_xAddAll(m_xBuilder->weld_button(u"addall"_ustr))
+ , m_xRemoveAll(m_xBuilder->weld_button(u"removeall"_ustr))
{
int nWidth = m_xLB_TableIndexes->get_approximate_digit_width() * 18;
int nHeight = m_xLB_TableIndexes->get_height_rows(10);
@@ -64,8 +65,10 @@ ODbaseIndexDialog::ODbaseIndexDialog(weld::Window * pParent, const OUString& aDa
m_xRemoveAll->connect_clicked( LINK(this, ODbaseIndexDialog, RemoveAllClickHdl) );
m_xPB_OK->connect_clicked( LINK(this, ODbaseIndexDialog, OKClickHdl) );
- m_xLB_FreeIndexes->connect_changed( LINK(this, ODbaseIndexDialog, OnListEntrySelected) );
- m_xLB_TableIndexes->connect_changed( LINK(this, ODbaseIndexDialog, OnListEntrySelected) );
+ m_xLB_FreeIndexes->connect_selection_changed(
+ LINK(this, ODbaseIndexDialog, OnListEntrySelected));
+ m_xLB_TableIndexes->connect_selection_changed(
+ LINK(this, ODbaseIndexDialog, OnListEntrySelected));
Init();
SetCtrls();
@@ -116,7 +119,7 @@ void ODbaseIndexDialog::implInsertIndex(const OTableIndex& _rIndex, TableIndexLi
_rDisplay.select(0);
}
-OTableIndex ODbaseIndexDialog::RemoveTableIndex( const OUString& _rTableName, const OUString& _rIndexName )
+OTableIndex ODbaseIndexDialog::RemoveTableIndex( std::u16string_view _rTableName, const OUString& _rIndexName )
{
OTableIndex aReturn;
@@ -130,7 +133,7 @@ OTableIndex ODbaseIndexDialog::RemoveTableIndex( const OUString& _rTableName, co
return implRemoveIndex(_rIndexName, aTablePos->aIndexList, *m_xLB_TableIndexes, true/*_bMustExist*/);
}
-void ODbaseIndexDialog::InsertTableIndex( const OUString& _rTableName, const OTableIndex& _rIndex)
+void ODbaseIndexDialog::InsertTableIndex( std::u16string_view _rTableName, const OTableIndex& _rIndex)
{
TableInfoList::iterator aTablePos = std::find_if(m_aTableInfoList.begin(), m_aTableInfoList.end(),
[&] (const OTableInfo& arg) { return arg.aTableName == _rTableName; });
@@ -253,9 +256,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,17 +266,17 @@ 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();
// open the INF file
- aURL.setExtension("inf");
+ aURL.setExtension(u"inf");
OFileNotation aTransformer(aURL.GetURLNoPass(), OFileNotation::N_URL);
Config aInfFile( aTransformer.get(OFileNotation::N_SYSTEM) );
aInfFile.SetGroup( aGroupIdent );
@@ -363,14 +363,13 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const
}
aURL.SetSmartURL(aDsn);
aURL.Append(aTableName);
- aURL.setExtension("inf");
+ aURL.setExtension(u"inf");
OFileNotation aTransformer(aURL.GetURLNoPass(), OFileNotation::N_URL);
Config aInfFile( aTransformer.get(OFileNotation::N_SYSTEM) );
aInfFile.SetGroup( aGroupIdent );
// first, delete all table indices
- OString aNDX;
sal_uInt16 nKeyCnt = aInfFile.GetKeyCount();
sal_uInt16 nKey = 0;
@@ -378,7 +377,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 +413,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( u"delete"_ustr, Any( true ) );
}
catch (const Exception& )
{
diff --git a/dbaccess/source/ui/dlg/dbfindex.hxx b/dbaccess/source/ui/dlg/dbfindex.hxx
index d0c23a416a5f..7b86a450f53d 100644
--- a/dbaccess/source/ui/dlg/dbfindex.hxx
+++ b/dbaccess/source/ui/dlg/dbfindex.hxx
@@ -17,9 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DBFINDEX_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DBFINDEX_HXX
+#pragma once
+#include <utility>
#include <vcl/weld.hxx>
#include <deque>
@@ -35,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; }
};
@@ -43,7 +43,6 @@ public:
typedef std::deque< OTableIndex > TableIndexList;
// OTableInfo
-class ODbaseIndexDialog;
/** holds the INF file of a table
*/
class OTableInfo
@@ -54,7 +53,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;
};
@@ -64,7 +63,6 @@ typedef std::deque< OTableInfo > TableInfoList;
// IndexDialog
class ODbaseIndexDialog : public weld::GenericDialogController
{
-protected:
OUString m_aDSN;
TableInfoList m_aTableInfoList;
TableIndexList m_aFreeIndexList;
@@ -88,6 +86,7 @@ protected:
DECL_LINK( OKClickHdl, weld::Button&, void );
DECL_LINK( OnListEntrySelected, weld::TreeView&, void );
+protected:
void Init();
void SetCtrls();
@@ -96,18 +95,16 @@ protected:
OTableIndex RemoveFreeIndex( const OUString& _rName, bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, *m_xLB_FreeIndexes, _bMustExist); }
void InsertFreeIndex( const OTableIndex& _rIndex ) { implInsertIndex(_rIndex, m_aFreeIndexList, *m_xLB_FreeIndexes); }
- OTableIndex RemoveTableIndex( const OUString& _rTableName, const OUString& _rIndexName );
- void InsertTableIndex( const OUString& _rTableName, const OTableIndex& _rIndex );
+ OTableIndex RemoveTableIndex( std::u16string_view _rTableName, const OUString& _rIndexName );
+ void InsertTableIndex( std::u16string_view _rTableName, const OTableIndex& _rIndex );
void checkButtons();
public:
- ODbaseIndexDialog(weld::Window * pParent, const OUString& rDataSrcName);
+ ODbaseIndexDialog(weld::Window * pParent, OUString aDataSrcName);
virtual ~ODbaseIndexDialog() override;
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DBFINDEX_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index d39fd3c79c29..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:
@@ -214,10 +213,10 @@ void ODbTypeWizDialog::clearPassword()
std::unique_ptr<BuilderPage> ODbTypeWizDialog::createPage(WizardState _nState)
{
- const char* pStringId = STR_PAGETITLE_ADVANCED;
+ 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)
@@ -303,7 +302,7 @@ void ODbTypeWizDialog::enableConfirmSettings( bool _bEnable )
// As soon as it is to be used more wide-spread, we should find a proper concept
// for enabling both the Next and Finish buttons, depending on the current page state.
// Plus, the concept must also care for the case where those pages are embedded into
- // anormal tab dialog.
+ // a normal tab dialog.
}
void ODbTypeWizDialog::saveDatasource()
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 1dd342c12401..ec6c9040fd03 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -43,7 +43,6 @@
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/frame/TerminationVetoException.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -61,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
{
@@ -72,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;
@@ -106,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 ) )
@@ -115,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);
@@ -138,7 +137,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
::dbaccess::ODsnTypeCollection::TypeIterator aIter = m_pCollection->begin();
::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
- for(PathId i = 1;aIter != aEnd;++aIter,++i)
+ for(auto i = 1;aIter != aEnd;++aIter,++i)
{
const OUString& sURLPrefix = aIter.getURLPrefix();
WizardPath aPath;
@@ -147,17 +146,21 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
aPath.push_back(PAGE_DBSETUPWIZARD_AUTHENTIFICATION);
aPath.push_back(PAGE_DBSETUPWIZARD_FINAL);
- declareAuthDepPath(sURLPrefix,i,aPath);
+ declareAuthDepPath(sURLPrefix,static_cast<PathId>(i),aPath);
}
WizardPath aPath;
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);
@@ -210,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;
@@ -255,19 +261,12 @@ IMPL_LINK_NOARG(ODbTypeWizDialogSetup, OnTypeSelected, OGeneralPage&, void)
static void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,const ::comphelper::NamedValueCollection& _aNew,::comphelper::NamedValueCollection& _rDSInfo)
{
_rDSInfo.merge(_aNew,true);
- uno::Sequence< beans::NamedValue > aOldValues = _aOld.getNamedValues();
- const beans::NamedValue* pIter = aOldValues.getConstArray();
- const beans::NamedValue* pEnd = pIter + aOldValues.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if ( !_aNew.has(pIter->Name) )
- {
- _rDSInfo.remove(pIter->Name);
- }
- }
+ for (auto& val : _aOld.getNamedValues())
+ if (!_aNew.has(val.Name))
+ _rDSInfo.remove(val.Name);
}
-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 ;
@@ -282,7 +281,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()
@@ -293,7 +292,7 @@ void ODbTypeWizDialogSetup::activateDatabasePath()
{
sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pGeneralPage->GetSelectedType() );
if ( nCreateNewDBIndex == -1 )
- nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" );
+ nCreateNewDBIndex = m_pCollection->getIndexOf( u"sdbc:dbase:" );
OSL_ENSURE( nCreateNewDBIndex != -1, "ODbTypeWizDialogSetup::activateDatabasePath: the GeneralPage should have prevented this!" );
activatePath( static_cast< PathId >( nCreateNewDBIndex + 1 ), true );
@@ -305,6 +304,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)
@@ -457,7 +459,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)
@@ -487,16 +489,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;
@@ -504,6 +506,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;
@@ -646,12 +652,11 @@ namespace
{
bool lcl_handle( const Reference< XInteractionHandler2 >& _rxHandler, const Any& _rRequest )
{
- OInteractionRequest* pRequest = new OInteractionRequest( _rRequest );
- Reference < XInteractionRequest > xRequest( pRequest );
- OInteractionAbort* pAbort = new OInteractionAbort;
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest( _rRequest );
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
pRequest->addContinuation( pAbort );
- return _rxHandler->handleInteractionRequest( xRequest );
+ return _rxHandler->handleInteractionRequest( pRequest );
}
}
@@ -671,10 +676,10 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
CreateDatabase();
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- aArgs.put( "Overwrite", true );
- aArgs.put( "InteractionHandler", xHandler );
- aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
- aArgs.put( "IgnoreFirebirdMigration", true );
+ aArgs.put( u"Overwrite"_ustr, true );
+ aArgs.put( u"InteractionHandler"_ustr, xHandler );
+ aArgs.put( u"MacroExecutionMode"_ustr, MacroExecMode::USE_CONFIG );
+ aArgs.put( u"IgnoreFirebirdMigration"_ustr, true );
OUString sPath = ODbDataSourceAdministrationHelper::getDocumentUrl( *m_pOutSet );
xStore->storeAsURL( sPath, aArgs.getPropertyValues() );
@@ -692,16 +697,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 ) );
}
}
}
@@ -740,7 +742,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) )
@@ -751,13 +753,13 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
createUniqueFolderName(&aDBPathURL);
sUrl = aDBPathURL.GetMainURL( INetURLObject::DecodeMechanism::NONE);
xSimpleFileAccess->createFolder(sUrl);
- sUrl = eType.concat(sUrl);
+ sUrl = eType + sUrl;
}
m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, sUrl));
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()) );
@@ -773,15 +775,14 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
FileDialogFlags::NONE, m_xAssistant.get());
+ aFileDlg.SetContext(sfx2::FileDialogHelper::BaseSaveAs);
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
if ( pFilter )
{
- INetURLObject aWorkURL( m_sWorkPath );
- aFileDlg.SetDisplayFolder( aWorkURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ));
-
OUString sDefaultName = DBA_RES( STR_DATABASEDEFAULTNAME );
OUString sExtension = pFilter->GetDefaultExtension();
- sDefaultName += sExtension.replaceAt( 0, 1, OUString() );
+ sDefaultName += sExtension.replaceAt( 0, 1, u"" );
+ INetURLObject aWorkURL( m_sWorkPath );
aWorkURL.Append( sDefaultName );
sDefaultName = createUniqueFileName( aWorkURL );
aFileDlg.SetFileName( sDefaultName );
@@ -817,7 +818,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
if (bFolderExists)
{
i++;
- pURL->setName(sLastSegmentName.concat(OUString::number(i)));
+ pURL->setName(Concat2View(sLastSegmentName + OUString::number(i)));
}
}
}
@@ -835,7 +836,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
bElementExists = xSimpleFileAccess->exists( aExistenceCheck.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if ( bElementExists )
{
- aExistenceCheck.setBase( BaseName.concat( OUString::number( i ) ) );
+ aExistenceCheck.setBase( Concat2View(BaseName + OUString::number( i ) ));
++i;
}
}
@@ -862,7 +863,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();
@@ -876,8 +877,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
@@ -914,14 +915,14 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
if ( m_xFrameLoader.is() )
{
::comphelper::NamedValueCollection aLoadArgs;
- aLoadArgs.put( "InteractionHandler", m_xInteractionHandler );
- aLoadArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
+ aLoadArgs.put( u"InteractionHandler"_ustr, m_xInteractionHandler );
+ aLoadArgs.put( u"MacroExecutionMode"_ustr, MacroExecMode::USE_CONFIG );
Sequence< PropertyValue > aLoadArgPV;
aLoadArgs >>= aLoadArgPV;
m_xFrameLoader->loadComponentFromURL( m_sURL,
- "_default",
+ u"_default"_ustr,
FrameSearchFlag::ALL,
aLoadArgPV
);
@@ -969,8 +970,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
try
{
- AsyncLoader* pAsyncLoader = new AsyncLoader( getORB(), m_pGeneralPage->GetSelectedDocumentURL() );
- ::rtl::Reference< AsyncLoader > xKeepAlive( pAsyncLoader );
+ rtl::Reference<AsyncLoader> pAsyncLoader = new AsyncLoader( getORB(), m_pGeneralPage->GetSelectedDocumentURL() );
pAsyncLoader->doLoadAsync();
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 1ce6475b6573..65af148913ba 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -45,34 +45,29 @@ 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)
{
if (m_nControlFlags & OCommonBehaviourTabPageFlags::UseOptions)
{
- m_xOptionsLabel = m_xBuilder->weld_label("optionslabel");
+ m_xOptionsLabel = m_xBuilder->weld_label(u"optionslabel"_ustr);
m_xOptionsLabel->show();
- m_xOptions = m_xBuilder->weld_entry("options");
+ m_xOptions = m_xBuilder->weld_entry(u"options"_ustr);
m_xOptions->show();
m_xOptions->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
}
if (m_nControlFlags & OCommonBehaviourTabPageFlags::UseCharset)
{
- m_xDataConvertLabel = m_xBuilder->weld_label("charsetheader");
+ m_xDataConvertLabel = m_xBuilder->weld_label(u"charsetheader"_ustr);
m_xDataConvertLabel->show();
- m_xCharsetLabel = m_xBuilder->weld_label("charsetlabel");
+ m_xCharsetLabel = m_xBuilder->weld_label(u"charsetlabel"_ustr);
m_xCharsetLabel->show();
- m_xCharset.reset(new CharSetListBox(m_xBuilder->weld_combo_box("charset")));
+ m_xCharset.reset(new CharSetListBox(m_xBuilder->weld_combo_box(u"charset"_ustr)));
m_xCharset->show();
m_xCharset->connect_changed(LINK(this, OCommonBehaviourTabPage, CharsetSelectHdl));
}
@@ -157,14 +152,14 @@ namespace dbaui
// ODbaseDetailsPage
ODbaseDetailsPage::ODbaseDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/dbasepage.ui", "DbasePage",
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/dbasepage.ui"_ustr, u"DbasePage"_ustr,
_rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
- , m_xShowDeleted(m_xBuilder->weld_check_button("showDelRowsCheckbutton"))
- , m_xFT_Message(m_xBuilder->weld_label("specMessageLabel"))
- , m_xIndexes(m_xBuilder->weld_button("indiciesButton"))
+ , m_xShowDeleted(m_xBuilder->weld_check_button(u"showDelRowsCheckbutton"_ustr))
+ , m_xFT_Message(m_xBuilder->weld_label(u"specMessageLabel"_ustr))
+ , m_xIndexes(m_xBuilder->weld_button(u"indiciesButton"_ustr))
{
m_xIndexes->connect_clicked(LINK(this, ODbaseDetailsPage, OnButtonClicked));
- m_xShowDeleted->connect_clicked(LINK(this, ODbaseDetailsPage, OnButtonClicked));
+ m_xShowDeleted->connect_toggled(LINK(this, ODbaseDetailsPage, OnButtonToggled));
}
ODbaseDetailsPage::~ODbaseDetailsPage()
@@ -209,24 +204,23 @@ namespace dbaui
return bChangedSomething;
}
- IMPL_LINK(ODbaseDetailsPage, OnButtonClicked, weld::Button&, rButton, void)
+ IMPL_LINK_NOARG(ODbaseDetailsPage, OnButtonClicked, weld::Button&, void)
{
- if (m_xIndexes.get() == &rButton)
- {
- ODbaseIndexDialog aIndexDialog(GetFrameWeld(), m_sDsn);
- aIndexDialog.run();
- }
- else
- {
- m_xFT_Message->set_visible(m_xShowDeleted->get_active());
- // it was one of the checkboxes -> we count as modified from now on
- callModifiedHdl();
- }
+ ODbaseIndexDialog aIndexDialog(GetFrameWeld(), m_sDsn);
+ aIndexDialog.run();
}
+ IMPL_LINK_NOARG(ODbaseDetailsPage, OnButtonToggled, weld::Toggleable&, void)
+ {
+ m_xFT_Message->set_visible(m_xShowDeleted->get_active());
+ // it was the checkbox -> we count as modified from now on
+ callModifiedHdl();
+ }
+
+
// OAdoDetailsPage
OAdoDetailsPage::OAdoDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/autocharsetpage.ui", "AutoCharset",
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/autocharsetpage.ui"_ustr, u"AutoCharset"_ustr,
rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset )
{
@@ -239,9 +233,9 @@ namespace dbaui
// OOdbcDetailsPage
OOdbcDetailsPage::OOdbcDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/odbcpage.ui", "ODBC", rCoreAttrs,
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/odbcpage.ui"_ustr, u"ODBC"_ustr, rCoreAttrs,
OCommonBehaviourTabPageFlags::UseCharset | OCommonBehaviourTabPageFlags::UseOptions)
- , m_xUseCatalog(m_xBuilder->weld_check_button("useCatalogCheckbutton"))
+ , m_xUseCatalog(m_xBuilder->weld_check_button(u"useCatalogCheckbutton"_ustr))
{
m_xUseCatalog->connect_toggled(LINK(this, OGenericAdministrationPage, OnControlModifiedButtonClick));
}
@@ -276,13 +270,13 @@ namespace dbaui
}
// OOdbcDetailsPage
OUserDriverDetailsPage::OUserDriverDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/userdetailspage.ui", "UserDetailsPage",
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/userdetailspage.ui"_ustr, u"UserDetailsPage"_ustr,
rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset | OCommonBehaviourTabPageFlags::UseOptions)
- , m_xFTHostname(m_xBuilder->weld_label("hostnameft"))
- , m_xEDHostname(m_xBuilder->weld_entry("hostname"))
- , m_xPortNumber(m_xBuilder->weld_label("portnumberft"))
- , m_xNFPortNumber(m_xBuilder->weld_spin_button("portnumber"))
- , m_xUseCatalog(m_xBuilder->weld_check_button("usecatalog"))
+ , m_xFTHostname(m_xBuilder->weld_label(u"hostnameft"_ustr))
+ , m_xEDHostname(m_xBuilder->weld_entry(u"hostname"_ustr))
+ , m_xPortNumber(m_xBuilder->weld_label(u"portnumberft"_ustr))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button(u"portnumber"_ustr))
+ , m_xUseCatalog(m_xBuilder->weld_check_button(u"usecatalog"_ustr))
{
m_xUseCatalog->connect_toggled(LINK(this, OGenericAdministrationPage, OnControlModifiedButtonClick));
}
@@ -310,7 +304,7 @@ namespace dbaui
{
OCommonBehaviourTabPage::fillControls(_rControlList);
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xEDHostname.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xUseCatalog.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xUseCatalog.get()));
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get()));
}
void OUserDriverDetailsPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
@@ -344,7 +338,7 @@ namespace dbaui
}
// OMySQLODBCDetailsPage
OMySQLODBCDetailsPage::OMySQLODBCDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/autocharsetpage.ui", "AutoCharset",
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/autocharsetpage.ui"_ustr, u"AutoCharset"_ustr,
rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset )
{
}
@@ -356,17 +350,17 @@ namespace dbaui
// OMySQLJDBCDetailsPage
OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs ,sal_uInt16 _nPortId, bool bShowSocket)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/generalspecialjdbcdetailspage.ui", "GeneralSpecialJDBCDetails",
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/generalspecialjdbcdetailspage.ui"_ustr, u"GeneralSpecialJDBCDetails"_ustr,
rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
, m_nPortId(_nPortId)
, m_bUseClass(true)
- , m_xEDHostname(m_xBuilder->weld_entry("hostNameEntry"))
- , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
- , m_xFTSocket(m_xBuilder->weld_label("socketLabel"))
- , m_xEDSocket(m_xBuilder->weld_entry("socketEntry"))
- , m_xFTDriverClass(m_xBuilder->weld_label("driverClassLabel"))
- , m_xEDDriverClass(m_xBuilder->weld_entry("jdbcDriverClassEntry"))
- , m_xTestJavaDriver(m_xBuilder->weld_button("testDriverClassButton"))
+ , m_xEDHostname(m_xBuilder->weld_entry(u"hostNameEntry"_ustr))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button(u"portNumberSpinbutton"_ustr))
+ , m_xFTSocket(m_xBuilder->weld_label(u"socketLabel"_ustr))
+ , m_xEDSocket(m_xBuilder->weld_entry(u"socketEntry"_ustr))
+ , m_xFTDriverClass(m_xBuilder->weld_label(u"driverClassLabel"_ustr))
+ , m_xEDDriverClass(m_xBuilder->weld_entry(u"jdbcDriverClassEntry"_ustr))
+ , m_xTestJavaDriver(m_xBuilder->weld_button(u"testDriverClassButton"_ustr))
{
const SfxStringItem* pUrlItem = rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL);
const DbuTypeCollectionItem* pTypesItem = rCoreAttrs.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
@@ -443,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();
@@ -451,14 +445,14 @@ namespace dbaui
}
IMPL_LINK_NOARG(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, weld::Button&, void)
{
- OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
+ assert(m_pAdminDialog && "No Admin dialog set! ->GPF");
OSL_ENSURE(m_bUseClass,"Who called me?");
bool bSuccess = false;
#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() );
@@ -470,7 +464,7 @@ namespace dbaui
{
}
#endif
- const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
+ TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error;
OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt);
aMsg.run();
@@ -479,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();
@@ -487,14 +481,14 @@ namespace dbaui
// MySQLNativePage
MySQLNativePage::MySQLNativePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/mysqlnativepage.ui", "MysqlNativePage", rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
- , m_xMySQLSettingsContainer(m_xBuilder->weld_widget("MySQLSettingsContainer"))
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/mysqlnativepage.ui"_ustr, u"MysqlNativePage"_ustr, rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
+ , m_xMySQLSettingsContainer(m_xBuilder->weld_widget(u"MySQLSettingsContainer"_ustr))
, m_xMySQLSettings(new MySQLNativeSettings(m_xMySQLSettingsContainer.get(), LINK(this,OGenericAdministrationPage,OnControlModified)))
- , m_xSeparator1(m_xBuilder->weld_label("connectionheader"))
- , m_xSeparator2(m_xBuilder->weld_label("userheader"))
- , m_xUserNameLabel(m_xBuilder->weld_label("usernamelabel"))
- , m_xUserName(m_xBuilder->weld_entry("username"))
- , m_xPasswordRequired(m_xBuilder->weld_check_button("passwordrequired"))
+ , m_xSeparator1(m_xBuilder->weld_label(u"connectionheader"_ustr))
+ , m_xSeparator2(m_xBuilder->weld_label(u"userheader"_ustr))
+ , m_xUserNameLabel(m_xBuilder->weld_label(u"usernamelabel"_ustr))
+ , m_xUserName(m_xBuilder->weld_entry(u"username"_ustr))
+ , m_xPasswordRequired(m_xBuilder->weld_check_button(u"passwordrequired"_ustr))
{
m_xUserName->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
}
@@ -510,7 +504,7 @@ namespace dbaui
m_xMySQLSettings->fillControls( _rControlList );
_rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xUserName.get()));
- _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xPasswordRequired.get()));
+ _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xPasswordRequired.get()));
}
void MySQLNativePage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
@@ -577,12 +571,12 @@ namespace dbaui
// OLDAPDetailsPage
OLDAPDetailsPage::OLDAPDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/ldappage.ui", "LDAP",
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/ldappage.ui"_ustr, u"LDAP"_ustr,
rCoreAttrs, OCommonBehaviourTabPageFlags::NONE)
- , m_xETBaseDN(m_xBuilder->weld_entry("baseDNEntry"))
- , m_xCBUseSSL(m_xBuilder->weld_check_button("useSSLCheckbutton"))
- , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
- , m_xNFRowCount(m_xBuilder->weld_spin_button("LDAPRowCountspinbutton"))
+ , m_xETBaseDN(m_xBuilder->weld_entry(u"baseDNEntry"_ustr))
+ , m_xCBUseSSL(m_xBuilder->weld_check_button(u"useSSLCheckbutton"_ustr))
+ , m_xNFPortNumber(m_xBuilder->weld_spin_button(u"portNumberSpinbutton"_ustr))
+ , m_xNFRowCount(m_xBuilder->weld_spin_button(u"LDAPRowCountspinbutton"_ustr))
{
m_xETBaseDN->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
m_xNFPortNumber->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
@@ -613,7 +607,7 @@ namespace dbaui
return bChangedSomething;
}
- IMPL_LINK(OLDAPDetailsPage, OnCheckBoxClick, weld::ToggleButton&, rCheckBox, void)
+ IMPL_LINK(OLDAPDetailsPage, OnCheckBoxClick, weld::Toggleable&, rCheckBox, void)
{
OnControlModifiedButtonClick(rCheckBox);
callModifiedHdl();
@@ -653,7 +647,7 @@ namespace dbaui
// OTextDetailsPage
OTextDetailsPage::OTextDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs)
- : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/emptypage.ui", "EmptyPage", rCoreAttrs, OCommonBehaviourTabPageFlags::NONE)
+ : OCommonBehaviourTabPage(pPage, pController, u"dbaccess/ui/emptypage.ui"_ustr, u"EmptyPage"_ustr, rCoreAttrs, OCommonBehaviourTabPageFlags::NONE)
, m_xTextConnectionHelper(new OTextConnectionHelper(m_xContainer.get(), TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET))
{
}
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index ff82ce06dbc5..aa01c12f930e 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DETAILPAGES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DETAILPAGES_HXX
+#pragma once
#include "adminpages.hxx"
#include <charsetlistbox.hxx>
@@ -55,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;
@@ -102,6 +95,7 @@ namespace dbaui
private:
DECL_LINK(OnButtonClicked, weld::Button&, void);
+ DECL_LINK(OnButtonToggled, weld::Toggleable&, void);
};
// OAdoDetailsPage
@@ -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;
@@ -225,7 +219,7 @@ namespace dbaui
std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
std::unique_ptr<weld::SpinButton> m_xNFRowCount;
- DECL_LINK(OnCheckBoxClick, weld::ToggleButton&, void);
+ DECL_LINK(OnCheckBoxClick, weld::Toggleable&, void);
};
// OTextDetailsPage
@@ -250,6 +244,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DETAILPAGES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index 5e7b579df72e..97ae2046983e 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -19,105 +19,38 @@
#include <core_resource.hxx>
#include <directsql.hxx>
+#include <sqledit.hxx>
+#include <strings.hxx>
#include <strings.hrc>
#include <comphelper/types.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/eeitem.hxx>
#include <osl/mutex.hxx>
-#include <svl/itemset.hxx>
-#include <svtools/editsyntaxhighlighter.hxx>
-#include <tools/diagnose_ex.h>
-#include <vcl/event.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#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
+// tdf#140298 - remember user settings within the current session
+// memp is filled in dtor and restored after initialization
+namespace
{
- SQLEditView::SQLEditView()
- {
- }
-
- void SQLEditView::DoBracketHilight(sal_uInt16 nKey)
- {
- ESelection aCurrentPos = m_xEditView->GetSelection();
- sal_Int32 nStartPos = aCurrentPos.nStartPos;
- const sal_uInt32 nStartPara = aCurrentPos.nStartPara;
- sal_uInt16 nCount = 0;
- int nChar = -1;
-
- switch (nKey)
- {
- case '\'': // no break
- case '"':
- {
- nChar = nKey;
- break;
- }
- case '}' :
- {
- nChar = '{';
- break;
- }
- case ')':
- {
- nChar = '(';
- break;
- }
- case ']':
- {
- nChar = '[';
- break;
- }
- }
-
- if (nChar == -1)
- return;
-
- sal_uInt32 nPara = nStartPara;
- do
- {
- if (nPara == nStartPara && nStartPos == 0)
- continue;
-
- OUString aLine( m_xEditEngine->GetText( nPara ) );
-
- if (aLine.isEmpty())
- continue;
-
- for (sal_Int32 i = (nPara==nStartPara) ? nStartPos-1 : aLine.getLength()-1; i>0; --i)
- {
- if (aLine[i] == nChar)
- {
- if (!nCount)
- {
- SfxItemSet aSet(m_xEditEngine->GetEmptyItemSet());
- aSet.Put(SvxColorItem(Color(0,0,0), EE_CHAR_COLOR));
- aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT));
- aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT_CJK));
- aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT_CTL));
-
- m_xEditEngine->QuickSetAttribs(aSet, ESelection(nPara, i, nPara, i + 1));
- m_xEditEngine->QuickSetAttribs(aSet, ESelection(nStartPara, nStartPos, nStartPara, nStartPos));
- return;
- }
- else
- --nCount;
- }
- if (aLine[i] == nKey)
- ++nCount;
- }
- } while (nPara--);
- }
+ struct memParam {
+ std::vector<OUString> SQLHistory;
+ bool DirectSQL;
+ bool ShowOutput;
+ };
+ memParam memp;
+}
- bool SQLEditView::KeyInput(const KeyEvent& rKEvt)
- {
- DoBracketHilight(rKEvt.GetCharCode());
- return WeldEditView::KeyInput(rKEvt);
- }
+namespace dbaui
+{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
@@ -127,18 +60,17 @@ namespace dbaui
// DirectSQLDialog
DirectSQLDialog::DirectSQLDialog(weld::Window* _pParent, const Reference< XConnection >& _rxConn)
- : GenericDialogController(_pParent, "dbaccess/ui/directsqldialog.ui", "DirectSQLDialog")
- , m_xExecute(m_xBuilder->weld_button("execute"))
- , m_xSQLHistory(m_xBuilder->weld_combo_box("sqlhistory"))
- , m_xStatus(m_xBuilder->weld_text_view("status"))
- , m_xShowOutput(m_xBuilder->weld_check_button("showoutput"))
- , m_xOutput(m_xBuilder->weld_text_view("output"))
- , m_xClose(m_xBuilder->weld_button("close"))
- , m_xSQL(new SQLEditView)
- , m_xSQLEd(new weld::CustomWeld(*m_xBuilder, "sql", *m_xSQL))
- , m_aHighlighter(HighlighterLanguage::SQL)
+ : GenericDialogController(_pParent, u"dbaccess/ui/directsqldialog.ui"_ustr, u"DirectSQLDialog"_ustr)
+ , m_xExecute(m_xBuilder->weld_button(u"execute"_ustr))
+ , m_xSQLHistory(m_xBuilder->weld_combo_box(u"sqlhistory"_ustr))
+ , m_xStatus(m_xBuilder->weld_text_view(u"status"_ustr))
+ , m_xDirectSQL(m_xBuilder->weld_check_button(u"directsql"_ustr))
+ , m_xShowOutput(m_xBuilder->weld_check_button(u"showoutput"_ustr))
+ , m_xOutput(m_xBuilder->weld_text_view(u"output"_ustr))
+ , m_xClose(m_xBuilder->weld_button(u"close"_ustr))
+ , m_xSQL(new SQLEditView(m_xBuilder->weld_scrolled_window(u"scrolledwindow"_ustr, true)))
+ , m_xSQLEd(new weld::CustomWeld(*m_xBuilder, u"sql"_ustr, *m_xSQL))
, m_nStatusCount(1)
- , m_bInUpdate(false)
, m_xConnection(_rxConn)
, m_pClosingEvent(nullptr)
{
@@ -148,6 +80,7 @@ namespace dbaui
m_xSQLEd->set_size_request(nWidth, nHeight);
m_xStatus->set_size_request(-1, nHeight);
m_xOutput->set_size_request(-1, nHeight);
+ m_xSQLHistory->set_size_request(nWidth, -1);
m_xSQL->GrabFocus();
@@ -155,6 +88,16 @@ namespace dbaui
m_xClose->connect_clicked(LINK(this, DirectSQLDialog, OnCloseClick));
m_xSQLHistory->connect_changed(LINK(this, DirectSQLDialog, OnListEntrySelected));
+ m_xDirectSQL->set_active(true);
+ m_xShowOutput->set_active(true);
+
+ for (size_t i = 0; i < memp.SQLHistory.size(); i++)
+ {
+ implAddToStatementHistory(memp.SQLHistory[i], true);
+ m_xDirectSQL->set_active(memp.DirectSQL);
+ m_xShowOutput->set_active(memp.ShowOutput);
+ }
+
// add a dispose listener to the connection
Reference< XComponent > xConnComp(m_xConnection, UNO_QUERY);
OSL_ENSURE(xConnComp.is(), "DirectSQLDialog::DirectSQLDialog: invalid connection!");
@@ -163,13 +106,13 @@ namespace dbaui
m_xSQL->SetModifyHdl(LINK(this, DirectSQLDialog, OnStatementModified));
OnStatementModified(nullptr);
-
- m_aUpdateDataTimer.SetTimeout(300);
- m_aUpdateDataTimer.SetInvokeHandler(LINK(this, DirectSQLDialog, ImplUpdateDataHdl));
}
DirectSQLDialog::~DirectSQLDialog()
{
+ memp.DirectSQL = m_xDirectSQL->get_active();
+ memp.ShowOutput = m_xShowOutput->get_active();
+
::osl::MutexGuard aGuard(m_aMutex);
if (m_pClosingEvent)
Application::RemoveUserEvent(m_pClosingEvent);
@@ -199,13 +142,25 @@ namespace dbaui
sal_Int32 DirectSQLDialog::getHistorySize() const
{
- CHECK_INVARIANTS("DirectSQLDialog::getHistorySize");
+ #ifdef DBG_UTIL
+ {
+ const char* pError = impl_CheckInvariants();
+ if (pError)
+ SAL_WARN("dbaccess.ui", "DirectSQLDialog::getHistorySize: " << pError);
+ }
+ #endif
return m_aStatementHistory.size();
}
void DirectSQLDialog::implEnsureHistoryLimit()
{
- CHECK_INVARIANTS("DirectSQLDialog::implEnsureHistoryLimit");
+ #ifdef DBG_UTIL
+ {
+ const char* pError = impl_CheckInvariants();
+ if (pError)
+ SAL_WARN("dbaccess.ui", "DirectSQLDialog::implEnsureHistoryLimit: " << pError);
+ }
+ #endif
if (getHistorySize() <= g_nHistoryLimit)
// nothing to do
@@ -220,12 +175,20 @@ namespace dbaui
}
}
- void DirectSQLDialog::implAddToStatementHistory(const OUString& _rStatement)
+ void DirectSQLDialog::implAddToStatementHistory(const OUString& _rStatement, const bool bFromMemory)
{
- CHECK_INVARIANTS("DirectSQLDialog::implAddToStatementHistory");
+ #ifdef DBG_UTIL
+ {
+ const char* pError = impl_CheckInvariants();
+ if (pError)
+ SAL_WARN("dbaccess.ui", "DirectSQLDialog::implAddToStatementHistor: " << pError);
+ }
+ #endif
// add the statement to the history
m_aStatementHistory.push_back(_rStatement);
+ if (!bFromMemory)
+ memp.SQLHistory.push_back(_rStatement);
// normalize the statement, and remember the normalized form, too
OUString sNormalized = _rStatement.replaceAll("\n", " ");
@@ -259,7 +222,13 @@ namespace dbaui
void DirectSQLDialog::implExecuteStatement(const OUString& _rStatement)
{
- CHECK_INVARIANTS("DirectSQLDialog::implExecuteStatement");
+ #ifdef DBG_UTIL
+ {
+ const char* pError = impl_CheckInvariants();
+ if (pError)
+ SAL_WARN("dbaccess.ui", "DirectSQLDialog::implExecuteStatement: " << pError);
+ }
+ #endif
::osl::MutexGuard aGuard(m_aMutex);
@@ -272,6 +241,19 @@ namespace dbaui
// create a statement
Reference< XStatement > xStatement = m_xConnection->createStatement();
+ if (m_xDirectSQL->get_active())
+ {
+ Reference< css::beans::XPropertySet > xStatementProps(xStatement, UNO_QUERY_THROW);
+ try
+ {
+ xStatementProps->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, Any(false));
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ }
+
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
css::uno::Reference< css::sdbc::XMultipleResults > xMR ( xStatement, UNO_QUERY );
@@ -285,7 +267,8 @@ namespace dbaui
display(xRS);
}
else
- addOutputText(OUString::number(xMR->getUpdateCount()) + " rows updated\n");
+ addOutputText(
+ Concat2View(OUString::number(xMR->getUpdateCount()) + " rows updated\n"));
for (;;)
{
hasRS = xMR->getMoreResults();
@@ -301,7 +284,28 @@ namespace dbaui
}
else
{
- if (_rStatement.toAsciiUpperCase().startsWith("SELECT"))
+ const OUString upperStatement = _rStatement.toAsciiUpperCase();
+ if (upperStatement.startsWith("UPDATE"))
+ {
+ sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows updated\n"));
+ }
+ else if (upperStatement.startsWith("INSERT"))
+ {
+ sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows inserted\n"));
+ }
+ else if (upperStatement.startsWith("DELETE"))
+ {
+ sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows deleted\n"));
+ }
+ else if (upperStatement.startsWith("CREATE"))
+ {
+ xStatement->executeUpdate(_rStatement);
+ addOutputText(u"Command executed\n");
+ }
+ else if (upperStatement.startsWith("SELECT") || m_xShowOutput->get_active())
{
css::uno::Reference< css::sdbc::XResultSet > xRS = xStatement->executeQuery(_rStatement);
if (m_xShowOutput->get_active())
@@ -310,7 +314,7 @@ namespace dbaui
else
{
sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
- addOutputText(OUString::number(resultCount) + " rows updated\n");
+ addOutputText(Concat2View(OUString::number(resultCount) + " rows updated\n"));
}
}
// successful
@@ -334,6 +338,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();
+ sal_Int32 nRowCount = 0;
// get a handle for the rows
css::uno::Reference< css::sdbc::XRow > xRow( xRS, css::uno::UNO_QUERY );
// work through each of the rows
@@ -344,24 +352,45 @@ 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)).append(",");
- 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) + ",");
+ }
}
+ nRowCount++;
}
// trap for when we fall off the end of the row
catch (const SQLException&)
{
}
// report the output
- addOutputText(out.makeStringAndClear());
+ addOutputText(out);
}
+ addOutputText(DBA_RES_PLURAL(STR_COMMAND_NROWS, nRowCount).replaceAll("%1", OUString::number(nRowCount)));
}
- void DirectSQLDialog::addStatusText(const OUString& _rMessage)
+ void DirectSQLDialog::addStatusText(std::u16string_view _rMessage)
{
OUString sAppendMessage = OUString::number(m_nStatusCount++) + ": " + _rMessage + "\n\n";
@@ -371,9 +400,9 @@ namespace dbaui
m_xStatus->select_region(sCompleteMessage.getLength(), sCompleteMessage.getLength());
}
- void DirectSQLDialog::addOutputText(const OUString& _rMessage)
+ void DirectSQLDialog::addOutputText(std::u16string_view _rMessage)
{
- OUString sAppendMessage = _rMessage + "\n";
+ OUString sAppendMessage = OUString::Concat(_rMessage) + "\n";
OUString sCompleteMessage = m_xOutput->get_text() + sAppendMessage;
m_xOutput->set_text(sCompleteMessage);
@@ -381,7 +410,13 @@ namespace dbaui
void DirectSQLDialog::executeCurrent()
{
- CHECK_INVARIANTS("DirectSQLDialog::executeCurrent");
+ #ifdef DBG_UTIL
+ {
+ const char* pError = impl_CheckInvariants();
+ if (pError)
+ SAL_WARN("dbaccess.ui", "DirectSQLDialog::executeCurrent: " << pError);
+ }
+ #endif
OUString sStatement = m_xSQL->GetText();
@@ -396,14 +431,19 @@ namespace dbaui
void DirectSQLDialog::switchToHistory(sal_Int32 _nHistoryPos)
{
- CHECK_INVARIANTS("DirectSQLDialog::switchToHistory");
+ #ifdef DBG_UTIL
+ {
+ const char* pError = impl_CheckInvariants();
+ if (pError)
+ SAL_WARN("dbaccess.ui", "DirectSQLDialog::switchToHistory: " << pError);
+ }
+ #endif
if ((_nHistoryPos >= 0) && (_nHistoryPos < getHistorySize()))
{
// set the text in the statement editor
OUString sStatement = m_aStatementHistory[_nHistoryPos];
- m_xSQL->SetText(sStatement);
- UpdateData();
+ m_xSQL->SetTextAndUpdate(sStatement);
OnStatementModified(nullptr);
m_xSQL->GrabFocus();
@@ -414,11 +454,7 @@ namespace dbaui
IMPL_LINK_NOARG( DirectSQLDialog, OnStatementModified, LinkParamNone*, void )
{
- if (m_bInUpdate)
- return;
-
m_xExecute->set_sensitive(!m_xSQL->GetText().isEmpty());
- m_aUpdateDataTimer.Start();
}
IMPL_LINK_NOARG( DirectSQLDialog, OnCloseClick, weld::Button&, void )
@@ -447,46 +483,6 @@ namespace dbaui
switchToHistory(nSelected);
}
- Color DirectSQLDialog::GetColorValue(TokenType aToken)
- {
- return MultiLineEditSyntaxHighlight::GetSyntaxHighlightColor(m_aColorConfig, m_aHighlighter.GetLanguage(), aToken);
- }
-
- IMPL_LINK_NOARG(DirectSQLDialog, ImplUpdateDataHdl, Timer*, void)
- {
- UpdateData();
- }
-
- void DirectSQLDialog::UpdateData()
- {
- m_bInUpdate = true;
- EditEngine& rEditEngine = m_xSQL->GetEditEngine();
- // syntax highlighting
- bool bOrigModified = rEditEngine.IsModified();
- for (sal_Int32 nLine=0; nLine < rEditEngine.GetParagraphCount(); ++nLine)
- {
- OUString aLine( rEditEngine.GetText( nLine ) );
-
- ESelection aAllLine(nLine, 0, nLine, EE_TEXTPOS_ALL);
- rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_COLOR);
- rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT);
- rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT_CJK);
- rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT_CTL);
-
- std::vector<HighlightPortion> aPortions;
- m_aHighlighter.getHighlightPortions( aLine, aPortions );
- for (auto const& portion : aPortions)
- {
- SfxItemSet aSet(rEditEngine.GetEmptyItemSet());
- aSet.Put(SvxColorItem(GetColorValue(portion.tokenType), EE_CHAR_COLOR));
- rEditEngine.QuickSetAttribs(aSet, ESelection(nLine, portion.nBegin, nLine, portion.nEnd));
- }
- }
- if (!bOrigModified)
- rEditEngine.ClearModifyFlag();
- m_bInUpdate = false;
- }
-
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/dlgattr.cxx b/dbaccess/source/ui/dlg/dlgattr.cxx
index a69f29fe7fb2..2e8b16910584 100644
--- a/dbaccess/source/ui/dlg/dlgattr.cxx
+++ b/dbaccess/source/ui/dlg/dlgattr.cxx
@@ -25,35 +25,34 @@
#include <svx/dialogs.hrc>
#include <svl/itemset.hxx>
-#include <svl/zforlist.hxx>
#include <svx/svxids.hrc>
using namespace dbaui;
-SbaSbAttrDlg::SbaSbAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs,
+SbaSbAttrDlg::SbaSbAttrDlg(weld::Widget* pParent, const SfxItemSet* pCellAttrs,
SvNumberFormatter* pFormatter, bool bHasFormat)
- : SfxTabDialogController(pParent, "dbaccess/ui/fielddialog.ui", "FieldDialog", pCellAttrs)
+ : SfxTabDialogController(pParent, u"dbaccess/ui/fielddialog.ui"_ustr, u"FieldDialog"_ustr, pCellAttrs)
{
- pNumberInfoItem.reset( new SvxNumberInfoItem( pFormatter, 0 ) );
+ pNumberInfoItem.reset( new SvxNumberInfoItem( pFormatter, SID_ATTR_NUMBERFORMAT_INFO ) );
if (bHasFormat)
- AddTabPage("format", RID_SVXPAGE_NUMBERFORMAT);
+ AddTabPage(u"format"_ustr, RID_SVXPAGE_NUMBERFORMAT);
else
- RemoveTabPage("format");
- AddTabPage("alignment", RID_SVXPAGE_ALIGNMENT);
+ RemoveTabPage(u"format"_ustr);
+ AddTabPage(u"alignment"_ustr, RID_SVXPAGE_ALIGNMENT);
}
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..b07eb152ec11 100644
--- a/dbaccess/source/ui/dlg/dlgsave.cxx
+++ b/dbaccess/source/ui/dlg/dlgsave.cxx
@@ -24,58 +24,17 @@
#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 <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 +42,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)();
@@ -183,71 +79,95 @@ OSaveAsDlg::OSaveAsDlg( weld::Window * pParent,
const OUString& rDefault,
const IObjectNameCheck& _rObjectNameCheck,
SADFlags _nFlags)
- : GenericDialogController(pParent, "dbaccess/ui/savedialog.ui", "SaveDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/savedialog.ui"_ustr, u"SaveDialog"_ustr)
, m_xContext( _rxContext )
+ , m_aName(rDefault)
+ , m_rObjectNameCheck( _rObjectNameCheck )
+ , m_nType(_rType)
+ , m_nFlags(_nFlags)
+ , m_aChecker(OUString())
+ , m_xDescription(m_xBuilder->weld_label(u"descriptionft"_ustr))
+ , m_xCatalogLbl(m_xBuilder->weld_label(u"catalogft"_ustr))
+ , m_xCatalog(m_xBuilder->weld_combo_box(u"catalog"_ustr))
+ , m_xSchemaLbl(m_xBuilder->weld_label(u"schemaft"_ustr))
+ , m_xSchema(m_xBuilder->weld_combo_box(u"schema"_ustr))
+ , m_xLabel(m_xBuilder->weld_label(u"titleft"_ustr))
+ , m_xTitle(m_xBuilder->weld_entry(u"title"_ustr))
+ , m_xPB_OK(m_xBuilder->weld_button(u"ok"_ustr))
{
- 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;
@@ -264,10 +184,25 @@ OSaveAsDlg::OSaveAsDlg(weld::Window * pParent,
const OUString& _sLabel,
const IObjectNameCheck& _rObjectNameCheck,
SADFlags _nFlags)
- : GenericDialogController(pParent, "dbaccess/ui/savedialog.ui", "SaveDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/savedialog.ui"_ustr, u"SaveDialog"_ustr)
, 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(u"descriptionft"_ustr))
+ , m_xCatalogLbl(m_xBuilder->weld_label(u"catalogft"_ustr))
+ , m_xCatalog(m_xBuilder->weld_combo_box(u"catalog"_ustr))
+ , m_xSchemaLbl(m_xBuilder->weld_label(u"schemaft"_ustr))
+ , m_xSchema(m_xBuilder->weld_combo_box(u"schema"_ustr))
+ , m_xLabel(m_xBuilder->weld_label(u"titleft"_ustr))
+ , m_xTitle(m_xBuilder->weld_entry(u"title"_ustr))
+ , m_xPB_OK(m_xBuilder->weld_button(u"ok"_ustr))
{
- 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 +213,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 +229,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 5b9f3a1ae839..ad1d1e4f5dc5 100644
--- a/dbaccess/source/ui/dlg/dlgsize.cxx
+++ b/dbaccess/source/ui/dlg/dlgsize.cxx
@@ -26,11 +26,11 @@ namespace dbaui
#define DEF_COL_WIDTH 227
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"))
+ : GenericDialogController(pParent, bRow ? u"dbaccess/ui/rowheightdialog.ui"_ustr : u"dbaccess/ui/colwidthdialog.ui"_ustr,
+ bRow ? u"RowHeightDialog"_ustr : u"ColWidthDialog"_ustr)
, m_nPrevValue(nVal)
- , m_xMF_VALUE(m_xBuilder->weld_metric_spin_button("value", FieldUnit::CM))
- , m_xCB_STANDARD(m_xBuilder->weld_check_button("automatic"))
+ , m_xMF_VALUE(m_xBuilder->weld_metric_spin_button(u"value"_ustr, FieldUnit::CM))
+ , m_xCB_STANDARD(m_xBuilder->weld_check_button(u"automatic"_ustr))
{
sal_Int32 nStandard(bRow ? DEF_ROW_HEIGHT : DEF_COL_WIDTH);
if ( _nAlternativeStandard > 0 )
@@ -63,14 +63,14 @@ sal_Int32 DlgSize::GetValue() const
return static_cast<sal_Int32>(m_xMF_VALUE->get_value( FieldUnit::CM ));
}
-IMPL_LINK_NOARG(DlgSize, CbClickHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(DlgSize, CbClickHdl, weld::Toggleable&, void)
{
m_xMF_VALUE->set_sensitive(!m_xCB_STANDARD->get_active());
if (m_xCB_STANDARD->get_active())
{
// don't use getValue as this will use m_xCB_STANDARD->to determine if we're standard
m_nPrevValue = static_cast<sal_Int32>(m_xMF_VALUE->get_value(FieldUnit::CM));
- m_xMF_VALUE->set_text("");
+ m_xMF_VALUE->set_text(u""_ustr);
}
else
{
diff --git a/dbaccess/source/ui/dlg/dsnItem.hxx b/dbaccess/source/ui/dlg/dsnItem.hxx
index 41103f8de4b8..8f73921af359 100644
--- a/dbaccess/source/ui/dlg/dsnItem.hxx
+++ b/dbaccess/source/ui/dlg/dsnItem.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DSNITEM_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DSNITEM_HXX
+#pragma once
#include <svl/poolitem.hxx>
@@ -36,6 +35,7 @@ namespace dbaui
::dbaccess::ODsnTypeCollection* m_pCollection;
public:
+ DECLARE_ITEM_TYPE_FUNCTION(DbuTypeCollectionItem)
DbuTypeCollectionItem(sal_Int16 nWhich, ::dbaccess::ODsnTypeCollection* _pCollection);
DbuTypeCollectionItem(const DbuTypeCollectionItem& _rSource);
@@ -46,6 +46,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DSNITEM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index 4c0b9a836382..adb24331c236 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -19,22 +19,11 @@
#include "dsselect.hxx"
-#include <com/sun/star/sdbcx/XCreateCatalog.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-
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"))
+ : GenericDialogController(_pParent, u"dbaccess/ui/choosedatasourcedialog.ui"_ustr, u"ChooseDataSourceDialog"_ustr)
+ , m_xDatasource(m_xBuilder->weld_tree_view(u"treeview"_ustr))
{
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 f365eaf007ca..bae8a35ac4db 100644
--- a/dbaccess/source/ui/dlg/dsselect.hxx
+++ b/dbaccess/source/ui/dlg/dsselect.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DSSELECT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_DSSELECT_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <vcl/weld.hxx>
@@ -26,17 +25,12 @@
#include <memory>
#include <set>
-class SfxItemSet;
namespace dbaui
{
-
// ODatasourceSelector
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
@@ -44,17 +38,13 @@ class ODatasourceSelectDialog final : public weld::GenericDialogController
public:
ODatasourceSelectDialog(weld::Window* pParent, const std::set<OUString>& rDatasources);
virtual ~ODatasourceSelectDialog() override;
- OUString GetSelected() const {
- return m_xDatasource->get_selected_text();
- }
- void Select( const OUString& _rEntry ) {
- m_xDatasource->select_text(_rEntry);
- }
+ OUString GetSelected() const { return m_xDatasource->get_selected_text(); }
+ void Select(const OUString& _rEntry) { m_xDatasource->select_text(_rEntry); }
virtual short run() override;
private:
- DECL_LINK( ListDblClickHdl, weld::TreeView&, bool );
+ DECL_LINK(ListDblClickHdl, weld::TreeView&, bool);
#ifdef HAVE_ODBC_ADMINISTRATION
DECL_LINK(ManageClickHdl, weld::Button&, void);
DECL_LINK(ManageProcessFinished, void*, void);
@@ -62,8 +52,6 @@ private:
void fillListBox(const std::set<OUString>& _rDatasources);
};
-} // namespace dbaui
-
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DSSELECT_HXX
+} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/finteraction.hxx b/dbaccess/source/ui/dlg/finteraction.hxx
index fdc70b7fc49c..a487392a5958 100644
--- a/dbaccess/source/ui/dlg/finteraction.hxx
+++ b/dbaccess/source/ui/dlg/finteraction.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_FINTERACTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_FINTERACTION_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
@@ -52,6 +51,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_FINTERACTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 5361fc2d0907..b6f2b359ccac 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -17,24 +17,25 @@
* 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"
-#include <connectivity/dbexception.hxx>
#include <strings.hrc>
#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>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <UITools.hxx>
+#include <officecfg/Office/Common.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/confignode.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <svtools/miscopt.hxx>
#include <sal/log.hxx>
#include <dbwizsetup.hxx>
@@ -42,17 +43,15 @@ namespace dbaui
{
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
// OGeneralPage
OGeneralPage::OGeneralPage(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems)
- : OGenericAdministrationPage(pPage, pController, _rUIXMLDescription, "PageGeneral", _rItems)
- , m_xSpecialMessage(m_xBuilder->weld_label("specialMessage"))
+ : OGenericAdministrationPage(pPage, pController, _rUIXMLDescription, u"PageGeneral"_ustr, _rItems)
+ , m_xSpecialMessage(m_xBuilder->weld_label(u"specialMessage"_ustr))
, m_eLastMessage(smNone)
, m_bInitTypeList(true)
- , m_xDatasourceType(m_xBuilder->weld_combo_box("datasourceType"))
+ , m_xDatasourceType(m_xBuilder->weld_combo_box(u"datasourceType"_ustr))
, m_pCollection(nullptr)
{
// extract the datasource type collection from the item set
@@ -76,7 +75,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;
@@ -142,9 +141,6 @@ namespace dbaui
DisplayedTypes aDisplayedTypes;
::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
-
- SvtMiscOptions aMiscOptions;
-
for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
aTypeLoop != aEnd;
++aTypeLoop
@@ -157,9 +153,13 @@ namespace dbaui
if (m_xEmbeddedDBType->find_text(sDisplayName) == -1 &&
dbaccess::ODsnTypeCollection::isEmbeddedDatabase(sURLPrefix))
{
- if( !aMiscOptions.IsExperimentalMode() && sURLPrefix.startsWith("sdbc:embedded:firebird") )
+#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;
}
}
}
@@ -172,17 +172,17 @@ namespace dbaui
{
}
- void OGeneralPage::switchMessage(const OUString& _sURLPrefix)
+ void OGeneralPage::switchMessage(std::u16string_view _sURLPrefix)
{
SPECIAL_MESSAGE eMessage = smNone;
- if ( _sURLPrefix.isEmpty()/*_eType == m_eNotSupportedKnownType*/ )
+ if ( _sURLPrefix.empty()/*_eType == m_eNotSupportedKnownType*/ )
{
eMessage = smUnsupportedType;
}
if ( eMessage != m_eLastMessage )
{
- const char* pResId = nullptr;
+ TranslateId pResId;
if ( smUnsupportedType == eMessage )
pResId = STR_UNSUPPORTED_DATASOURCE_TYPE;
OUString sMessage;
@@ -223,31 +223,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;
@@ -298,7 +296,7 @@ namespace dbaui
// representative for all MySQl databases)
// Also, embedded databases (embedded HSQL, at the moment), are not to appear in the list of
// databases to connect to.
- bool OGeneralPage::approveDatasourceType( const OUString& _sURLPrefix, OUString& _inout_rDisplayName )
+ bool OGeneralPage::approveDatasourceType( std::u16string_view _sURLPrefix, OUString& _inout_rDisplayName )
{
return approveDatasourceType( m_pCollection->determineType(_sURLPrefix), _inout_rDisplayName );
}
@@ -309,7 +307,7 @@ namespace dbaui
{
// do not display the Connector/OOo driver itself, it is always wrapped via the MySQL-Driver, if
// this driver is installed
- if ( m_pCollection->hasDriver( "sdbc:mysql:mysqlc:" ) )
+ if ( m_pCollection->hasDriver( u"sdbc:mysql:mysqlc:" ) )
_inout_rDisplayName.clear();
}
@@ -401,7 +399,7 @@ namespace dbaui
// OGeneralPageDialog
OGeneralPageDialog::OGeneralPageDialog(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rItems)
- : OGeneralPage(pPage, pController, "dbaccess/ui/generalpagedialog.ui", _rItems)
+ : OGeneralPage(pPage, pController, u"dbaccess/ui/generalpagedialog.ui"_ustr, _rItems)
{
}
@@ -444,32 +442,33 @@ namespace dbaui
// OGeneralPageWizard
OGeneralPageWizard::OGeneralPageWizard(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rItems)
- : OGeneralPage( pPage, pController, "dbaccess/ui/generalpagewizard.ui", _rItems )
- , m_xRB_CreateDatabase(m_xBuilder->weld_radio_button("createDatabase"))
- , m_xRB_OpenExistingDatabase(m_xBuilder->weld_radio_button("openExistingDatabase"))
- , m_xRB_ConnectDatabase(m_xBuilder->weld_radio_button("connectDatabase"))
- , m_xFT_EmbeddedDBLabel(m_xBuilder->weld_label("embeddeddbLabel"))
- , m_xEmbeddedDBType(m_xBuilder->weld_combo_box("embeddeddbList"))
- , m_xFT_DocListLabel(m_xBuilder->weld_label("docListLabel"))
- , 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"))
+ : OGeneralPage( pPage, pController, u"dbaccess/ui/generalpagewizard.ui"_ustr, _rItems )
+ , m_xRB_CreateDatabase(m_xBuilder->weld_radio_button(u"createDatabase"_ustr))
+ , m_xRB_OpenExistingDatabase(m_xBuilder->weld_radio_button(u"openExistingDatabase"_ustr))
+ , m_xRB_ConnectDatabase(m_xBuilder->weld_radio_button(u"connectDatabase"_ustr))
+ , m_xFT_EmbeddedDBLabel(m_xBuilder->weld_label(u"embeddeddbLabel"_ustr))
+ , m_xEmbeddedDBType(m_xBuilder->weld_combo_box(u"embeddeddbList"_ustr))
+ , m_xFT_DocListLabel(m_xBuilder->weld_label(u"docListLabel"_ustr))
+ , m_xLB_DocumentList(new OpenDocumentListBox(m_xBuilder->weld_combo_box(u"documentList"_ustr), "com.sun.star.sdb.OfficeDatabaseDocument"))
+ , m_xPB_OpenDatabase(new OpenDocumentButton(m_xBuilder->weld_button(u"openDatabase"_ustr), u"com.sun.star.sdb.OfficeDatabaseDocument"_ustr))
+ , m_xFT_NoEmbeddedDBLabel(m_xBuilder->weld_label(u"noembeddeddbLabel"_ustr))
, m_eOriginalCreationMode(eCreateNew)
, m_bInitEmbeddedDBList(true)
+ , m_bIsDisplayedTypesEmpty(true)
{
// If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option
sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() );
if ( nCreateNewDBIndex == -1 )
- nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" );
+ nCreateNewDBIndex = m_pCollection->getIndexOf( u"sdbc:dbase:" );
bool bHideCreateNew = ( nCreateNewDBIndex == -1 );
// also, if our application policies tell us to hide the option, do it
::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithComponentContext(
::comphelper::getProcessComponentContext(),
- "/org.openoffice.Office.DataAccess/Policies/Features/Base"
+ u"/org.openoffice.Office.DataAccess/Policies/Features/Base"_ustr
) );
bool bAllowCreateLocalDatabase( true );
- OSL_VERIFY( aConfig.getNodeValue( "CreateLocalDatabase" ) >>= bAllowCreateLocalDatabase );
+ OSL_VERIFY( aConfig.getNodeValue( u"CreateLocalDatabase"_ustr ) >>= bAllowCreateLocalDatabase );
if ( !bAllowCreateLocalDatabase )
bHideCreateNew = true;
@@ -483,11 +482,12 @@ namespace dbaui
// do some knittings
m_xEmbeddedDBType->connect_changed(LINK(this, OGeneralPageWizard, OnEmbeddedDBTypeSelected));
- m_xRB_CreateDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
- m_xRB_ConnectDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
- m_xRB_OpenExistingDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
+ m_xRB_CreateDatabase->connect_toggled( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
+ m_xRB_ConnectDatabase->connect_toggled( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
+ m_xRB_OpenExistingDatabase->connect_toggled( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
m_xLB_DocumentList->connect_changed( LINK( this, OGeneralPageWizard, OnDocumentSelected ) );
m_xPB_OpenDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnOpenDocument ) );
+ m_xFT_NoEmbeddedDBLabel->hide();
pController->SetGeneralPage(this);
}
@@ -512,6 +512,15 @@ namespace dbaui
initializeEmbeddedDBList();
m_xEmbeddedDBType->set_active_text(getEmbeddedDBName(_rSet));
+ if(m_bIsDisplayedTypesEmpty)
+ {
+ m_xRB_CreateDatabase->set_sensitive(false);
+ m_xFT_EmbeddedDBLabel->hide();
+ m_xEmbeddedDBType->hide();
+ m_xFT_NoEmbeddedDBLabel->show();
+ m_xRB_OpenExistingDatabase->set_active(true);
+ }
+
// 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 );
@@ -540,7 +549,7 @@ namespace dbaui
// Sets the default selected database on startup.
if (m_xRB_CreateDatabase->get_active() )
{
- return m_pCollection->getTypeDisplayName( "sdbc:firebird:" );
+ return m_pCollection->getTypeDisplayName( u"sdbc:firebird:" );
}
return OGeneralPage::getDatasourceName( _rSet );
@@ -553,7 +562,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;
@@ -570,7 +579,7 @@ namespace dbaui
if ( m_xRB_CreateDatabase->get_active() )
{
- _rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, "sdbc:dbase:" ) );
+ _rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, u"sdbc:dbase:"_ustr ) );
bChangedSomething = true;
bCommitTypeSelection = false;
}
@@ -636,8 +645,10 @@ namespace dbaui
EnableControls();
}
- IMPL_LINK_NOARG( OGeneralPageWizard, OnSetupModeSelected, weld::Button&, void )
+ IMPL_LINK(OGeneralPageWizard, OnSetupModeSelected, weld::Toggleable&, rButton, void)
{
+ if (!rButton.get_active())
+ return;
SetupModeSelected();
}
@@ -650,7 +661,8 @@ namespace dbaui
{
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
- FileDialogFlags::NONE, "sdatabase", SfxFilterFlags::NONE, SfxFilterFlags::NONE, GetFrameWeld());
+ FileDialogFlags::NONE, u"sdatabase"_ustr, SfxFilterFlags::NONE, SfxFilterFlags::NONE, GetFrameWeld());
+ aFileDlg.SetContext(sfx2::FileDialogHelper::BaseDataSource);
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
if ( pFilter )
{
@@ -663,7 +675,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 e8af35387728..57ea5f5a4937 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_GENERALPAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_GENERALPAGE_HXX
+#pragma once
#include "adminpages.hxx"
#include <opendoccontrols.hxx>
@@ -47,7 +46,7 @@ namespace dbaui
Link<OGeneralPage&,void> m_aTypeSelectHandler; /// to be called if a new type is selected
bool m_bInitTypeList : 1;
- bool approveDatasourceType( const OUString& _sURLPrefix, OUString& _inout_rDisplayName );
+ bool approveDatasourceType( std::u16string_view _sURLPrefix, OUString& _inout_rDisplayName );
void insertDatasourceTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
protected:
@@ -91,7 +90,7 @@ namespace dbaui
void implSetCurrentType( const OUString& _eType );
- void switchMessage(const OUString& _sURLPrefix);
+ void switchMessage(std::u16string_view _sURLPrefix);
/// sets the title of the parent dialog
virtual void setParentTitle( const OUString& _sURLPrefix );
@@ -136,10 +135,11 @@ 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;
+ std::unique_ptr<weld::Label> m_xFT_NoEmbeddedDBLabel;
+
// state
OUString m_aBrowsedDocumentURL;
CreationMode m_eOriginalCreationMode;
@@ -149,6 +149,7 @@ namespace dbaui
Link<OGeneralPageWizard&,void> m_aChooseDocumentHandler; /// to be called when a recent document has been definitely chosen
bool m_bInitEmbeddedDBList : 1;
+ bool m_bIsDisplayedTypesEmpty : 1;
void insertEmbeddedDBTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
void EnableControls();
@@ -177,12 +178,11 @@ namespace dbaui
void SetupModeSelected();
DECL_LINK( OnEmbeddedDBTypeSelected, weld::ComboBox&, void );
- DECL_LINK( OnSetupModeSelected, weld::Button&, void );
+ DECL_LINK( OnSetupModeSelected, weld::Toggleable&, void );
DECL_LINK( OnDocumentSelected, weld::ComboBox&, void );
DECL_LINK( OnOpenDocument, weld::Button&, void );
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_GENERALPAGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index fa24be183a09..160eafa192ec 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -65,21 +65,21 @@ namespace dbaui
const Reference< XNameAccess >& _rxIndexes,
const Reference< XConnection >& _rxConnection,
const Reference< XComponentContext >& _rxContext)
- : GenericDialogController(pParent, "dbaccess/ui/indexdesigndialog.ui", "IndexDesignDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/indexdesigndialog.ui"_ustr, u"IndexDesignDialog"_ustr)
, m_xConnection(_rxConnection)
, m_bEditingActive(false)
, m_bEditAgain(false)
, m_bNoHandlerCall(false)
, m_xContext(_rxContext)
- , m_xActions(m_xBuilder->weld_toolbar("ACTIONS"))
- , m_xIndexList(m_xBuilder->weld_tree_view("INDEX_LIST"))
- , m_xIndexDetails(m_xBuilder->weld_label("INDEX_DETAILS"))
- , m_xDescriptionLabel(m_xBuilder->weld_label("DESC_LABEL"))
- , m_xDescription(m_xBuilder->weld_label("DESCRIPTION"))
- , m_xUnique(m_xBuilder->weld_check_button("UNIQUE"))
- , m_xFieldsLabel(m_xBuilder->weld_label("FIELDS_LABEL"))
- , m_xClose(m_xBuilder->weld_button("close"))
- , m_xTable(m_xBuilder->weld_container("FIELDS"))
+ , m_xActions(m_xBuilder->weld_toolbar(u"ACTIONS"_ustr))
+ , m_xIndexList(m_xBuilder->weld_tree_view(u"INDEX_LIST"_ustr))
+ , m_xIndexDetails(m_xBuilder->weld_label(u"INDEX_DETAILS"_ustr))
+ , m_xDescriptionLabel(m_xBuilder->weld_label(u"DESC_LABEL"_ustr))
+ , m_xDescription(m_xBuilder->weld_label(u"DESCRIPTION"_ustr))
+ , m_xUnique(m_xBuilder->weld_check_button(u"UNIQUE"_ustr))
+ , m_xFieldsLabel(m_xBuilder->weld_label(u"FIELDS_LABEL"_ustr))
+ , m_xClose(m_xBuilder->weld_button(u"close"_ustr))
+ , m_xTable(m_xBuilder->weld_container(u"FIELDS"_ustr))
, m_xTableCtrlParent(m_xTable->CreateChildFrame())
, m_xFields(VclPtr<IndexFieldsControl>::Create(m_xTableCtrlParent))
{
@@ -92,7 +92,7 @@ namespace dbaui
m_xActions->connect_clicked(LINK(this, DbaIndexDialog, OnIndexAction));
- m_xIndexList->connect_changed(LINK(this, DbaIndexDialog, OnIndexSelected));
+ m_xIndexList->connect_selection_changed(LINK(this, DbaIndexDialog, OnIndexSelected));
m_xIndexList->connect_editing(LINK(this, DbaIndexDialog, OnEntryEditing),
LINK(this, DbaIndexDialog, OnEntryEdited));
@@ -116,7 +116,7 @@ namespace dbaui
fillIndexList();
- m_xUnique->connect_clicked(LINK(this, DbaIndexDialog, OnModifiedClick));
+ m_xUnique->connect_toggled(LINK(this, DbaIndexDialog, OnModifiedClick));
m_xFields->SetModifyHdl(LINK(this, DbaIndexDialog, OnModified));
m_xClose->connect_clicked(LINK(this, DbaIndexDialog, OnCloseDialog));
@@ -141,7 +141,7 @@ namespace dbaui
void DbaIndexDialog::updateToolbox()
{
- m_xActions->set_item_sensitive("ID_INDEX_NEW", !m_bEditingActive);
+ m_xActions->set_item_sensitive(u"ID_INDEX_NEW"_ustr, !m_bEditingActive);
int nSelected = m_xIndexList->get_selected_index();
bool bSelectedAnything = nSelected != -1;
@@ -149,17 +149,17 @@ namespace dbaui
{
// is the current entry modified?
Indexes::const_iterator aSelectedPos = m_xIndexes->begin() + m_xIndexList->get_id(nSelected).toUInt32();
- m_xActions->set_item_sensitive("ID_INDEX_SAVE", aSelectedPos->isModified() || aSelectedPos->isNew());
- m_xActions->set_item_sensitive("ID_INDEX_RESET", aSelectedPos->isModified() || aSelectedPos->isNew());
+ m_xActions->set_item_sensitive(u"ID_INDEX_SAVE"_ustr, aSelectedPos->isModified() || aSelectedPos->isNew());
+ m_xActions->set_item_sensitive(u"ID_INDEX_RESET"_ustr, aSelectedPos->isModified() || aSelectedPos->isNew());
bSelectedAnything = !aSelectedPos->bPrimaryKey;
}
else
{
- m_xActions->set_item_sensitive("ID_INDEX_SAVE", false);
- m_xActions->set_item_sensitive("ID_INDEX_RESET", false);
+ m_xActions->set_item_sensitive(u"ID_INDEX_SAVE"_ustr, false);
+ m_xActions->set_item_sensitive(u"ID_INDEX_RESET"_ustr, false);
}
- m_xActions->set_item_sensitive("ID_INDEX_DROP", bSelectedAnything);
- m_xActions->set_item_sensitive("ID_INDEX_RENAME", bSelectedAnything);
+ m_xActions->set_item_sensitive(u"ID_INDEX_DROP"_ustr, bSelectedAnything);
+ m_xActions->set_item_sensitive(u"ID_INDEX_RENAME"_ustr, bSelectedAnything);
}
void DbaIndexDialog::fillIndexList()
@@ -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();
@@ -451,8 +451,8 @@ namespace dbaui
Indexes::const_iterator aSelected = m_xIndexes->begin() + m_xIndexList->get_id(*xSelected).toUInt32();
if (aSelected->isModified() || aSelected->isNew())
{
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), "dbaccess/ui/saveindexdialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("SaveIndexDialog"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), u"dbaccess/ui/saveindexdialog.ui"_ustr));
+ std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(u"SaveIndexDialog"_ustr));
nResponse = xQuery->run();
}
}
@@ -537,28 +537,28 @@ namespace dbaui
bool DbaIndexDialog::implSaveModified(bool _bPlausibility)
{
- if (m_xPreviousSelection)
- {
- // try to commit the previously selected index
- if (m_xFields->IsModified() && !m_xFields->SaveModified())
- return false;
+ if (!m_xPreviousSelection)
+ return true;
- Indexes::iterator aPreviouslySelected = m_xIndexes->begin() + m_xIndexList->get_id(*m_xPreviousSelection).toUInt32();
+ // try to commit the previously selected index
+ if (m_xFields->IsModified() && !m_xFields->SaveModified())
+ return false;
- // the unique flag
- aPreviouslySelected->bUnique = m_xUnique->get_active();
- if (m_xUnique->get_state_changed_from_saved())
- aPreviouslySelected->setModified(true);
+ Indexes::iterator aPreviouslySelected = m_xIndexes->begin() + m_xIndexList->get_id(*m_xPreviousSelection).toUInt32();
- // the fields
- m_xFields->commitTo(aPreviouslySelected->aFields);
- if (m_xFields->GetSavedValue() != aPreviouslySelected->aFields)
- aPreviouslySelected->setModified(true);
+ // the unique flag
+ aPreviouslySelected->bUnique = m_xUnique->get_active();
+ if (m_xUnique->get_state_changed_from_saved())
+ aPreviouslySelected->setModified(true);
- // plausibility checks
- if (_bPlausibility && !implCheckPlausibility(aPreviouslySelected))
- return false;
- }
+ // the fields
+ m_xFields->commitTo(aPreviouslySelected->aFields);
+ if (m_xFields->GetSavedValue() != aPreviouslySelected->aFields)
+ aPreviouslySelected->setModified(true);
+
+ // plausibility checks
+ if (_bPlausibility && !implCheckPlausibility(aPreviouslySelected))
+ return false;
return true;
}
@@ -615,7 +615,7 @@ namespace dbaui
return true;
}
- IMPL_LINK_NOARG(DbaIndexDialog, OnModifiedClick, weld::Button&, void)
+ IMPL_LINK_NOARG(DbaIndexDialog, OnModifiedClick, weld::Toggleable&, void)
{
OnModified(*m_xFields);
}
@@ -641,7 +641,7 @@ namespace dbaui
m_xUnique->set_sensitive(!aSelectedIndex->bPrimaryKey);
m_xUnique->save_state();
- m_xFields->initializeFrom(aSelectedIndex->aFields);
+ m_xFields->initializeFrom(std::vector(aSelectedIndex->aFields));
m_xFields->Enable(!aSelectedIndex->bPrimaryKey);
m_xFields->SaveValue();
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index dd959a05dda8..d8c1c962809b 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>
@@ -89,7 +90,7 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
::svt::EditBrowseBox::dispose();
}
- bool IndexFieldsControl::SeekRow(long nRow)
+ bool IndexFieldsControl::SeekRow(sal_Int32 nRow)
{
if (!EditBrowseBox::SeekRow(nRow))
return false;
@@ -137,10 +138,10 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
_rDev.SetClipRegion();
}
- void IndexFieldsControl::initializeFrom(const IndexFields& _rFields)
+ void IndexFieldsControl::initializeFrom(IndexFields&& _rFields)
{
// copy the field descriptions
- m_aFields = _rFields;
+ m_aFields = std::move(_rFields);
m_aSeekRow = m_aFields.end();
SetUpdateMode(false);
@@ -165,7 +166,7 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
_rFields.resize(aDest - _rFields.begin());
}
- sal_uInt32 IndexFieldsControl::GetTotalCellWidth(long _nRow, sal_uInt16 _nColId)
+ sal_uInt32 IndexFieldsControl::GetTotalCellWidth(sal_Int32 _nRow, sal_uInt16 _nColId)
{
if (COLUMN_ID_ORDER == _nColId)
{
@@ -227,13 +228,11 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
weld::ComboBox& rNameListBox = m_pFieldNameCell->get_widget();
rNameListBox.append_text(OUString());
rNameListBox.set_help_id(HID_DLGINDEX_INDEXDETAILS_FIELD);
- const OUString* pFields = _rAvailableFields.getConstArray();
- const OUString* pFieldsEnd = pFields + _rAvailableFields.getLength();
- for (;pFields < pFieldsEnd; ++pFields)
- rNameListBox.append_text(*pFields);
+ for (auto& text : _rAvailableFields)
+ rNameListBox.append_text(text);
}
- CellController* IndexFieldsControl::GetController(long _nRow, sal_uInt16 _nColumnId)
+ CellController* IndexFieldsControl::GetController(sal_Int32 _nRow, sal_uInt16 _nColumnId)
{
if (!IsEnabled())
return nullptr;
@@ -263,10 +262,10 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
return pReturn;
}
- bool IndexFieldsControl::implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos)
+ 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;
@@ -343,7 +342,7 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
return true;
}
- void IndexFieldsControl::InitController(CellControllerRef& /*_rController*/, long _nRow, sal_uInt16 _nColumnId)
+ void IndexFieldsControl::InitController(CellControllerRef& /*_rController*/, sal_Int32 _nRow, sal_uInt16 _nColumnId)
{
IndexFields::const_iterator aFieldDescription;
bool bNewField = !implGetFieldDesc(_nRow, aFieldDescription);
@@ -407,7 +406,7 @@ constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMo
SaveModified();
}
- OUString IndexFieldsControl::GetCellText(long _nRow,sal_uInt16 nColId) const
+ OUString IndexFieldsControl::GetCellText(sal_Int32 _nRow,sal_uInt16 nColId) const
{
IndexFields::const_iterator aRow = m_aFields.end();
if ( _nRow >= 0 )
diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index 49b120d13588..b2f3a45ff90d 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -61,10 +61,6 @@ typedef SQLRETURN (SQL_API* TSQLSetEnvAttr) (SQLHENV EnvironmentHandle, SQLINTEG
typedef SQLRETURN (SQL_API* TSQLDataSources) (SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR* ServerName,
SQLSMALLINT BufferLength1, SQLSMALLINT* NameLength1Ptr, SQLCHAR* Description, SQLSMALLINT BufferLength2, SQLSMALLINT* NameLength2Ptr);
-#define NSQLAllocHandle(a,b,c) (*reinterpret_cast<TSQLAllocHandle>(m_pAllocHandle))(a,b,c)
-#define NSQLFreeHandle(a,b) (*reinterpret_cast<TSQLFreeHandle>(m_pFreeHandle))(a,b)
-#define NSQLSetEnvAttr(a,b,c,d) (*reinterpret_cast<TSQLSetEnvAttr>(m_pSetEnvAttr))(a,b,c,d)
-#define NSQLDataSources(a,b,c,d,e,f,g,h) (*reinterpret_cast<TSQLDataSources>(m_pDataSources))(a,b,c,d,e,f,g,h)
#endif
// OOdbcLibWrapper
@@ -164,12 +160,12 @@ bool OOdbcEnumeration::allocEnv()
if (m_pImpl->hEnvironment)
// nothing to do
return true;
- SQLRETURN nResult = NSQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &m_pImpl->hEnvironment);
+ SQLRETURN nResult = (*reinterpret_cast<TSQLAllocHandle>(m_pAllocHandle))(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &m_pImpl->hEnvironment);
if (SQL_SUCCESS != nResult)
// can't do anything without environment
return false;
- NSQLSetEnvAttr(m_pImpl->hEnvironment, SQL_ATTR_ODBC_VERSION, reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3), SQL_IS_INTEGER);
+ (*reinterpret_cast<TSQLSetEnvAttr>(m_pSetEnvAttr))(m_pImpl->hEnvironment, SQL_ATTR_ODBC_VERSION, reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3),SQL_IS_INTEGER);
return true;
#else
return sal_False;
@@ -180,7 +176,7 @@ void OOdbcEnumeration::freeEnv()
{
#ifdef HAVE_ODBC_SUPPORT
if (m_pImpl->hEnvironment)
- NSQLFreeHandle(SQL_HANDLE_ENV, m_pImpl->hEnvironment);
+ (*reinterpret_cast<TSQLFreeHandle>(m_pFreeHandle))(SQL_HANDLE_ENV, m_pImpl->hEnvironment);
m_pImpl->hEnvironment = nullptr;
#endif
}
@@ -206,9 +202,11 @@ void OOdbcEnumeration::getDatasourceNames(std::set<OUString>& _rNames)
SQLRETURN nResult = SQL_SUCCESS;
rtl_TextEncoding nTextEncoding = osl_getThreadTextEncoding();
- for ( nResult = NSQLDataSources(m_pImpl->hEnvironment, SQL_FETCH_FIRST, szDSN, sizeof(szDSN), &pcbDSN, szDescription, sizeof(szDescription)-1, &pcbDescription);
+ for ( nResult = (*reinterpret_cast<TSQLDataSources>(m_pDataSources))(m_pImpl->hEnvironment, SQL_FETCH_FIRST, szDSN,
+ sizeof(szDSN), &pcbDSN, szDescription, sizeof(szDescription)-1, &pcbDescription);
;
- nResult = NSQLDataSources(m_pImpl->hEnvironment, SQL_FETCH_NEXT, szDSN, sizeof(szDSN), &pcbDSN, szDescription, sizeof(szDescription)-1, &pcbDescription)
+ nResult = (*reinterpret_cast<TSQLDataSources>(m_pDataSources))(m_pImpl->hEnvironment, SQL_FETCH_NEXT, szDSN,
+ sizeof(szDSN), &pcbDSN, szDescription, sizeof(szDescription)-1, &pcbDescription)
)
{
if (nResult != SQL_SUCCESS)
@@ -279,7 +277,7 @@ OOdbcManagement::OOdbcManagement(const Link<void*,void>& rAsyncFinishCallback)
OOdbcManagement::~OOdbcManagement()
{
// wait for our thread to be finished
- if ( m_pProcessWait.get() )
+ if ( m_pProcessWait )
m_pProcessWait->join();
}
@@ -305,19 +303,19 @@ bool OOdbcManagement::manageDataSources_async()
void OOdbcManagement::disableCallback()
{
- if (m_pProcessWait.get())
+ if (m_pProcessWait)
m_pProcessWait->disableCallback();
}
void OOdbcManagement::receivedCallback()
{
- if (m_pProcessWait.get())
+ if (m_pProcessWait)
m_pProcessWait->receivedCallback();
}
bool OOdbcManagement::isRunning() const
{
- return ( m_pProcessWait.get() && m_pProcessWait->isRunning() );
+ return ( m_pProcessWait && m_pProcessWait->isRunning() );
}
#endif // HAVE_ODBC_ADMINISTRATION
diff --git a/dbaccess/source/ui/dlg/odbcconfig.hxx b/dbaccess/source/ui/dlg/odbcconfig.hxx
index 0b4a78452033..16177ad8a810 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.hxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
+#pragma once
#if defined(_WIN32) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
#define HAVE_ODBC_SUPPORT
@@ -104,6 +103,4 @@ public:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/optionalboolitem.cxx b/dbaccess/source/ui/dlg/optionalboolitem.cxx
index 5eb4b1272a15..30d176391ba4 100644
--- a/dbaccess/source/ui/dlg/optionalboolitem.cxx
+++ b/dbaccess/source/ui/dlg/optionalboolitem.cxx
@@ -25,7 +25,6 @@ namespace dbaui
// OptionalBoolItem
OptionalBoolItem::OptionalBoolItem( sal_uInt16 _nWhich )
:SfxPoolItem( _nWhich )
- ,m_aValue()
{
}
diff --git a/dbaccess/source/ui/dlg/optionalboolitem.hxx b/dbaccess/source/ui/dlg/optionalboolitem.hxx
index 25aef5ceca3f..c319c5737d84 100644
--- a/dbaccess/source/ui/dlg/optionalboolitem.hxx
+++ b/dbaccess/source/ui/dlg/optionalboolitem.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_OPTIONALBOOLITEM_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_OPTIONALBOOLITEM_HXX
+#pragma once
#include <svl/poolitem.hxx>
@@ -33,12 +32,13 @@ namespace dbaui
::std::optional< bool > m_aValue;
public:
+ DECLARE_ITEM_TYPE_FUNCTION(OptionalBoolItem)
explicit OptionalBoolItem( sal_uInt16 nWhich );
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; }
@@ -49,6 +49,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_OPTIONALBOOLITEM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index a7bd8ae1538f..783b41c4622e 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
@@ -46,15 +44,16 @@ namespace dbaui
OParameterDialog::OParameterDialog(
weld::Window* pParent, const Reference< XIndexAccess > & rParamContainer,
const Reference< XConnection > & _rxConnection, const Reference< XComponentContext >& rxContext)
- : GenericDialogController(pParent, "dbaccess/ui/parametersdialog.ui", "Parameters")
+ : GenericDialogController(pParent, u"dbaccess/ui/parametersdialog.ui"_ustr, u"Parameters"_ustr)
, m_nCurrentlySelected(-1)
, m_xConnection(_rxConnection)
, m_aPredicateInput( rxContext, _rxConnection, getParseContext() )
- , m_xAllParams(m_xBuilder->weld_tree_view("allParamTreeview"))
- , m_xParam(m_xBuilder->weld_entry("paramEntry"))
- , m_xTravelNext(m_xBuilder->weld_button("next"))
- , m_xOKBtn(m_xBuilder->weld_button("ok"))
- , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
+ , m_aResetVisitFlag("dbaccess OParameterDialog m_aResetVisitFlag")
+ , m_xAllParams(m_xBuilder->weld_tree_view(u"allParamTreeview"_ustr))
+ , m_xParam(m_xBuilder->weld_entry(u"paramEntry"_ustr))
+ , m_xTravelNext(m_xBuilder->weld_button(u"next"_ustr))
+ , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr))
+ , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr))
{
m_xAllParams->set_size_request(-1, m_xAllParams->get_height_rows(10));
@@ -110,7 +109,8 @@ namespace dbaui
void OParameterDialog::Construct()
{
- m_xAllParams->connect_changed(LINK(this, OParameterDialog, OnEntryListBoxSelected));
+ m_xAllParams->connect_selection_changed(
+ LINK(this, OParameterDialog, OnEntryListBoxSelected));
m_xParam->connect_focus_out(LINK(this, OParameterDialog, OnValueLoseFocusHdl));
m_xParam->connect_changed(LINK(this, OParameterDialog, OnValueModified));
m_xTravelNext->connect_clicked(LINK(this, OParameterDialog, OnButtonClicked));
@@ -123,15 +123,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_button(m_xOKBtn.get(), m_xTravelNext.get());
}
m_xParam->grab_focus();
@@ -279,7 +274,7 @@ namespace dbaui
return true;
}
- m_aFinalValues[m_nCurrentlySelected].Value <<= m_xParam->get_text();
+ m_aFinalValues.getArray()[m_nCurrentlySelected].Value <<= m_xParam->get_text();
}
// initialize the controls with the new values
@@ -321,8 +316,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_button(m_xTravelNext.get(), m_xOKBtn.get());
}
}
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 5eeb86ef0869..b99d59597901 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -18,25 +18,20 @@
*/
#include <queryfilter.hxx>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/sdbc/ColumnSearch.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#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;
@@ -59,23 +54,23 @@ DlgFilterCrit::DlgFilterCrit(weld::Window * pParent,
const Reference< XConnection>& _rxConnection,
const Reference< XSingleSelectQueryComposer >& _rxComposer,
const Reference< XNameAccess>& _rxCols)
- : GenericDialogController(pParent, "dbaccess/ui/queryfilterdialog.ui", "QueryFilterDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/queryfilterdialog.ui"_ustr, u"QueryFilterDialog"_ustr)
, m_xQueryComposer(_rxComposer)
, m_xColumns( _rxCols )
, m_xConnection( _rxConnection )
, m_xMetaData( _rxConnection->getMetaData() )
, m_aPredicateInput( rxContext, _rxConnection, getParseContext() )
- , m_xLB_WHEREFIELD1(m_xBuilder->weld_combo_box("field1"))
- , m_xLB_WHERECOMP1(m_xBuilder->weld_combo_box("cond1"))
- , m_xET_WHEREVALUE1(m_xBuilder->weld_entry("value1"))
- , m_xLB_WHERECOND2(m_xBuilder->weld_combo_box("op2"))
- , m_xLB_WHEREFIELD2(m_xBuilder->weld_combo_box("field2"))
- , m_xLB_WHERECOMP2(m_xBuilder->weld_combo_box("cond2"))
- , m_xET_WHEREVALUE2(m_xBuilder->weld_entry("value2"))
- , m_xLB_WHERECOND3(m_xBuilder->weld_combo_box("op3"))
- , m_xLB_WHEREFIELD3(m_xBuilder->weld_combo_box("field3"))
- , m_xLB_WHERECOMP3(m_xBuilder->weld_combo_box("cond3"))
- , m_xET_WHEREVALUE3(m_xBuilder->weld_entry("value3"))
+ , m_xLB_WHEREFIELD1(m_xBuilder->weld_combo_box(u"field1"_ustr))
+ , m_xLB_WHERECOMP1(m_xBuilder->weld_combo_box(u"cond1"_ustr))
+ , m_xET_WHEREVALUE1(m_xBuilder->weld_entry(u"value1"_ustr))
+ , m_xLB_WHERECOND2(m_xBuilder->weld_combo_box(u"op2"_ustr))
+ , m_xLB_WHEREFIELD2(m_xBuilder->weld_combo_box(u"field2"_ustr))
+ , m_xLB_WHERECOMP2(m_xBuilder->weld_combo_box(u"cond2"_ustr))
+ , m_xET_WHEREVALUE2(m_xBuilder->weld_entry(u"value2"_ustr))
+ , m_xLB_WHERECOND3(m_xBuilder->weld_combo_box(u"op3"_ustr))
+ , m_xLB_WHEREFIELD3(m_xBuilder->weld_combo_box(u"field3"_ustr))
+ , m_xLB_WHERECOMP3(m_xBuilder->weld_combo_box(u"cond3"_ustr))
+ , m_xET_WHEREVALUE3(m_xBuilder->weld_entry(u"value3"_ustr))
{
//set all condition preferred width to max width
//if all entries exist
@@ -92,15 +87,12 @@ DlgFilterCrit::DlgFilterCrit(weld::Window * pParent,
m_xLB_WHERECOMP1->clear();
// ... also write it into the remaining fields
- Sequence< OUString> aNames = m_xColumns->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
Reference<XPropertySet> xColumn;
- for(;pIter != pEnd;++pIter)
+ for (auto& colName : m_xColumns->getElementNames())
{
try
{
- xColumn.set( m_xColumns->getByName( *pIter ), UNO_QUERY_THROW );
+ xColumn.set(m_xColumns->getByName(colName), UNO_QUERY_THROW);
sal_Int32 nDataType( 0 );
OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_TYPE ) >>= nDataType );
@@ -117,21 +109,18 @@ DlgFilterCrit::DlgFilterCrit(weld::Window * pParent,
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xLB_WHEREFIELD1->append_text( *pIter );
- m_xLB_WHEREFIELD2->append_text( *pIter );
- m_xLB_WHEREFIELD3->append_text( *pIter );
+ m_xLB_WHEREFIELD1->append_text(colName);
+ m_xLB_WHEREFIELD2->append_text(colName);
+ m_xLB_WHEREFIELD3->append_text(colName);
}
Reference<XNameAccess> xSelectColumns = Reference<XColumnsSupplier>(m_xQueryComposer,UNO_QUERY_THROW)->getColumns();
- aNames = xSelectColumns->getElementNames();
- pIter = aNames.getConstArray();
- pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& colName : xSelectColumns->getElementNames())
{
// don't insert a column name twice
- if ( !m_xColumns->hasByName(*pIter) )
+ if (!m_xColumns->hasByName(colName))
{
- xColumn.set(xSelectColumns->getByName(*pIter),UNO_QUERY);
+ xColumn.set(xSelectColumns->getByName(colName), UNO_QUERY);
OSL_ENSURE(xColumn.is(),"DlgFilterCrit::DlgFilterCrit: Column is null!");
sal_Int32 nDataType(0);
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nDataType;
@@ -140,9 +129,9 @@ DlgFilterCrit::DlgFilterCrit(weld::Window * pParent,
// !pColumn->IsFunction()
if(eColumnSearch != ColumnSearch::NONE)
{
- m_xLB_WHEREFIELD1->append_text( *pIter );
- m_xLB_WHEREFIELD2->append_text( *pIter );
- m_xLB_WHEREFIELD3->append_text( *pIter );
+ m_xLB_WHEREFIELD1->append_text(colName);
+ m_xLB_WHEREFIELD2->append_text(colName);
+ m_xLB_WHEREFIELD3->append_text(colName);
}
}
}
@@ -180,10 +169,7 @@ DlgFilterCrit::~DlgFilterCrit()
{
}
-#define LbText(x) ((x).get_active_text())
-#define LbPos(x) ((x).get_active())
-
-sal_Int32 DlgFilterCrit::GetOSQLPredicateType( const OUString& _rSelectedPredicate ) const
+sal_Int32 DlgFilterCrit::GetOSQLPredicateType( std::u16string_view _rSelectedPredicate ) const
{
sal_Int32 nPredicateIndex = -1;
for ( size_t i=0; i < m_aSTR_COMPARE_OPERATORS.size(); ++i)
@@ -282,12 +268,12 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo
bool bHaving = false;
try
{
- OUString sTableName;
_rFilter.Name = _rField.get_active_text();
Reference< XPropertySet > xColumn = getQueryColumn(_rFilter.Name);
if ( xColumn.is() )
{
bool bFunction = false;
+ OUString sTableName;
Reference< XPropertySetInfo > xInfo = xColumn->getPropertySetInfo();
if ( xInfo->hasPropertyByName(PROPERTY_REALNAME) )
{
@@ -298,16 +284,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 const char sAgg[] = "AggregateFunction";
+ static constexpr OUString sAgg = u"AggregateFunction"_ustr;
if ( xInfo->hasPropertyByName(sAgg) )
xColumn->getPropertyValue(sAgg) >>= bHaving;
- static const char sFunction[] = "Function";
+ static constexpr OUString sFunction = u"Function"_ustr;
if ( xInfo->hasPropertyByName(sFunction) )
xColumn->getPropertyValue(sFunction) >>= bFunction;
}
@@ -351,20 +337,17 @@ Reference< XPropertySet > DlgFilterCrit::getColumn( const OUString& _rFieldName
Reference< XNameAccess> xColumns = Reference< XColumnsSupplier >(m_xQueryComposer,UNO_QUERY_THROW)->getColumns();
if ( xColumns.is() && !xColumn.is() )
{
- Sequence< OUString> aSeq = xColumns->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& colName : xColumns->getElementNames())
{
- Reference<XPropertySet> xProp(xColumns->getByName(*pIter),UNO_QUERY);
+ Reference<XPropertySet> xProp(xColumns->getByName(colName), UNO_QUERY);
if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME) )
{
OUString sRealName;
xProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
if ( sRealName == _rFieldName )
{
- if ( m_xColumns.is() && m_xColumns->hasByName( *pIter ) )
- m_xColumns->getByName( *pIter ) >>= xColumn;
+ if (m_xColumns.is() && m_xColumns->hasByName(colName))
+ m_xColumns->getByName(colName) >>= xColumn;
break;
}
}
@@ -493,7 +476,7 @@ void DlgFilterCrit::SetLine( int nIdx, const PropertyValue& _rItem, bool _bOr )
pPredicateValueControl->set_text( aString );
}
-void DlgFilterCrit::SelectField(weld::ComboBox& rBox, const OUString& rField)
+void DlgFilterCrit::SelectField(weld::ComboBox& rBox, std::u16string_view rField)
{
const sal_Int32 nCnt = rBox.get_count();
@@ -512,7 +495,7 @@ void DlgFilterCrit::SelectField(weld::ComboBox& rBox, const OUString& rField)
void DlgFilterCrit::EnableLines()
{
// enabling/disabling of whole lines
- if( LbPos(*m_xLB_WHEREFIELD1) == 0 )
+ if( m_xLB_WHEREFIELD1->get_active() == 0 )
{
m_xLB_WHEREFIELD2->set_sensitive(false);
m_xLB_WHERECOND2->set_sensitive(false);
@@ -537,7 +520,7 @@ void DlgFilterCrit::EnableLines()
m_xET_WHEREVALUE3->set_sensitive(true);
}
- if( LbPos(*m_xLB_WHEREFIELD2) == 0 )
+ if( m_xLB_WHEREFIELD2->get_active() == 0 )
{
m_xLB_WHEREFIELD3->set_sensitive(false);
m_xLB_WHERECOND3->set_sensitive(false);
@@ -553,7 +536,7 @@ void DlgFilterCrit::EnableLines()
}
// comparison field equal to NOENTRY
- if( LbPos(*m_xLB_WHEREFIELD1) == 0 )
+ if( m_xLB_WHEREFIELD1->get_active() == 0 )
{
m_xLB_WHERECOMP1->set_sensitive(false);
m_xET_WHEREVALUE1->set_sensitive(false);
@@ -565,7 +548,7 @@ void DlgFilterCrit::EnableLines()
m_xET_WHEREVALUE1->set_sensitive(true);
}
- if( LbPos(*m_xLB_WHEREFIELD2) == 0 )
+ if( m_xLB_WHEREFIELD2->get_active() == 0 )
{
m_xLB_WHERECOND2->set_sensitive(false);
m_xLB_WHERECOMP2->set_sensitive(false);
@@ -579,7 +562,7 @@ void DlgFilterCrit::EnableLines()
m_xET_WHEREVALUE2->set_sensitive(true);
}
- if( LbPos(*m_xLB_WHEREFIELD3) == 0 )
+ if( m_xLB_WHEREFIELD3->get_active() == 0 )
{
m_xLB_WHERECOND3->set_sensitive(false);
m_xLB_WHERECOMP3->set_sensitive(false);
@@ -596,18 +579,18 @@ void DlgFilterCrit::EnableLines()
// comparison operator equal to ISNULL or ISNOTNULL
if(m_xLB_WHERECOMP1->get_count() > 2 &&
- ((LbPos(*m_xLB_WHERECOMP1) == m_xLB_WHERECOMP1->get_count()-1) ||
- (LbPos(*m_xLB_WHERECOMP1) == m_xLB_WHERECOMP1->get_count()-2)) )
+ ((m_xLB_WHERECOMP1->get_active() == m_xLB_WHERECOMP1->get_count()-1) ||
+ (m_xLB_WHERECOMP1->get_active() == m_xLB_WHERECOMP1->get_count()-2)) )
m_xET_WHEREVALUE1->set_sensitive(false);
if(m_xLB_WHERECOMP2->get_count() > 2 &&
- ((LbPos(*m_xLB_WHERECOMP2) == m_xLB_WHERECOMP2->get_count()-1) ||
- (LbPos(*m_xLB_WHERECOMP2) == m_xLB_WHERECOMP2->get_count()-2)) )
+ ((m_xLB_WHERECOMP2->get_active() == m_xLB_WHERECOMP2->get_count()-1) ||
+ (m_xLB_WHERECOMP2->get_active() == m_xLB_WHERECOMP2->get_count()-2)) )
m_xET_WHEREVALUE2->set_sensitive(false);
if(m_xLB_WHERECOMP3->get_count() > 2 &&
- ((LbPos(*m_xLB_WHERECOMP3) == m_xLB_WHERECOMP3->get_count()-1) ||
- (LbPos(*m_xLB_WHERECOMP3) == m_xLB_WHERECOMP3->get_count()-2)) )
+ ((m_xLB_WHERECOMP3->get_active() == m_xLB_WHERECOMP3->get_count()-1) ||
+ (m_xLB_WHERECOMP3->get_active() == m_xLB_WHERECOMP3->get_count()-2)) )
m_xET_WHEREVALUE3->set_sensitive(false);
}
@@ -617,17 +600,17 @@ IMPL_LINK( DlgFilterCrit, ListSelectHdl, weld::ComboBox&, rListBox, void )
weld::ComboBox* pComp;
if(&rListBox == m_xLB_WHEREFIELD1.get())
{
- aName = LbText(*m_xLB_WHEREFIELD1);
+ aName = m_xLB_WHEREFIELD1->get_active_text();
pComp = m_xLB_WHERECOMP1.get();
}
else if(&rListBox == m_xLB_WHEREFIELD2.get())
{
- aName = LbText(*m_xLB_WHEREFIELD2);
+ aName = m_xLB_WHEREFIELD2->get_active_text();
pComp = m_xLB_WHERECOMP2.get();
}
else
{
- aName = LbText(*m_xLB_WHEREFIELD3);
+ aName = m_xLB_WHEREFIELD3->get_active_text();
pComp = m_xLB_WHERECOMP3.get();
}
@@ -675,71 +658,49 @@ IMPL_LINK_NOARG(DlgFilterCrit, ListSelectCompHdl, weld::ComboBox&, void)
void DlgFilterCrit::BuildWherePart()
{
- Sequence<Sequence<PropertyValue> > aFilter,aHaving;
- aFilter.realloc(1);
- aHaving.realloc(1);
+ Sequence<Sequence<PropertyValue> > aFilter(1),aHaving(1);
- if( LbPos(*m_xLB_WHEREFIELD1) != 0 )
+ if( m_xLB_WHEREFIELD1->get_active() != 0 )
{
PropertyValue aValue;
if ( getCondition(*m_xLB_WHEREFIELD1,*m_xLB_WHERECOMP1,*m_xET_WHEREVALUE1,aValue) )
{
- aHaving[0].realloc(1);
- aHaving[0][0] = aValue;
+ aHaving = { { std::move(aValue) } };
}
else
{
- aFilter[0].realloc(1);
- aFilter[0][0] = aValue;
+ aFilter = { { std::move(aValue) } };
}
}
- if( LbPos(*m_xLB_WHEREFIELD2) != 0 )
+ if( m_xLB_WHEREFIELD2->get_active() != 0 )
{
PropertyValue aValue;
Sequence<Sequence<PropertyValue> >& _rValues = aFilter;
if ( getCondition(*m_xLB_WHEREFIELD2,*m_xLB_WHERECOMP2,*m_xET_WHEREVALUE2,aValue) )
_rValues = aHaving;
- PropertyValue* pPos = nullptr;
if ( m_xLB_WHERECOND2->get_active() )
- {
- sal_Int32 nPos = _rValues.getLength();
- _rValues.realloc( nPos + 1);
- _rValues[nPos].realloc( 1);
- pPos = &_rValues[nPos][0];
- }
- else
- {
- sal_Int32 nPos = _rValues.getLength() - 1;
- sal_Int32 nAndPos = _rValues[nPos].getLength();
- _rValues[nPos].realloc( _rValues[nPos].getLength() + 1);
- pPos = &_rValues[nPos][nAndPos];
- }
- *pPos = aValue;
+ _rValues.realloc( _rValues.getLength() + 1);
+ sal_Int32 nPos = _rValues.getLength() - 1;
+ sal_Int32 nAndPos = _rValues[nPos].getLength();
+ auto pValues = _rValues.getArray();
+ pValues[nPos].realloc( _rValues[nPos].getLength() + 1);
+ pValues[nPos].getArray()[nAndPos] = std::move(aValue);
}
- if( LbPos(*m_xLB_WHEREFIELD3) != 0 )
+ if( m_xLB_WHEREFIELD3->get_active() != 0 )
{
PropertyValue aValue;
Sequence<Sequence<PropertyValue> >& _rValues = aFilter;
if ( getCondition(*m_xLB_WHEREFIELD3,*m_xLB_WHERECOMP3,*m_xET_WHEREVALUE3,aValue) )
_rValues = aHaving;
- PropertyValue* pPos = nullptr;
if (m_xLB_WHERECOND3->get_active())
- {
- sal_Int32 nPos = _rValues.getLength();
- _rValues.realloc( nPos + 1);
- _rValues[nPos].realloc( 1);
- pPos = &_rValues[nPos][0];
- }
- else
- {
- sal_Int32 nPos = _rValues.getLength() - 1;
- sal_Int32 nAndPos = _rValues[nPos].getLength();
- _rValues[nPos].realloc( _rValues[nPos].getLength() + 1);
- pPos = &_rValues[nPos][nAndPos];
- }
- *pPos = aValue;
+ _rValues.realloc( _rValues.getLength() + 1);
+ sal_Int32 nPos = _rValues.getLength() - 1;
+ sal_Int32 nAndPos = _rValues[nPos].getLength();
+ auto pValues = _rValues.getArray();
+ pValues[nPos].realloc( _rValues[nPos].getLength() + 1);
+ pValues[nPos].getArray()[nAndPos] = std::move(aValue);
}
try
{
@@ -754,16 +715,12 @@ void DlgFilterCrit::BuildWherePart()
void DlgFilterCrit::fillLines(int &i, const Sequence< Sequence< PropertyValue > >& _aValues)
{
- const Sequence<PropertyValue >* pOrIter = _aValues.getConstArray();
- const Sequence<PropertyValue >* pOrEnd = pOrIter + _aValues.getLength();
bool bOr(i != 0); // WHERE clause and HAVING clause are always ANDed, nor ORed
- for(; pOrIter != pOrEnd; ++pOrIter)
+ for (auto& rOr : _aValues)
{
- const PropertyValue* pAndIter = pOrIter->getConstArray();
- const PropertyValue* pAndEnd = pAndIter + pOrIter->getLength();
- for(;pAndIter != pAndEnd; ++pAndIter)
+ for (auto& rAnd : rOr)
{
- SetLine( i++,*pAndIter,bOr);
+ SetLine(i++, rAnd, bOr);
bOr = false;
}
bOr=true;
diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx
index f06935f5e72b..0e41b99ffd56 100644
--- a/dbaccess/source/ui/dlg/queryorder.cxx
+++ b/dbaccess/source/ui/dlg/queryorder.cxx
@@ -26,17 +26,13 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#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;
@@ -44,16 +40,16 @@ DlgOrderCrit::DlgOrderCrit(weld::Window * pParent,
const Reference< XConnection>& _rxConnection,
const Reference< XSingleSelectQueryComposer >& _rxComposer,
const Reference< XNameAccess>& _rxCols)
- : GenericDialogController(pParent, "dbaccess/ui/sortdialog.ui", "SortDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/sortdialog.ui"_ustr, u"SortDialog"_ustr)
, m_xQueryComposer(_rxComposer)
, m_xColumns(_rxCols)
, m_xConnection(_rxConnection)
- , m_xLB_ORDERFIELD1(m_xBuilder->weld_combo_box("field1"))
- , m_xLB_ORDERVALUE1(m_xBuilder->weld_combo_box("value1"))
- , m_xLB_ORDERFIELD2(m_xBuilder->weld_combo_box("field2"))
- , m_xLB_ORDERVALUE2(m_xBuilder->weld_combo_box("value2"))
- , m_xLB_ORDERFIELD3(m_xBuilder->weld_combo_box("field3"))
- , m_xLB_ORDERVALUE3(m_xBuilder->weld_combo_box("value3"))
+ , m_xLB_ORDERFIELD1(m_xBuilder->weld_combo_box(u"field1"_ustr))
+ , m_xLB_ORDERVALUE1(m_xBuilder->weld_combo_box(u"value1"_ustr))
+ , m_xLB_ORDERFIELD2(m_xBuilder->weld_combo_box(u"field2"_ustr))
+ , m_xLB_ORDERVALUE2(m_xBuilder->weld_combo_box(u"value2"_ustr))
+ , m_xLB_ORDERFIELD3(m_xBuilder->weld_combo_box(u"field3"_ustr))
+ , m_xLB_ORDERVALUE3(m_xBuilder->weld_combo_box(u"value3"_ustr))
{
m_aColumnList[0] = m_xLB_ORDERFIELD1.get();
m_aColumnList[1] = m_xLB_ORDERFIELD2.get();
@@ -77,13 +73,10 @@ DlgOrderCrit::DlgOrderCrit(weld::Window * pParent,
try
{
// ... also the remaining fields
- Sequence< OUString> aNames = m_xColumns->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
Reference<XPropertySet> xColumn;
- for(;pIter != pEnd;++pIter)
+ for (auto& name : m_xColumns->getElementNames())
{
- xColumn.set(m_xColumns->getByName(*pIter),UNO_QUERY);
+ xColumn.set(m_xColumns->getByName(name), UNO_QUERY);
OSL_ENSURE(xColumn.is(),"Column is null!");
if ( xColumn.is() )
{
@@ -94,7 +87,7 @@ DlgOrderCrit::DlgOrderCrit(weld::Window * pParent,
{
for (auto j : m_aColumnList)
{
- j->append_text(*pIter);
+ j->append_text(name);
}
}
}
@@ -126,8 +119,8 @@ void DlgOrderCrit::impl_initializeOrderList_nothrow()
{
try
{
- const OUString sNameProperty = "Name";
- const OUString sAscendingProperty = "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 39ba6dc8eed1..9fe71ae4b44f 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))
{
}
@@ -66,7 +67,7 @@ namespace
private:
OUString m_label;
public:
- explicit LabelProvider(const char* labelResourceID)
+ explicit LabelProvider(TranslateId labelResourceID)
: m_label(DBA_RES(labelResourceID))
{
}
@@ -95,7 +96,7 @@ namespace
std::shared_ptr< ImageProvider > const & getImageProvider( SQLExceptionInfo::TYPE _eType ) const
{
std::shared_ptr< ImageProvider >* ppProvider( &m_pErrorImage );
- OUString sNormalImageID("dialog-error");
+ OUString sNormalImageID(u"dialog-error"_ustr);
switch ( _eType )
{
@@ -121,7 +122,7 @@ namespace
std::shared_ptr< LabelProvider > const & getLabelProvider( SQLExceptionInfo::TYPE _eType, bool _bSubLabel ) const
{
std::shared_ptr< LabelProvider >* ppProvider( &m_pErrorLabel );
- const char* pLabelID( STR_EXCEPTION_ERROR );
+ TranslateId pLabelID( STR_EXCEPTION_ERROR );
switch ( _eType )
{
@@ -196,10 +197,7 @@ namespace
void lcl_buildExceptionChain( const SQLExceptionInfo& _rErrorInfo, const ProviderFactory& _rFactory, ExceptionDisplayChain& _out_rChain )
{
- {
- ExceptionDisplayChain empty;
- _out_rChain.swap( empty );
- }
+ ExceptionDisplayChain().swap(_out_rChain);
SQLExceptionIteratorHelper iter( _rErrorInfo );
while ( iter.hasMoreElements() )
@@ -209,7 +207,7 @@ namespace
iter.next( aCurrentElement );
const SQLException* pCurrentError = aCurrentElement;
- OSL_ENSURE( pCurrentError, "lcl_buildExceptionChain: iterator failure!" );
+ assert(pCurrentError && "lcl_buildExceptionChain: iterator failure!");
// hasMoreElements should not have returned <TRUE/> in this case
ExceptionDisplayInfo aDisplayInfo( aCurrentElement.getType() );
@@ -230,7 +228,7 @@ namespace
aDisplayInfo.pImageProvider = _rFactory.getImageProvider( aCurrentElement.getType() );
aDisplayInfo.pLabelProvider = _rFactory.getLabelProvider( aCurrentElement.getType(), false );
- _out_rChain.push_back( aDisplayInfo );
+ _out_rChain.push_back(std::move(aDisplayInfo));
if ( aCurrentElement.getType() == SQLExceptionInfo::TYPE::SQLContext )
{
@@ -244,16 +242,11 @@ namespace
aSubInfo.pLabelProvider = _rFactory.getLabelProvider( aCurrentElement.getType(), true );
aSubInfo.bSubEntry = true;
- _out_rChain.push_back( aSubInfo );
+ _out_rChain.push_back(std::move(aSubInfo));
}
}
}
}
-
- void lcl_insertExceptionEntry(weld::TreeView& rList, size_t nElementPos, const ExceptionDisplayInfo& rEntry)
- {
- rList.append(OUString::number(nElementPos), rEntry.pLabelProvider->getLabel(), rEntry.pImageProvider->getImage());
- }
}
namespace {
@@ -269,19 +262,22 @@ class OExceptionChainDialog : public weld::GenericDialogController
ExceptionDisplayChain m_aExceptions;
public:
- OExceptionChainDialog(weld::Window* pParent, const ExceptionDisplayChain& rExceptions);
+ OExceptionChainDialog(weld::Window* pParent, ExceptionDisplayChain&& rExceptions);
protected:
DECL_LINK(OnExceptionSelected, weld::TreeView&, void);
+
+private:
+ void insertExceptionEntry(size_t nElementPos, const ExceptionDisplayInfo& rEntry);
};
}
-OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const ExceptionDisplayChain& rExceptions)
- : GenericDialogController(pParent, "dbaccess/ui/sqlexception.ui", "SQLExceptionDialog")
- , m_xExceptionList(m_xBuilder->weld_tree_view("list"))
- , m_xExceptionText(m_xBuilder->weld_text_view("description"))
- , m_aExceptions(rExceptions)
+OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, ExceptionDisplayChain&& rExceptions)
+ : GenericDialogController(pParent, u"dbaccess/ui/sqlexception.ui"_ustr, u"SQLExceptionDialog"_ustr)
+ , m_xExceptionList(m_xBuilder->weld_tree_view(u"list"_ustr))
+ , m_xExceptionText(m_xBuilder->weld_text_view(u"description"_ustr))
+ , m_aExceptions(std::move(rExceptions))
{
int nListWidth = m_xExceptionText->get_approximate_digit_width() * 28;
int nTextWidth = m_xExceptionText->get_approximate_digit_width() * 42;
@@ -292,14 +288,15 @@ OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const Except
m_sStatusLabel = DBA_RES( STR_EXCEPTION_STATUS );
m_sErrorCodeLabel = DBA_RES( STR_EXCEPTION_ERRORCODE );
- m_xExceptionList->connect_changed(LINK(this, OExceptionChainDialog, OnExceptionSelected));
+ m_xExceptionList->connect_selection_changed(
+ LINK(this, OExceptionChainDialog, OnExceptionSelected));
bool bHave22018 = false;
size_t elementPos = 0;
for (auto const& elem : m_aExceptions)
{
- lcl_insertExceptionEntry(*m_xExceptionList, elementPos, elem);
+ insertExceptionEntry(elementPos, elem);
bHave22018 = elem.sSQLState == "22018";
++elementPos;
}
@@ -316,7 +313,7 @@ OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const Except
aInfo22018.pImageProvider = aProviderFactory.getImageProvider( SQLExceptionInfo::TYPE::SQLContext );
m_aExceptions.push_back( aInfo22018 );
- lcl_insertExceptionEntry(*m_xExceptionList, m_aExceptions.size() - 1, aInfo22018);
+ insertExceptionEntry(m_aExceptions.size() - 1, aInfo22018);
}
if (m_xExceptionList->n_children())
@@ -326,6 +323,13 @@ OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const Except
}
}
+void OExceptionChainDialog::insertExceptionEntry(size_t nElementPos,
+ const ExceptionDisplayInfo& rEntry)
+{
+ m_xExceptionList->append(OUString::number(nElementPos), rEntry.pLabelProvider->getLabel(),
+ rEntry.pImageProvider->getImage());
+}
+
IMPL_LINK_NOARG(OExceptionChainDialog, OnExceptionSelected, weld::TreeView&, void)
{
OUString sText;
@@ -484,7 +488,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()
@@ -509,7 +513,7 @@ void OSQLMessageBox::impl_addDetailsButton()
if ( bMoreDetailsAvailable )
{
m_xDialog->add_button(GetStandardText(StandardButtonType::More), RET_MORE);
- m_xMoreButton.reset(m_xDialog->weld_widget_for_response(RET_MORE));
+ m_xMoreButton = m_xDialog->weld_button_for_response(RET_MORE);
m_xMoreButton->connect_clicked(LINK(this, OSQLMessageBox, ButtonClickHdl));
}
}
@@ -548,7 +552,7 @@ void OSQLMessageBox::Construct(weld::Window* pParent, MessBoxStyle _nStyle, Mess
break;
}
- m_xDialog.reset(Application::CreateMessageDialog(pParent, eMessageType, VclButtonsType::NONE, ""));
+ m_xDialog.reset(Application::CreateMessageDialog(pParent, eMessageType, VclButtonsType::NONE, u""_ustr));
m_xDialog->set_title(utl::ConfigManager::getProductName() + " Base");
impl_fillMessages();
@@ -558,20 +562,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)));
@@ -584,7 +587,7 @@ OSQLMessageBox::~OSQLMessageBox()
IMPL_LINK_NOARG(OSQLMessageBox, ButtonClickHdl, weld::Button&, void)
{
- OExceptionChainDialog aDlg(m_xDialog.get(), m_pImpl->aDisplayInfo);
+ OExceptionChainDialog aDlg(m_xDialog.get(), std::vector(m_pImpl->aDisplayInfo));
aDlg.run();
}
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index 2fa719517a91..e827cce83bff 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -19,7 +19,6 @@
#include "tablespage.hxx"
#include <dsitems.hxx>
-#include <datasourceconnector.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbexception.hxx>
@@ -32,7 +31,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,22 +39,19 @@ 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;
// OTableSubscriptionPage
OTableSubscriptionPage::OTableSubscriptionPage(weld::Container* pPage, OTableSubscriptionDialog* pTablesDlg, const SfxItemSet& _rCoreAttrs)
- : OGenericAdministrationPage(pPage, pTablesDlg, "dbaccess/ui/tablesfilterpage.ui", "TablesFilterPage", _rCoreAttrs)
+ : OGenericAdministrationPage(pPage, pTablesDlg, u"dbaccess/ui/tablesfilterpage.ui"_ustr, u"TablesFilterPage"_ustr, _rCoreAttrs)
, m_bCatalogAtStart(true)
, m_pTablesDlg(pTablesDlg)
- , m_xTables(m_xBuilder->weld_widget("TablesFilterPage"))
- , m_xTablesList(new TableTreeListBox(m_xBuilder->weld_tree_view("treeview")))
+ , m_xTables(m_xBuilder->weld_widget(u"TablesFilterPage"_ustr))
+ , m_xTablesList(new OTableTreeListBox(m_xBuilder->weld_tree_view(u"treeview"_ustr), true))
{
m_xTablesList->init();
@@ -105,7 +101,7 @@ namespace dbaui
for (const OUString& rIncludeTable : _rTables)
{
if (xMeta.is())
- qualifiedNameComponents(xMeta, rIncludeTable.getStr(), sCatalog, sSchema, sName,::dbtools::EComposeRule::InDataManipulation);
+ qualifiedNameComponents(xMeta, rIncludeTable, sCatalog, sSchema, sName,::dbtools::EComposeRule::InDataManipulation);
else
sName = rIncludeTable;
@@ -204,10 +200,10 @@ namespace dbaui
Reference<XModifiable> xModi(getDataSourceOrModel(xProp),UNO_QUERY);
bool bModified = ( xModi.is() && xModi->isModified() );
- Sequence< OUString > aNewTableFilter { "%" };
- xProp->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(aNewTableFilter));
+ Sequence< OUString > aNewTableFilter { u"%"_ustr };
+ 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 +331,7 @@ namespace dbaui
Sequence< OUString > OTableSubscriptionPage::collectDetailedSelection() const
{
Sequence< OUString > aTableFilter;
- static const char sWildcard[] = "%";
+ static constexpr OUString sWildcard = u"%"_ustr;
std::unique_ptr<weld::TreeIter> xAllObjectsEntry(m_xTablesList->getAllObjectsEntry());
if (!xAllObjectsEntry)
@@ -381,7 +377,7 @@ namespace dbaui
bCatalogWildcard = m_xTablesList->isWildcardChecked(*xCatalog);
if (m_bCatalogAtStart)
{
- sComposedName.append(m_xTablesList->GetWidget().get_text(*xCatalog)).append(m_sCatalogSeparator);
+ sComposedName.append(m_xTablesList->GetWidget().get_text(*xCatalog) + m_sCatalogSeparator);
if (bCatalogWildcard)
sComposedName.append(sWildcard);
}
@@ -396,7 +392,7 @@ namespace dbaui
}
}
bSchemaWildcard = m_xTablesList->isWildcardChecked(*xSchema);
- sComposedName.append(m_xTablesList->GetWidget().get_text(*xSchema)).append(".");
+ sComposedName.append(m_xTablesList->GetWidget().get_text(*xSchema) + ".");
}
if (bSchemaWildcard)
@@ -412,7 +408,7 @@ namespace dbaui
sal_Int32 nOldLen = aTableFilter.getLength();
aTableFilter.realloc(nOldLen + 1);
// add the new name
- aTableFilter[nOldLen] = sComposedName.makeStringAndClear();
+ aTableFilter.getArray()[nOldLen] = sComposedName.makeStringAndClear();
}
if (bCatalogWildcard)
@@ -463,8 +459,7 @@ namespace dbaui
auto xRoot = m_xTablesList->getAllObjectsEntry();
if (xRoot && m_xTablesList->isWildcardChecked(*xRoot))
{
- aTableFilter.realloc(1);
- aTableFilter[0] = "%";
+ aTableFilter = { u"%"_ustr };
}
else
{
diff --git a/dbaccess/source/ui/dlg/tablespage.hxx b/dbaccess/source/ui/dlg/tablespage.hxx
index 34618a0432be..483518b2ad40 100644
--- a/dbaccess/source/ui/dlg/tablespage.hxx
+++ b/dbaccess/source/ui/dlg/tablespage.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_TABLESPAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_DLG_TABLESPAGE_HXX
+#pragma once
#include "adminpages.hxx"
#include <tabletree.hxx>
@@ -41,7 +40,7 @@ namespace dbaui
OTableSubscriptionDialog* m_pTablesDlg;
std::unique_ptr<weld::Widget> m_xTables;
- std::unique_ptr<TableTreeListBox> m_xTablesList;
+ std::unique_ptr<OTableTreeListBox> m_xTablesList;
public:
virtual bool FillItemSet(SfxItemSet* _rCoreAttrs) override;
@@ -79,6 +78,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_TABLESPAGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
index 5076b3d328c3..224b24e5fe79 100644
--- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx
+++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
@@ -26,10 +26,10 @@ namespace dbaui
{
// TextConnectionSettingsDialog
TextConnectionSettingsDialog::TextConnectionSettingsDialog(weld::Window* pParent, SfxItemSet& rItems)
- : GenericDialogController(pParent, "dbaccess/ui/textconnectionsettings.ui", "TextConnectionSettingsDialog")
+ : GenericDialogController(pParent, u"dbaccess/ui/textconnectionsettings.ui"_ustr, u"TextConnectionSettingsDialog"_ustr)
, m_rItems(rItems)
- , m_xContainer(m_xBuilder->weld_widget("TextPageContainer"))
- , m_xOK(m_xBuilder->weld_button("ok"))
+ , m_xContainer(m_xBuilder->weld_widget(u"TextPageContainer"_ustr))
+ , m_xOK(m_xBuilder->weld_button(u"ok"_ustr))
, m_xTextConnectionHelper(new OTextConnectionHelper(m_xContainer.get(), TC_HEADER | TC_SEPARATORS | TC_CHARSET))
{
m_xOK->connect_clicked(LINK(this, TextConnectionSettingsDialog, OnOK));
diff --git a/dbaccess/source/ui/inc/AppElementType.hxx b/dbaccess/source/ui/inc/AppElementType.hxx
index bcc0d3052fc2..b7265e5af663 100644
--- a/dbaccess/source/ui/inc/AppElementType.hxx
+++ b/dbaccess/source/ui/inc/AppElementType.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_APPELEMENTTYPE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_APPELEMENTTYPE_HXX
+#pragma once
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
@@ -35,21 +34,20 @@ 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
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_APPELEMENTTYPE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ChildWindow.hxx b/dbaccess/source/ui/inc/ChildWindow.hxx
new file mode 100644
index 000000000000..c2f68ac46f78
--- /dev/null
+++ b/dbaccess/source/ui/inc/ChildWindow.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+class OChildWindow
+{
+protected:
+ OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription, const OUString& rID);
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+public:
+ virtual ~OChildWindow();
+
+ virtual void GrabFocus() = 0;
+
+ virtual bool HasChildPathFocus() const = 0;
+
+ void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
+
+ void SetHelpId(const OUString& rHelpId) { m_xContainer->set_help_id(rHelpId); }
+
+ void Show() { m_xContainer->show(); }
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/dbaccess/source/ui/inc/CollectionView.hxx b/dbaccess/source/ui/inc/CollectionView.hxx
index 7d693329fefc..444424b9cacf 100644
--- a/dbaccess/source/ui/inc/CollectionView.hxx
+++ b/dbaccess/source/ui/inc/CollectionView.hxx
@@ -17,14 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_COLLECTIONVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_COLLECTIONVIEW_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+namespace ucbhelper { class CommandEnvironment; }
+
namespace dbaui
{
/* this class allows to browse through the collection of forms and reports
@@ -33,7 +33,7 @@ namespace dbaui
{
css::uno::Reference< css::ucb::XContent> m_xContent;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv;
+ rtl::Reference< ::ucbhelper::CommandEnvironment > m_xCmdEnv;
bool m_bCreateForm;
std::unique_ptr<weld::Label> m_xFTCurrentPath;
@@ -56,13 +56,11 @@ 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;
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_COLLECTIONVIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ColumnControlWindow.hxx b/dbaccess/source/ui/inc/ColumnControlWindow.hxx
index 1b6d4a5fd8a8..e68b99067e8c 100644
--- a/dbaccess/source/ui/inc/ColumnControlWindow.hxx
+++ b/dbaccess/source/ui/inc/ColumnControlWindow.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_COLUMNCONTROLWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_COLUMNCONTROLWINDOW_HXX
+#pragma once
#include "FieldDescControl.hxx"
#include "TypeInfo.hxx"
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <vcl/InterimItemWindow.hxx>
namespace dbaui
{
@@ -50,11 +50,11 @@ namespace dbaui
virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) override;
virtual bool isAutoIncrementValueEnabled() const override;
virtual OUString getAutoIncrementValue() const override;
- virtual void CellModified(long nRow, sal_uInt16 nColId ) override;
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) override;
public:
- OColumnControlWindow(vcl::Window* pParent
- ,const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+ OColumnControlWindow(weld::Container* pParent,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
void setConnection(const css::uno::Reference< css::sdbc::XConnection>& _xCon);
@@ -63,7 +63,20 @@ namespace dbaui
virtual const OTypeInfoMap* getTypeInfo() const override;
TOTypeInfoSP const & getDefaultTyp() const;
};
+
+ class OColumnControlTopLevel final : public InterimItemWindow
+ {
+ std::unique_ptr<OColumnControlWindow> m_xControl;
+ public:
+ OColumnControlTopLevel(vcl::Window* pParent,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+ virtual void dispose() override;
+
+ OColumnControlWindow& GetControl() { return *m_xControl; }
+
+ virtual void GetFocus() override;
+ };
+
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_COLUMNCONTROLWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
index 89dd1dff21e0..360395f94b6e 100644
--- a/dbaccess/source/ui/inc/ConnectionLine.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINE_HXX
+#pragma once
#include <tools/gen.hxx>
#include "ConnectionLineData.hxx"
@@ -46,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();
@@ -68,6 +67,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
index 4365e7134053..bc9dbbb6fef0 100644
--- a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
@@ -16,26 +16,23 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEACCESS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEACCESS_HXX
+#pragma once
#include "TableConnection.hxx"
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <vcl/accessibility/vclxaccessiblecomponent.hxx>
#include <vcl/vclptr.hxx>
+using css::accessibility::AccessibleRelationType;
+
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>
{
VclPtr<const OTableConnection> m_pLine; // the window which I should give accessibility to
protected:
@@ -46,48 +43,29 @@ 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( ) throw () override
- { // here inline is allowed because we do not use this class outside this dll
- VCLXAccessibleComponent::acquire( );
- }
- virtual void SAL_CALL release( ) throw () 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;
- // 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_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;
+ // OAccessible
+ virtual css::awt::Rectangle implGetBounds() override;
+
// XAccessibleComponent
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
- virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
- virtual css::awt::Point SAL_CALL getLocation( ) override;
- virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
- virtual css::awt::Size SAL_CALL getSize( ) override;
// XAccessibleRelationSet
virtual sal_Int32 SAL_CALL getRelationCount( ) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelation( sal_Int32 nIndex ) override;
- virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType ) override;
- virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType( sal_Int16 aRelationType ) override;
+ virtual sal_Bool SAL_CALL containsRelation(AccessibleRelationType eRelationType) override;
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType(AccessibleRelationType eRelationType) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEACCESS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ConnectionLineData.hxx b/dbaccess/source/ui/inc/ConnectionLineData.hxx
index 4a3f16c86c77..2a41c93d9aab 100644
--- a/dbaccess/source/ui/inc/ConnectionLineData.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
+#pragma once
#include "QEnumTypes.hxx"
#include <vector>
@@ -49,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);
@@ -77,6 +76,5 @@ namespace dbaui
typedef ::rtl::Reference< OConnectionLineData > OConnectionLineDataRef;
typedef std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx
index fca471a84265..a79999647077 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DEXPORT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DEXPORT_HXX
+#pragma once
#include <sal/config.h>
@@ -138,7 +137,7 @@ namespace dbaui
// required for automatic type recognition
ODatabaseExport(
sal_Int32 nRows,
- const TPositions& _rColumnPositions,
+ TPositions&& _rColumnPositions,
const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* rList,
@@ -154,12 +153,10 @@ 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);
};
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldControls.hxx b/dbaccess/source/ui/inc/FieldControls.hxx
index 98c1a7cfcbae..7eb88ec4e077 100644
--- a/dbaccess/source/ui/inc/FieldControls.hxx
+++ b/dbaccess/source/ui/inc/FieldControls.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDCONTROLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDCONTROLS_HXX
+#pragma once
#include "SqlNameEdit.hxx"
+#include <unotools/resmgr.hxx>
namespace dbaui
{
@@ -29,7 +29,7 @@ namespace dbaui
short m_nPos;
OUString m_strHelpText;
public:
- OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, const char* pHelpId, short nPosition);
+ OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, TranslateId pHelpId, short nPosition);
short GetPos() const { return m_nPos; }
const OUString& GetHelp() const { return m_strHelpText; }
@@ -42,7 +42,7 @@ namespace dbaui
OUString m_strHelpText;
public:
- OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pHelpId, short nPosition);
+ OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition);
void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
OUString get_text() const { return m_xEntry->get_text(); }
@@ -62,7 +62,7 @@ namespace dbaui
OUString m_strHelpText;
public:
- OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, const char* pHelpId, short nPosition);
+ OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition);
void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
OUString get_text() const { return m_xSpinButton->get_text(); }
@@ -88,7 +88,7 @@ namespace dbaui
OUString m_strHelpText;
public:
- OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, const char* pHelpId, short nPosition);
+ OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition);
virtual ~OPropListBoxCtrl() override
{
m_xComboBox->clear();
@@ -116,6 +116,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDCONTROLS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index 0de625a646a3..410e086116fe 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -16,17 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
+#pragma once
-#include <vcl/idle.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/tabpage.hxx>
#include <vcl/weld.hxx>
+#include "IClipBoardTest.hxx"
#include "QEnumTypes.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
#include "TypeInfo.hxx"
+#include <unotools/resmgr.hxx>
// field description columns of a table
#define FIELD_NAME 1
@@ -49,13 +47,6 @@
#define FIELD_PROPERTY_TYPE 15
#define FIELD_PROPERTY_AUTOINCREMENT 16
-class FixedText;
-class PushButton;
-class ScrollBar;
-class Button;
-class ListBox;
-class Control;
-
namespace dbaui
{
class OTableDesignHelpBar;
@@ -65,15 +56,13 @@ namespace dbaui
class OFieldDescription;
class OPropColumnEditCtrl;
- class OFieldDescControl : public TabPage
+ class OFieldDescControl : public IClipboardTest
{
private:
- Idle m_aLayoutIdle;
- VclPtr<VclVBox> m_xVclContentArea;
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
- VclPtr<OTableDesignHelpBar> pHelp;
+ OTableDesignHelpBar* m_pHelp;
weld::Widget* m_pLastFocusWindow;
weld::Widget* m_pActFocusWindow;
@@ -105,6 +94,8 @@ namespace dbaui
std::unique_ptr<weld::Button> m_xFormat;
+ Link<weld::Widget&, void> m_aControlFocusIn;
+
TOTypeInfoSP m_pPreviousType;
short m_nPos;
OUString aYes;
@@ -112,27 +103,27 @@ namespace dbaui
sal_Int32 m_nEditWidth;
- bool m_bAdded;
-
OFieldDescription* pActFieldDescr;
DECL_LINK(FormatClickHdl, weld::Button&, void);
DECL_LINK(ChangeHdl, weld::ComboBox&, void);
- DECL_LINK(ImplHandleLayoutTimerHdl, Timer*, void);
// used by ActivatePropertyField
DECL_LINK( OnControlFocusLost, weld::Widget&, void );
DECL_LINK( OnControlFocusGot, weld::Widget&, void );
+ DECL_LINK( HelpFocusOut, weld::Widget&, void );
+
void UpdateFormatSample(OFieldDescription const * pFieldDescr);
bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
- std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OString& rId, const char* 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;
+ void dispose();
protected:
void saveCurrentFieldDescData() { SaveData( pActFieldDescr ); }
OFieldDescription* getCurrentFieldDescData() { return pActFieldDescr; }
@@ -146,7 +137,7 @@ namespace dbaui
virtual css::lang::Locale GetLocale() const = 0;
- virtual void CellModified(long nRow, sal_uInt16 nColId ) = 0;
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) = 0;
virtual void SetModified(bool bModified); // base implementation is empty
virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) = 0;
@@ -155,7 +146,7 @@ namespace dbaui
virtual bool isAutoIncrementValueEnabled() const = 0;
virtual OUString getAutoIncrementValue() const = 0;
- OUString BoolStringPersistent(const OUString& rUIString) const;
+ OUString BoolStringPersistent(std::u16string_view rUIString) const;
OUString BoolStringUI(const OUString& rPersistentString) const;
const OPropColumnEditCtrl* getColumnCtrl() const { return m_xColumnName.get(); }
@@ -163,9 +154,8 @@ namespace dbaui
void implFocusLost(weld::Widget* _pWhich);
public:
- OFieldDescControl(weld::Container* pPage, vcl::Window* pParent, OTableDesignHelpBar* pHelpBar);
- virtual ~OFieldDescControl() override;
- virtual void dispose() override;
+ OFieldDescControl(weld::Container* pPage, OTableDesignHelpBar* pHelpBar);
+ virtual ~OFieldDescControl();
void DisplayData(OFieldDescription* pFieldDescr );
@@ -174,30 +164,38 @@ namespace dbaui
void SetControlText( sal_uInt16 nControlId, const OUString& rText );
void SetReadOnly( bool bReadOnly );
- // when resize is called
- bool isCutAllowed() const;
- bool isCopyAllowed() const;
- bool isPasteAllowed() const;
+ void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
+ void SetHelpId(const OUString& rId) { m_xContainer->set_help_id(rId); }
+
+ virtual bool isCutAllowed() override;
+ virtual bool isCopyAllowed() override;
+ virtual bool isPasteAllowed() override;
+
+ virtual void cut() override;
+ virtual void copy() override;
+ virtual void paste() override;
+
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_aControlFocusIn = rLink;
+ }
- void cut();
- void copy();
- void paste();
+ void Init();
- void Init();
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
- virtual void Resize() override;
+ void GrabFocus();
- virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+ bool HasChildPathFocus() const;
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() = 0;
virtual css::uno::Reference< css::sdbc::XConnection> getConnection() = 0;
- OUString getControlDefault( const OFieldDescription* _pFieldDescr, bool _bCheck = true) const;
+ OUString getControlDefault( const OFieldDescription* pFieldDescr, bool _bCheck = true) const;
+ // tdf#138409 take the control default in the UI Locale format, e.g. 12,34 and return a string
+ // suitable as the database default, e.g. 12.34
+ OUString CanonicalizeToControlDefault(const OFieldDescription* pFieldDescr, const OUString& rUserText) const;
void setEditWidth(sal_Int32 _nWidth) { m_nEditWidth = _nWidth; }
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldDescriptions.hxx b/dbaccess/source/ui/inc/FieldDescriptions.hxx
index 576a4016b267..5eccd7430979 100644
--- a/dbaccess/source/ui/inc/FieldDescriptions.hxx
+++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
+#pragma once
#include <editeng/svxenum.hxx>
#include "TypeInfo.hxx"
@@ -107,7 +106,6 @@ namespace dbaui
bool IsNullable() const;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/GeneralUndo.hxx b/dbaccess/source/ui/inc/GeneralUndo.hxx
index 3a7365c1da9c..1bbb593e333d 100644
--- a/dbaccess/source/ui/inc/GeneralUndo.hxx
+++ b/dbaccess/source/ui/inc/GeneralUndo.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_GENERALUNDO_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_GENERALUNDO_HXX
+#pragma once
#include <svl/undo.hxx>
#include <core_resource.hxx>
@@ -32,11 +31,10 @@ namespace dbaui
OUString m_strComment; // undo, redo comment
public:
- OCommentUndoAction(const char* pCommentID) { m_strComment = DBA_RES(pCommentID); }
+ OCommentUndoAction(TranslateId pCommentID) { m_strComment = DBA_RES(pCommentID); }
virtual OUString GetComment() const override { return m_strComment; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_GENERALUNDO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/HtmlReader.hxx b/dbaccess/source/ui/inc/HtmlReader.hxx
index 89c142ae230c..5c4ddde13f4e 100644
--- a/dbaccess/source/ui/inc/HtmlReader.hxx
+++ b/dbaccess/source/ui/inc/HtmlReader.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_HTMLREADER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_HTMLREADER_HXX
+#pragma once
#include "DExport.hxx"
#include <svtools/parhtml.hxx>
@@ -55,7 +54,7 @@ namespace dbaui
// required for automatic type recognition
OHTMLReader(SvStream& rIn,
sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&& _rColumnPositions,
const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* rList,
@@ -65,6 +64,5 @@ namespace dbaui
virtual SvParserState CallParser() override;// base class
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/IClipBoardTest.hxx b/dbaccess/source/ui/inc/IClipBoardTest.hxx
index 428116704717..e3eb0496272c 100644
--- a/dbaccess/source/ui/inc/IClipBoardTest.hxx
+++ b/dbaccess/source/ui/inc/IClipBoardTest.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_ICLIPBOARDTEST_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_ICLIPBOARDTEST_HXX
+#pragma once
#include <sal/types.h>
namespace dbaui
@@ -37,6 +36,5 @@ namespace dbaui
~IClipboardTest() {}
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_ICLIPBOARDTEST_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/IItemSetHelper.hxx b/dbaccess/source/ui/inc/IItemSetHelper.hxx
index 8b0fe5f88278..b581c5a55e69 100644
--- a/dbaccess/source/ui/inc/IItemSetHelper.hxx
+++ b/dbaccess/source/ui/inc/IItemSetHelper.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_IITEMSETHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_IITEMSETHELPER_HXX
+#pragma once
#include <sal/types.h>
#include <com/sun/star/uno/Reference.hxx>
@@ -29,9 +28,6 @@ namespace com::sun::star {
class XConnection;
class XDriver;
}
- namespace lang {
- class XMultiServiceFactory;
- }
}
class SfxItemSet;
@@ -69,6 +65,5 @@ namespace dbaui
~IDatabaseSettingsDialog() {}
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_IITEMSETHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/IUpdateHelper.hxx b/dbaccess/source/ui/inc/IUpdateHelper.hxx
index 975eef75c442..e6ef24a96760 100644
--- a/dbaccess/source/ui/inc/IUpdateHelper.hxx
+++ b/dbaccess/source/ui/inc/IUpdateHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_IUPDATEHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_IUPDATEHELPER_HXX
+#pragma once
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/DateTime.hpp>
@@ -42,6 +41,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_IUPDATEHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JAccess.hxx b/dbaccess/source/ui/inc/JAccess.hxx
index f5410bef975c..33c539dfb14c 100644
--- a/dbaccess/source/ui/inc/JAccess.hxx
+++ b/dbaccess/source/ui/inc/JAccess.hxx
@@ -16,23 +16,18 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_JACCESS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_JACCESS_HXX
+#pragma once
#include "JoinTableView.hxx"
-#include <toolkit/awt/vclxaccessiblecomponent.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <vcl/accessibility/vclxaccessiblecomponent.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 VCLXAccessibleComponent
{
VclPtr<OJoinTableView> m_pTableView; // the window which I should give accessibility to
@@ -41,18 +36,11 @@ 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(
@@ -67,6 +55,5 @@ namespace dbaui
void clearTableView();
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_JACCESS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index 94638e638bea..9410823222e4 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_JOINCONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_JOINCONTROLLER_HXX
+#pragma once
#include "singledoccontroller.hxx"
#include "JoinTableView.hxx"
@@ -106,9 +105,9 @@ namespace dbaui
*/
void removeConnectionData(const TTableConnectionData::value_type& _pData);
- void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
+ void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, tools::Long nOffsetX, tools::Long nOffsetY );
- static void SaveTabWinPosSize(OTableWindow const * pTabWin, long nOffsetX, long nOffsetY);
+ static void SaveTabWinPosSize(OTableWindow const * pTabWin, tools::Long nOffsetX, tools::Long nOffsetY);
// UNO interface overridables
// XEventListener
@@ -151,6 +150,5 @@ namespace dbaui
AddTableDialogContext& impl_getDialogContext() const;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_JOINCONTROLLER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinDesignView.hxx b/dbaccess/source/ui/inc/JoinDesignView.hxx
index c1153e3463e7..0883e424f790 100644
--- a/dbaccess/source/ui/inc/JoinDesignView.hxx
+++ b/dbaccess/source/ui/inc/JoinDesignView.hxx
@@ -17,13 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_JOINDESIGNVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_JOINDESIGNVIEW_HXX
+#pragma once
#include <dbaccess/dataview.hxx>
-class Splitter;
-
namespace dbaui
{
class OJoinController;
@@ -64,7 +61,6 @@ namespace dbaui
virtual void resizeDocumentView(tools::Rectangle& rRect) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_JOINDESIGNVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
index a1a73595ae5c..7401ec886e44 100644
--- a/dbaccess/source/ui/inc/JoinExchange.hxx
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_JOINEXCHANGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_JOINEXCHANGE_HXX
+#pragma once
#include "TableWindowListBox.hxx"
@@ -30,41 +29,34 @@ namespace dbaui
// OJoinExchObj: Additional data to create Joins in the JoinShell
typedef ::cppu::ImplHelper1< css::lang::XUnoTunnel > OJoinExchObj_Base;
- class OJoinExchObj final : public TransferableHelper, public OJoinExchObj_Base
+ class OJoinExchObj final : public TransferDataContainer, public OJoinExchObj_Base
{
bool m_bFirstEntry;
OJoinExchangeData m_jxdSourceDescription;
- IDragTransferableListener* m_pDragListener;
virtual ~OJoinExchObj() override;
public:
- OJoinExchObj(const OJoinExchangeData& jxdSource, bool _bFirstEntry);
-
+ OJoinExchObj();
+ void setDescriptors(const OJoinExchangeData& jxdSource, bool _bFirstEntry);
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
- virtual void SAL_CALL acquire( ) throw() override;
- virtual void SAL_CALL release( ) throw() override;
+ virtual void SAL_CALL acquire( ) noexcept override;
+ 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;
- void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions, IDragTransferableListener* _pListener );
-
static OJoinExchangeData GetSourceDescription(const css::uno::Reference< css::datatransfer::XTransferable >& _rxObject);
static bool isFormatAvailable( const DataFlavorExVector& _rFormats ,SotClipboardFormatId _nSlotID=SotClipboardFormatId::SBA_JOIN);
private:
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
- virtual void DragFinished( sal_Int8 nDropAction ) override;
-
- using TransferableHelper::StartDrag;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index 413cccf32e7d..9da25a4c1d30 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -16,13 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_JOINTABLEVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_JOINTABLEVIEW_HXX
+#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>
@@ -33,8 +32,6 @@
#include <map>
#include <vector>
-struct AcceptDropEvent;
-struct ExecuteDropEvent;
class SfxUndoAction;
namespace dbaui
@@ -43,7 +40,6 @@ namespace dbaui
class OTableWindow;
struct OJoinExchangeData;
class OJoinDesignView;
- class OTableWindowData;
class OJoinDesignViewAccess;
// this class contains only the scrollbars to avoid that
@@ -51,9 +47,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:
@@ -69,8 +64,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; }
};
@@ -106,7 +101,7 @@ namespace dbaui
protected:
VclPtr<OTableWindow> m_pLastFocusTabWin;
VclPtr<OJoinDesignView> m_pView;
- OJoinDesignViewAccess* m_pAccessible;
+ rtl::Reference<OJoinDesignViewAccess> m_pAccessible;
public:
OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView );
@@ -118,13 +113,14 @@ namespace dbaui
virtual void GetFocus() override;
virtual void LoseFocus() override;
virtual void KeyInput( const KeyEvent& rEvt ) override;
- // Accessibility
- virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ virtual rtl::Reference<comphelper::OAccessible> 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,8 +159,8 @@ namespace dbaui
*/
void addConnection(OTableConnection* _pConnection,bool _bAddData = true);
- bool ScrollPane( long nDelta, bool bHoriz, bool bPaintScrollBars );
- sal_uLong GetTabWinCount() const;
+ bool ScrollPane( tools::Long nDelta, bool bHoriz, bool bPaintScrollBars );
+ sal_Int64 GetTabWinCount() const;
const Point& GetScrollOffset() const { return m_aScrollOffset; }
OJoinDesignView* getDesignView() const { return m_pView; }
@@ -197,7 +193,7 @@ namespace dbaui
*/
sal_Int32 getConnectionCount(const OTableWindow* _pFromWin) const;
- OTableConnection* GetTabConn(const OTableWindow* pLhs,const OTableWindow* pRhs,bool _bSupressCrossOrNaturalJoin = false) const;
+ OTableConnection* GetTabConn(const OTableWindow* pLhs,const OTableWindow* pRhs,bool _bSuppressCrossOrNaturalJoin = false) const;
/** clear the window map and connection vector without destroying it
@@ -300,7 +296,7 @@ namespace dbaui
Expected to throw. */
virtual void onNoColumns_throw();
- virtual bool supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
+ virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
private:
void InitColors();
@@ -322,6 +318,5 @@ namespace dbaui
using Window::Scroll;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QEnumTypes.hxx b/dbaccess/source/ui/inc/QEnumTypes.hxx
index d88a7f4d6fa8..b889870c9b91 100644
--- a/dbaccess/source/ui/inc/QEnumTypes.hxx
+++ b/dbaccess/source/ui/inc/QEnumTypes.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QENUMTYPES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QENUMTYPES_HXX
+#pragma once
namespace dbaui
{
@@ -76,6 +75,5 @@ namespace dbaui
tpAutoIncrementValue
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index 4f057178669c..efef444e8670 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
+#pragma once
#include "JoinDesignView.hxx"
#include <vcl/split.hxx>
@@ -100,18 +99,18 @@ namespace dbaui
bool isSlotEnabled(sal_Int32 _nSlotId);
void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
- void setNoneVisbleRow(sal_Int32 _nRows);
+ void setNoneVisibleRow(sal_Int32 _nRows);
const css::lang::Locale& getLocale() const { return m_aLocale;}
const OUString& getDecimalSeparator() const { return m_sDecimalSep;}
SqlParseError InsertField( const OTableFieldDescRef& rInfo, bool bActivate = true);
- bool HasFieldByAliasName(const OUString& rFieldName, OTableFieldDescRef const & rInfo) const;
+ bool HasFieldByAliasName(std::u16string_view rFieldName, OTableFieldDescRef const & rInfo) const;
// called when a table from tabview was deleted
void TableDeleted(const OUString& rAliasName);
sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
- void fillValidFields(const OUString& strTableName, weld::ComboBox& rFieldList);
+ void fillValidFields(std::u16string_view strTableName, weld::ComboBox& rFieldList);
void SaveUIConfig();
void stopTimer();
@@ -151,6 +150,5 @@ namespace dbaui
using OJoinDesignView::SaveTabWinUIConfig;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYDESIGNVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
index 901427c056b5..2d8bb80dcf49 100644
--- a/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
+++ b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYPROPERTIESDIALOG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYPROPERTIESDIALOG_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -43,6 +42,4 @@ private:
} ///dbaui namespace
-#endif /// INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYPROPERTIESDIALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
index e1c442704040..26133d2cca42 100644
--- a/dbaccess/source/ui/inc/QueryTableView.hxx
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTABLEVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTABLEVIEW_HXX
+#pragma once
#include "JoinTableView.hxx"
#include "TableFieldDescription.hxx"
@@ -41,7 +40,7 @@ namespace dbaui
Expected to throw. */
virtual void onNoColumns_throw() override;
- virtual bool supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const override;
+ virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const override;
public:
OQueryTableView(vcl::Window* pParent,OQueryDesignView* pView);
@@ -113,6 +112,5 @@ namespace dbaui
using OJoinTableView::EnsureVisible;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryTextView.hxx b/dbaccess/source/ui/inc/QueryTextView.hxx
index c41a7cea7bc9..33f66342b25d 100644
--- a/dbaccess/source/ui/inc/QueryTextView.hxx
+++ b/dbaccess/source/ui/inc/QueryTextView.hxx
@@ -16,23 +16,39 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTEXTVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTEXTVIEW_HXX
+#pragma once
+#include <vcl/InterimItemWindow.hxx>
#include "querycontainerwindow.hxx"
+#include "sqledit.hxx"
namespace dbaui
{
- class OSqlEdit;
- class OQueryTextView : public vcl::Window
+ class OQueryTextView final : public InterimItemWindow
{
friend class OQueryViewSwitch;
- VclPtr<OSqlEdit> m_pEdit;
+
+ OQueryController& m_rController;
+ std::unique_ptr<SQLEditView> m_xSQL;
+ std::unique_ptr<weld::CustomWeld> m_xSQLEd;
+
+ Timer m_timerUndoActionCreation;
+ OUString m_strOrigText; // is restored on undo
+ Timer m_timerInvalidate;
+ bool m_bStopTimer;
+
+ DECL_LINK(OnUndoActionTimer, Timer*, void);
+ DECL_LINK(OnInvalidateTimer, Timer*, void);
+ DECL_LINK(ModifyHdl, LinkParamNone*, void);
+
public:
- OQueryTextView( OQueryContainerWindow* pParent );
+ OQueryTextView(OQueryContainerWindow* pParent, OQueryController& rController);
virtual ~OQueryTextView() override;
virtual void dispose() override;
+ void SetSQLText(const OUString& rNewText);
+ OUString GetSQLText() const;
+
virtual void GetFocus() override;
bool isCutAllowed() const;
@@ -44,15 +60,10 @@ namespace dbaui
// set the statement for representation
void setStatement(const OUString& _rsStatement);
OUString getStatement() const;
- // allow access to our edit
- OSqlEdit* getSqlEdit() const { return m_pEdit; }
- OQueryContainerWindow* getContainerWindow() { return static_cast< OQueryContainerWindow* >( GetParent() ); }
- protected:
- virtual void Resize() override;
+ void stopTimer();
+ void startTimer();
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYTEXTVIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
index 879c29b01d42..0f17d40bdcbf 100644
--- a/dbaccess/source/ui/inc/QueryViewSwitch.hxx
+++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
+#pragma once
#include <com/sun/star/uno/XComponentContext.hpp>
#include <tools/gen.hxx>
@@ -72,7 +71,7 @@ namespace dbaui
void forceInitialView();
bool isSlotEnabled(sal_Int32 _nSlotId);
void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
- void setNoneVisbleRow(sal_Int32 _nRows);
+ void setNoneVisibleRow(sal_Int32 _nRows);
void SaveUIConfig();
void reset();
void GrabFocus();
@@ -91,6 +90,5 @@ namespace dbaui
bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYVIEWSWITCH_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx
index bfff5fc9a25e..ad6f0d376ccc 100644
--- a/dbaccess/source/ui/inc/RTableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
+#pragma once
#include "TableConnectionData.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -29,7 +28,6 @@ namespace dbaui
Undefined, OneMany, ManyOne, OneOne
};
- class OConnectionLineData;
class ORelationTableConnectionData final : public OTableConnectionData
{
friend bool operator==(const ORelationTableConnectionData& lhs, const ORelationTableConnectionData& rhs);
@@ -77,6 +75,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelControliFace.hxx b/dbaccess/source/ui/inc/RelControliFace.hxx
index a6bfa0ec956d..65ef79db0d07 100644
--- a/dbaccess/source/ui/inc/RelControliFace.hxx
+++ b/dbaccess/source/ui/inc/RelControliFace.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RELCONTROLIFACE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RELCONTROLIFACE_HXX
+#pragma once
namespace dbaui
{
@@ -37,6 +36,5 @@ namespace dbaui
virtual void notifyConnectionChange() = 0;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RELCONTROLIFACE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationControl.hxx b/dbaccess/source/ui/inc/RelationControl.hxx
index a2d3a0e35d93..2067242bf7ab 100644
--- a/dbaccess/source/ui/inc/RelationControl.hxx
+++ b/dbaccess/source/ui/inc/RelationControl.hxx
@@ -16,15 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONCONTROL_HXX
+#pragma once
#include <vcl/weld.hxx>
#include "JoinTableView.hxx"
namespace dbaui
{
- class OTableListBoxControl;
class IRelationControlInterface;
class ORelationControl;
@@ -88,6 +86,5 @@ namespace dbaui
IRelationControlInterface* getContainer() const { return m_pParentDialog; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONCONTROL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx
index b358da57541c..d4aa52faf080 100644
--- a/dbaccess/source/ui/inc/RelationController.hxx
+++ b/dbaccess/source/ui/inc/RelationController.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONCONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONCONTROLLER_HXX
+#pragma once
#include <memory>
+#include <string_view>
+
#include "JoinController.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
namespace weld
{
@@ -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
@@ -45,7 +45,7 @@ namespace dbaui
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
void loadData();
- TTableWindowData::value_type existsTable(const OUString& _rComposedTableName) const;
+ TTableWindowData::value_type existsTable(std::u16string_view _rComposedTableName) const;
// load the window positions out of the datasource
void loadLayoutInformation();
@@ -70,11 +70,10 @@ 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 );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONCONTROLLER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationDesignView.hxx b/dbaccess/source/ui/inc/RelationDesignView.hxx
index bc69359c82ce..2fba88be08d3 100644
--- a/dbaccess/source/ui/inc/RelationDesignView.hxx
+++ b/dbaccess/source/ui/inc/RelationDesignView.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONDESIGNVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONDESIGNVIEW_HXX
+#pragma once
#include "JoinDesignView.hxx"
@@ -41,7 +40,6 @@ namespace dbaui
virtual void GetFocus() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONDESIGNVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationDlg.hxx b/dbaccess/source/ui/inc/RelationDlg.hxx
index e3fe49f1335c..c4285f04aae5 100644
--- a/dbaccess/source/ui/inc/RelationDlg.hxx
+++ b/dbaccess/source/ui/inc/RelationDlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONDLG_HXX
+#pragma once
#include <memory>
#include <vcl/weld.hxx>
@@ -71,6 +70,5 @@ namespace dbaui
DECL_LINK(OKClickHdl, weld::Button&, void);
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationTableView.hxx b/dbaccess/source/ui/inc/RelationTableView.hxx
index 0bc8c86275bb..6c178a3de937 100644
--- a/dbaccess/source/ui/inc/RelationTableView.hxx
+++ b/dbaccess/source/ui/inc/RelationTableView.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONTABLEVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RELATIONTABLEVIEW_HXX
+#pragma once
#include "JoinTableView.hxx"
#include <comphelper/containermultiplexer.hxx>
@@ -71,6 +70,5 @@ namespace dbaui
virtual void lookForUiActivities() override;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RtfReader.hxx b/dbaccess/source/ui/inc/RtfReader.hxx
index c24ca3817c9a..58f6aa26ba2b 100644
--- a/dbaccess/source/ui/inc/RtfReader.hxx
+++ b/dbaccess/source/ui/inc/RtfReader.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RTFREADER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_RTFREADER_HXX
+#pragma once
#include <vector>
#include <svtools/parrtf.hxx>
@@ -46,7 +45,7 @@ namespace dbaui
// required for automatic type recognition
ORTFReader( SvStream& rIn,
sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&& _rColumnPositions,
const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* rList,
@@ -56,6 +55,5 @@ namespace dbaui
virtual SvParserState CallParser() override;// base class
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ScrollHelper.hxx b/dbaccess/source/ui/inc/ScrollHelper.hxx
deleted file mode 100644
index 87e50018aa2d..000000000000
--- a/dbaccess/source/ui/inc/ScrollHelper.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SCROLLHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SCROLLHELPER_HXX
-
-#include <tools/link.hxx>
-#include <tools/gen.hxx>
-
-namespace dbaui
-{
- class OScrollHelper
- {
- Link<LinkParamNone*,void> m_aUpScroll;
- Link<LinkParamNone*,void> m_aDownScroll;
- public:
- /** default constructor
- */
- OScrollHelper();
-
- ~OScrollHelper();
-
- /** set the memthod which should be called when scrolling up
- @param _rUpScroll
- the method to set
- */
- void setUpScrollMethod( const Link<LinkParamNone*,void>& _rUpScroll )
- {
- m_aUpScroll = _rUpScroll;
- }
-
- /** set the memthod which should be called when scrolling down
- @param _rDownScroll
- the method to set
- */
- void setDownScrollMethod( const Link<LinkParamNone*,void>& _rDownScroll )
- {
- m_aDownScroll = _rDownScroll;
- }
-
- /** check if a scroll method has to be called
- @param _rPoint
- the current selection point
- @param _rOutputSize
- the output size of the window
- */
- void scroll(const Point& _rPoint, const Size& _rOutputSize);
- };
-}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SCROLLHELPER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/SqlNameEdit.hxx b/dbaccess/source/ui/inc/SqlNameEdit.hxx
index 7a6e43c15b32..14d845b4b17c 100644
--- a/dbaccess/source/ui/inc/SqlNameEdit.hxx
+++ b/dbaccess/source/ui/inc/SqlNameEdit.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
+#pragma once
-#include <vcl/edit.hxx>
+#include <svtools/editbrowsebox.hxx>
+#include <utility>
#include <vcl/weld.hxx>
namespace dbaui
@@ -29,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)
{
}
@@ -43,21 +43,29 @@ namespace dbaui
{
m_bCheck = _bCheck;
}
- bool checkString(const OUString& _sToCheck,OUString& _rsCorrected);
+ bool checkString(std::u16string_view _sToCheck,OUString& _rsCorrected);
};
- class OSQLNameEdit : public Edit
- ,public OSQLNameChecker
+ class OSQLNameEditControl : public svt::EditControl
+ , public OSQLNameChecker
{
public:
- OSQLNameEdit(vcl::Window* _pParent,WinBits nStyle = WB_BORDER, const OUString& _rAllowedChars = OUString())
- : Edit(_pParent,nStyle)
- , OSQLNameChecker(_rAllowedChars)
+ OSQLNameEditControl(BrowserDataWin* pParent, const OUString& rAllowedChars)
+ : svt::EditControl(pParent)
+ , OSQLNameChecker(rAllowedChars)
+ {
+ m_xWidget->connect_changed(LINK(this, OSQLNameEditControl, ModifyHdl));
+ }
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override
{
+ m_ChainChangedHdl = rLink;
}
- // Edit overrides
- virtual void Modify() override;
+ private:
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+
+ Link<weld::Entry&,void> m_ChainChangedHdl;
};
class OWidgetBase
@@ -102,7 +110,6 @@ namespace dbaui
OUString get_text() const { return m_xEntry->get_text(); }
void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
void set_max_length(int nLen) { m_xEntry->set_max_length(nLen); }
- void set_sensitive(bool bSensitive) { m_xEntry->set_sensitive(bSensitive); }
virtual void save_value() override { m_xEntry->save_value(); }
virtual bool get_value_changed_from_saved() const override
{
@@ -111,6 +118,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
index 73aa51d50749..78b396d55c58 100644
--- a/dbaccess/source/ui/inc/TableConnection.hxx
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTION_HXX
+#pragma once
#include <vector>
#include <vcl/window.hxx>
-#include <com/sun/star/uno/Reference.h>
#include "TableConnectionData.hxx"
class Point;
@@ -29,7 +27,6 @@ namespace tools { class Rectangle; }
namespace dbaui
{
- class OTableConnectionData;
class OTableWindow;
class OJoinTableView;
class OConnectionLine;
@@ -48,7 +45,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
@@ -92,9 +89,8 @@ namespace dbaui
OJoinTableView* GetParent() const { return m_pParent; }
virtual void Draw(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
using Window::Draw;
- virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx
index c55bce40d463..096a6de70ad3 100644
--- a/dbaccess/source/ui/inc/TableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/TableConnectionData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTIONDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTIONDATA_HXX
+#pragma once
#include "ConnectionLineData.hxx"
#include "TableWindowData.hxx"
@@ -48,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();
@@ -98,6 +97,5 @@ namespace dbaui
typedef std::vector< std::shared_ptr<OTableConnectionData> > TTableConnectionData;
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index 41643d95b240..13af9cf51c48 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONTROLLER_HXX
+#pragma once
#include "singledoccontroller.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "TypeInfo.hxx"
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
@@ -123,10 +121,9 @@ namespace dbaui
private:
void startTableListening();
void stopTableListening();
- virtual void impl_initialize() override;
+ virtual void impl_initialize(const ::comphelper::NamedValueCollection& rArguments) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONTROLLER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx
index 670920028ece..17d5d4c78926 100644
--- a/dbaccess/source/ui/inc/TableCopyHelper.hxx
+++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx
@@ -16,18 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECOPYHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECOPYHELPER_HXX
+#pragma once
#include "AppElementType.hxx"
#include "commontypes.hxx"
#include <svx/dataaccessdescriptor.hxx>
-#include <sot/storage.hxx>
+#include <tools/stream.hxx>
#include <vcl/transfer.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
-class SvTreeListEntry;
namespace dbaui
{
class OGenericUnoController;
@@ -73,23 +72,22 @@ namespace dbaui
OUString sDefaultTableName;
OUString aUrl;
- tools::SvRef<SotStorageStream> aHtmlRtfStorage;
+ std::unique_ptr<SvStream> aHtmlRtfStorage;
ElementType nType;
- SvTreeListEntry* pDroppedAt;
+ std::unique_ptr<weld::TreeIter> xDroppedAt;
sal_Int8 nAction;
bool bHtml;
bool bError;
DropDescriptor()
: nType(E_TABLE)
- , pDroppedAt(nullptr)
, nAction(DND_ACTION_NONE)
, bHtml(false)
, bError(false)
{ }
};
- OTableCopyHelper(OGenericUnoController* _pControler);
+ OTableCopyHelper(OGenericUnoController* _pController);
/** pastes a table into the data source
@param _rPasteData
@@ -98,7 +96,7 @@ namespace dbaui
The name of the dest data source.
*/
void pasteTable( const TransferableDataHelper& _rTransData
- ,const OUString& _sDestDataSourceName
+ ,std::u16string_view _sDestDataSourceName
,const SharedConnection& _xConnection);
/** pastes a table into the data source
@@ -111,7 +109,7 @@ namespace dbaui
*/
void pasteTable( SotClipboardFormatId _nFormatId
,const TransferableDataHelper& _rTransData
- ,const OUString& _sDestDataSourceName
+ ,std::u16string_view _sDestDataSourceName
,const SharedConnection& _xConnection);
/** copies a table which was constructed by tags like HTML or RTF
@@ -135,7 +133,7 @@ namespace dbaui
The connection
*/
void asyncCopyTagTable( DropDescriptor& _rDesc
- ,const OUString& _sDestDataSourceName
+ ,std::u16string_view _sDestDataSourceName
,const SharedConnection& _xConnection);
/** copies a table which was constructed by tags like HTML or RTF
@@ -166,26 +164,25 @@ namespace dbaui
*/
void pasteTable(
const svx::ODataAccessDescriptor& _rPasteData,
- const OUString& _sDestDataSourceName,
+ std::u16string_view _sDestDataSourceName,
const SharedConnection& _xDestConnection
);
/** insert a table into the data source. The source can either be a table or a query
*/
void insertTable(
- const OUString& i_rSourceDataSource,
+ std::u16string_view i_rSourceDataSource,
const css::uno::Reference< css::sdbc::XConnection>& i_rSourceConnection,
const OUString& i_rCommand,
const sal_Int32 i_nCommandType,
const css::uno::Reference< css::sdbc::XResultSet >& i_rSourceRows,
const css::uno::Sequence< css::uno::Any >& i_rSelection,
const bool i_bBookmarkSelection,
- const OUString& i_rDestDataSource,
+ std::u16string_view i_rDestDataSource,
const css::uno::Reference< css::sdbc::XConnection>& i_rDestConnection
);
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECOPYHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableDesignControl.hxx b/dbaccess/source/ui/inc/TableDesignControl.hxx
index 9d933b3e6245..89debc9e1125 100644
--- a/dbaccess/source/ui/inc/TableDesignControl.hxx
+++ b/dbaccess/source/ui/inc/TableDesignControl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNCONTROL_HXX
+#pragma once
#include <svtools/editbrowsebox.hxx>
@@ -33,8 +32,8 @@ namespace dbaui
friend class OTableDesignUndoAct;
protected:
- long m_nDataPos; ///< currently needed row
- long m_nCurrentPos; ///< current position of selected column
+ tools::Long m_nDataPos; ///< currently needed row
+ tools::Long m_nCurrentPos; ///< current position of selected column
private:
sal_uInt16 m_nCurUndoActId;
@@ -42,10 +41,10 @@ namespace dbaui
public:
OTableRowView(vcl::Window* pParent);
- virtual void SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) = 0;
- virtual void SetCellData( long nRow, sal_uInt16 nColId, const css::uno::Any& _rNewData ) = 0;
- virtual css::uno::Any GetCellData( long nRow, sal_uInt16 nColId ) = 0;
- virtual void SetControlText( long nRow, sal_uInt16 nColId, const OUString& rText ) = 0;
+ virtual void SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) = 0;
+ virtual void SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const css::uno::Any& _rNewData ) = 0;
+ virtual css::uno::Any GetCellData( sal_Int32 nRow, sal_uInt16 nColId ) = 0;
+ virtual void SetControlText( sal_Int32 nRow, sal_uInt16 nColId, const OUString& rText ) = 0;
virtual OTableDesignView* GetView() const = 0;
@@ -57,24 +56,23 @@ namespace dbaui
virtual void paste() override;
protected:
- void Paste( long nRow );
+ void Paste( sal_Int32 nRow );
virtual void CopyRows() = 0;
virtual void DeleteRows() = 0;
- virtual void InsertRows( long nRow ) = 0;
- virtual void InsertNewRows( long nRow ) = 0;
+ virtual void InsertRows( sal_Int32 nRow ) = 0;
+ virtual void InsertNewRows( sal_Int32 nRow ) = 0;
virtual bool IsPrimaryKeyAllowed() = 0;
- virtual bool IsInsertNewAllowed( long nRow ) = 0;
+ virtual bool IsInsertNewAllowed( sal_Int32 nRow ) = 0;
virtual bool IsDeleteAllowed() = 0;
- virtual RowStatus GetRowStatus(long nRow) const override;
+ virtual RowStatus GetRowStatus(sal_Int32 nRow) const override;
virtual void KeyInput(const KeyEvent& rEvt) override;
virtual void Command( const CommandEvent& rEvt ) override;
virtual void Init() override;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
index 87118362511b..db4023d36cc0 100644
--- a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
+++ b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
@@ -16,34 +16,34 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNHELPBAR_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNHELPBAR_HXX
+#pragma once
-#include <vcl/tabpage.hxx>
+#include <vcl/weld.hxx>
#include "IClipBoardTest.hxx"
-class VclMultiLineEdit;
-
namespace dbaui
{
- // Deriving from TabPage is a trick to notice changes
- // of the system colors
- class OTableDesignHelpBar : public TabPage, public IClipboardTest
+ class OTableDesignHelpBar final : public IClipboardTest
{
private:
- VclPtr<VclMultiLineEdit> m_pTextWin;
-
- protected:
- virtual void Resize() override;
+ std::unique_ptr<weld::TextView> m_xTextWin;
public:
- OTableDesignHelpBar( vcl::Window* pParent );
- virtual ~OTableDesignHelpBar() override;
- virtual void dispose() override;
+ OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin);
void SetHelpText( const OUString& rText );
- virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ bool HasFocus() const { return m_xTextWin->has_focus(); }
+
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xTextWin->connect_focus_in(rLink);
+ }
+
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xTextWin->connect_focus_out(rLink);
+ }
// IClipboardTest
virtual bool isCutAllowed() override;
@@ -55,6 +55,5 @@ namespace dbaui
virtual void paste() override;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableDesignView.hxx b/dbaccess/source/ui/inc/TableDesignView.hxx
index 262e04933959..077eb211e3b4 100644
--- a/dbaccess/source/ui/inc/TableDesignView.hxx
+++ b/dbaccess/source/ui/inc/TableDesignView.hxx
@@ -16,42 +16,45 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
+#pragma once
#include <dbaccess/dataview.hxx>
#include <com/sun/star/lang/Locale.hpp>
-#include <vcl/split.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
#include "IClipBoardTest.hxx"
namespace dbaui
{
class OTableController;
+ class OTableDesignView;
class OTableFieldDescWin;
class OTableEditorCtrl;
- class OTableBorderWindow : public vcl::Window
+
+ class OTableBorderWindow final : public InterimItemWindow
{
- VclPtr<Splitter> m_aHorzSplitter;
- VclPtr<OTableFieldDescWin> m_pFieldDescWin;
- VclPtr<OTableEditorCtrl> m_pEditorCtrl;
+ std::unique_ptr<weld::Paned> m_xHorzSplitter;
+ std::unique_ptr<weld::Container> m_xEditorParent;
+ css::uno::Reference<css::awt::XWindow> m_xEditorParentWin;
+ VclPtr<OTableEditorCtrl> m_xEditorCtrl;
+ std::unique_ptr<weld::Container> m_xFieldDescParent;
+ std::unique_ptr<OTableFieldDescWin> m_xFieldDescWin;
- void ImplInitSettings();
- DECL_LINK( SplitHdl, Splitter*, void );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
public:
- OTableBorderWindow(vcl::Window* pParent);
+ OTableBorderWindow(OTableDesignView* pParent);
virtual ~OTableBorderWindow() override;
// Window overrides
virtual void dispose() override;
- virtual void Resize() override;
+
virtual void GetFocus() override;
+ virtual void Layout() override;
- OTableEditorCtrl* GetEditorCtrl() const { return m_pEditorCtrl; }
- OTableFieldDescWin* GetDescWin() const { return m_pFieldDescWin; }
+ OTableEditorCtrl* GetEditorCtrl() const { return m_xEditorCtrl.get(); }
+ OTableFieldDescWin* GetDescWin() const { return m_xFieldDescWin.get(); }
};
+
class OTableDesignView : public ODataView
- ,public IClipboardTest
+ , public IClipboardTest
{
enum ChildFocusState
{
@@ -66,6 +69,8 @@ namespace dbaui
ChildFocusState m_eChildFocus;
IClipboardTest* getActiveChild() const;
+
+ DECL_LINK( FieldDescFocusIn, weld::Widget&, void );
protected:
// return the Rectangle where I can paint myself
@@ -103,6 +108,5 @@ namespace dbaui
void reSync(); // resync window data with realdata
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index 1834f409f84d..8c3c9b1cd82a 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEFIELDDESCRIPTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEFIELDDESCRIPTION_HXX
+#pragma once
#include <vector>
@@ -35,8 +34,6 @@ namespace comphelper
class NamedValueCollection;
}
-namespace vcl { class Window; }
-
namespace dbaui
{
class OTableFieldDesc : public ::salhelper::SimpleReferenceObject
@@ -147,6 +144,5 @@ namespace dbaui
typedef ::rtl::Reference< OTableFieldDesc> OTableFieldDescRef;
typedef std::vector<OTableFieldDescRef> OTableFields;
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
index e15e08e902aa..62330965de98 100644
--- a/dbaccess/source/ui/inc/TableGrantCtrl.hxx
+++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEGRANTCTRL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEGRANTCTRL_HXX
+#pragma once
#include <sal/config.h>
@@ -29,7 +28,6 @@
#include <com/sun/star/sdbcx/XAuthorizable.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-class Edit;
namespace dbaui
{
@@ -53,7 +51,7 @@ class OTableGrantControl : public ::svt::EditBrowseBox
OUString m_sUserName;
VclPtr<::svt::CheckBoxControl> m_pCheckCell;
VclPtr<::svt::EditControl> m_pEdit;
- long m_nDataPos;
+ tools::Long m_nDataPos;
ImplSVEvent * m_nDeactivateEvent;
public:
@@ -73,21 +71,20 @@ public:
/** Creates the accessible object of a data table cell.
@param nRow The row index of the cell.
@param nColumnId The column ID of the cell.
- @return The XAccessible interface of the specified cell. */
- virtual css::uno::Reference<
- css::accessibility::XAccessible >
- CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+ @return The accessible object of the specified cell. */
+ virtual rtl::Reference<comphelper::OAccessible>
+ CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override;
protected:
virtual bool PreNotify(NotifyEvent& rNEvt ) override;
virtual bool IsTabAllowed(bool bForward) const override;
- virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) override;
- virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) override;
+ virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
+ virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
- virtual bool SeekRow( long nRow ) override;
+ virtual bool SeekRow( sal_Int32 nRow ) override;
virtual bool SaveModified() override;
- virtual OUString GetCellText( long nRow, sal_uInt16 nColId ) const override;
+ virtual OUString GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const override;
virtual void CellModified() override;
@@ -102,6 +99,4 @@ private:
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEGRANTCTRL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableRow.hxx b/dbaccess/source/ui/inc/TableRow.hxx
index c7bf3a783fe2..4f34a94bf58e 100644
--- a/dbaccess/source/ui/inc/TableRow.hxx
+++ b/dbaccess/source/ui/inc/TableRow.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX
+#pragma once
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <tools/long.hxx>
#include "TypeInfo.hxx"
class SvStream;
@@ -38,8 +37,7 @@ namespace dbaui
protected:
public:
OTableRow();
- OTableRow(const css::uno::Reference< css::beans::XPropertySet >& xAffectedCol);
- OTableRow( const OTableRow& rRow, long nPosition = -1 );
+ OTableRow( const OTableRow& rRow, tools::Long nPosition = -1 );
~OTableRow();
OFieldDescription* GetActFieldDescr() const { return m_pActFieldDescr; }
@@ -75,6 +73,4 @@ namespace dbaui
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx
index 6d3668f6d0ec..9450ab2ff827 100644
--- a/dbaccess/source/ui/inc/TableRowExchange.hxx
+++ b/dbaccess/source/ui/inc/TableRowExchange.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROWEXCHANGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROWEXCHANGE_HXX
+#pragma once
#include <vcl/transfer.hxx>
#include <memory>
@@ -29,14 +28,13 @@ namespace dbaui
{
std::vector< std::shared_ptr<OTableRow> > m_vTableRow;
public:
- OTableRowExchange(const std::vector< std::shared_ptr<OTableRow> >& _rvTableRow);
+ OTableRowExchange(std::vector< std::shared_ptr<OTableRow> >&& _rvTableRow);
protected:
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
- virtual bool WriteObject( tools::SvRef<SotStorageStream>& 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;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROWEXCHANGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index e356a5a265f7..9ece39e6be1f 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOW_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -32,8 +31,6 @@
#include <cppuhelper/basemutex.hxx>
#include <o3tl/typed_flags_set.hxx>
-class SvTreeListEntry;
-
// Flags for the size adjustment of SbaJoinTabWins
enum class SizingFlags {
NONE = 0x0000,
@@ -51,7 +48,6 @@ namespace dbaui
{
class OJoinDesignView;
class OJoinTableView;
- class OTableWindowAccess;
class OTableWindow : public ::cppu::BaseMutex
,public ::comphelper::OContainerListener
@@ -61,7 +57,6 @@ namespace dbaui
friend class OTableWindowListBox;
protected:
// and the table itself (needed for me as I want to lock it as long as the window is alive)
- VclPtr<FixedImage> m_aTypeImage;
VclPtr<OTableWindowTitle> m_xTitle;
VclPtr<OTableWindowListBox> m_xListBox;
@@ -90,17 +85,9 @@ namespace dbaui
void FillListBox();
// called at EACH Init
- virtual void OnEntryDoubleClicked(SvTreeListEntry* /*pEntry*/) { }
+ virtual void OnEntryDoubleClicked(weld::TreeIter& /*rEntry*/) { }
// called from the DoubleClickHdl of the ListBox
- /** HandleKeyInput tries to handle the KeyEvent. Movement or deletion
- @param rEvt
- The KeyEvent
- @return
- <TRUE/> when the table could handle the KeyEvent.
- */
- bool HandleKeyInput( const KeyEvent& rEvt );
-
/** delete the user data with the equal type as created within createUserData
@param _pUserData
The user data store in the listbox entries. Created with a call to createUserData.
@@ -120,11 +107,11 @@ namespace dbaui
css::beans::XPropertySet>& _xColumn,
bool _bPrimaryKey);
- /** updates m_aTypeImage
+ /** updates image
*/
void impl_updateImage();
- OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData );
+ OTableWindow( vcl::Window* pParent, TTableWindowData::value_type aTabWinData );
public:
virtual ~OTableWindow() override;
@@ -178,8 +165,7 @@ namespace dbaui
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
virtual void Command(const CommandEvent& rEvt) override;
- // Accessibility
- virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override;
// do I have connections to the outside?
bool ExistsAConn() const;
@@ -191,6 +177,5 @@ namespace dbaui
void clearListBox();
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowAccess.hxx b/dbaccess/source/ui/inc/TableWindowAccess.hxx
index 4ee3539a25bb..327f929c6d79 100644
--- a/dbaccess/source/ui/inc/TableWindowAccess.hxx
+++ b/dbaccess/source/ui/inc/TableWindowAccess.hxx
@@ -16,30 +16,28 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWACCESS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWACCESS_HXX
+#pragma once
#include "TableWindow.hxx"
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <vcl/accessibility/vclxaccessiblecomponent.hxx>
#include <vcl/vclptr.hxx>
+using css::accessibility::AccessibleRelationType;
+
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>
{
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
*/
@@ -49,31 +47,14 @@ 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( ) throw () override
- { // here inline is allowed because we do not use this class outside this dll
- VCLXAccessibleComponent::acquire( );
- }
- virtual void SAL_CALL release( ) throw () 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;
- // 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_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;
@@ -87,10 +68,9 @@ namespace dbaui
// XAccessibleRelationSet
virtual sal_Int32 SAL_CALL getRelationCount( ) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelation( sal_Int32 nIndex ) override;
- virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType ) override;
- virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType( sal_Int16 aRelationType ) override;
+ virtual sal_Bool SAL_CALL containsRelation(AccessibleRelationType eRelationType) override;
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType(AccessibleRelationType eRelationType) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWACCESS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowData.hxx b/dbaccess/source/ui/inc/TableWindowData.hxx
index 863d4ab45b9f..0160ea723316 100644
--- a/dbaccess/source/ui/inc/TableWindowData.hxx
+++ b/dbaccess/source/ui/inc/TableWindowData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
+#pragma once
#include <tools/gen.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -35,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;
@@ -52,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
@@ -92,6 +91,5 @@ namespace dbaui
typedef std::vector< std::shared_ptr<OTableWindowData> > TTableWindowData;
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx
index 1e0f8bd61037..ab1f84d52703 100644
--- a/dbaccess/source/ui/inc/TableWindowListBox.hxx
+++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx
@@ -16,14 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWLISTBOX_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWLISTBOX_HXX
+#pragma once
-#include <vcl/treelistbox.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/InterimItemWindow.hxx>
#include "callbacks.hxx"
-struct AcceptDropEvent;
-struct ExecuteDropEvent;
namespace dbaui
{
class OTableWindowListBox;
@@ -31,70 +29,91 @@ namespace dbaui
{
public:
VclPtr<OTableWindowListBox> pListBox; // the ListBox inside the same (you can get the TabWin and the WinName out of it)
- SvTreeListEntry* pEntry; // the entry, which was dragged or to which was dropped on
+ int nEntry; // the entry, which was dragged or to which was dropped on
OJoinExchangeData(OTableWindowListBox* pBox);
- OJoinExchangeData() : pListBox(nullptr), pEntry(nullptr) { }
+ OJoinExchangeData() : pListBox(nullptr), nEntry(-1) { }
};
+
struct OJoinDropData
{
OJoinExchangeData aSource;
OJoinExchangeData aDest;
};
+ class OJoinExchObj;
class OTableWindow;
+ class TableWindowListBoxHelper;
+
class OTableWindowListBox
- :public SvTreeListBox
- ,public IDragTransferableListener
+ : public InterimItemWindow
+ , public IDragTransferableListener
{
- DECL_LINK( OnDoubleClick, SvTreeListBox*, bool );
- DECL_LINK( ScrollUpHdl, Timer*, void );
- DECL_LINK( ScrollDownHdl, Timer*, void );
+ std::unique_ptr<weld::TreeView> m_xTreeView;
+ std::unique_ptr<TableWindowListBoxHelper> m_xDragDropTargetHelper;
+
+ DECL_LINK( OnDoubleClick, weld::TreeView&, bool );
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
DECL_LINK( DropHdl, void*, void );
DECL_LINK( LookForUiHdl, void*, void );
+ DECL_LINK( DragBeginHdl, bool&, bool );
+ DECL_LINK( ScrollHdl, weld::TreeView&, void );
- Timer m_aScrollTimer;
- Point m_aMousePos;
+ rtl::Reference<OJoinExchObj> m_xHelper;
VclPtr<OTableWindow> m_pTabWin;
ImplSVEvent * m_nDropEvent;
ImplSVEvent * m_nUiEvent;
OJoinDropData m_aDropInfo;
- bool m_bReallyScrolled : 1;
-
protected:
virtual void LoseFocus() override;
virtual void GetFocus() override;
- virtual void NotifyScrolled() override;
- virtual void NotifyEndScroll() override;
-
- virtual bool PreNotify(NotifyEvent& rNEvt) override;
virtual void dragFinished( ) override;
-
public:
OTableWindowListBox(OTableWindow* pParent);
virtual ~OTableWindowListBox() override;
virtual void dispose() override;
+ const weld::TreeView& get_widget() const { return *m_xTreeView; }
+ weld::TreeView& get_widget() { return *m_xTreeView; }
+
// DnD stuff
- virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+ sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
+ sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
// window
virtual void Command(const CommandEvent& rEvt) override;
OTableWindow* GetTabWin(){ return m_pTabWin; }
- SvTreeListEntry* GetEntryFromText( const OUString& rEntryText );
+ int GetEntryFromText( std::u16string_view rEntryText );
+ };
+ class TableWindowListBoxHelper final : public DropTargetHelper
+ {
private:
- using SvTreeListBox::ExecuteDrop;
+ OTableWindowListBox& m_rParent;
+
+ virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override
+ {
+ return m_rParent.AcceptDrop(rEvt);
+ }
+
+ virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
+ {
+ return m_rParent.ExecuteDrop(rEvt);
+ }
+
+ public:
+ TableWindowListBoxHelper(OTableWindowListBox& rParent, const css::uno::Reference<css::datatransfer::dnd::XDropTarget>& rDropTarget)
+ : DropTargetHelper(rDropTarget)
+ , m_rParent(rParent)
+ {
+ }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWLISTBOX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowTitle.hxx b/dbaccess/source/ui/inc/TableWindowTitle.hxx
index 50f5dda8a8b2..0a3779bd8873 100644
--- a/dbaccess/source/ui/inc/TableWindowTitle.hxx
+++ b/dbaccess/source/ui/inc/TableWindowTitle.hxx
@@ -16,36 +16,29 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWTITLE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWTITLE_HXX
+#pragma once
-#include <vcl/fixed.hxx>
+#include <vcl/InterimItemWindow.hxx>
namespace dbaui
{
class OTableWindow;
- class OTableWindowTitle : public FixedText
+ class OTableWindowTitle final : public InterimItemWindow
{
VclPtr<OTableWindow> m_pTabWin;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Image> m_xImage;
- protected:
- virtual void Command(const CommandEvent& rEvt) override;
- // virtual void Paint( const Rectangle& rRect );
- virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
- virtual void KeyInput( const KeyEvent& rEvt ) override;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ DECL_LINK(MousePressHdl, const MouseEvent&, bool);
public:
OTableWindowTitle( OTableWindow* pParent );
virtual ~OTableWindowTitle() override;
virtual void dispose() override;
- virtual void LoseFocus() override;
- virtual void GetFocus() override;
- virtual void RequestHelp( const HelpEvent& rHEvt ) override;
- // window override
- virtual void StateChanged( StateChangedType nStateChange ) override;
+
+ weld::Label& GetLabel() { return *m_xLabel; }
+ weld::Image& GetImage() { return *m_xImage; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWTITLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TablesSingleDlg.hxx b/dbaccess/source/ui/inc/TablesSingleDlg.hxx
index 6e73555b6892..c75fa1eb3da2 100644
--- a/dbaccess/source/ui/inc/TablesSingleDlg.hxx
+++ b/dbaccess/source/ui/inc/TablesSingleDlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLESSINGLEDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLESSINGLEDLG_HXX
+#pragma once
#include <sfx2/basedlgs.hxx>
#include "IItemSetHelper.hxx"
@@ -69,6 +68,4 @@ class ODbDataSourceAdministrationHelper;
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLESSINGLEDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index ecf8f9442e58..3a4bfc359f0b 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TOKENWRITER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TOKENWRITER_HXX
+#pragma once
#include "commontypes.hxx"
@@ -47,7 +46,6 @@ class SvStream;
namespace dbaui
{
// ODatabaseImportExport base class for import/export
- class ODatabaseExport;
class ODatabaseImportExport : public ::cppu::WeakImplHelper< css::lang::XEventListener>
{
protected:
@@ -84,7 +82,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);
@@ -138,10 +136,6 @@ namespace dbaui
const sal_Int16 nIndentMax = 23;
class OHTMLImportExport : public ODatabaseImportExport
{
- // default HtmlFontSz[1-7]
- static const sal_Int16 nDefaultFontSize[SBA_HTML_FONTSIZES];
- // HtmlFontSz[1-7] in s*3.ini [user]
- static sal_Int16 nFontSize[SBA_HTML_FONTSIZES];
static const sal_Int16 nCellSpacing;
static const char sIndentSource[];
char sIndent[nIndentMax+1];
@@ -207,6 +201,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TOKENWRITER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TypeInfo.hxx b/dbaccess/source/ui/inc/TypeInfo.hxx
index 36cf41e9228d..e9958e8e8dda 100644
--- a/dbaccess/source/ui/inc/TypeInfo.hxx
+++ b/dbaccess/source/ui/inc/TypeInfo.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TYPEINFO_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TYPEINFO_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -119,6 +118,4 @@ const sal_uInt16 TYPE_BIT = 31;
bool& _brForceToType);
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TYPEINFO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
index 0ea5b03c93c3..f45213a28b49 100644
--- a/dbaccess/source/ui/inc/UITools.hxx
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_UITOOLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_UITOOLS_HXX
+#pragma once
#include <connectivity/dbexception.hxx>
#include <comphelper/stl_types.hxx>
@@ -25,8 +24,10 @@
#include <editeng/svxenum.hxx>
#include <vcl/taskpanelist.hxx>
#include <connectivity/dbtools.hxx>
+#include <unotools/resmgr.hxx>
#include <memory>
+#include <string_view>
#define RET_ALL 100
@@ -43,11 +44,6 @@ namespace com::sun::star {
{
class XEventListener;
}
- namespace awt
- {
- struct FontDescriptor;
- class XWindow;
- }
namespace sdbc
{
class XDatabaseMetaData;
@@ -55,7 +51,6 @@ namespace com::sun::star {
}
namespace util
{
- struct URL;
class XNumberFormatter;
}
namespace ucb { class XContent; }
@@ -68,9 +63,10 @@ namespace svt
}
namespace vcl { class Window; }
-namespace weld {class Window; }
-class ToolBox;
-namespace vcl { class Font; }
+namespace weld {
+ class Widget;
+ class Window;
+}
class SvNumberFormatter;
class SfxFilter;
@@ -111,7 +107,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);
@@ -136,7 +132,7 @@ namespace dbaui
@param SvxCellHorJustify& _eAlignment
@return the corresponding css::awt::TextAlign
*/
- sal_Int32 mapTextAllign(const SvxCellHorJustify& _eAlignment);
+ sal_Int32 mapTextAlign(const SvxCellHorJustify& _eAlignment);
/** retrieves a data source given by name or URL, and displays an error if this fails
@@ -181,11 +177,11 @@ namespace dbaui
void callColumnFormatDialog(const css::uno::Reference< css::beans::XPropertySet>& _xAffectedCol,
const css::uno::Reference< css::beans::XPropertySet>& _xField,
SvNumberFormatter* _pFormatter,
- const vcl::Window* _pParent);
+ weld::Widget* _pParent);
/** second variant of the function before
*/
- bool callColumnFormatDialog(const vcl::Window* _pParent,
+ bool callColumnFormatDialog(weld::Widget* _pParent,
SvNumberFormatter* _pFormatter,
sal_Int32 _nDataType,
sal_Int32& _nFormatKey,
@@ -307,7 +303,7 @@ namespace dbaui
@return
RET_YES, RET_NO, RET_ALL
*/
- sal_Int32 askForUserAction(weld::Window* pParent, const char* pTitle, const char* pText, bool bAll, const OUString& rName);
+ sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool bAll, std::u16string_view rName);
/** creates a new view from a query or table
@param _sName
@@ -368,7 +364,7 @@ namespace dbaui
@return
<TRUE/> if the insert operation was successful, otherwise <FALSE/>.
*/
- bool insertHierachyElement(
+ bool insertHierarchyElement(
weld::Window* pParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const css::uno::Reference< css::container::XHierarchicalNameContainer>& _xNames,
@@ -388,6 +384,5 @@ namespace dbaui
css::uno::Reference< css::util::XNumberFormatter > getNumberFormatter(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_UITOOLS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
index b30f2cd95d91..8787e10f39e5 100644
--- a/dbaccess/source/ui/inc/UserAdminDlg.hxx
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_USERADMINDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_USERADMINDLG_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include "IItemSetHelper.hxx"
@@ -28,9 +27,6 @@ namespace com::sun::star {
namespace sdbc {
class XConnection;
}
- namespace lang {
- class XMultiServiceFactory;
- }
}
namespace dbaui
@@ -48,7 +44,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,
@@ -74,6 +70,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_USERADMINDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/VertSplitView.hxx b/dbaccess/source/ui/inc/VertSplitView.hxx
deleted file mode 100644
index 25a0a6442e81..000000000000
--- a/dbaccess/source/ui/inc/VertSplitView.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_VERTSPLITVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_VERTSPLITVIEW_HXX
-
-#include <vcl/window.hxx>
-
-class Splitter;
-
-namespace dbaui
-{
- class OSplitterView : public vcl::Window
- {
- VclPtr<Splitter> m_pSplitter;
- VclPtr<vcl::Window> m_pLeft;
- VclPtr<vcl::Window> m_pRight;
- ImplSVEvent *m_pResizeId;
-
- void ImplInitSettings();
- DECL_LINK(SplitHdl, Splitter*, void);
- DECL_LINK(ResizeHdl, void*, void);
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
- public:
- OSplitterView(vcl::Window* _pParent);
- virtual ~OSplitterView() override;
- // Window overrides
- virtual void dispose() override;
- virtual void GetFocus() override;
-
- void setSplitter(Splitter* _pSplitter);
- void set(vcl::Window* _pRight,Window* _pLeft = nullptr);
- virtual void Resize() override;
- };
-}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_VERTSPLITVIEW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx
index 617f723c78fa..e23d64f59940 100644
--- a/dbaccess/source/ui/inc/WCPage.hxx
+++ b/dbaccess/source/ui/inc/WCPage.hxx
@@ -16,15 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WCPAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WCPAGE_HXX
+#pragma once
#include "WTabPage.hxx"
namespace dbaui
{
- class OWizColumnSelect;
- class OWizNormalExtend;
class OCopyTable final : public OWizardPage
{
bool m_bPKeyAllowed;
@@ -41,9 +38,8 @@ namespace dbaui
std::unique_ptr<weld::Label> m_xFT_KeyName;
std::unique_ptr<weld::Entry> m_xEdKeyName;
- DECL_LINK( AppendDataClickHdl, weld::Button&, void );
- DECL_LINK( RadioChangeHdl, weld::Button&, void );
- DECL_LINK( KeyClickHdl, weld::Button&, void );
+ DECL_LINK( RadioChangeHdl, weld::Toggleable&, void );
+ DECL_LINK( KeyClickHdl, weld::Toggleable&, void );
bool checkAppendData();
void SetAppendDataRadio();
@@ -76,6 +72,5 @@ namespace dbaui
void setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WCPAGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx
index 59ebc0ae81a4..38b1317fd507 100644
--- a/dbaccess/source/ui/inc/WColumnSelect.hxx
+++ b/dbaccess/source/ui/inc/WColumnSelect.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WCOLUMNSELECT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WCOLUMNSELECT_HXX
+#pragma once
#include "WTabPage.hxx"
#include "WCopyTable.hxx"
@@ -50,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);
@@ -58,14 +57,14 @@ 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);
void enableButtons();
sal_Int32 adjustColumnPosition(weld::TreeView const * _pLeft,
- const OUString& _sColumnName,
+ std::u16string_view _sColumnName,
ODatabaseExport::TColumnVector::size_type nCurrentPos,
const ::comphelper::UStringMixEqual& _aCase);
@@ -79,6 +78,5 @@ namespace dbaui
virtual ~OWizColumnSelect() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WCOLUMNSELECT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 0563232451f9..84b9182fe5f6 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WCOPYTABLE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WCOPYTABLE_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -27,7 +26,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/stl_types.hxx>
#include "TypeInfo.hxx"
-#include <vcl/roadmapwizard.hxx>
+#include <vcl/roadmapwizardmachine.hxx>
#include "DExport.hxx"
#include "WTabPage.hxx"
#include "FieldDescriptions.hxx"
@@ -62,7 +61,7 @@ namespace dbaui
bool operator()(const OUString& _sColumnName) const override
{
- return m_pColumns->find(_sColumnName) != m_pColumns->end();
+ return m_pColumns->contains(_sColumnName);
}
};
@@ -184,7 +183,7 @@ namespace dbaui
public:
NamedTableCopySource(
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
- const OUString& _rTableName
+ OUString _sTableName
);
// ICopyTableSourceObject overridables
@@ -310,9 +309,9 @@ namespace dbaui
// used for importing rtf/html sources
OCopyTableWizard(
weld::Window* pParent,
- const OUString& _rDefaultName,
+ OUString _sDefaultName,
sal_Int16 _nOperation,
- const ODatabaseExport::TColumns& _rDestColumns,
+ ODatabaseExport::TColumns&& _rDestColumns,
const ODatabaseExport::TColumnVector& _rSourceColVec,
const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
const css::uno::Reference< css::util::XNumberFormatter >& _xFormatter,
@@ -386,7 +385,7 @@ namespace dbaui
void clearDestColumns();
css::uno::Reference< css::beans::XPropertySet > returnTable();
- css::uno::Reference< css::beans::XPropertySet > getTable();
+ css::uno::Reference< css::beans::XPropertySet > getTable() const;
css::uno::Reference< css::beans::XPropertySet > createTable();
css::uno::Reference< css::beans::XPropertySet > createView() const;
sal_Int32 getMaxColumnNameLength() const;
@@ -396,14 +395,14 @@ 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);
OUString createUniqueName(const OUString& _sName);
// displays an error message that a column type is not supported
- void showColumnTypeNotSupported(const OUString& _rColumnName);
+ void showColumnTypeNotSupported(std::u16string_view _rColumnName);
void removeColumnNameFromNameMap(const OUString& _sName);
void showError(const OUString& _sErrorMessage);
@@ -411,6 +410,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WCOPYTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx
index 05a251c0ee8b..7d75f2cc1abf 100644
--- a/dbaccess/source/ui/inc/WExtendPages.hxx
+++ b/dbaccess/source/ui/inc/WExtendPages.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WEXTENDPAGES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WEXTENDPAGES_HXX
+#pragma once
#include "WTypeSelect.hxx"
@@ -66,6 +65,5 @@ namespace dbaui
}
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WEXTENDPAGES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WNameMatch.hxx b/dbaccess/source/ui/inc/WNameMatch.hxx
index 0b4b45617cad..d108c043c635 100644
--- a/dbaccess/source/ui/inc/WNameMatch.hxx
+++ b/dbaccess/source/ui/inc/WNameMatch.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WNAMEMATCH_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WNAMEMATCH_HXX
+#pragma once
#include "WTabPage.hxx"
#include "DExport.hxx"
@@ -60,6 +59,5 @@ namespace dbaui
virtual ~OWizNameMatching() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WNAMEMATCH_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WTabPage.hxx b/dbaccess/source/ui/inc/WTabPage.hxx
index 0bcd04082dcd..ef3d7f23b20c 100644
--- a/dbaccess/source/ui/inc/WTabPage.hxx
+++ b/dbaccess/source/ui/inc/WTabPage.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WTABPAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WTABPAGE_HXX
+#pragma once
#include <vcl/wizardmachine.hxx>
@@ -32,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;
@@ -43,6 +42,5 @@ namespace dbaui
bool IsFirstTime() const { return m_bFirstTime; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTABPAGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
index 4a0f240a788f..3c206d0fecb1 100644
--- a/dbaccess/source/ui/inc/WTypeSelect.hxx
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
+#pragma once
#include "FieldDescControl.hxx"
#include "TypeInfo.hxx"
@@ -28,7 +27,6 @@ class SvStream;
namespace dbaui
{
class OWizTypeSelect;
- class OTableDesignHelpBar;
// OWizTypeSelectControl
class OWizTypeSelectControl final : public OFieldDescControl
{
@@ -36,7 +34,7 @@ namespace dbaui
virtual void ActivateAggregate( EControlType eType ) override;
virtual void DeactivateAggregate( EControlType eType ) override;
- virtual void CellModified(long nRow, sal_uInt16 nColId ) override;
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) override;
virtual css::lang::Locale GetLocale() const override;
virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override;
@@ -73,7 +71,6 @@ namespace dbaui
void SetPKey(bool bPKey) { m_bPKey = bPKey; }
weld::TreeView* GetWidget() { return m_xControl.get(); }
OUString get_selected_id() const { return m_xControl->get_selected_id(); }
- void show() { m_xControl->show(); }
void clear() { m_xControl->clear(); }
void append(const OUString& rId, const OUString& rStr)
{
@@ -89,7 +86,7 @@ namespace dbaui
void connect_changed(const Link<weld::TreeView&, void>& rLink)
{
m_aChangeHdl = rLink;
- m_xControl->connect_changed(rLink);
+ m_xControl->connect_selection_changed(rLink);
}
};
@@ -105,9 +102,8 @@ 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;
- VclPtr<OWizTypeSelectControl> m_xTypeControl;
+ std::unique_ptr<OWizTypeSelectControl> m_xTypeControl;
std::unique_ptr<weld::Label> m_xAutoType;
std::unique_ptr<weld::Label> m_xAutoFt;
std::unique_ptr<weld::SpinButton> m_xAutoEt;
@@ -137,6 +133,5 @@ namespace dbaui
typedef std::unique_ptr<OWizTypeSelect> (*TypeSelectionPageFactory)(weld::Container*, OCopyTableWizard*, SvStream&);
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/adtabdlg.hxx b/dbaccess/source/ui/inc/adtabdlg.hxx
index bad72a5f6830..5fe1d7c1da42 100644
--- a/dbaccess/source/ui/inc/adtabdlg.hxx
+++ b/dbaccess/source/ui/inc/adtabdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_ADTABDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_ADTABDLG_HXX
+#pragma once
#include <memory>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -61,7 +60,7 @@ namespace dbaui
std::unique_ptr<weld::RadioButton> m_xCaseTables;
std::unique_ptr<weld::RadioButton> m_xCaseQueries;
- std::unique_ptr<TableTreeListBox> m_xTableList;
+ std::unique_ptr<OTableTreeListBox> m_xTableList;
std::unique_ptr<weld::TreeView> m_xQueryList;
std::unique_ptr<weld::Button> m_xAddButton;
@@ -71,7 +70,7 @@ namespace dbaui
DECL_LINK( CloseClickHdl, weld::Button&, void);
DECL_LINK( TableListDoubleClickHdl, weld::TreeView&, bool );
DECL_LINK( TableListSelectHdl, weld::TreeView&, void );
- DECL_LINK( OnTypeSelected, weld::Button&, void );
+ DECL_LINK( OnTypeSelected, weld::Toggleable&, void );
public:
OAddTableDlg(weld::Window* _pParent,
@@ -95,6 +94,5 @@ namespace dbaui
void impl_switchTo( ObjectList _eList );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_ADTABDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
index f2d6e68cd60d..7c38562145a5 100644
--- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_ADVANCEDSETTINGSDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_ADVANCEDSETTINGSDLG_HXX
+#pragma once
#include "IItemSetHelper.hxx"
#include <sfx2/tabdlg.hxx>
@@ -38,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:
@@ -68,6 +67,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_ADVANCEDSETTINGSDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/asyncmodaldialog.hxx b/dbaccess/source/ui/inc/asyncmodaldialog.hxx
index 3b6d2517a154..483dfb7c161b 100644
--- a/dbaccess/source/ui/inc/asyncmodaldialog.hxx
+++ b/dbaccess/source/ui/inc/asyncmodaldialog.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_ASYNCMODALDIALOG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_ASYNCMODALDIALOG_HXX
+#pragma once
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
@@ -45,6 +44,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_ASYNCMODALDIALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/browserids.hxx b/dbaccess/source/ui/inc/browserids.hxx
index 44e96431fe82..0c510497dea1 100644
--- a/dbaccess/source/ui/inc/browserids.hxx
+++ b/dbaccess/source/ui/inc/browserids.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_BROWSERIDS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_BROWSERIDS_HXX
+#pragma once
#include <svx/svxids.hrc>
#include <dbaccess_slotid.hrc>
@@ -51,7 +50,6 @@
#define ID_BROWSER_COLWIDTH 10021 // column width
#define ID_BROWSER_TABLEATTR 10022 // table format attributes
#define ID_BROWSER_ROWHEIGHT 10023 // row height
-#define ID_BROWSER_COLUMNINFO 10024 // copies the column description to insert it into the table design
#define ID_BROWSER_ADDTABLE SID_FM_ADDTABLE
#define ID_BROWSER_EXPLORER SID_DSBROWSER_EXPLORER
#define ID_BROWSER_DOCUMENT_DATASOURCE SID_DOCUMENT_DATA_SOURCE
@@ -97,6 +95,4 @@
#define ID_BROWSER_INSERT_ROW (SID_SBA_START + 46) // insert row
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_BROWSERIDS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index 58a13cf17690..38c8ecc40f35 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_BRWCTRLR_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_BRWCTRLR_HXX
+#pragma once
#include <dbaccess/genericcontroller.hxx>
#include "brwview.hxx"
@@ -46,11 +45,6 @@
struct FmFoundRecordInformation;
struct FmSearchContext;
-namespace dbtools
-{
- class SQLExceptionInfo;
-}
-
namespace dbaui
{
@@ -80,7 +74,6 @@ namespace dbaui
css::uno::Reference< css::form::XLoadable > m_xLoadable; // queried from the rowset member as well
css::uno::Reference< css::form::XFormComponent > m_xGridModel; // the model of our grid
css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
- css::uno::Reference< css::uno::XAggregation > m_xFormControllerImpl;
mutable css::uno::Reference< css::sdb::XSingleSelectQueryComposer >
m_xParser; // for sorting 'n filtering
@@ -101,7 +94,7 @@ namespace dbaui
OUString m_sModuleIdentifier;
// members for asynchronous load operations
- FormControllerImpl* m_pFormControllerImpl; // implementing the XFormController
+ rtl::Reference<FormControllerImpl> m_xFormControllerImpl; // implementing the XFormController
sal_uInt16 m_nFormActionNestingLevel; // see enter-/leaveFormAction
@@ -331,6 +324,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_BRWCTRLR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/brwview.hxx b/dbaccess/source/ui/inc/brwview.hxx
index 82a7129f6985..d7c83a4062f1 100644
--- a/dbaccess/source/ui/inc/brwview.hxx
+++ b/dbaccess/source/ui/inc/brwview.hxx
@@ -17,16 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_BRWVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_BRWVIEW_HXX
+#pragma once
#include <vcl/window.hxx>
#include <dbaccess/dataview.hxx>
#include <unotools/eventlisteneradapter.hxx>
+#include "dbtreelistbox.hxx"
namespace com::sun::star::awt {
- class XControl;
class XControlContainer;
class XControlModel;
}
@@ -35,22 +34,21 @@ class Splitter;
namespace dbaui
{
- class DBTreeView;
class SbaGridControl;
+ class SbaXGridControl;
class UnoDataBrowserView final : public ODataView, public ::utl::OEventListenerAdapter
{
- css::uno::Reference< css::awt::XControl > m_xGrid; // our grid's UNO representation
+ rtl::Reference< SbaXGridControl > m_xGrid; // our grid's UNO representation
css::uno::Reference< css::awt::XControlContainer > m_xMe; // our own UNO representation
- VclPtr<DBTreeView> m_pTreeView;
+ VclPtr<InterimDBTreeListBox> m_pTreeView;
VclPtr<Splitter> m_pSplitter;
mutable VclPtr<SbaGridControl> m_pVclControl; // our grid's VCL representation
- VclPtr<vcl::Window> m_pStatus;
DECL_LINK( SplitHdl, Splitter*, void );
// attribute access
public:
- const css::uno::Reference< css::awt::XControl >& getGridControl() const { return m_xGrid; }
+ const rtl::Reference< SbaXGridControl >& getGridControl() const { return m_xGrid; }
SbaGridControl* getVclControl() const;
UnoDataBrowserView( vcl::Window* pParent,
@@ -68,8 +66,8 @@ namespace dbaui
sal_uInt16 View2ModelPos(sal_uInt16 nPos) const;
/// for the same reason the view column count isn't the same as the model column count
- void setSplitter(Splitter* _pSplitter);
- void setTreeView(DBTreeView* _pTreeView);
+ void setSplitter(Splitter* pSplitter);
+ void setTreeView(InterimDBTreeListBox* pTreeView);
void showStatus( const OUString& _rStatus );
void hideStatus();
@@ -94,6 +92,5 @@ namespace dbaui
~BrowserViewStatusDisplay( );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_BRWVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx
index 8a607db34eff..e380b2671d6c 100644
--- a/dbaccess/source/ui/inc/callbacks.hxx
+++ b/dbaccess/source/ui/inc/callbacks.hxx
@@ -17,20 +17,27 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CALLBACKS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CALLBACKS_HXX
+#pragma once
#include <sot/exchange.hxx>
-class SvTreeListEntry;
class Point;
-class PopupMenu;
-class Control;
struct AcceptDropEvent;
struct ExecuteDropEvent;
namespace comphelper { class OInterfaceContainerHelper2; }
+namespace vcl
+{
+ class Window;
+}
+
+namespace weld
+{
+ class TreeIter;
+ class TreeView;
+}
+
namespace dbaui
{
@@ -42,12 +49,12 @@ namespace dbaui
/** requests a quick help text to display
@return <FALSE/> if the default quick help text should be used
*/
- virtual bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const = 0;
+ virtual bool requestQuickHelp(const void* pUserData, OUString& rText) const = 0;
/** handler for StartDrag requests
@return <TRUE/> if a drag operation was started
*/
- virtual bool requestDrag( const Point& _rPosPixel ) = 0;
+ virtual bool requestDrag(const weld::TreeIter& rEntry) = 0;
/** check whether or not a drop request should be accepted
*/
@@ -69,7 +76,7 @@ namespace dbaui
Supposed to be a valid name from uiconfig/<module>/popupmenu folder.
*/
- virtual OUString getContextMenuResourceName( Control& _rControl ) const = 0;
+ virtual OUString getContextMenuResourceName() const = 0;
/** returns the controller which is responsible for providing states of certain features,
and executing them.
@@ -87,7 +94,14 @@ namespace dbaui
This selection is used for filling a ContextMenuExecuteEvent event for the given
control.
*/
- virtual css::uno::Any getCurrentSelection( Control& _rControl ) const = 0;
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const = 0;
+
+ virtual vcl::Window* getMenuParent() const = 0;
+
+ /** adjust rPos which is initially relative to rControl to be relative to
+ the window of getMenuParent
+ */
+ virtual void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const = 0;
protected:
~IContextMenuProvider() {}
@@ -106,6 +120,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CALLBACKS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/charsetlistbox.hxx b/dbaccess/source/ui/inc/charsetlistbox.hxx
index d58c1ca6531a..a12b425cd9c1 100644
--- a/dbaccess/source/ui/inc/charsetlistbox.hxx
+++ b/dbaccess/source/ui/inc/charsetlistbox.hxx
@@ -17,13 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CHARSETLISTBOX_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CHARSETLISTBOX_HXX
+#pragma once
+#include <svl/typedwhich.hxx>
#include <vcl/weld.hxx>
#include "charsets.hxx"
class SfxItemSet;
+class SfxStringItem;
namespace dbaui
{
@@ -33,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); }
@@ -46,6 +47,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CHARSETLISTBOX_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/charsets.hxx b/dbaccess/source/ui/inc/charsets.hxx
index b48e14f6e5a7..49977bd56262 100644
--- a/dbaccess/source/ui/inc/charsets.hxx
+++ b/dbaccess/source/ui/inc/charsets.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CHARSETS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CHARSETS_HXX
+#pragma once
#include <connectivity/dbcharset.hxx>
#include <rtl/ustring.hxx>
@@ -44,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
@@ -73,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
@@ -98,11 +97,9 @@ namespace dbaui
const ExtendedCharsetIterator& operator++();
protected:
- ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, const base_iterator& _rPosition );
+ ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, base_iterator _aPosition );
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CHARSETS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/commontypes.hxx b/dbaccess/source/ui/inc/commontypes.hxx
index 6562555e6f5c..50c5670104bd 100644
--- a/dbaccess/source/ui/inc/commontypes.hxx
+++ b/dbaccess/source/ui/inc/commontypes.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_COMMONTYPES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_COMMONTYPES_HXX
+#pragma once
#include <sal/config.h>
@@ -37,6 +36,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_COMMONTYPES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
index 1b53358c4f77..6042f761ce2f 100644
--- a/dbaccess/source/ui/inc/curledit.hxx
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <dsntypes.hxx>
@@ -44,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();
@@ -100,6 +99,4 @@ public:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx
index 9fa293c0e213..46df99181627 100644
--- a/dbaccess/source/ui/inc/databaseobjectview.hxx
+++ b/dbaccess/source/ui/inc/databaseobjectview.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -92,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(){}
@@ -228,6 +227,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATABASEOBJECTVIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/datasourceconnector.hxx b/dbaccess/source/ui/inc/datasourceconnector.hxx
index 30cc3cdfe730..56f7bf2f067b 100644
--- a/dbaccess/source/ui/inc/datasourceconnector.hxx
+++ b/dbaccess/source/ui/inc/datasourceconnector.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
+#pragma once
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -49,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
@@ -74,6 +73,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index f0c6ed6c7e71..3d1457793640 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -17,24 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBADMIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DBADMIN_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <dsntypes.hxx>
#include "IItemSetHelper.hxx"
+#include <unotools/resmgr.hxx>
#include <memory>
namespace com::sun::star {
namespace beans {
class XPropertySet;
}
- namespace sdbc {
- class XConnection;
- }
- namespace lang {
- class XMultiServiceFactory;
- }
}
namespace dbaui
@@ -49,7 +43,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 +57,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, 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, 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 +83,9 @@ public:
private:
// adds a new detail page and remove all the old ones
- void addDetailPage(const OString& rPageId, const char* 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 ..
@@ -111,6 +105,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBADMIN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
index 7ee0f5ca2cf2..050f5bd3b849 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBEXCHANGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DBEXCHANGE_HXX
+#pragma once
#include "TokenWriter.hxx"
#include <com/sun/star/util/XNumberFormatter.hpp>
@@ -43,7 +42,16 @@ namespace dbaui
::rtl::Reference< ORTFImportExport > m_pRtf;
public:
+ ODataClipboard();
+
ODataClipboard(
+ const css::uno::Reference< css::beans::XPropertySet >& i_rAliveForm,
+ const css::uno::Sequence< css::uno::Any >& i_rSelectedRows,
+ const bool i_bBookmarkSelection,
+ const css::uno::Reference< css::uno::XComponentContext >& i_rORB
+ );
+
+ void Update(
const OUString& _rDatasource,
const sal_Int32 _nCommandType,
const OUString& _rCommand,
@@ -52,7 +60,7 @@ namespace dbaui
const css::uno::Reference< css::uno::XComponentContext >& _rxORB
);
- ODataClipboard(
+ void Update(
const OUString& _rDatasource,
const sal_Int32 _nCommandType,
const OUString& _rCommand,
@@ -60,13 +68,6 @@ namespace dbaui
const css::uno::Reference< css::uno::XComponentContext >& _rxORB
);
- ODataClipboard(
- const css::uno::Reference< css::beans::XPropertySet >& i_rAliveForm,
- const css::uno::Sequence< css::uno::Any >& i_rSelectedRows,
- const bool i_bBookmarkSelection,
- const css::uno::Reference< css::uno::XComponentContext >& i_rORB
- );
-
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
@@ -74,11 +75,9 @@ 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<SotStorageStream>& 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;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBEXCHANGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index f79abe8f5df7..7682841a23ac 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -16,26 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBTREELISTBOX_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DBTREELISTBOX_HXX
+#pragma once
-#include "ScrollHelper.hxx"
-
-#include <com/sun/star/frame/XPopupMenuController.hpp>
-
-#include <vcl/treelistbox.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/transfer.hxx>
#include <vcl/timer.hxx>
+#include <vcl/weld.hxx>
#include <memory>
-#include <set>
namespace dbaui
{
- struct DBTreeEditedEntry
- {
- OUString aNewText;
- };
-
class IEntryFilter
{
public:
@@ -47,94 +38,127 @@ namespace dbaui
class IControlActionListener;
class IContextMenuProvider;
- class DBTreeListBox :public SvTreeListBox
+
+ class TreeListBox;
+
+ class TreeListBoxDropTarget : public DropTargetHelper
{
- OScrollHelper m_aScrollHelper;
- Timer m_aTimer; // is needed for table updates
- Point m_aMousePos;
- std::set<SvTreeListEntry*> m_aSelectedEntries;
- SvTreeListEntry* m_pDragedEntry;
+ private:
+ TreeListBox& m_rTreeView;
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+ public:
+ TreeListBoxDropTarget(TreeListBox& rTreeView);
+ };
+
+ class TreeListBox
+ {
+ protected:
+ std::unique_ptr<weld::TreeView> m_xTreeView;
+ TreeListBoxDropTarget m_aDropTargetHelper;
+
+ std::unique_ptr<weld::TreeIter> m_xDragedEntry;
IControlActionListener* m_pActionListener;
IContextMenuProvider* m_pContextMenuProvider;
- ImplSVEvent* m_pResetEvent;
- css::uno::Reference<css::frame::XPopupMenuController> m_xMenuController;
- Link<SvTreeListEntry*,bool> m_aPreExpandHandler; // handler to be called before a node is expanded
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(SelectHdl, weld::TreeView&, void);
+ DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
+ DECL_LINK(DragBeginHdl, bool&, bool);
+
+ private:
+ Timer m_aTimer; // is needed for table updates
+ rtl::Reference<TransferDataContainer> m_xHelper;
+
Link<LinkParamNone*,void> m_aSelChangeHdl; // handler to be called (asynchronously) when the selection changes in any way
Link<LinkParamNone*,void> m_aCopyHandler; // called when someone press CTRL+C
Link<LinkParamNone*,void> m_aPasteHandler; // called when someone press CTRL+V
Link<LinkParamNone*,void> m_aDeleteHandler; // called when someone press DELETE Key
- Link<DBTreeListBox*,void> m_aEnterKeyHdl;
- private:
- void init();
- DECL_LINK( OnTimeOut, Timer*, void );
- DECL_LINK( OnResetEntryHdl, void*, void );
- DECL_LINK( ScrollUpHdl, LinkParamNone*, void );
- DECL_LINK( ScrollDownHdl, LinkParamNone*, void );
- DECL_LINK( MenuEventListener, VclMenuEvent&, void );
+ DECL_LINK(OnTimeOut, Timer*, void);
- public:
- DBTreeListBox( vcl::Window* pParent, WinBits nWinStyle);
- virtual ~DBTreeListBox() override;
- virtual void dispose() override;
+ protected:
+ void implStopSelectionTimer();
+ void implStartSelectionTimer();
- void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
- void setContextMenuProvider( IContextMenuProvider* _pContextMenuProvider ) { m_pContextMenuProvider = _pContextMenuProvider; }
+ virtual bool DoChildKeyInput(const KeyEvent& rKEvt);
- void SetPreExpandHandler(const Link<SvTreeListEntry*,bool>& _rHdl) { m_aPreExpandHandler = _rHdl; }
- void SetSelChangeHdl( const Link<LinkParamNone*,void>& _rHdl ) { m_aSelChangeHdl = _rHdl; }
- void setCopyHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aCopyHandler = _rHdl; }
- void setPasteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aPasteHandler = _rHdl; }
- void setDeleteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aDeleteHandler = _rHdl; }
+ public:
+ TreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bSQLType);
+ virtual ~TreeListBox();
- // modified the given entry so that the expand handler is called whenever the entry is expanded
- // (normally, the expand handler is called only once)
- void EnableExpandHandler(SvTreeListEntry* _pEntry);
+ std::unique_ptr<weld::TreeIter> GetEntryPosByName(std::u16string_view rName,
+ const weld::TreeIter* pStart = nullptr,
+ const IEntryFilter* pFilter = nullptr) const;
- SvTreeListEntry* GetEntryPosByName( const OUString& aName, SvTreeListEntry* pStart = nullptr, const IEntryFilter* _pFilter = nullptr ) const;
- virtual void RequestingChildren( SvTreeListEntry* pParent ) override;
- virtual void SelectHdl() override;
- virtual void DeselectHdl() override;
- // Window
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ std::unique_ptr<weld::TreeIter> GetRootLevelParent(const weld::TreeIter* pEntry) const;
- virtual void StateChanged( StateChangedType nStateChange ) override;
- virtual void InitEntry(SvTreeListEntry* pEntry, const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp) override;
+ void setControlActionListener(IControlActionListener* pListener) { m_pActionListener = pListener; }
+ void setContextMenuProvider(IContextMenuProvider* pContextMenuProvider) { m_pContextMenuProvider = pContextMenuProvider; }
- // enable editing for tables/views and queries
- virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& ) override;
- virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) override;
+ weld::TreeView& GetWidget() { return *m_xTreeView; }
+ const weld::TreeView& GetWidget() const { return *m_xTreeView; }
- virtual bool DoubleClickHdl() override;
+ TransferDataContainer& GetDataTransfer() { return *m_xHelper; }
- virtual VclPtr<PopupMenu> CreateContextMenu() override;
+ sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
+ sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
- void SetEnterKeyHdl(const Link<DBTreeListBox*,void>& rNewHdl) {m_aEnterKeyHdl = rNewHdl;}
+ void SetSelChangeHdl( const Link<LinkParamNone*,void>& _rHdl ) { m_aSelChangeHdl = _rHdl; }
+ void setCopyHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aCopyHandler = _rHdl; }
+ void setPasteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aPasteHandler = _rHdl; }
+ void setDeleteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aDeleteHandler = _rHdl; }
+ };
- void clearCurrentSelection() { m_aSelectedEntries.clear(); }
+ class InterimDBTreeListBox : public InterimItemWindow
+ , public TreeListBox
+ {
+ private:
+ std::unique_ptr<weld::Label> m_xStatusBar;
+ public:
+ InterimDBTreeListBox(vcl::Window* pParent);
+ virtual void dispose() override;
+ weld::Label& GetStatusBar() { return *m_xStatusBar; }
+ virtual ~InterimDBTreeListBox() override;
+ void show_container() { m_xContainer->show(); }
+ protected:
+ virtual bool DoChildKeyInput(const KeyEvent& rKEvt) override;
+ };
+ class DBTreeViewBase
+ {
protected:
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
- virtual void RequestHelp( const HelpEvent& rHEvt ) override;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<TreeListBox> m_xTreeListBox;
+ public:
+ DBTreeViewBase(weld::Container* pContainer);
+ virtual ~DBTreeViewBase();
- // DragSourceHelper overridables
- virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
- // DropTargetHelper overridables
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ) override;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ) override;
+ weld::TreeView& GetWidget() { return m_xTreeListBox->GetWidget(); }
+ const weld::TreeView& GetWidget() const { return m_xTreeListBox->GetWidget(); }
- virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
- virtual void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
+ TreeListBox& getListBox() const { return *m_xTreeListBox; }
- void implStopSelectionTimer();
- void implStartSelectionTimer();
+ void hide() { m_xContainer->hide(); }
+ void show() { m_xContainer->show(); }
+ bool get_visible() const { return m_xContainer->get_visible(); }
+ };
- protected:
- using SvTreeListBox::ExecuteDrop;
+ class DBTreeView final : public DBTreeViewBase
+ {
+ public:
+ DBTreeView(weld::Container* pContainer, bool bSQLType);
};
-}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBTREELISTBOX_HXX
+ class DBTableTreeView final : public DBTreeViewBase
+ {
+ public:
+ DBTableTreeView(weld::Container* pContainer);
+ };
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbu_dlg.hxx b/dbaccess/source/ui/inc/dbu_dlg.hxx
index 02e7034b251c..ed97c4c937b5 100644
--- a/dbaccess/source/ui/inc/dbu_dlg.hxx
+++ b/dbaccess/source/ui/inc/dbu_dlg.hxx
@@ -16,12 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBU_DLG_HRC
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DBU_DLG_HRC
+#pragma once
-#define WIZARD_PAGE_X 56
-#define WIZARD_PAGE_Y 30
-
-#endif
+#define WIZARD_PAGE_X 56
+#define WIZARD_PAGE_Y 30
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index 776d19b52ba8..985735ce3e0c 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -17,28 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZ_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZ_HXX
+#pragma once
#include <dsntypes.hxx>
#include "IItemSetHelper.hxx"
#include <vcl/wizardmachine.hxx>
#include <memory>
-namespace com::sun::star {
- namespace beans {
- class XPropertySet;
- }
- namespace sdbc {
- class XConnection;
- }
- namespace lang {
- class XMultiServiceFactory;
- }
-}
-
using vcl::WizardTypes::WizardState;
-using vcl::WizardTypes::CommitPageReason;
namespace dbaccess
{
@@ -99,6 +85,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZ_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index e204dc1f49ba..abad4671bf42 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -17,29 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZSETUP_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZSETUP_HXX
+#pragma once
#include <dsntypes.hxx>
#include "IItemSetHelper.hxx"
#include <tools/urlobj.hxx>
#include <memory>
-#include <vcl/roadmapwizard.hxx>
+#include <vcl/roadmapwizardmachine.hxx>
namespace com::sun::star {
namespace beans {
class XPropertySet;
}
- namespace sdbc {
- class XConnection;
- }
- namespace lang {
- class XMultiServiceFactory;
- }
}
using vcl::WizardTypes::WizardState;
-using vcl::WizardTypes::CommitPageReason;
using vcl::RoadmapWizardTypes::PathId;
namespace dbaui
@@ -73,6 +65,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;
@@ -148,7 +141,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);
@@ -168,6 +161,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZSETUP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx b/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
index e86f2575cf8c..46b5606844bf 100644
--- a/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
+++ b/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
@@ -17,28 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX
+#pragma once
#include "objectnamecheck.hxx"
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
-
-#include <memory>
+#include <com/sun/star/sdb/tools/XObjectNames.hpp>
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
@@ -68,7 +66,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.
@@ -85,7 +82,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
@@ -118,6 +116,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index a58cfde7836a..4d141d8a2f02 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -17,37 +17,24 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
+#pragma once
#include <sal/config.h>
-#include <comphelper/syntaxhighlight.hxx>
-#include <sal/log.hxx>
-#include <svtools/colorcfg.hxx>
-#include <vcl/timer.hxx>
#include <vcl/weld.hxx>
#include <deque>
+#include <string_view>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <unotools/eventlisteneradapter.hxx>
#include <osl/mutex.hxx>
-#include <svx/weldeditview.hxx>
+#include "sqledit.hxx"
struct ImplSVEvent;
namespace dbaui
{
- class SQLEditView : public WeldEditView
- {
- private:
- void DoBracketHilight(sal_uInt16 nKey);
- public:
- SQLEditView();
- virtual bool KeyInput(const KeyEvent& rKEvt) override;
- };
-
// DirectSQLDialog
class DirectSQLDialog final
: public weld::GenericDialogController
@@ -58,22 +45,18 @@ namespace dbaui
std::unique_ptr<weld::Button> m_xExecute;
std::unique_ptr<weld::ComboBox> m_xSQLHistory;
std::unique_ptr<weld::TextView> m_xStatus;
+ std::unique_ptr<weld::CheckButton> m_xDirectSQL;
std::unique_ptr<weld::CheckButton> m_xShowOutput;
std::unique_ptr<weld::TextView> m_xOutput;
std::unique_ptr<weld::Button> m_xClose;
std::unique_ptr<SQLEditView> m_xSQL;
std::unique_ptr<weld::CustomWeld> m_xSQLEd;
- Timer m_aUpdateDataTimer;
- const SyntaxHighlighter m_aHighlighter;
- const svtools::ColorConfig m_aColorConfig;
-
typedef std::deque< OUString > StringQueue;
StringQueue m_aStatementHistory; // previous statements
StringQueue m_aNormalizedHistory; // previous statements, normalized to be used in the list box
sal_Int32 m_nStatusCount;
- bool m_bInUpdate;
css::uno::Reference< css::sdbc::XConnection >
m_xConnection;
@@ -93,10 +76,6 @@ namespace dbaui
void executeCurrent();
void switchToHistory(sal_Int32 _nHistoryPos);
- Color GetColorValue(TokenType aToken);
-
- void UpdateData();
-
// OEventListenerAdapter
virtual void _disposing( const css::lang::EventObject& _rSource ) override;
@@ -105,10 +84,9 @@ namespace dbaui
DECL_LINK( OnCloseClick, weld::Button&, void );
DECL_LINK( OnListEntrySelected, weld::ComboBox&, void );
DECL_LINK( OnStatementModified, LinkParamNone*, void );
- DECL_LINK( ImplUpdateDataHdl, Timer*, void );
/// adds a statement to the statement history
- void implAddToStatementHistory(const OUString& _rStatement);
+ void implAddToStatementHistory(const OUString& _rStatement, const bool bFromMemory = false);
/// ensures that our history has at most m_nHistoryLimit entries
void implEnsureHistoryLimit();
@@ -117,10 +95,10 @@ namespace dbaui
void implExecuteStatement(const OUString& _rStatement);
/// adds a status text to the status list
- void addStatusText(const OUString& _rMessage);
+ void addStatusText(std::u16string_view _rMessage);
/// adds a status text to the output list
- void addOutputText(const OUString& _rMessage);
+ void addOutputText(std::u16string_view _rMessage);
/// displays resultset
void display(const css::uno::Reference< css::sdbc::XResultSet >& xRS);
@@ -130,19 +108,6 @@ namespace dbaui
#endif
};
-#ifdef DBG_UTIL
-#define CHECK_INVARIANTS(methodname) \
- { \
- const char* pError = impl_CheckInvariants(); \
- if (pError) \
- SAL_WARN("dbaccess.ui", methodname ": " << pError); \
- }
-#else
-#define CHECK_INVARIANTS(methodname)
-#endif
-
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dlgattr.hxx b/dbaccess/source/ui/inc/dlgattr.hxx
index 6be420776208..83fe0466e4f8 100644
--- a/dbaccess/source/ui/inc/dlgattr.hxx
+++ b/dbaccess/source/ui/inc/dlgattr.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DLGATTR_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DLGATTR_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -32,13 +31,11 @@ namespace dbaui
std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem;
public:
- SbaSbAttrDlg(weld::Window * pParent, const SfxItemSet*, SvNumberFormatter*, bool bHasFormat);
+ 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
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DLGATTR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dlgsave.hxx b/dbaccess/source/ui/inc/dlgsave.hxx
index 598cbfb7cc7f..f3b33a278500 100644
--- a/dbaccess/source/ui/inc/dlgsave.hxx
+++ b/dbaccess/source/ui/inc/dlgsave.hxx
@@ -17,9 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSAVE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSAVE_HXX
+#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>
@@ -43,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,
@@ -78,7 +96,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSAVE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dlgsize.hxx b/dbaccess/source/ui/inc/dlgsize.hxx
index 0d27ba5439ee..5a673d7122b3 100644
--- a/dbaccess/source/ui/inc/dlgsize.hxx
+++ b/dbaccess/source/ui/inc/dlgsize.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSIZE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSIZE_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -30,7 +29,7 @@ namespace dbaui
sal_Int32 m_nPrevValue;
void SetValue( sal_Int32 nVal );
- DECL_LINK(CbClickHdl, weld::ToggleButton&, void);
+ DECL_LINK(CbClickHdl, weld::Toggleable&, void);
std::unique_ptr<weld::MetricSpinButton> m_xMF_VALUE;
std::unique_ptr<weld::CheckButton> m_xCB_STANDARD;
@@ -42,6 +41,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSIZE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
index 9d05d0adf728..9d2d3544325c 100644
--- a/dbaccess/source/ui/inc/dsitems.hxx
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -17,82 +17,86 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DSITEMS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DSITEMS_HXX
+#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
-
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DSITEMS_HXX
+#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 b6b7ab997e74..f1e5ca6fb7a9 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DSMETA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_DSMETA_HXX
+#pragma once
#include <sal/config.h>
@@ -28,8 +27,6 @@
#include <rtl/ustring.hxx>
-#include <memory>
-
namespace dbaui
{
@@ -43,7 +40,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
@@ -66,7 +62,7 @@ namespace dbaui
static AuthenticationMode getAuthentication( const OUString& _sURL );
private:
- std::shared_ptr< DataSourceMetaData_Impl > m_pImpl;
+ OUString m_sURL;
};
// FeatureSet
@@ -81,7 +77,7 @@ namespace dbaui
FeatureSet() { }
void put( const ItemID _id ) { m_aContent.insert( _id ); }
- bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); }
+ bool has( const ItemID _id ) const { return m_aContent.contains( _id ); }
inline bool supportsAnySpecialSetting() const;
inline bool supportsGeneratedValues() const;
@@ -123,6 +119,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DSMETA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/exsrcbrw.hxx b/dbaccess/source/ui/inc/exsrcbrw.hxx
index 6a480d7238b1..0ecda1ed647e 100644
--- a/dbaccess/source/ui/inc/exsrcbrw.hxx
+++ b/dbaccess/source/ui/inc/exsrcbrw.hxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_EXSRCBRW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_EXSRCBRW_HXX
+#pragma once
#include "brwctrlr.hxx"
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/uno3.hxx>
// SbaExternalSourceBrowser
@@ -33,9 +33,9 @@ namespace dbaui
:public SbaXDataBrowserController
,public css::util::XModifyBroadcaster
{
- ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
// for multiplexing the modify events
- SbaXFormAdapter* m_pDataSourceImpl;
+ rtl::Reference<SbaXFormAdapter> m_pDataSourceImpl;
bool m_bInQueryDispatch;
// our queryDispatch will ask our frame, which first will ask our queryDispatch, so we need to protect against
// recursion
@@ -93,6 +93,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_EXSRCBRW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/formadapter.hxx b/dbaccess/source/ui/inc/formadapter.hxx
index 3394aa2fe2a1..ca3394db5b56 100644
--- a/dbaccess/source/ui/inc/formadapter.hxx
+++ b/dbaccess/source/ui/inc/formadapter.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FORMADAPTER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_FORMADAPTER_HXX
+#pragma once
#include "sbamultiplex.hxx"
@@ -54,6 +53,7 @@
#include <com/sun/star/io/XPersistObject.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/util/XCancellable.hpp>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/implbase12.hxx>
@@ -76,8 +76,7 @@ namespace dbaui
// --- stardiv::one::form::component::DatabaseForm ---
, css::sdbc::XParameters
, css::sdbcx::XDeleteRows
- > SbaXFormAdapter_BASE1;
- typedef ::cppu::ImplHelper12 < css::sdbc::XWarningsSupplier
+ , css::sdbc::XWarningsSupplier
, css::sdbc::XCloseable
, css::form::XLoadable
, css::sdb::XSQLErrorBroadcaster
@@ -92,8 +91,7 @@ namespace dbaui
// already present : css::form::XFormComponent (base of css::form::XForm)
, css::beans::XMultiPropertySet
, css::container::XNamed
- > SbaXFormAdapter_BASE2;
- typedef ::cppu::ImplHelper10 < css::io::XPersistObject
+ , css::io::XPersistObject
, css::beans::XPropertySet
// --- stardiv::one::data::DatabaseCursor ---
, css::util::XCancellable
@@ -111,12 +109,10 @@ namespace dbaui
, css::container::XEnumerationAccess
// interfaces we need because of other reasons
, css::beans::XPropertyChangeListener
- > SbaXFormAdapter_BASE3;
+ > SbaXFormAdapter_BASE;
class SbaXFormAdapter final
- :public SbaXFormAdapter_BASE1
- ,public SbaXFormAdapter_BASE2
- ,public SbaXFormAdapter_BASE3
+ :public SbaXFormAdapter_BASE
{
private:
css::uno::Reference< css::sdbc::XRowSet > m_xMainForm;
@@ -134,8 +130,8 @@ namespace dbaui
SbaXVetoableChangeMultiplexer m_aVetoablePropertyChangeListeners;
SbaXPropertiesChangeMultiplexer m_aPropertiesChangeListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aDisposeListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_aDisposeListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
// hierarchy administration
css::uno::Reference< css::uno::XInterface > m_xParent;
@@ -158,14 +154,6 @@ namespace dbaui
void AttachForm(const css::uno::Reference< css::sdbc::XRowSet >& xNewMaster);
- // UNO
- DECLARE_UNO3_DEFAULTS(SbaXFormAdapter, SbaXFormAdapter_BASE1)
- virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
-
- // XTypeProvider
- virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
- virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
-
// css::sdbc::XCloseable
virtual void SAL_CALL close() override;
@@ -432,6 +420,5 @@ namespace dbaui
void StartListening();
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_FORMADAPTER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/imageprovider.hxx b/dbaccess/source/ui/inc/imageprovider.hxx
index 1f267818a592..5249fb0091fe 100644
--- a/dbaccess/source/ui/inc/imageprovider.hxx
+++ b/dbaccess/source/ui/inc/imageprovider.hxx
@@ -17,20 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_IMAGEPROVIDER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_IMAGEPROVIDER_HXX
-
-#include <vcl/image.hxx>
+#pragma once
#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
@@ -39,9 +34,6 @@ namespace dbaui
*/
class ImageProvider
{
- private:
- std::shared_ptr< ImageProvider_Data > m_pData;
-
public:
/** creates a semi-functional ImageProvider instance
@@ -66,17 +58,9 @@ namespace dbaui
constants.
@param _rName
the name of the object
- @param _out_rImage
- the normal image to use for the object
@return
- the image to be used for the object.
+ the name of the image to be used for the object.
*/
- void getImages(
- const OUString& _rName,
- const sal_Int32 _nDatabaseObjectType,
- Image& _out_rImage
- );
-
OUString getImageId(
const OUString& _rName,
const sal_Int32 _nDatabaseObjectType
@@ -86,25 +70,9 @@ namespace dbaui
css::uno::Reference<css::graphic::XGraphic> getXGraphic(const OUString& _rName,
const sal_Int32 _nDatabaseObjectType);
- /** returns the default image to be used for a database object
-
- In opposite to getImages, this method does not check the concrete object
- for its image, but returns a default image to be used for all objects of the given
- type.
-
- @param _nDatabaseObjectType
- the type of the object. Must be one of the css.sdb.application.DatabaseObject
- constants.
- @return
- the image to be used for the object type.
- */
- static Image getDefaultImage(
- sal_Int32 _nDatabaseObjectType
- );
-
/** returns the resource ID for the default image to be used for a database object
- In opposite to getImages, this method does not check the concrete object
+ In opposite to getImageId, this method does not check the concrete object
for its image, but returns a default image to be used for all objects of the given
type.
@@ -116,18 +84,6 @@ namespace dbaui
*/
static OUString getDefaultImageResourceID(sal_Int32 _nDatabaseObjectType);
- /** retrieves the image to be used for folders of database objects
- @param _nDatabaseObjectType
- the type of the object. Must be one of the css.sdb.application.DatabaseObject
- constants.
- @param _rName
- the name of the object
- @return
- the image to be used for folders of the given type
- */
- static Image getFolderImage(
- sal_Int32 _nDatabaseObjectType
- );
static OUString getFolderImageId(
sal_Int32 _nDatabaseObjectType
);
@@ -136,11 +92,16 @@ namespace dbaui
@return
the image to be used for folders of this type
*/
- static Image getDatabaseImage();
+ static const 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
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_IMAGEPROVIDER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexcollection.hxx b/dbaccess/source/ui/inc/indexcollection.hxx
index d58a4c180cef..3d227b0b3869 100644
--- a/dbaccess/source/ui/inc/indexcollection.hxx
+++ b/dbaccess/source/ui/inc/indexcollection.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXCOLLECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXCOLLECTION_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -30,7 +29,6 @@ namespace dbaui
// OIndexCollection
class OIndexCollection
{
- protected:
css::uno::Reference< css::container::XNameAccess >
m_xIndexes;
@@ -92,6 +90,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXCOLLECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx
index 00357f903a76..b3ba37936e79 100644
--- a/dbaccess/source/ui/inc/indexdialog.hxx
+++ b/dbaccess/source/ui/inc/indexdialog.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -75,10 +74,10 @@ 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::Button&, void );
+ DECL_LINK( OnModifiedClick, weld::Toggleable&, void );
DECL_LINK( OnModified, IndexFieldsControl&, void );
DECL_LINK( OnCloseDialog, weld::Button&, void );
@@ -101,6 +100,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexes.hxx b/dbaccess/source/ui/inc/indexes.hxx
index 0a54aff7ec17..068a5dec5026 100644
--- a/dbaccess/source/ui/inc/indexes.hxx
+++ b/dbaccess/source/ui/inc/indexes.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXES_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXES_HXX
+#pragma once
#include <sal/config.h>
@@ -32,9 +31,7 @@ namespace dbaui
struct OIndexField
{
OUString sFieldName;
- bool bSortAscending;
-
- OIndexField() : bSortAscending(true) { }
+ bool bSortAscending = true;
};
typedef std::vector<OIndexField> IndexFields;
@@ -79,6 +76,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexfieldscontrol.hxx b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
index b09723d570f5..90ae7172e3df 100644
--- a/dbaccess/source/ui/inc/indexfieldscontrol.hxx
+++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
+#pragma once
#include <svtools/editbrowsebox.hxx>
#include <com/sun/star/awt/XWindow.hpp>
@@ -55,7 +54,7 @@ namespace dbaui
void Init(const css::uno::Sequence< OUString >& _rAvailableFields, bool _bAddIndexAppendix);
- void initializeFrom(const IndexFields& _rFields);
+ void initializeFrom(IndexFields&& _rFields);
void commitTo(IndexFields& _rFields);
bool SaveModified() override;
@@ -65,20 +64,20 @@ namespace dbaui
void SaveValue() { m_aSavedValue = m_aFields; }
void SetModifyHdl(const Link<IndexFieldsControl&,void>& _rHdl) { m_aModifyHdl = _rHdl; }
- virtual OUString GetCellText(long _nRow,sal_uInt16 nColId) const override;
+ virtual OUString GetCellText(sal_Int32 _nRow,sal_uInt16 nColId) const override;
private:
// EditBrowseBox overridables
virtual void PaintCell( OutputDevice& _rDev, const tools::Rectangle& _rRect, sal_uInt16 _nColumnId ) const override;
- virtual bool SeekRow(long nRow) override;
- virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) override;
+ virtual bool SeekRow(sal_Int32 nRow) override;
+ virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
virtual bool IsTabAllowed(bool bForward) const override;
- ::svt::CellController* GetController(long _nRow, sal_uInt16 _nColumnId) override;
- void InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId) override;
+ ::svt::CellController* GetController(sal_Int32 _nRow, sal_uInt16 _nColumnId) override;
+ void InitController(::svt::CellControllerRef&, sal_Int32 _nRow, sal_uInt16 _nColumnId) override;
OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
- bool implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos);
+ bool implGetFieldDesc(sal_Int32 _nRow, IndexFields::const_iterator& _rPos);
bool isNewField() const { return GetCurRow() >= static_cast<sal_Int32>(m_aFields.size()); }
@@ -89,6 +88,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx
index 0a18bdcd2fa8..5bb5d87cb484 100644
--- a/dbaccess/source/ui/inc/linkeddocuments.hxx
+++ b/dbaccess/source/ui/inc/linkeddocuments.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_LINKEDDOCUMENTS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_LINKEDDOCUMENTS_HXX
+#pragma once
#include "AppElementType.hxx"
@@ -54,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();
@@ -95,17 +94,10 @@ namespace dbaui
const ::comphelper::NamedValueCollection& _rAdditionalArgs
);
- void
- impl_newWithPilot(
- const char* _pWizardService,
- const sal_Int32 _nCommandType,
- const OUString& _rObjectName
- );
-
+ void impl_newWithPilot(const OUString& rWizardService, const sal_Int32 _nCommandType,
+ const OUString& _rObjectName);
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_LINKEDDOCUMENTS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/listviewitems.hxx b/dbaccess/source/ui/inc/listviewitems.hxx
deleted file mode 100644
index 47b231272804..000000000000
--- a/dbaccess/source/ui/inc/listviewitems.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_LISTVIEWITEMS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_LISTVIEWITEMS_HXX
-
-#include <vcl/svlbitm.hxx>
-
-namespace dbaui
-{
-
- // OBoldListboxString
- class OBoldListboxString : public SvLBoxString
- {
- bool m_bEmphasized;
-
- public:
- OBoldListboxString(const OUString& _rStr)
- :SvLBoxString(_rStr)
- ,m_bEmphasized(false)
- {
- }
-
- virtual SvLBoxItemType GetType() const override;
-
- virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override;
- virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* _pViewData = nullptr) override;
-
- bool isEmphasized() const { return m_bEmphasized; }
- void emphasize(bool _bEmphasize) { m_bEmphasized = _bEmphasize; }
- };
-
-} // namespace dbaui
-
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_LISTVIEWITEMS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/marktree.hxx b/dbaccess/source/ui/inc/marktree.hxx
deleted file mode 100644
index 5eeece39d7ae..000000000000
--- a/dbaccess/source/ui/inc/marktree.hxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_MARKTREE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_MARKTREE_HXX
-
-#include "dbtreelistbox.hxx"
-
-#include <vcl/svlbitm.hxx>
-
-namespace dbaui
-{
-
-// OMarkableTreeListBox
-/** a tree list box where all entries can be marked (with a checkbox) and
- unmarked. In addition, inner nodes know a third state which applies
- if some, but not all of their descendants are marked.
-*/
-class OMarkableTreeListBox : public DBTreeListBox
-{
- std::unique_ptr<SvLBoxButtonData> m_pCheckButton;
-
-public:
- OMarkableTreeListBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~OMarkableTreeListBox() override;
- virtual void dispose() override;
-
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
- virtual void CheckButtonHdl() override;
- void CheckButtons(); // make the button states consistent (bottom-up)
-
-protected:
- virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect) override;
- virtual void checkedButton_noBroadcast(SvTreeListEntry* _pEntry);
-
- SvButtonState implDetermineState(SvTreeListEntry* _pEntry);
- // determines the check state of the given entry, by analyzing the states of all descendants
-
-private:
- void InitButtonData();
-};
-
-} // namespace dbaui
-
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_MARKTREE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/objectnamecheck.hxx b/dbaccess/source/ui/inc/objectnamecheck.hxx
index 602b822c476a..52f639e534a1 100644
--- a/dbaccess/source/ui/inc/objectnamecheck.hxx
+++ b/dbaccess/source/ui/inc/objectnamecheck.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_OBJECTNAMECHECK_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_OBJECTNAMECHECK_HXX
+#pragma once
#include <rtl/ustring.hxx>
@@ -55,6 +54,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_OBJECTNAMECHECK_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/opendoccontrols.hxx b/dbaccess/source/ui/inc/opendoccontrols.hxx
index 9ab29b624dee..d2cca5281111 100644
--- a/dbaccess/source/ui/inc/opendoccontrols.hxx
+++ b/dbaccess/source/ui/inc/opendoccontrols.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <rtl/ustring.hxx>
@@ -35,18 +34,12 @@ namespace dbaui
class OpenDocumentButton
{
private:
- OUString m_sModule;
-
std::unique_ptr<weld::Button> m_xControl;
public:
- OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const char* _pAsciiModuleName);
+ OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const OUString& _rAsciiModuleName);
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
- bool get_sensitive() const { return m_xControl->get_sensitive(); }
void connect_clicked(const Link<weld::Button&, void>& rLink) { m_xControl->connect_clicked(rLink); }
-
- private:
- void impl_init( const char* _pAsciiModuleName );
};
// OpenDocumentListBox
@@ -65,20 +58,16 @@ namespace dbaui
OUString GetSelectedDocumentURL() const;
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
- bool get_sensitive() const { return m_xControl->get_sensitive(); }
- void grab_focus() { m_xControl->grab_focus(); }
int get_count() const { return m_xControl->get_count(); }
void set_active(int nPos) { m_xControl->set_active(nPos); }
void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
private:
- StringPair impl_getDocumentAtIndex( sal_uInt16 _nListIndex ) const;
+ const StringPair & impl_getDocumentAtIndex( sal_uInt16 _nListIndex ) const;
void impl_init( const char* _pAsciiModuleName );
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/paramdialog.hxx b/dbaccess/source/ui/inc/paramdialog.hxx
index 201aabe29d25..5c7044ebbd60 100644
--- a/dbaccess/source/ui/inc/paramdialog.hxx
+++ b/dbaccess/source/ui/inc/paramdialog.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_PARAMDIALOG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_PARAMDIALOG_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <vcl/timer.hxx>
@@ -31,11 +30,6 @@
#include <svx/ParseContext.hxx>
#include <o3tl/typed_flags_set.hxx>
-namespace connectivity
-{
- class OSQLParseNode;
-}
-
enum class VisitFlags {
NONE = 0x00,
Visited = 0x01,
@@ -101,6 +95,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_PARAMDIALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/propertystorage.hxx b/dbaccess/source/ui/inc/propertystorage.hxx
index 51732053adf9..35d9f24d6e34 100644
--- a/dbaccess/source/ui/inc/propertystorage.hxx
+++ b/dbaccess/source/ui/inc/propertystorage.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_PROPERTYSTORAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_PROPERTYSTORAGE_HXX
+#pragma once
#include <com/sun/star/uno/Any.hxx>
#include <map>
@@ -52,6 +51,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_PROPERTYSTORAGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx
index 607a38c82920..12583ec0c065 100644
--- a/dbaccess/source/ui/inc/querycontainerwindow.hxx
+++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYCONTAINERWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYCONTAINERWINDOW_HXX
+#pragma once
#include <vcl/window.hxx>
#include <vcl/split.hxx>
@@ -76,7 +75,7 @@ namespace dbaui
void clear() { m_pViewSwitch->clear(); }
bool isSlotEnabled( sal_Int32 _nSlotId ) { return m_pViewSwitch->isSlotEnabled( _nSlotId ); }
void setSlotEnabled( sal_Int32 _nSlotId, bool _bEnable ) { m_pViewSwitch->setSlotEnabled( _nSlotId, _bEnable ); }
- void setNoneVisbleRow(sal_Int32 _nRows) { m_pViewSwitch->setNoneVisbleRow( _nRows); }
+ void setNoneVisibleRow(sal_Int32 _nRows) { m_pViewSwitch->setNoneVisibleRow( _nRows); }
bool checkStatement() { return m_pViewSwitch->checkStatement( ); }
OUString getStatement() { return m_pViewSwitch->getStatement( ); }
@@ -102,6 +101,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYCONTAINERWINDOW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index dae1bffe9013..d4347e47d58d 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -17,15 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYCONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYCONTROLLER_HXX
+#pragma once
#include "JoinController.hxx"
#include "querycontainerwindow.hxx"
#include <svx/ParseContext.hxx>
#include "TableFieldDescription.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
#include <com/sun/star/sdbcx/XAlterView.hpp>
@@ -43,8 +41,6 @@ namespace comphelper
namespace dbaui
{
- class OQueryContainerWindow;
-
typedef ::comphelper::OPropertyContainer OQueryController_PBase;
typedef ::comphelper::OPropertyArrayUsageHelper< OQueryController > OQueryController_PABase;
class OQueryController :public OJoinController
@@ -189,7 +185,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
@@ -215,6 +211,5 @@ namespace dbaui
using OQueryController_PBase::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYCONTROLLER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/queryfilter.hxx b/dbaccess/source/ui/inc/queryfilter.hxx
index b7917fdeb526..396778f22997 100644
--- a/dbaccess/source/ui/inc/queryfilter.hxx
+++ b/dbaccess/source/ui/inc/queryfilter.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYFILTER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYFILTER_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <connectivity/sqliterator.hxx>
@@ -26,32 +25,26 @@
#include <connectivity/predicateinput.hxx>
#include <svx/ParseContext.hxx>
-namespace com
-{
- namespace sun
+namespace com::sun::star {
+ namespace sdb
+ {
+ class XSingleSelectQueryComposer;
+ }
+ namespace sdbc
+ {
+ class XConnection;
+ class XDatabaseMetaData;
+ }
+ namespace container
{
- namespace star
- {
- namespace sdb
- {
- class XSingleSelectQueryComposer;
- }
- namespace sdbc
- {
- class XConnection;
- class XDatabaseMetaData;
- }
- namespace container
- {
- class XNameAccess;
- }
- namespace beans
- {
- struct PropertyValue;
- }
- }
+ class XNameAccess;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
}
}
+
// DlgFilterCrit
namespace dbaui
{
@@ -82,13 +75,13 @@ namespace dbaui
std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP3;
std::unique_ptr<weld::Entry> m_xET_WHEREVALUE3;
- static void SelectField(weld::ComboBox& rBox, const OUString& rField);
+ static void SelectField(weld::ComboBox& rBox, std::u16string_view rField);
DECL_LINK(ListSelectHdl, weld::ComboBox&, void);
DECL_LINK(ListSelectCompHdl, weld::ComboBox&, void);
void SetLine( int nIdx, const css::beans::PropertyValue& _rItem, bool _bOr );
void EnableLines();
- sal_Int32 GetOSQLPredicateType( const OUString& _rSelectedPredicate ) const;
+ sal_Int32 GetOSQLPredicateType( std::u16string_view _rSelectedPredicate ) const;
static sal_Int32 GetSelectionPos(sal_Int32 eType, const weld::ComboBox& rListBox);
bool getCondition(const weld::ComboBox& _rField, const weld::ComboBox& _rComp, const weld::Entry& _rValue, css::beans::PropertyValue& _rFilter) const;
void fillLines(int &i, const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& _aValues);
@@ -113,6 +106,4 @@ namespace dbaui
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYFILTER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/queryorder.hxx b/dbaccess/source/ui/inc/queryorder.hxx
index 2207be16a051..523d84f31fe7 100644
--- a/dbaccess/source/ui/inc/queryorder.hxx
+++ b/dbaccess/source/ui/inc/queryorder.hxx
@@ -16,32 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYORDER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYORDER_HXX
+#pragma once
#include <vcl/weld.hxx>
#define DOG_ROWS 3
-namespace com
-{
- namespace sun
+namespace com::sun::star{
+ namespace sdb
+ {
+ class XSingleSelectQueryComposer;
+ }
+ namespace sdbc
+ {
+ class XConnection;
+ }
+ namespace container
{
- namespace star
- {
- namespace sdb
- {
- class XSingleSelectQueryComposer;
- }
- namespace sdbc
- {
- class XConnection;
- }
- namespace container
- {
- class XNameAccess;
- }
- }
+ class XNameAccess;
}
}
@@ -85,6 +77,5 @@ namespace dbaui
void impl_initializeOrderList_nothrow();
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYORDER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 4e6e30e3cfef..dea84eae022d 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SBAGRID_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SBAGRID_HXX
+#pragma once
#include <svx/fmgridcl.hxx>
@@ -26,7 +25,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/util/URL.hpp>
-#include <comphelper/servicehelper.hxx>
+#include <comphelper/multiinterfacecontainer4.hxx>
#include <comphelper/uno3.hxx>
#include "sbamultiplex.hxx"
#include <svx/dataaccessdescriptor.hxx>
@@ -36,12 +35,6 @@
class SvNumberFormatter;
-namespace com::sun::star {
- namespace lang {
- class XMultiServiceFactory;
- }
-}
-
namespace dbaui
{
struct SbaURLCompare
@@ -49,7 +42,6 @@ namespace dbaui
bool operator() (const css::util::URL& x, const css::util::URL& y) const { return x.Complete == y.Complete; }
};
- class SbaXStatusMultiplexer;
class SbaXGridControl
:public FmXGridControl
,public css::frame::XDispatch
@@ -62,8 +54,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;
@@ -84,7 +76,7 @@ namespace dbaui
virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > & rToolkit, const css::uno::Reference< css::awt::XWindowPeer > & rParentPeer) override;
protected:
- virtual FmXGridPeer* imp_CreatePeer(vcl::Window* pParent) override;
+ virtual rtl::Reference<FmXGridPeer> imp_CreatePeer(vcl::Window* pParent) override;
};
// SbaXGridPeer
@@ -93,22 +85,20 @@ namespace dbaui
:public FmXGridPeer
,public css::frame::XDispatch
{
- cppu::OMultiTypeInterfaceContainerHelperVar<
- css::util::URL, void, SbaURLCompare> m_aStatusListeners;
+ comphelper::OMultiTypeInterfaceContainerHelperVar4< css::util::URL, css::frame::XStatusListener,
+ SbaURLCompare> m_aStatusListeners;
public:
SbaXGridPeer(const css::uno::Reference< css::uno::XComponentContext >&);
virtual ~SbaXGridPeer() override;
// UNO
- virtual void SAL_CALL acquire() throw() override { FmXGridPeer::acquire(); }
- virtual void SAL_CALL release() throw() override { FmXGridPeer::release(); }
+ virtual void SAL_CALL acquire() noexcept override { FmXGridPeer::acquire(); }
+ virtual void SAL_CALL release() noexcept override { FmXGridPeer::release(); }
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
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;
@@ -162,8 +152,10 @@ namespace dbaui
protected:
// FmGridHeader overridables
- virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu) override;
- virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult) override;
+ 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 OUString& rExecutionResult) override;
private:
// DragSourceHelper overridables
@@ -214,7 +206,7 @@ namespace dbaui
void SetMasterListener(SbaGridListener* pListener) { m_pMasterListener = pListener; }
- virtual void ActivateCell(long nRow, sal_uInt16 nCol, bool bSetCellFocus = true) override;
+ virtual void ActivateCell(sal_Int32 nRow, sal_uInt16 nCol, bool bSetCellFocus = true) override;
virtual void DeactivateCell(bool bUpdate = true) override;
using FmGridControl::ActivateCell;
@@ -230,7 +222,7 @@ namespace dbaui
@return
The description of the specified object.
*/
- virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
using FmGridControl::DeleteSelectedRows;
/** copies the currently selected rows to the clipboard
@@ -250,11 +242,11 @@ namespace dbaui
// EditBrowseBox overridables
virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
- virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) override;
+ virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override;
// DbGridControl overridables
- virtual void PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu) override;
- virtual void PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu& rMenu, sal_uInt16 nExecutionResult) override;
+ virtual void PreExecuteRowContextMenu(weld::Menu& rMenu) override;
+ virtual void PostExecuteRowContextMenu(const OUString& rExecutionResult) override;
// DbGridControl overridables
virtual void onRowChange() override;
@@ -287,6 +279,5 @@ namespace dbaui
using FmGridControl::MouseButtonDown;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SBAGRID_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sbamultiplex.hxx b/dbaccess/source/ui/inc/sbamultiplex.hxx
index c71c9cbbeea5..47fd753d4af6 100644
--- a/dbaccess/source/ui/inc/sbamultiplex.hxx
+++ b/dbaccess/source/ui/inc/sbamultiplex.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SBAMULTIPLEX_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SBAMULTIPLEX_HXX
+#pragma once
#include <com/sun/star/beans/XVetoableChangeListener.hpp>
#include <com/sun/star/form/XDatabaseParameterListener.hpp>
@@ -32,9 +31,8 @@
#include <com/sun/star/sdbc/XRowSetListener.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <comphelper/uno3.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-#include <comphelper/interfacecontainer2.hxx>
-#include <cppuhelper/queryinterface.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
#include <cppuhelper/weak.hxx>
namespace dbaui
@@ -48,350 +46,260 @@ namespace dbaui
public:
OSbaWeakSubObject(::cppu::OWeakObject& rParent) : m_rParent(rParent) { }
- virtual void SAL_CALL acquire() throw() override { m_rParent.acquire(); }
- virtual void SAL_CALL release() throw() override { m_rParent.release(); }
+ virtual void SAL_CALL acquire() noexcept override { m_rParent.acquire(); }
+ virtual void SAL_CALL release() noexcept override { m_rParent.release(); }
};
- // declaration of a listener multiplexer class
- #define BEGIN_DECLARE_LISTENER_MULTIPLEXER(classname, listenerclass) \
- class classname \
- :public OSbaWeakSubObject \
- ,public listenerclass \
- ,public ::comphelper::OInterfaceContainerHelper2 \
- { \
- public: \
- classname( ::cppu::OWeakObject& rSource, \
- ::osl::Mutex& rMutex); \
- DECLARE_UNO3_DEFAULTS(classname, OSbaWeakSubObject) \
- virtual css::uno::Any SAL_CALL queryInterface( \
- const css::uno::Type& _rType) override; \
- \
- /* css::lang::XEventListener */ \
- virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; \
-
- #define DECLARE_MULTIPLEXER_VOID_METHOD(methodname, eventtype) \
- virtual void SAL_CALL methodname(const eventtype& e) override; \
-
- #define DECLARE_MULTIPLEXER_BOOL_METHOD(methodname, eventtype) \
- virtual sal_Bool SAL_CALL methodname(const eventtype& e) override; \
-
- #define END_DECLARE_LISTENER_MULTIPLEXER() \
- /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */ \
- using OSbaWeakSubObject::operator new; \
- using OSbaWeakSubObject::operator delete; \
- }; \
-
- // implementation of a listener multiplexer class
-
- #define IMPLEMENT_LISTENER_MULTIPLEXER_CORE(classname, listenerclass) \
- \
- classname::classname(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex) \
- :OSbaWeakSubObject(rSource) \
- ,OInterfaceContainerHelper2(_rMutex) \
- { \
- } \
- \
- css::uno::Any SAL_CALL classname::queryInterface( \
- const css::uno::Type& _rType) \
- { \
- css::uno::Any aReturn = \
- OSbaWeakSubObject::queryInterface(_rType); \
- if (!aReturn.hasValue()) \
- aReturn = ::cppu::queryInterface(_rType, \
- static_cast< listenerclass* >(this), \
- static_cast< css::lang::XEventListener* >(static_cast< listenerclass* >(this)) \
- ); \
- \
- return aReturn; \
- } \
- void SAL_CALL classname::disposing(const css::lang::EventObject& )\
- { \
- } \
-
- #define IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(classname, listenerclass, methodname, eventtype) \
- void SAL_CALL classname::methodname(const eventtype& e) \
- { \
- eventtype aMulti(e); \
- aMulti.Source = &m_rParent; \
- ::comphelper::OInterfaceIteratorHelper2 aIt(*this); \
- while (aIt.hasMoreElements()) \
- static_cast< listenerclass*>(aIt.next())->methodname(aMulti); \
- } \
-
- #define IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(classname, listenerclass, methodname, eventtype) \
- sal_Bool SAL_CALL classname::methodname(const eventtype& e) \
- { \
- eventtype aMulti(e); \
- aMulti.Source = &m_rParent; \
- ::comphelper::OInterfaceIteratorHelper2 aIt(*this); \
- bool bResult = true; \
- while (bResult && aIt.hasMoreElements()) \
- bResult = static_cast< listenerclass*>(aIt.next())->methodname(aMulti); \
- return bResult; \
- } \
-
- // helper for classes which do event multiplexing
- #define IMPLEMENT_LISTENER_ADMINISTRATION(classname, listenernamespace, listenerdesc, multiplexer, broadcasterclass, broadcaster) \
- void SAL_CALL classname::add##listenerdesc(const css::uno::Reference< css::listenernamespace::X##listenerdesc >& l)\
- { \
- multiplexer.addInterface(l); \
- if (multiplexer.getLength() == 1) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->add##listenerdesc(&multiplexer); \
- } \
- } \
- void SAL_CALL classname::remove##listenerdesc(const css::uno::Reference< css::listenernamespace::X##listenerdesc >& l)\
- { \
- if (multiplexer.getLength() == 1) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->remove##listenerdesc(&multiplexer); \
- } \
- multiplexer.removeInterface(l); \
- } \
-
- #define STOP_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, broadcasterclass, broadcaster) \
- if (multiplexer.getLength()) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->remove##listenerdesc(&multiplexer); \
- } \
-
- #define START_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, broadcasterclass, broadcaster) \
- if (multiplexer.getLength()) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->add##listenerdesc(&multiplexer); \
- } \
-
- // declaration of property listener multiplexers
- // (with support for specialized and unspecialized property listeners)
-
- #define DECLARE_PROPERTY_MULTIPLEXER(classname, listenerclass, methodname, eventtype) \
- class classname final \
- :public OSbaWeakSubObject \
- ,public listenerclass \
- { \
- typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< \
- OUString > ListenerContainerMap; \
- ListenerContainerMap m_aListeners; \
- \
- public: \
- classname( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex ); \
- DECLARE_UNO3_DEFAULTS(classname, OSbaWeakSubObject) \
- virtual css::uno::Any SAL_CALL queryInterface( \
- const css::uno::Type& _rType) override; \
- \
- /* css::lang::XEventListener */ \
- virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; \
- \
- virtual void SAL_CALL methodname(const eventtype& e) override; \
- \
- void addInterface(const OUString& rName, const css::uno::Reference< css::uno::XInterface >& rListener); \
- void removeInterface(const OUString& rName, const css::uno::Reference< css::uno::XInterface >& rListener); \
- \
- void disposeAndClear(); \
- \
- sal_Int32 getOverallLen() const; \
- \
- ::cppu::OInterfaceContainerHelper* getContainer(const OUString& rName) \
- { return m_aListeners.getContainer(rName); } \
- \
- private: \
- void Notify(::cppu::OInterfaceContainerHelper& rListeners, const eventtype& e); \
- }; \
-
- // implementation of property listener multiplexers
- #define IMPLEMENT_PROPERTY_MULTIPLEXER(classname, listenerclass, methodname, eventtype) \
- classname::classname(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex) \
- :OSbaWeakSubObject(rSource) \
- ,m_aListeners(rMutex) \
- { \
- } \
- \
- css::uno::Any SAL_CALL classname::queryInterface( \
- const css::uno::Type& _rType) \
- { \
- css::uno::Any aReturn = \
- OSbaWeakSubObject::queryInterface(_rType); \
- if (!aReturn.hasValue()) \
- aReturn = ::cppu::queryInterface(_rType, \
- static_cast< listenerclass* >(this), \
- static_cast< css::lang::XEventListener* >(static_cast< listenerclass* >(this)) \
- ); \
- \
- return aReturn; \
- } \
- void SAL_CALL classname::disposing(const css::lang::EventObject& )\
- { \
- } \
- \
- void SAL_CALL classname::methodname(const eventtype& e) \
- { \
- ::cppu::OInterfaceContainerHelper* pListeners = m_aListeners.getContainer(e.PropertyName); \
- if (pListeners) \
- Notify(*pListeners, e); \
- \
- /* do the notification for the unspecialized listeners, too */ \
- pListeners = m_aListeners.getContainer(OUString()); \
- if (pListeners) \
- Notify(*pListeners, e); \
- } \
- \
- void classname::addInterface(const OUString& rName, \
- const css::uno::Reference< css::uno::XInterface > & rListener) \
- { \
- m_aListeners.addInterface(rName, rListener); \
- } \
- \
- void classname::removeInterface(const OUString& rName, \
- const css::uno::Reference< css::uno::XInterface > & rListener) \
- { \
- m_aListeners.removeInterface(rName, rListener); \
- } \
- \
- void classname::disposeAndClear() \
- { \
- css::lang::EventObject aEvt(m_rParent); \
- m_aListeners.disposeAndClear(aEvt); \
- } \
- \
- sal_Int32 classname::getOverallLen() const \
- { \
- sal_Int32 nLen = 0; \
- const css::uno::Sequence< OUString > aContained = m_aListeners.getContainedTypes(); \
- for ( OUString const & s : aContained) \
- { \
- ::cppu::OInterfaceContainerHelper* pListeners = m_aListeners.getContainer(s); \
- if (!pListeners) \
- continue; \
- nLen += pListeners->getLength(); \
- } \
- return nLen; \
- } \
- \
- void classname::Notify(::cppu::OInterfaceContainerHelper& rListeners, const eventtype& e) \
- { \
- eventtype aMulti(e); \
- aMulti.Source = &m_rParent; \
- ::cppu::OInterfaceIteratorHelper aIt(rListeners); \
- while (aIt.hasMoreElements()) \
- static_cast< listenerclass*>(aIt.next())->methodname(aMulti); \
- } \
-
- // helper for classes which do property event multiplexing
- #define IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(classname, listenerdesc, multiplexer, broadcasterclass, broadcaster) \
- void SAL_CALL classname::add##listenerdesc(const OUString& rName, const css::uno::Reference< css::beans::X##listenerdesc >& l )\
- { \
- multiplexer.addInterface(rName, l); \
- if (multiplexer.getOverallLen() == 1) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->add##listenerdesc(OUString(), &multiplexer); \
- } \
- } \
- void SAL_CALL classname::remove##listenerdesc(const OUString& rName, const css::uno::Reference< css::beans::X##listenerdesc >& l )\
- { \
- if (multiplexer.getOverallLen() == 1) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->remove##listenerdesc(OUString(), &multiplexer); \
- } \
- multiplexer.removeInterface(rName, l); \
- } \
-
- #define STOP_PROPERTY_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, broadcasterclass, broadcaster) \
- if (multiplexer.getOverallLen()) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->remove##listenerdesc(OUString(), &multiplexer); \
- } \
-
- #define START_PROPERTY_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, broadcasterclass, broadcaster) \
- if (multiplexer.getOverallLen()) \
- { \
- css::uno::Reference< broadcasterclass > xBroadcaster(broadcaster, css::uno::UNO_QUERY); \
- if (xBroadcaster.is()) \
- xBroadcaster->add##listenerdesc(OUString(), &multiplexer); \
- } \
-
// some listener multiplexers
// css::frame::XStatusListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXStatusMultiplexer, css::frame::XStatusListener)
- DECLARE_MULTIPLEXER_VOID_METHOD(statusChanged, css::frame::FeatureStateEvent)
+ class SbaXStatusMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::frame::XStatusListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::frame::XStatusListener>
+ {
+ public:
+ SbaXStatusMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXStatusMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& e) override;
private:
css::frame::FeatureStateEvent m_aLastKnownStatus;
- public: \
+ public:
const css::frame::FeatureStateEvent& getLastEvent( ) const { return m_aLastKnownStatus; }
- END_DECLARE_LISTENER_MULTIPLEXER()
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::form::XLoadListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXLoadMultiplexer, css::form::XLoadListener)
- DECLARE_MULTIPLEXER_VOID_METHOD(loaded, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(unloaded, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(unloading, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(reloading, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(reloaded, css::lang::EventObject)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXLoadMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XLoadListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XLoadListener>
+ {
+ public:
+ SbaXLoadMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXLoadMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL loaded(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL unloaded(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL unloading(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL reloading(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL reloaded(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::form::XDatabaseParameterListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXParameterMultiplexer, css::form::XDatabaseParameterListener)
- DECLARE_MULTIPLEXER_BOOL_METHOD(approveParameter, css::form::DatabaseParameterEvent)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXParameterMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XDatabaseParameterListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XDatabaseParameterListener>
+ {
+ public:
+ SbaXParameterMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXParameterMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveParameter(const css::form::DatabaseParameterEvent& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::form::XSubmitListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXSubmitMultiplexer, css::form::XSubmitListener)
- DECLARE_MULTIPLEXER_BOOL_METHOD(approveSubmit, css::lang::EventObject)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXSubmitMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XSubmitListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XSubmitListener>
+ {
+ public:
+ SbaXSubmitMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXSubmitMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveSubmit(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::form::XResetListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXResetMultiplexer, css::form::XResetListener)
- DECLARE_MULTIPLEXER_BOOL_METHOD(approveReset, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(resetted, css::lang::EventObject)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXResetMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XResetListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XResetListener>
+ {
+ public:
+ SbaXResetMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXResetMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveReset(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL resetted(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::sdbc::XRowSetListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXRowSetMultiplexer, css::sdbc::XRowSetListener)
- DECLARE_MULTIPLEXER_VOID_METHOD(cursorMoved, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(rowChanged, css::lang::EventObject)
- DECLARE_MULTIPLEXER_VOID_METHOD(rowSetChanged, css::lang::EventObject)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXRowSetMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::sdbc::XRowSetListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::sdbc::XRowSetListener>
+ {
+ public:
+ SbaXRowSetMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXRowSetMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual void SAL_CALL cursorMoved(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL rowChanged(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL rowSetChanged(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::sdb::XRowSetApproveListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXRowSetApproveMultiplexer, css::sdb::XRowSetApproveListener)
- DECLARE_MULTIPLEXER_BOOL_METHOD(approveCursorMove, css::lang::EventObject)
- DECLARE_MULTIPLEXER_BOOL_METHOD(approveRowChange, css::sdb::RowChangeEvent)
- DECLARE_MULTIPLEXER_BOOL_METHOD(approveRowSetChange, css::lang::EventObject)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXRowSetApproveMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::sdb::XRowSetApproveListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::sdb::XRowSetApproveListener>
+ {
+ public:
+ SbaXRowSetApproveMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXRowSetApproveMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveCursorMove(const css::lang::EventObject& e) override;
+ virtual sal_Bool SAL_CALL approveRowChange(const css::sdb::RowChangeEvent& e) override;
+ virtual sal_Bool SAL_CALL approveRowSetChange(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::sdb::XSQLErrorListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXSQLErrorMultiplexer, css::sdb::XSQLErrorListener)
- DECLARE_MULTIPLEXER_VOID_METHOD(errorOccured, css::sdb::SQLErrorEvent)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXSQLErrorMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::sdb::XSQLErrorListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::sdb::XSQLErrorListener>
+ {
+ public:
+ SbaXSQLErrorMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXSQLErrorMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual void SAL_CALL errorOccured(const css::sdb::SQLErrorEvent& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// css::beans::XPropertyChangeListener
- DECLARE_PROPERTY_MULTIPLEXER(SbaXPropertyChangeMultiplexer, css::beans::XPropertyChangeListener, propertyChange, css::beans::PropertyChangeEvent)
+ class SbaXPropertyChangeMultiplexer final
+ :public OSbaWeakSubObject
+ ,public css::beans::XPropertyChangeListener
+ {
+ typedef ::comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, OUString> ListenerContainerMap;
+ ListenerContainerMap m_aListeners;
+
+ public:
+ SbaXPropertyChangeMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(SbaXPropertyChangeMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& e) override;
+
+ void addInterface(const OUString& rName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rListener);
+ void removeInterface(const OUString& rName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rListener);
+
+ void disposeAndClear();
+
+ sal_Int32 getOverallLen() const;
+
+ ::comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>* getContainer(const OUString& rName)
+ { return m_aListeners.getContainer(rName); }
+
+ private:
+ void Notify(::comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e);
+ };
// css::beans::XVetoableChangeListener
- DECLARE_PROPERTY_MULTIPLEXER(SbaXVetoableChangeMultiplexer, css::beans::XVetoableChangeListener, vetoableChange, css::beans::PropertyChangeEvent)
+ class SbaXVetoableChangeMultiplexer final
+ :public OSbaWeakSubObject
+ ,public css::beans::XVetoableChangeListener
+ {
+ typedef ::comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XVetoableChangeListener, OUString > ListenerContainerMap;
+ ListenerContainerMap m_aListeners;
+
+ public:
+ SbaXVetoableChangeMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(SbaXVetoableChangeMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent& e) override;
+
+ void addInterface(const OUString& rName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rListener);
+ void removeInterface(const OUString& rName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rListener);
+
+ void disposeAndClear();
+
+ sal_Int32 getOverallLen() const;
+
+ private:
+ void Notify(::comphelper::OInterfaceContainerHelper3<css::beans::XVetoableChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e);
+ };
// css::beans::XPropertiesChangeListener
- BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXPropertiesChangeMultiplexer, css::beans::XPropertiesChangeListener)
- DECLARE_MULTIPLEXER_VOID_METHOD(propertiesChange, css::uno::Sequence< css::beans::PropertyChangeEvent >)
- END_DECLARE_LISTENER_MULTIPLEXER()
+ class SbaXPropertiesChangeMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::beans::XPropertiesChangeListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::beans::XPropertiesChangeListener>
+ {
+ public:
+ SbaXPropertiesChangeMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXPropertiesChangeMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual void SAL_CALL propertiesChange(const css::uno::Sequence< css::beans::PropertyChangeEvent >& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
// the SbaXPropertiesChangeMultiplexer doesn't care about the property names a listener logs on for, it simply
// forwards _all_ changes to _all_ listeners
}
-#endif // _SBA_MULTIPLEXER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx
index 37cc6740063e..6b535882bc80 100644
--- a/dbaccess/source/ui/inc/singledoccontroller.hxx
+++ b/dbaccess/source/ui/inc/singledoccontroller.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SINGLEDOCCONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SINGLEDOCCONTROLLER_HXX
+#pragma once
#include <memory>
#include <dbaccess/dbsubcomponentcontroller.hxx>
@@ -32,9 +31,8 @@ class SfxUndoManager;
namespace dbaui
{
+class UndoManager;
- // OSingleDocumentController
- struct OSingleDocumentController_Data;
typedef ::cppu::ImplInheritanceHelper< DBSubComponentController
, css::document::XUndoManagerSupplier
> OSingleDocumentController_Base;
@@ -71,11 +69,10 @@ 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
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SINGLEDOCCONTROLLER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx
index 8337ae398c64..d0f8672cc698 100644
--- a/dbaccess/source/ui/inc/sqledit.hxx
+++ b/dbaccess/source/ui/inc/sqledit.hxx
@@ -16,71 +16,85 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
+#pragma once
#include <sal/config.h>
+#include <comphelper/syntaxhighlight.hxx>
#include <rtl/ref.hxx>
-#include <svtools/editsyntaxhighlighter.hxx>
#include <svtools/colorcfg.hxx>
+#include <svx/weldeditview.hxx>
+#include <vcl/timer.hxx>
+#include <mutex>
namespace com::sun::star::beans { class XMultiPropertySet; }
namespace dbaui
{
- class OQueryTextView;
- class OSqlEdit final : public MultiLineEditSyntaxHighlight, public utl::ConfigurationListener
+ class SQLEditView final : public WeldEditView, public utl::ConfigurationListener
{
private:
class ChangesListener;
friend class ChangesListener;
- Timer m_timerInvalidate;
- Timer m_timerUndoActionCreation;
- OUString m_strOrigText; // is restored on undo
- VclPtr<OQueryTextView> m_pView;
- bool m_bAccelAction; // is set on cut, copy, paste
- bool m_bStopTimer;
- svtools::ColorConfig m_ColorConfig;
+ std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
+ Link<LinkParamNone*,void> m_aModifyLink;
+ const svtools::ColorConfig m_aColorConfig;
+ Timer m_aUpdateDataTimer;
+ const SyntaxHighlighter m_aHighlighter;
+ svtools::ColorConfig m_ColorConfig;
+ rtl::Reference<SfxItemPool> m_pItemPool;
- rtl::Reference< ChangesListener > m_listener;
- osl::Mutex m_mutex;
- css::uno::Reference< css::beans::XMultiPropertySet > m_notifier;
+ rtl::Reference<ChangesListener> m_listener;
+ std::mutex m_mutex;
+ css::uno::Reference<css::beans::XMultiPropertySet> m_notifier;
- DECL_LINK(OnUndoActionTimer, Timer*, void);
- DECL_LINK(OnInvalidateTimer, Timer*, void);
+ bool m_bInUpdate;
+ bool m_bDisableInternalUndo;
- void ImplSetFont();
+ DECL_LINK(ModifyHdl, LinkParamNone*, void);
+ DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
+ DECL_LINK(EditStatusHdl, EditStatus&, void);
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
- virtual void GetFocus() override;
+ Color GetColorValue(TokenType aToken);
- DECL_LINK(ModifyHdl, Edit&, void);
+ void ImplSetFont();
+
+ void DoBracketHilight(sal_uInt16 nKey);
+
+ static void SetItemPoolFont(SfxItemPool* pItemPool);
+
+ void UpdateData();
+
+ void SetScrollBarRange();
+ void DoScroll();
+
+ virtual void EditViewScrollStateChange() override;
public:
- OSqlEdit( OQueryTextView* pParent);
- virtual ~OSqlEdit() override;
- virtual void dispose() override;
+ SQLEditView(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
+ virtual void makeEditEngine() override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SQLEditView() override;
+
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual bool Command(const CommandEvent& rCEvt) override;
- // Edit overridables
- virtual void SetText(const OUString& rNewText) override;
- using MultiLineEditSyntaxHighlight::SetText;
+ void SetTextAndUpdate(const OUString& rNewText);
- // own functionality
- // Cut, Copy, Paste by Accel. runs the action in the Edit but also the
- // corresponding slot in the View. Therefore, the action occurs twice.
- // To prevent this, SlotExec in View can call this function.
- bool IsInAccelAct() const { return m_bAccelAction; }
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rLink)
+ {
+ m_aModifyLink = rLink;
+ }
- void stopTimer();
- void startTimer();
+ void DisableInternalUndo();
- virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
+ static Color GetSyntaxHighlightColor(const svtools::ColorConfig& rColorConfig, HighlighterLanguage eLanguage, TokenType aToken);
+
+ virtual void ConfigurationChanged(utl::ConfigurationBroadcaster*, ConfigurationHints) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sqlmessage.hxx b/dbaccess/source/ui/inc/sqlmessage.hxx
index ff80b962f52e..ab827c5dec23 100644
--- a/dbaccess/source/ui/inc/sqlmessage.hxx
+++ b/dbaccess/source/ui/inc/sqlmessage.hxx
@@ -17,23 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
+#pragma once
#include <connectivity/dbexception.hxx>
#include <vcl/weld.hxx>
#include <memory>
-// some forwards
-namespace com::sun::star {
- namespace sdb {
- class SQLContext;
- }
- namespace sdbc {
- class SQLException;
- }
-}
-
namespace dbaui
{
@@ -90,7 +79,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
@@ -107,7 +96,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;
@@ -143,6 +132,4 @@ public:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/stringlistitem.hxx b/dbaccess/source/ui/inc/stringlistitem.hxx
index 7601f3030cb9..18156cc2385e 100644
--- a/dbaccess/source/ui/inc/stringlistitem.hxx
+++ b/dbaccess/source/ui/inc/stringlistitem.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_STRINGLISTITEM_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_STRINGLISTITEM_HXX
+#pragma once
#include <svl/poolitem.hxx>
@@ -27,26 +26,24 @@
namespace dbaui
{
-
// OStringListItem
/** <type>SfxPoolItem</type> which transports a sequence of <type scope="rtl">OUString</type>'s
*/
class OStringListItem : public SfxPoolItem
{
- css::uno::Sequence< OUString > m_aList;
+ css::uno::Sequence<OUString> m_aList;
public:
- OStringListItem(sal_Int16 nWhich, const css::uno::Sequence< OUString >& _rList);
+ DECLARE_ITEM_TYPE_FUNCTION(OStringListItem)
+ OStringListItem(sal_Int16 nWhich, const css::uno::Sequence<OUString>& _rList);
OStringListItem(const OStringListItem& _rSource);
- virtual bool operator==(const SfxPoolItem& _rItem) const override;
+ virtual bool operator==(const SfxPoolItem& _rItem) const override;
virtual OStringListItem* Clone(SfxItemPool* _pPool = nullptr) const override;
- const css::uno::Sequence< OUString >& getList() const { return m_aList; }
+ const css::uno::Sequence<OUString>& getList() const { return m_aList; }
};
-} // namespace dbaui
-
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_STRINGLISTITEM_HXX
+} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
index 30b3f742f591..ebfbf7d29c4a 100644
--- a/dbaccess/source/ui/inc/tabletree.hxx
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -17,42 +17,43 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
+#pragma once
#include "imageprovider.hxx"
-#include "marktree.hxx"
+#include "dbtreelistbox.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
-#include <vcl/weld.hxx>
#include <memory>
namespace dbaui
{
// OTableTreeListBox
-class OTableTreeListBox final : public OMarkableTreeListBox
+class OTableTreeListBox : public TreeListBox
{
css::uno::Reference< css::sdbc::XConnection >
m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
std::unique_ptr< ImageProvider >
m_xImageProvider; // provider for our images
+ bool m_bVirtualRoot; // should the first entry be visible
+ bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
+ bool m_bShowToggles; // show toggle buttons
public:
- OTableTreeListBox(vcl::Window* pParent, WinBits nWinStyle);
+ OTableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bShowToggles);
+
+ void init() { m_bVirtualRoot = true; }
typedef std::pair< OUString, bool > TTableViewName;
typedef std::vector< TTableViewName > TNames;
- /** call when HiContrast change.
- */
- void notifyHiContrastChanged();
+ void SuppressEmptyFolders() { m_bNoEmptyFolders = true; }
/** determines whether the given entry denotes a tables folder
*/
- static bool isFolderEntry( const SvTreeListEntry* _pEntry );
+ bool isFolderEntry(const weld::TreeIter& rEntry) const;
/** fill the table list with the tables belonging to the connection described by the parameters
@param _rxConnection
@@ -77,110 +78,14 @@ public:
const css::uno::Sequence< OUString>& _rViews
);
- /** returns a NamedDatabaseObject record which describes the given entry
- */
- css::sdb::application::NamedDatabaseObject
- describeObject( SvTreeListEntry* _pEntry );
-
/** to be used if a foreign instance added a table
*/
- SvTreeListEntry* addedTable( const OUString& _rName );
+ std::unique_ptr<weld::TreeIter> addedTable( const OUString& _rName );
/** to be used if a foreign instance removed a table
*/
void removedTable( const OUString& _rName );
- /** returns the fully qualified name of a table entry
- @param _pEntry
- the entry whose name is to be obtained. Must not denote a folder entry.
- */
- OUString getQualifiedTableName( SvTreeListEntry* _pEntry ) const;
-
- SvTreeListEntry* getEntryByQualifiedName( const OUString& _rName );
-
-private:
- virtual void InitEntry(SvTreeListEntry* _pEntry, const OUString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap) override;
-
- virtual void checkedButton_noBroadcast(SvTreeListEntry* _pEntry) override;
-
- void implEmphasize(SvTreeListEntry* _pEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
-
- /** adds the given entry to our list
- @precond
- our image provider must already have been reset to the connection to which the meta data
- belong.
- */
- SvTreeListEntry* implAddEntry(
- const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
- const OUString& _rTableName,
- bool _bCheckName = true
- );
-
- void implSetDefaultImages();
-
- void implOnNewConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
-
- bool impl_getAndAssertMetaData( css::uno::Reference< css::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
-
- /** fill the table list with the tables and views determined by the two given containers
- @param _rxConnection the connection where you got the object names from. Must not be NULL.
- Used to split the full qualified names into its parts.
- @param _rTables table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
- */
- void UpdateTableList(
- const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
- const TNames& _rTables
- );
-
-};
-
-class TableTreeListBox
-{
- css::uno::Reference< css::sdbc::XConnection >
- m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
- std::unique_ptr< ImageProvider >
- m_xImageProvider; // provider for our images
- bool m_bVirtualRoot; // should the first entry be visible
- bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
- bool m_bShowToggles; // show toggle buttons
- std::unique_ptr<weld::TreeView> m_xTreeView;
-
-public:
- TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView);
-
- weld::TreeView& GetWidget() { return *m_xTreeView; }
-
- void init() { m_bVirtualRoot = true; }
-
- typedef std::pair< OUString, bool > TTableViewName;
- typedef std::vector< TTableViewName > TNames;
-
- void SuppressEmptyFolders() { m_bNoEmptyFolders = true; }
- void DisableCheckButtons();
-
- /** fill the table list with the tables belonging to the connection described by the parameters
- @param _rxConnection
- the connection, which must support the service com.sun.star.sdb.Connection
- @throws
- <type scope="css::sdbc">SQLException</type> if no connection could be created
- */
- void UpdateTableList(
- const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
- );
-
- /** fill the table list with the tables and views determined by the two given containers.
- The views sequence is used to determine which table is of type view.
- @param _rxConnection the connection where you got the object names from. Must not be NULL.
- Used to split the full qualified names into its parts.
- @param _rTables table/view sequence
- @param _rViews view sequence
- */
- void UpdateTableList(
- const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
- const css::uno::Sequence< OUString>& _rTables,
- const css::uno::Sequence< OUString>& _rViews
- );
-
std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
/** does a wildcard check of the given entry
@@ -188,20 +93,18 @@ public:
from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
table filter it's represented by a wildcard.</p>
*/
- void checkWildcard(weld::TreeIter& rEntry);
+ void checkWildcard(const weld::TreeIter& rEntry);
/** determine if the given entry is 'wildcard checked'
@see checkWildcard
*/
bool isWildcardChecked(const weld::TreeIter& rEntry);
- std::unique_ptr<weld::TreeIter> GetEntryPosByName(const OUString& aName, const weld::TreeIter* pStart = nullptr, const IEntryFilter* _pFilter = nullptr) const;
-
void CheckButtons(); // make the button states consistent (bottom-up)
void checkedButton_noBroadcast(const weld::TreeIter& rEntry);
private:
- TriState implDetermineState(weld::TreeIter& rEntry);
+ TriState implDetermineState(const weld::TreeIter& rEntry);
void implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
@@ -210,15 +113,19 @@ private:
our image provider must already have been reset to the connection to which the meta data
belong.
*/
- void implAddEntry(
+ std::unique_ptr<weld::TreeIter> implAddEntry(
const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
- const OUString& _rTableName
+ const OUString& _rTableName,
+ bool _bCheckName = true
);
void implOnNewConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
+ bool impl_getAndAssertMetaData( css::uno::Reference< css::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
+
bool haveVirtualRoot() const { return m_bVirtualRoot; }
+public:
/** fill the table list with the tables and views determined by the two given containers
@param _rxConnection the connection where you got the object names from. Must not be NULL.
Used to split the full qualified names into its parts.
@@ -228,10 +135,21 @@ private:
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const TNames& _rTables
);
+
+ /** returns a NamedDatabaseObject record which describes the given entry
+ */
+ css::sdb::application::NamedDatabaseObject
+ describeObject(const weld::TreeIter& rEntry);
+
+ /** returns the fully qualified name of a table entry
+ @param _pEntry
+ the entry whose name is to be obtained. Must not denote a folder entry.
+ */
+ OUString getQualifiedTableName(const weld::TreeIter& rEntry) const;
+
+ std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/textconnectionsettings.hxx b/dbaccess/source/ui/inc/textconnectionsettings.hxx
index 4f2a8662034c..9d21c879568c 100644
--- a/dbaccess/source/ui/inc/textconnectionsettings.hxx
+++ b/dbaccess/source/ui/inc/textconnectionsettings.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX
+#pragma once
#include "propertystorage.hxx"
#include <vcl/weld.hxx>
@@ -57,6 +56,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/undosqledit.hxx b/dbaccess/source/ui/inc/undosqledit.hxx
index 8d7f1d9ba56f..2b760bbada73 100644
--- a/dbaccess/source/ui/inc/undosqledit.hxx
+++ b/dbaccess/source/ui/inc/undosqledit.hxx
@@ -16,21 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_UNDOSQLEDIT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_UNDOSQLEDIT_HXX
+#pragma once
#include "GeneralUndo.hxx"
-#include "sqledit.hxx"
-#include <vcl/vclptr.hxx>
#include <strings.hrc>
namespace dbaui
{
- class OSqlEdit;
+ class OQueryTextView;
+
// OSqlEditUndoAct - Undo-class for changing sql text
class OSqlEditUndoAct final : public OCommentUndoAction
{
- VclPtr<OSqlEdit> m_pOwner;
+ OQueryTextView& m_rOwner;
OUString m_strNextText;
virtual void Undo() override { ToggleText(); }
@@ -38,11 +36,10 @@ namespace dbaui
void ToggleText();
public:
- OSqlEditUndoAct(OSqlEdit* pEdit) : OCommentUndoAction(STR_QUERY_UNDO_MODIFYSQLEDIT), m_pOwner(pEdit) { }
+ OSqlEditUndoAct(OQueryTextView& rEdit) : OCommentUndoAction(STR_QUERY_UNDO_MODIFYSQLEDIT), m_rOwner(rEdit) { }
- void SetOriginalText(const OUString& strText) { m_strNextText =strText; }
+ void SetOriginalText(const OUString& strText) { m_strNextText = strText; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_UNDOSQLEDIT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx
index 8f9013d4d27b..a1d6de4e8a0f 100644
--- a/dbaccess/source/ui/inc/unoadmin.hxx
+++ b/dbaccess/source/ui/inc/unoadmin.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_UNOADMIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_UNOADMIN_HXX
+#pragma once
#include <svtools/genericunodialog.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -26,7 +25,6 @@
class SfxItemSet;
class SfxItemPool;
-class SfxPoolItem;
namespace dbaui
{
@@ -38,9 +36,7 @@ class ODatabaseAdministrationDialog
{
protected:
std::unique_ptr<SfxItemSet> m_pDatasourceItems; // item set for the dialog
- SfxItemPool* m_pItemPool; // item pool for the item set for the dialog
- std::vector<SfxPoolItem*>*
- m_pItemPoolDefaults; // pool defaults
+ rtl::Reference<SfxItemPool> m_pItemPool; // item pool for the item set for the dialog
std::unique_ptr<::dbaccess::ODsnTypeCollection>
m_pCollection; // datasource type collection
@@ -57,6 +53,4 @@ protected:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_UNOADMIN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 498b634f2575..68c887e25e7e 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_UNODATBR_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_UNODATBR_HXX
+#pragma once
#include <memory>
#include "brwctrlr.hxx"
@@ -32,25 +31,22 @@
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
#include <com/sun/star/sdb/XDatabaseRegistrationsListener.hpp>
+#include <comphelper/interfacecontainer2.hxx>
#include <cppuhelper/implbase5.hxx>
#include "callbacks.hxx"
-#include <vcl/transfer.hxx>
+#include <utility>
#include <svx/dataaccessdescriptor.hxx>
#include "TableCopyHelper.hxx"
#include "commontypes.hxx"
-class SvTreeListEntry;
class Splitter;
-struct SvSortData;
+class ODataClipboard;
namespace com::sun::star::container { class XNameContainer; }
-class SvTreeList;
namespace dbaui
{
-
- class DBTreeView;
- struct DBTreeEditedEntry;
+ struct DBTreeListUserData;
class ImageProvider;
typedef ::cppu::ImplHelper5 < css::frame::XStatusListener
@@ -77,7 +73,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;
@@ -95,9 +91,9 @@ namespace dbaui
OUString m_sQueryCommand; // the command of the query currently loaded (if any)
//OUString m_sToBeLoaded; // contains the element name which should be loaded if any
- VclPtr<DBTreeView> m_pTreeView; // contains the datasources of the registry
+ VclPtr<InterimDBTreeListBox> m_pTreeView; // contains the datasources of the registry
VclPtr<Splitter> m_pSplitter;
- SvTreeListEntry* m_pCurrentlyDisplayed;
+ std::unique_ptr<weld::TreeIter> m_xCurrentlyDisplayed;
ImplSVEvent * m_nAsyncDrop;
bool m_bQueryEscapeProcessing : 1; // the escape processing flag of the query currently loaded (if any)
@@ -174,9 +170,6 @@ namespace dbaui
// css::frame::XFrameActionListener
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
- //IController
- virtual void notifyHiContrastChanged() override;
-
// XScriptInvocationContext
virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
@@ -213,19 +206,21 @@ namespace dbaui
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
// IControlActionListener overridables
- virtual bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const override;
- virtual bool requestDrag( const Point& _rPosPixel ) override;
+ virtual bool requestQuickHelp(const void* pUserData, OUString& rText) const override;
+ virtual bool requestDrag(const weld::TreeIter& rEntry) override;
virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ) override;
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider
- virtual OUString getContextMenuResourceName( Control& _rControl ) const override;
+ virtual OUString getContextMenuResourceName() const override;
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
- virtual css::uno::Any getCurrentSelection( Control& _rControl ) const override;
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const override;
+ 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;
@@ -240,11 +235,11 @@ namespace dbaui
// methods for handling the 'selection' (painting them bold) of SvLBoxEntries
// returns <TRUE/> if the entry is selected (which means it's part of the selected path)
- static bool isSelected(SvTreeListEntry* _pEntry);
+ bool isSelected(const weld::TreeIter& rEntry) const;
// select the entry (and only the entry, not the whole path)
- void select(SvTreeListEntry* _pEntry, bool _bSelect);
+ void select(const weld::TreeIter* pEntry, bool bSelect);
// select the path of the entry (which must be an entry without children)
- void selectPath(SvTreeListEntry* _pEntry, bool _bSelect = true);
+ void selectPath(const weld::TreeIter* pEntry, bool bSelect = true);
virtual void loadMenu(const css::uno::Reference< css::frame::XFrame >& _xFrame) override;
@@ -265,16 +260,16 @@ namespace dbaui
<p>The given names and images may be empty, in this case they're filled with the correct
values. This way they may be reused for the next call, which saves some resource manager calls.</p>
*/
- void implAddDatasource(const OUString& _rDbName, Image& _rDbImage,
- OUString& _rQueryName, Image& _rQueryImage,
- OUString& _rTableName, Image& _rTableImage,
+ void implAddDatasource(const OUString& _rDbName, OUString& _rDbImage,
+ OUString& _rQueryName, OUString& _rQueryImage,
+ OUString& _rTableName, OUString& _rTableImage,
const SharedConnection& _rxConnection
);
void implAddDatasource( const OUString& _rDataSourceName, const SharedConnection& _rxConnection );
/// removes (and cleans up) the entry for the given data source
- void impl_cleanupDataSourceEntry( const OUString& _rDataSourceName );
+ void impl_cleanupDataSourceEntry( std::u16string_view _rDataSourceName );
/// clears the tree list box
void clearTreeModel();
@@ -288,63 +283,62 @@ namespace dbaui
void unloadAndCleanup( bool _bDisposeConnection = true );
// disposes the connection associated with the given entry (which must represent a data source)
- void disposeConnection( SvTreeListEntry* _pDSEntry );
+ void disposeConnection(const weld::TreeIter* xpDSEntry);
/// flushes and disposes the given connection, and de-registers as listener
void impl_releaseConnection( SharedConnection& _rxConnection );
/** close the connection (and collapse the list entries) of the given list entries
*/
- void closeConnection(SvTreeListEntry* _pEntry, bool _bDisposeConnection = true);
+ void closeConnection(const weld::TreeIter& rEntry, bool bDisposeConnection = true);
- void populateTree(const css::uno::Reference< css::container::XNameAccess>& _xNameAccess, SvTreeListEntry* _pParent, EntryType _eEntryType);
+ void populateTree(const css::uno::Reference< css::container::XNameAccess>& xNameAccess, const weld::TreeIter& rParent, EntryType eEntryType);
void initializeTreeModel();
/** search in the tree for query- or tablecontainer equal to this interface and return
this container entry
*/
- SvTreeListEntry* getEntryFromContainer(const css::uno::Reference< css::container::XNameAccess>& _rxNameAccess);
+ std::unique_ptr<weld::TreeIter> getEntryFromContainer(const css::uno::Reference<css::container::XNameAccess>& rxNameAccess);
+
// return true when there is connection available
- bool ensureConnection(SvTreeListEntry* _pDSEntry, void * pDSData, SharedConnection& _rConnection );
- bool ensureConnection(SvTreeListEntry* _pAnyEntry, SharedConnection& _rConnection );
+ bool ensureConnection(const weld::TreeIter* pDSEntry, void * pDSData, SharedConnection& rConnection);
+ bool ensureConnection(const weld::TreeIter* pAnyEntry, SharedConnection& rConnection);
- bool getExistentConnectionFor( SvTreeListEntry* _pDSEntry, SharedConnection& _rConnection );
+ bool getExistentConnectionFor(const weld::TreeIter* pDSEntry, SharedConnection& rConnection);
/** returns an image provider which works with the connection belonging to the given entry
*/
- std::unique_ptr< ImageProvider >
- getImageProviderFor( SvTreeListEntry* _pAnyEntry );
+ std::unique_ptr<ImageProvider> getImageProviderFor(const weld::TreeIter* pAnyEntry);
- void implAdministrate( SvTreeListEntry* _pApplyTo );
+ void implAdministrate(const weld::TreeIter& rApplyTo);
- TransferableHelper*
- implCopyObject( SvTreeListEntry* _pApplyTo, sal_Int32 _nCommandType );
+ bool implCopyObject(ODataClipboard& rExchange, const weld::TreeIter& rApplyTo, sal_Int32 nCommandType);
- EntryType getEntryType( const SvTreeListEntry* _pEntry ) const;
- EntryType getChildType( SvTreeListEntry const * _pEntry ) const;
+ EntryType getEntryType(const weld::TreeIter& rEntry) const;
+ EntryType getChildType(const weld::TreeIter& rEntry) const;
static bool isObject( EntryType _eType ) { return ( etTableOrView== _eType ) || ( etQuery == _eType ); }
static bool isContainer( EntryType _eType ) { return (etTableContainer == _eType) || (etQueryContainer == _eType); }
- bool isContainer( const SvTreeListEntry* _pEntry ) const { return isContainer( getEntryType( _pEntry ) ); }
+ bool isContainer(const weld::TreeIter& rEntry) const { return isContainer(getEntryType(rEntry)); }
// ensure that the xObject for the given entry is set on the user data
- bool ensureEntryObject( SvTreeListEntry* _pEntry );
+ bool ensureEntryObject(const weld::TreeIter& rEntry);
// get the display text of the entry given
- OUString GetEntryText( SvTreeListEntry* _pEntry ) const;
+ OUString GetEntryText(const weld::TreeIter& rEntry) const;
// is called when a table or a query was selected
DECL_LINK( OnSelectionChange, LinkParamNone*, void );
- DECL_LINK( OnExpandEntry, SvTreeListEntry*, bool );
+ DECL_LINK( OnExpandEntry, const weld::TreeIter&, bool );
DECL_LINK( OnCopyEntry, LinkParamNone*, void );
- DECL_LINK( OnTreeEntryCompare, const SvSortData&, sal_Int32 );
+ int OnTreeEntryCompare(const weld::TreeIter& rLHS, const weld::TreeIter& rRHS);
DECL_LINK( OnAsyncDrop, void*, void );
void implRemoveStatusListeners();
bool implSelect(const svx::ODataAccessDescriptor& _rDescriptor, bool _bSelectDirect = false);
- bool implSelect( SvTreeListEntry* _pEntry );
+ bool implSelect(const weld::TreeIter* pEntry);
/// selects the entry given and loads the grid control with the object's data
bool implSelect(
@@ -356,51 +350,49 @@ namespace dbaui
bool _bSelectDirect
);
- SvTreeListEntry* implGetConnectionEntry(SvTreeListEntry* _pEntry) const;
+ std::unique_ptr<weld::TreeIter> implGetConnectionEntry(const weld::TreeIter& rEntry) const;
/// inserts an entry into the tree
- SvTreeListEntry* implAppendEntry(
- SvTreeListEntry* _pParent,
- const OUString& _rName,
- void* _pUserData,
- EntryType _eEntryType
- );
+ std::unique_ptr<weld::TreeIter> implAppendEntry(
+ const weld::TreeIter* pParent,
+ const OUString& rName,
+ 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,
const sal_Int32 _nCommandType, const bool _bEscapeProcessing, const SharedConnection& _rxConnection );
/** retrieves the tree entry for the object described by <arg>_rDescriptor</arg>
- @param _rDescriptor
+ @param rDescriptor
the object descriptor
- @param _ppDataSourceEntry
+ @param ppDataSourceEntry
If not <NULL/>, the data source tree entry will be returned here
- @param _ppContainerEntry
+ @param ppContainerEntry
If not <NULL/>, the object container tree entry will be returned here
*/
- SvTreeListEntry* getObjectEntry(const svx::ODataAccessDescriptor& _rDescriptor,
- SvTreeListEntry** _ppDataSourceEntry, SvTreeListEntry** _ppContainerEntry
+ std::unique_ptr<weld::TreeIter> getObjectEntry(const svx::ODataAccessDescriptor& rDescriptor,
+ std::unique_ptr<weld::TreeIter>* ppDataSourceEntry, std::unique_ptr<weld::TreeIter>* ppContainerEntry
);
/** retrieves the tree entry for the object described by data source name, command and command type
- @param _rDataSource
+ @param rDataSource
the data source name
- @param _rCommand
+ @param rCommand
the command
- @param _nCommandType
+ @param nCommandType
the command type
- @param _rDescriptor
+ @param rDescriptor
the object descriptor
- @param _ppDataSourceEntry
+ @param ppDataSourceEntry
If not <NULL/>, the data source tree entry will be returned here
- @param _ppContainerEntry
+ @param ppContainerEntry
If not <NULL/>, the object container tree entry will be returned here
- @param _bExpandAncestors
+ @param bExpandAncestors
If <TRUE/>, all ancestor on the way to the entry will be expanded
*/
- SvTreeListEntry* getObjectEntry(
- const OUString& _rDataSource, const OUString& _rCommand, sal_Int32 _nCommandType,
- SvTreeListEntry** _ppDataSourceEntry, SvTreeListEntry** _ppContainerEntry,
+ std::unique_ptr<weld::TreeIter> getObjectEntry(
+ const OUString& rDataSource, const OUString& rCommand, sal_Int32 nCommandType,
+ std::unique_ptr<weld::TreeIter>* ppDataSourceEntry, std::unique_ptr<weld::TreeIter>* ppContainerEntry,
bool _bExpandAncestors = true,
- const SharedConnection& _rxConnection = SharedConnection()
+ const SharedConnection& rxConnection = SharedConnection()
);
/// checks if m_aDocumentDataSource describes a known object
@@ -412,32 +404,32 @@ namespace dbaui
void transferChangedControlProperty(const OUString& _rProperty, const css::uno::Any& _rNewValue);
// checks whether the given tree entry denotes a data source
- bool impl_isDataSourceEntry( SvTreeListEntry* _pEntry ) const;
+ bool impl_isDataSourceEntry(const weld::TreeIter* pEntry) const;
/// retrieves the data source URL/name for the given entry representing a data source
- OUString getDataSourceAccessor( SvTreeListEntry* _pDataSourceEntry ) const;
+ OUString getDataSourceAccessor(const weld::TreeIter& rDataSourceEntry) const;
/** get the signature (command/escape processing) of the query the form is based on
<p>If the for is not based on a query or not even loaded, nothing happens and <FALSE/> is returned.</p>
*/
bool implGetQuerySignature( OUString& _rCommand, bool& _bEscapeProcessing );
- bool isEntryCopyAllowed(SvTreeListEntry const * _pEntry) const;
+ bool isEntryCopyAllowed(const weld::TreeIter& rEntry) const;
- void copyEntry(SvTreeListEntry* _pEntry);
+ void copyEntry(const weld::TreeIter& rEntry);
// remove all grid columns and dispose them
static void clearGridColumns(const css::uno::Reference< css::container::XNameContainer >& _xColContainer);
/** checks if the currently displayed entry changed
- @param _sName
+ @param rName
Name of the changed entry
- @param _pContainer
+ @param rContainer
The container of the displayed entry
@return
<TRUE/> if it is the currently displayed otherwise <FALSE/>
*/
- bool isCurrentlyDisplayedChanged(const OUString& _sName, SvTreeListEntry const * _pContainer);
+ bool isCurrentlyDisplayedChanged(std::u16string_view rName, const weld::TreeIter& rContainer);
/** called whenever the content of the browser is used for preview, as the very last action
of the load process
@@ -451,6 +443,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_UNODATBR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/unosqlmessage.hxx b/dbaccess/source/ui/inc/unosqlmessage.hxx
index bda4cbf23b90..c084ef240b7d 100644
--- a/dbaccess/source/ui/inc/unosqlmessage.hxx
+++ b/dbaccess/source/ui/inc/unosqlmessage.hxx
@@ -17,11 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_UNOSQLMESSAGE_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_INC_UNOSQLMESSAGE_HXX
+#pragma once
#include <svtools/genericunodialog.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/proparrhlp.hxx>
namespace dbaui
@@ -67,6 +65,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_UNOSQLMESSAGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index cc24fe114c63..ad1ff39f3b80 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -40,11 +39,11 @@
#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>
-#include <svl/zforlist.hxx>
+#include <svl/numformat.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/FValue.hxx>
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
@@ -68,20 +67,19 @@ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOper
// ODatabaseExport
ODatabaseExport::ODatabaseExport(sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&&_rColumnPositions,
const Reference< XNumberFormatter >& _rxNumberF,
const Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* pList,
const OTypeInfoMap* _pInfoMap,
bool _bAutoIncrementEnabled,
SvStream& _rInputStream)
- :m_vColumnPositions(_rColumnPositions)
- ,m_aDestColumns(true)
+ :m_vColumnPositions(std::move(_rColumnPositions))
+ ,m_aDestColumns(comphelper::UStringMixLess(true))
,m_xFormatter(_rxNumberF)
,m_xContext(_rxContext)
,m_pFormatter(nullptr)
,m_rInputStream( _rInputStream )
- ,m_pTypeInfo()
,m_pColumnList(pList)
,m_pInfoMap(_pInfoMap)
,m_nColumnPos(0)
@@ -126,13 +124,12 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
const Reference< XNumberFormatter >& _rxNumberF,
const Reference< css::uno::XComponentContext >& _rxContext,
SvStream& _rInputStream)
- :m_aDestColumns(_rxConnection->getMetaData().is() && _rxConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ :m_aDestColumns(comphelper::UStringMixLess(_rxConnection->getMetaData().is() && _rxConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()))
,m_xConnection(_rxConnection)
,m_xFormatter(_rxNumberF)
,m_xContext(_rxContext)
,m_pFormatter(nullptr)
,m_rInputStream( _rInputStream )
- ,m_pTypeInfo()
,m_pColumnList(nullptr)
,m_pInfoMap(nullptr)
,m_nColumnPos(0)
@@ -190,11 +187,11 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
sal_Int32 nPos = 1;
OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector");
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- OUString sTypeName = aValue;
+ OUString sTypeName = aValue.getString();
++nPos;
OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector");
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- sal_Int32 nType = aValue;
+ sal_Int32 nType = aValue.getInt32();
++nPos;
if( nType == DataType::VARCHAR )
@@ -206,44 +203,44 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector");
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nPrecision = aValue;
+ m_pTypeInfo->nPrecision = aValue.getInt32();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralPrefix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->aCreateParams = aValue;
+ m_pTypeInfo->aCreateParams = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE;
+ m_pTypeInfo->bNullable = aValue.getInt32() == ColumnValue::NULLABLE;
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bCaseSensitive
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nSearchType = aValue;
+ m_pTypeInfo->nSearchType = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bUnsigned
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->bCurrency = aValue;
+ m_pTypeInfo->bCurrency = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->bAutoIncrement = aValue;
+ m_pTypeInfo->bAutoIncrement = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->aLocalTypeName = aValue;
+ m_pTypeInfo->aLocalTypeName = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nMinimumScale = aValue;
+ m_pTypeInfo->nMinimumScale = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nMaximumScale = aValue;
+ m_pTypeInfo->nMaximumScale = aValue.getInt16();
nPos = 18;
aValue.fill(nPos,aTypes[nPos],xRow);
- m_pTypeInfo->nNumPrecRadix = aValue;
+ m_pTypeInfo->nNumPrecRadix = aValue.getInt32();
// check if values are less than zero like it happens in a oracle jdbc driver
if( m_pTypeInfo->nPrecision < 0)
@@ -423,9 +420,6 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
case NumberFormat::ALL:
nNumberFormat = NumberFormat::ALL;
break;
- case NumberFormat::DEFINED:
- nNumberFormat = NumberFormat::TEXT;
- break;
case NumberFormat::DATE:
switch(_nOldNumberFormat)
{
@@ -461,12 +455,10 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
case NumberFormat::CURRENCY:
switch(_nOldNumberFormat)
{
- case NumberFormat::NUMBER:
- nNumberFormat = NumberFormat::CURRENCY;
- break;
case NumberFormat::CURRENCY:
nNumberFormat = _nOldNumberFormat;
break;
+ case NumberFormat::NUMBER:
case NumberFormat::ALL:
nNumberFormat = NumberFormat::CURRENCY;
break;
@@ -498,6 +490,7 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
case NumberFormat::TEXT:
case NumberFormat::UNDEFINED:
case NumberFormat::LOGICAL:
+ case NumberFormat::DEFINED:
nNumberFormat = NumberFormat::TEXT; // Text overwrites everything
break;
case NumberFormat::DATETIME:
@@ -550,13 +543,6 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
switch ( nType )
{
- case NumberFormat::ALL:
- nDataType = DataType::DOUBLE;
- break;
- case NumberFormat::DEFINED:
- nDataType = DataType::VARCHAR;
- nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10;
- break;
case NumberFormat::DATE:
nDataType = DataType::DATE;
break;
@@ -571,12 +557,14 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
nScale = 4;
nLength = 19;
break;
+ case NumberFormat::ALL:
case NumberFormat::NUMBER:
case NumberFormat::SCIENTIFIC:
case NumberFormat::FRACTION:
case NumberFormat::PERCENT:
nDataType = DataType::DOUBLE;
break;
+ case NumberFormat::DEFINED:
case NumberFormat::TEXT:
case NumberFormat::UNDEFINED:
case NumberFormat::LOGICAL:
@@ -657,18 +645,18 @@ 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,
- m_aDestColumns,
+ ODatabaseExport::TColumns(m_aDestColumns),
m_vDestVector,
m_xConnection,
m_xFormatter,
@@ -691,7 +679,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);
}
@@ -773,14 +761,14 @@ void ODatabaseExport::ensureFormatter()
if ( !m_pFormatter )
{
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
m_pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr;
Reference<XPropertySet> xNumberFormatSettings = xSupplier->getNumberFormatSettings();
- xNumberFormatSettings->getPropertyValue("NullDate") >>= m_aNullDate;
+ xNumberFormatSettings->getPropertyValue(u"NullDate"_ustr) >>= m_aNullDate;
}
}
-Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const Reference<XDatabaseMetaData>& _xMetaData
+Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const Reference<XDatabaseMetaData>& _xMetaData
,const Reference<XPropertySet>& _xDestTable
,const TPositions& _rvColumns)
{
@@ -805,19 +793,17 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
{
return Reference< XPreparedStatement > ();
}
- const OUString* pIter = aDestColumnNames.getConstArray();
- std::vector< OUString> aInsertList;
- aInsertList.resize(aDestColumnNames.getLength()+1);
- for(size_t j=0; j < aInsertList.size(); ++j)
+
+ std::vector<OUString> aInsertList;
+ auto sortedColumns = _rvColumns;
+ std::sort(sortedColumns.begin(), sortedColumns.end());
+ aInsertList.reserve(_rvColumns.size());
+ for (const auto& [nSrc, nDest] : sortedColumns)
{
- ODatabaseExport::TPositions::const_iterator aFind = std::find_if(_rvColumns.begin(),_rvColumns.end(),
- [j] (const ODatabaseExport::TPositions::value_type& tPos)
- { return tPos.second == static_cast<sal_Int32>(j+1); });
- if ( _rvColumns.end() != aFind && aFind->second != COLUMN_POSITION_NOT_FOUND && aFind->first != COLUMN_POSITION_NOT_FOUND )
- {
- OSL_ENSURE((aFind->first) < static_cast<sal_Int32>(aInsertList.size()),"aInsertList: Illegal index for vector");
- aInsertList[aFind->first] = ::dbtools::quoteName( aQuote,*(pIter+j));
- }
+ if (nSrc == COLUMN_POSITION_NOT_FOUND || nDest == COLUMN_POSITION_NOT_FOUND)
+ continue;
+ assert(nDest > 0 && nDest <= aDestColumnNames.getLength());
+ aInsertList.push_back(dbtools::quoteName(aQuote, aDestColumnNames[nDest - 1]));
}
// create the sql string
@@ -825,8 +811,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 6e3d329e3ef2..0da9f975f0b8 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -26,7 +26,6 @@
#include <strings.hrc>
#include <osl/diagnose.h>
#include <core_resource.hxx>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
@@ -40,10 +39,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::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::awt;
#define DBAUI_HTML_FONTSIZES 8 // like export, HTML-Options
@@ -64,14 +60,14 @@ OHTMLReader::OHTMLReader(SvStream& rIn,const SharedConnection& _rxConnection,
OHTMLReader::OHTMLReader(SvStream& rIn,
sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&& _rColumnPositions,
const Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* pList,
const OTypeInfoMap* _pInfoMap,
bool _bAutoIncrementEnabled)
: HTMLParser(rIn)
- , ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
+ , ODatabaseExport( nRows, std::move(_rColumnPositions), _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
, m_nTableCount(0)
, m_nColumnWidth(87)
{
@@ -312,7 +308,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 +461,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..2efbe1cf414d 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,
@@ -62,7 +58,7 @@ void ORowSetImportExport::initialize()
m_xTargetResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xTargetResultSetUpdate,UNO_QUERY_THROW)->getMetaData();
if(!m_xTargetResultSetMetaData.is() || !xColumnLocate.is() || !m_xResultSetMetaData.is() )
- throw SQLException(DBA_RES(STR_UNEXPECTED_ERROR),*this,"S1000",0,Any());
+ throw SQLException(DBA_RES(STR_UNEXPECTED_ERROR),*this,u"S1000"_ustr,0,Any());
sal_Int32 nCount = m_xTargetResultSetMetaData->getColumnCount();
m_aColumnMapping.reserve(nCount);
@@ -99,21 +95,21 @@ bool ORowSetImportExport::Write()
bool ORowSetImportExport::Read()
{
+ if (!m_xResultSet)
+ return false;
// check if there is any column to copy
if(std::none_of(m_aColumnMapping.begin(),m_aColumnMapping.end(),
[](sal_Int32 n) { return n > 0; }))
return false;
- bool bContinue = true;
if(m_aSelection.hasElements())
{
- const Any* pBegin = m_aSelection.getConstArray();
- const Any* pEnd = pBegin + m_aSelection.getLength();
- for(;pBegin != pEnd && bContinue;++pBegin)
+ for (auto& any : m_aSelection)
{
sal_Int32 nPos = -1;
- *pBegin >>= nPos;
+ any >>= nPos;
OSL_ENSURE(nPos != -1,"Invalid position!");
- bContinue = (m_xResultSet.is() && m_xResultSet->absolute(nPos) && insertNewRow());
+ if (!m_xResultSet->absolute(nPos) || !insertNewRow())
+ break;
}
}
else
@@ -135,10 +131,11 @@ bool ORowSetImportExport::Read()
}
OSL_ENSURE(nRowCount,"RowCount is 0!");
m_xResultSet->beforeFirst();
- while(m_xResultSet.is() && m_xResultSet->next() && bContinue && nRowCount )
+ while(m_xResultSet.is() && m_xResultSet->next() && nRowCount )
{
--nRowCount;
- bContinue = insertNewRow();
+ if (!insertNewRow())
+ break;
}
}
return true;
diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx
index 1a247ca88b06..3cb47cda8388 100644
--- a/dbaccess/source/ui/misc/RtfReader.cxx
+++ b/dbaccess/source/ui/misc/RtfReader.cxx
@@ -19,7 +19,6 @@
#include <RtfReader.hxx>
#include <tools/stream.hxx>
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
@@ -38,10 +37,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::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::awt;
// ORTFReader
@@ -57,14 +53,14 @@ ORTFReader::ORTFReader( SvStream& rIn,
ORTFReader::ORTFReader(SvStream& rIn,
sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&& _rColumnPositions,
const Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* pList,
const OTypeInfoMap* _pInfoMap,
bool _bAutoIncrementEnabled)
:SvRTFParser(rIn)
- ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
+ ,ODatabaseExport( nRows, std::move(_rColumnPositions), _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
{
m_bAppendFirstLine = false;
}
diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index 596aa7335771..3f48a44d9fe6 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -23,7 +23,6 @@
#include <strings.hxx>
#include <dbaccess/genericcontroller.hxx>
#include <com/sun/star/task/InteractionHandler.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
#include <com/sun/star/sdb/application/CopyTableWizard.hpp>
#include <com/sun/star/sdb/DataAccessDescriptorFactory.hpp>
@@ -32,10 +31,11 @@
#include <TokenWriter.hxx>
#include <UITools.hxx>
#include <dbaccess/dataview.hxx>
+#include <sot/storage.hxx>
#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,23 +48,21 @@ 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* _pControler)
- :m_pController(_pControler)
+OTableCopyHelper::OTableCopyHelper(OGenericUnoController* _pController)
+ :m_pController(_pController)
{
}
-void OTableCopyHelper::insertTable( const OUString& i_rSourceDataSource, const Reference<XConnection>& i_rSourceConnection,
+void OTableCopyHelper::insertTable( std::u16string_view i_rSourceDataSource, const Reference<XConnection>& i_rSourceConnection,
const OUString& i_rCommand, const sal_Int32 i_nCommandType,
const Reference< XResultSet >& i_rSourceRows, const Sequence< Any >& i_rSelection, const bool i_bBookmarkSelection,
- const OUString& i_rDestDataSource, const Reference<XConnection>& i_rDestConnection)
+ std::u16string_view i_rDestDataSource, const Reference<XConnection>& i_rDestConnection)
{
if ( CommandType::QUERY != i_nCommandType && CommandType::TABLE != i_nCommandType )
{
@@ -89,15 +87,15 @@ void OTableCopyHelper::insertTable( const OUString& i_rSourceDataSource, const R
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()));
@@ -109,7 +107,7 @@ void OTableCopyHelper::insertTable( const OUString& i_rSourceDataSource, const R
bool bAppendToExisting = !sTableNameForAppend.isEmpty();
xWizard->setOperation( bAppendToExisting ? CopyTableOperation::AppendData : CopyTableOperation::CopyDefinitionAndData );
- xWizard->execute();
+ (void)xWizard->execute();
}
catch( const SQLException& )
{
@@ -121,7 +119,7 @@ void OTableCopyHelper::insertTable( const OUString& i_rSourceDataSource, const R
}
}
-void OTableCopyHelper::pasteTable( const svx::ODataAccessDescriptor& _rPasteData, const OUString& i_rDestDataSourceName,
+void OTableCopyHelper::pasteTable( const svx::ODataAccessDescriptor& _rPasteData, std::u16string_view i_rDestDataSourceName,
const SharedConnection& i_rDestConnection )
{
OUString sSrcDataSourceName = _rPasteData.getDataSource();
@@ -166,7 +164,7 @@ void OTableCopyHelper::pasteTable( const svx::ODataAccessDescriptor& _rPasteData
void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
,const TransferableDataHelper& _rTransData
- ,const OUString& i_rDestDataSource
+ ,std::u16string_view i_rDestDataSource
,const SharedConnection& _xConnection)
{
if ( _nFormatId == SotClipboardFormatId::DBACCESS_TABLE || _nFormatId == SotClipboardFormatId::DBACCESS_QUERY )
@@ -182,17 +180,16 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
try
{
DropDescriptor aTrans;
- bool bOk;
if ( _nFormatId != SotClipboardFormatId::RTF )
- bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SotClipboardFormatId::HTML ,aTrans.aHtmlRtfStorage);
+ aTrans.aHtmlRtfStorage = _rTransData.GetSotStorageStream(SotClipboardFormatId::HTML);
else
- bOk = const_cast<TransferableDataHelper&>(_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) )
- m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
+ if ( !aTrans.aHtmlRtfStorage || !copyTagTable(aTrans,false,_xConnection) )
+ m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, u"S1000"_ustr, 0, Any()));
}
catch(const SQLException&)
{
@@ -204,11 +201,11 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
}
}
else
- m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
+ m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, u"S1000"_ustr, 0, Any()));
}
void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData
- ,const OUString& i_rDestDataSource
+ ,std::u16string_view i_rDestDataSource
,const SharedConnection& _xConnection)
{
if ( _rTransData.HasFormat(SotClipboardFormatId::DBACCESS_TABLE) || _rTransData.HasFormat(SotClipboardFormatId::DBACCESS_QUERY) )
@@ -221,14 +218,12 @@ void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData
bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor const & _rDesc, bool _bCheck, const SharedConnection& _xConnection)
{
- Reference<XEventListener> xEvt;
- ODatabaseImportExport* pImport = nullptr;
+ rtl::Reference<ODatabaseImportExport> pImport;
if ( _rDesc.bHtml )
pImport = new OHTMLImportExport(_xConnection,getNumberFormatter(_xConnection, m_pController->getORB()),m_pController->getORB());
else
pImport = new ORTFImportExport(_xConnection,getNumberFormatter(_xConnection, m_pController->getORB()),m_pController->getORB());
- xEvt = pImport;
SvStream* pStream = _rDesc.aHtmlRtfStorage.get();
if ( _bCheck )
pImport->enableCheckOnly();
@@ -258,26 +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 = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SotClipboardFormatId::HTML ,_rAsyncDrop.aHtmlRtfStorage);
- else
- bOk = const_cast<TransferableDataHelper&>(_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<SotStorageStream> aNew = new SotStorageStream( aTmp.GetFileName() );
+ std::unique_ptr<SvStream> aNew = SotTempStream::Create( aTmp.GetFileName() );
_rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN);
- _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew.get() );
- aNew->Commit();
- _rAsyncDrop.aHtmlRtfStorage = aNew;
+ aNew->WriteStream(*_rAsyncDrop.aHtmlRtfStorage);
+ _rAsyncDrop.aHtmlRtfStorage = std::move(aNew);
}
else
_rAsyncDrop.aHtmlRtfStorage = nullptr;
@@ -286,10 +276,10 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData
}
void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
- ,const OUString& i_rDestDataSource
+ ,std::u16string_view i_rDestDataSource
,const SharedConnection& _xConnection)
{
- if ( _rDesc.aHtmlRtfStorage.is() )
+ if ( _rDesc.aHtmlRtfStorage )
{
copyTagTable(_rDesc,false,_xConnection);
_rDesc.aHtmlRtfStorage = nullptr;
@@ -301,7 +291,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
else if ( !_rDesc.bError )
pasteTable(_rDesc.aDroppedData,i_rDestDataSource,_xConnection);
else
- m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
+ m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, u"S1000"_ustr, 0, Any()));
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 3d73e9427b0e..768177354f41 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,13 +48,14 @@
#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>
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include <svtools/rtfout.hxx>
-#include <svtools/htmlcfg.hxx>
+#include <o3tl/string_view.hxx>
#include <connectivity/formattedcolumnvalue.hxx>
#include <memory>
@@ -72,12 +73,13 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::util;
-#define CELL_X 1437
+constexpr sal_Int32 CELL_X = 1437;
ODatabaseImportExport::ODatabaseImportExport(const svx::ODataAccessDescriptor& _aDataDescriptor,
const Reference< XComponentContext >& _rM,
const Reference< css::util::XNumberFormatter >& _rxNumberF)
:m_bBookmarkSelection( false )
+ ,m_pStream(nullptr)
,m_xFormatter(_rxNumberF)
,m_xContext(_rM)
,m_nCommandType(CommandType::TABLE)
@@ -93,11 +95,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)
@@ -120,7 +122,7 @@ void ODatabaseImportExport::dispose()
Reference< XComponent > xComponent(m_xConnection, UNO_QUERY);
if (xComponent.is())
{
- Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ Reference< XEventListener> xEvt(this);
xComponent->removeEventListener(xEvt);
}
m_xConnection.clear();
@@ -133,6 +135,7 @@ void ODatabaseImportExport::dispose()
m_xRow.clear();
m_xRowLocate.clear();
m_xFormatter.clear();
+ m_xRowSetColumns.clear();
}
void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source )
@@ -163,7 +166,7 @@ void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor
{
Reference< XConnection > xPureConn( _aDataDescriptor[DataAccessDescriptorProperty::Connection], UNO_QUERY );
m_xConnection.reset( xPureConn, SharedConnection::NoTakeOwnership );
- Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ Reference< XEventListener> xEvt(this);
Reference< XComponent > xComponent(m_xConnection, UNO_QUERY);
if (xComponent.is() && xEvt.is())
xComponent->addEventListener(xEvt);
@@ -212,7 +215,7 @@ void ODatabaseImportExport::initialize()
{ // we need a connection
OSL_ENSURE(!m_sDataSourceName.isEmpty(),"There must be a datsource name!");
Reference<XNameAccess> xDatabaseContext( DatabaseContext::create(m_xContext), UNO_QUERY_THROW);
- Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ Reference< XEventListener> xEvt(this);
Reference< XConnection > xConnection;
SQLExceptionInfo aInfo = ::dbaui::createConnection( m_sDataSourceName, xDatabaseContext, m_xContext, xEvt, xConnection );
@@ -256,11 +259,11 @@ void ODatabaseImportExport::initialize()
// the result set may be already set with the datadescriptor
if ( !m_xResultSet.is() )
{
- m_xResultSet.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", m_xContext), UNO_QUERY );
+ m_xResultSet.set( m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.sdb.RowSet"_ustr, 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();
}
@@ -317,23 +320,22 @@ 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 );
bool bUnderline = ( css::awt::FontUnderline::NONE != m_aFont.Underline );
bool bStrikeout = ( css::awt::FontStrikeout::NONE != m_aFont.Strikeout );
- sal_Int32 nColor = 0;
+ ::Color aColor;
if(m_xObject.is())
- m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
- ::Color aColor(nColor);
+ m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
OString aFonts(OUStringToOString(m_aFont.Name, RTL_TEXTENCODING_MS_1252));
if (aFonts.isEmpty())
@@ -342,44 +344,43 @@ 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())
{
Reference<XColumnsSupplier> xColSup(m_xObject,UNO_QUERY);
Reference<XNameAccess> xColumns = xColSup->getColumns();
Sequence< OUString> aNames(xColumns->getElementNames());
- const OUString* pIter = aNames.getConstArray();
sal_Int32 nCount = aNames.getLength();
bool bUseResultMetaData = false;
@@ -391,14 +392,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]);
@@ -410,11 +411,10 @@ bool ORTFImportExport::Write()
sColumnName = m_xResultSetMetaData->getColumnName(i);
else
{
- sColumnName = *pIter;
+ sColumnName = aNames[i - 1];
Reference<XPropertySet> xColumn;
xColumns->getByName(sColumnName) >>= xColumn;
xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
- ++pIter;
}
const char* pChar;
@@ -428,52 +428,49 @@ 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;
if ( m_aSelection.hasElements() )
{
- const Any* pSelIter = m_aSelection.getConstArray();
- const Any* pEnd = pSelIter + m_aSelection.getLength();
-
- bool bContinue = true;
- for( ; pSelIter != pEnd && bContinue; ++pSelIter )
+ for (auto& any : m_aSelection)
{
if ( m_bBookmarkSelection )
{
- bContinue = m_xRowLocate->moveToBookmark( *pSelIter );
+ if (!m_xRowLocate->moveToBookmark(any))
+ break;
}
else
{
sal_Int32 nPos = -1;
- OSL_VERIFY( *pSelIter >>= nPos );
- bContinue = ( m_xResultSet->absolute( nPos ) );
+ OSL_VERIFY(any >>= nPos);
+ if (!m_xResultSet->absolute(nPos))
+ break;
}
- if ( bContinue )
- appendRow( pHorzChar.get(), nCount, k, kk );
+ appendRow(pHorzChar.get(), nCount, k, kk);
}
}
else
@@ -486,7 +483,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 +491,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 +511,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 +538,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;
}
@@ -566,24 +563,9 @@ bool ORTFImportExport::Read()
return eState != SvParserState::Error;
}
-const sal_Int16 OHTMLImportExport::nDefaultFontSize[SBA_HTML_FONTSIZES] =
-{
- HTMLFONTSZ1_DFLT, HTMLFONTSZ2_DFLT, HTMLFONTSZ3_DFLT, HTMLFONTSZ4_DFLT,
- HTMLFONTSZ5_DFLT, HTMLFONTSZ6_DFLT, HTMLFONTSZ7_DFLT
-};
-
-sal_Int16 OHTMLImportExport::nFontSize[SBA_HTML_FONTSIZES] = { 0 };
-
const sal_Int16 OHTMLImportExport::nCellSpacing = 0;
const char OHTMLImportExport::sIndentSource[nIndentMax+1] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
-// Macros for HTML-Export
-#define TAG_ON( tag ) HTMLOutFuncs::Out_AsciiTag( (*m_pStream), tag )
-#define TAG_OFF( tag ) HTMLOutFuncs::Out_AsciiTag( (*m_pStream), tag, false )
-#define OUT_LF() m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() )
-#define TAG_ON_LF( tag ) (TAG_ON( tag ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() ))
-#define TAG_OFF_LF( tag ) (TAG_OFF( tag ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() ))
-
OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDescriptor,
const Reference< XComponentContext >& _rM,
const Reference< css::util::XNumberFormatter >& _rxNumberF)
@@ -594,8 +576,7 @@ OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDes
#endif
{
// set HTML configuration
- SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
- m_eDestEnc = rHtmlOptions.GetTextEncoding();
+ m_eDestEnc = RTL_TEXTENCODING_UTF8;
strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource)));
sIndent[0] = 0;
}
@@ -605,13 +586,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_doctype40 ).WriteChar( '>' ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( SAL_NEWLINE_STRING );
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_html );
+ 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();
- OUT_LF();
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteBody();
- OUT_LF();
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_html );
+ 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);
}
@@ -642,47 +623,53 @@ void OHTMLImportExport::WriteHeader()
xDocProps->setTitle(m_sName);
}
- IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_head );
+ IncIndent(1);
+ 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() );
- OUT_LF();
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head );
+ xDocProps, sIndent );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ IncIndent(-1);
+ 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( "<!-- " ); OUT_LF();
- 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( '}' );
- OUT_LF();
- m_pStream->WriteCharPtr( " -->" );
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_style );
- OUT_LF();
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString( " -->" );
+ IncIndent(-1);
+ 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( '=' );
- sal_Int32 nColor = 0;
+ 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) >>= nColor;
- ::Color aColor(nColor);
+ 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( '>' ); OUT_LF();
+ m_pStream->WriteChar( '>' );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteTables();
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_body );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_body, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteTables()
@@ -691,7 +678,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;
@@ -705,8 +692,9 @@ void OHTMLImportExport::WriteTables()
{
sal_Int32 nCount = m_xResultSetMetaData->getColumnCount();
aNames.realloc(nCount);
+ auto aNamesRange = asNonConstRange(aNames);
for (sal_Int32 i= 0; i < nCount; ++i)
- aNames[i] = m_xResultSetMetaData->getColumnName(i+1);
+ aNamesRange[i] = m_xResultSetMetaData->getColumnName(i+1);
bUseResultMetaData = true;
}
}
@@ -728,27 +716,27 @@ void OHTMLImportExport::WriteTables()
"=1";
IncIndent(1);
- TAG_ON( aStrOut.getStr() );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut);
FontOn();
- TAG_ON( OOO_STRING_SVTOOLS_HTML_caption );
- TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_caption);
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold);
m_pStream->WriteOString( OUStringToOString(m_sName, osl_getThreadTextEncoding()) );
// TODO : think about the encoding of the name
- TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
- TAG_OFF( OOO_STRING_SVTOOLS_HTML_caption );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold, false);
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_caption, false);
FontOff();
- OUT_LF();
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// </FONT>
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_thead );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
if(m_xObject.is())
{
@@ -761,10 +749,7 @@ void OHTMLImportExport::WriteTables()
m_xObject->getPropertyValue(PROPERTY_ROW_HEIGHT) >>= nHeight;
// 1. writing the column description
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
-
- for( sal_Int32 i=0;pIter != pEnd; ++pIter,++i )
+ for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
{
sal_Int32 nAlign = 0;
pFormat[i] = 0;
@@ -772,7 +757,7 @@ void OHTMLImportExport::WriteTables()
if ( !bUseResultMetaData )
{
Reference<XPropertySet> xColumn;
- xColumns->getByName(*pIter) >>= xColumn;
+ xColumns->getByName(aNames[i]) >>= xColumn;
xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
pFormat[i] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_FORMATKEY));
pColWidth[i] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_WIDTH));
@@ -788,26 +773,24 @@ void OHTMLImportExport::WriteTables()
if(i == aNames.getLength()-1)
IncIndent(-1);
- WriteCell(pFormat[i],pColWidth[i],nHeight,pHorJustify[i],*pIter,OOO_STRING_SVTOOLS_HTML_tableheader);
+ WriteCell(pFormat[i],pColWidth[i],nHeight,pHorJustify[i],aNames[i],OOO_STRING_SVTOOLS_HTML_tableheader);
}
IncIndent(-1);
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_thead );
+ 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);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
+ 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);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
+ 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())
@@ -830,21 +813,24 @@ void OHTMLImportExport::WriteTables()
}
WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
}
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
}
else
{
IncIndent(-1);
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_thead );
+ 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);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tbody );
- IncIndent(-1); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_table );
+ IncIndent(-1);
+ 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).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal_Int32 nHeightPixel, const char* pChar,
@@ -872,7 +858,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
"=" +
pChar;
- SvNumberFormatsSupplierObj* pSupplierImpl = m_xFormatter.is() ? comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(m_xFormatter->getNumberFormatsSupplier()) : nullptr;
+ SvNumberFormatsSupplierObj* pSupplierImpl = m_xFormatter.is() ? comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(m_xFormatter->getNumberFormatsSupplier()) : nullptr;
SvNumberFormatter* pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr;
if(pFormatter)
{
@@ -889,7 +875,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
}
}
- TAG_ON( aStrTD.getStr() );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD);
FontOn();
@@ -898,24 +884,24 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
bool bUnderline = ( css::awt::FontUnderline::NONE != m_aFont.Underline );
bool bStrikeout = ( css::awt::FontStrikeout::NONE != m_aFont.Strikeout );
- if ( bBold ) TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
- if ( bItalic ) TAG_ON( OOO_STRING_SVTOOLS_HTML_italic );
- if ( bUnderline ) TAG_ON( OOO_STRING_SVTOOLS_HTML_underline );
- if ( bStrikeout ) TAG_ON( OOO_STRING_SVTOOLS_HTML_strike );
+ if ( bBold ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold);
+ if ( bItalic ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_italic);
+ if ( bUnderline ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_underline);
+ if ( bStrikeout ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_strike);
if ( rValue.isEmpty() )
- TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak ); // no completely empty cell
+ 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 ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_strike );
- if ( bUnderline ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline );
- if ( bItalic ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_italic );
- if ( bBold ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
+ 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);
+ if ( bItalic ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_italic, false);
+ if ( bBold ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold, false);
FontOff();
- TAG_OFF_LF( pHtmlTag );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, pHtmlTag, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::FontOn()
@@ -939,13 +925,12 @@ void OHTMLImportExport::FontOn()
"=";
m_pStream->WriteOString( aStrOut );
- sal_Int32 nColor = 0;
+ ::Color aColor;
if(m_xObject.is())
- m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
- ::Color aColor(nColor);
+ m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
- m_pStream->WriteCharPtr( ">" );
+ m_pStream->WriteOString( ">" );
}
inline void OHTMLImportExport::FontOff()
@@ -953,7 +938,7 @@ inline void OHTMLImportExport::FontOff()
#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(m_bCheckFont,"No FontOn() called");
#endif
- TAG_OFF( OOO_STRING_SVTOOLS_HTML_font );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_font, false);
#if OSL_DEBUG_LEVEL > 0
m_bCheckFont = false;
#endif
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index e7c5a72ffbb3..6d11eb21340d 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -29,7 +29,6 @@
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
@@ -40,7 +39,6 @@
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
@@ -64,6 +62,7 @@
#include <svx/svxids.hrc>
#include <sal/log.hxx>
+#include <svl/numformat.hxx>
#include <svl/itempool.hxx>
#include <helpids.h>
#include <svl/itemset.hxx>
@@ -82,7 +81,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>
@@ -105,7 +104,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;
@@ -195,7 +193,6 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create(_rxContext);
Reference< XDataSource > xDatasource;
- Any aError;
SQLExceptionInfo aSQLError;
try
{
@@ -218,8 +215,6 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
else
{
aSQLError = SQLExceptionInfo( e.TargetException );
- if ( !aSQLError.isValid() )
- aError = e.TargetException;
}
}
catch( const Exception& )
@@ -234,7 +229,7 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
{
if ( _pErrorInfo )
{
- *_pErrorInfo = aSQLError;
+ *_pErrorInfo = std::move(aSQLError);
}
else
{
@@ -397,7 +392,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)
{
@@ -434,52 +429,52 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
}
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aTypeName = aValue;
+ pInfo->aTypeName = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nType = aValue;
+ pInfo->nType = aValue.getInt32();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nPrecision = aValue;
+ pInfo->nPrecision = aValue.getInt32();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // LiteralPrefix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aCreateParams = aValue;
+ pInfo->aCreateParams = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE;
+ pInfo->bNullable = aValue.getInt32() == ColumnValue::NULLABLE;
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bCaseSensitive
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nSearchType = aValue;
+ pInfo->nSearchType = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bUnsigned
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bCurrency = static_cast<bool>(aValue);
+ pInfo->bCurrency = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bAutoIncrement = static_cast<bool>(aValue);
+ pInfo->bAutoIncrement = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aLocalTypeName = aValue;
+ pInfo->aLocalTypeName = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nMinimumScale = aValue;
+ pInfo->nMinimumScale = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nMaximumScale = aValue;
+ pInfo->nMaximumScale = aValue.getInt16();
assert(nPos == 15);
// 16 and 17 are unused
nPos = 18;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nNumPrecRadix = aValue;
+ pInfo->nNumPrecRadix = aValue.getInt32();
// check if values are less than zero like it happens in a oracle jdbc driver
if( pInfo->nPrecision < 0)
@@ -491,108 +486,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);
@@ -607,25 +602,29 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
// Close the result set/statement.
- ::comphelper::disposeComponent(xRs);
+ Reference<XCloseable> xCloseable(xRs, UNO_QUERY);
+ if (xCloseable.is())
+ xCloseable->close();
+ else
+ ::comphelper::disposeComponent(xRs);
}
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)
@@ -645,12 +644,20 @@ OUString createDefaultName(const Reference< XDatabaseMetaData>& _xMetaData,const
if ( sCatalog.isEmpty() )
{
Reference<XResultSet> xRes = _xMetaData->getCatalogs();
- Reference<XRow> xRow(xRes,UNO_QUERY);
- while(xRes.is() && xRes->next())
+ if ( xRes.is() )
{
- sCatalog = xRow->getString(1);
- if(!xRow->wasNull())
- break;
+ Reference<XRow> xRow(xRes,UNO_QUERY);
+ while(xRes->next())
+ {
+ sCatalog = xRow->getString(1);
+ if(!xRow->wasNull())
+ break;
+ }
+ Reference<XCloseable> xCloseable(xRes, UNO_QUERY);
+ if (xCloseable.is())
+ xCloseable->close();
+ else
+ ::comphelper::disposeComponent(xRes);
}
}
}
@@ -688,7 +695,7 @@ bool checkDataSourceAvailable(const OUString& _sDataSourceName,const Reference<
return bRet;
}
-sal_Int32 mapTextAllign(const SvxCellHorJustify& _eAlignment)
+sal_Int32 mapTextAlign(const SvxCellHorJustify& _eAlignment)
{
sal_Int32 nAlignment = css::awt::TextAlign::LEFT;
switch (_eAlignment)
@@ -720,7 +727,7 @@ SvxCellHorJustify mapTextJustify(sal_Int32 _nAlignment)
void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
const Reference<XPropertySet>& xField,
SvNumberFormatter* _pFormatter,
- const vcl::Window* _pParent)
+ weld::Widget* _pParent)
{
if (!(xAffectedCol.is() && xField.is()))
return;
@@ -741,9 +748,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::mapTextAllign(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));
}
}
@@ -753,7 +760,32 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
}
}
-bool callColumnFormatDialog(const vcl::Window* _pParent,
+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,
sal_Int32& _nFormatKey,
@@ -763,36 +795,17 @@ bool callColumnFormatDialog(const vcl::Window* _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_ONE_AREA, true },
- { SID_ATTR_NUMBERFORMAT_INFO, true }
- };
- static const sal_uInt16 aAttrMap[] =
- {
+ static const auto aAttrMap = svl::Items<
SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY,
- SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
- 0
- };
+ 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 SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false),
- new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO)
- };
-
- SfxItemPool* pPool = new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults);
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool(u"GridBrowserProperties"_ustr));
+ pPool->registerItemInfoPackage(getItemInfoPackageColumnFormatDialog());
pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
- std::unique_ptr<SfxItemSet> pFormatDescriptor(new SfxItemSet(*pPool, aAttrMap));
+ std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap));
// fill it
pFormatDescriptor->Put(SvxHorJustifyItem(_eJustify, SBA_ATTR_ALIGN_HOR_JUSTIFY));
bool bText = false;
@@ -805,7 +818,7 @@ bool callColumnFormatDialog(const vcl::Window* _pParent,
pFormatDescriptor->Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, true));
if (!_pFormatter->IsTextFormat(_nFormatKey))
// text fields can only have text formats
- _nFormatKey = _pFormatter->GetStandardFormat(SvNumFormatType::TEXT,_pParent->GetSettings().GetLanguageTag().getLanguageType());
+ _nFormatKey = _pFormatter->GetStandardFormat(SvNumFormatType::TEXT, Application::GetSettings().GetLanguageTag().getLanguageType());
}
pFormatDescriptor->Put(SfxUInt32Item(SBA_DEF_FMTVALUE, _nFormatKey));
@@ -818,7 +831,7 @@ bool callColumnFormatDialog(const vcl::Window* _pParent,
}
{ // want the dialog to be destroyed before our set
- SbaSbAttrDlg aDlg(_pParent->GetFrameWeld(), pFormatDescriptor.get(), _pFormatter, _bHasFormat);
+ SbaSbAttrDlg aDlg(_pParent, &*pFormatDescriptor, _pFormatter, _bHasFormat);
if (RET_OK == aDlg.run())
{
// ItemSet->UNO
@@ -855,16 +868,14 @@ bool callColumnFormatDialog(const vcl::Window* _pParent,
}
pFormatDescriptor.reset();
- SfxItemPool::Free(pPool);
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
+ pPool.clear();
return bRet;
}
std::shared_ptr<const SfxFilter> getStandardDatabaseFilter()
{
- std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
+ std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName(u"StarOffice XML (Base)"_ustr);
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
return pFilter;
}
@@ -885,7 +896,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)
{
@@ -911,7 +922,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));
}
}
}
@@ -932,7 +943,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 ) );
@@ -986,17 +997,17 @@ void fillAutoIncrementValue(const Reference<XPropertySet>& _xDatasource,
_xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
// search the right propertyvalue
- const PropertyValue* pValue =std::find_if(aInfo.begin(), aInfo.end(),
+ const PropertyValue* pValue =std::find_if(std::cbegin(aInfo), std::cend(aInfo),
[](const PropertyValue& lhs)
{return lhs.Name == PROPERTY_AUTOINCREMENTCREATION;} );
- if ( pValue != aInfo.end() )
+ if ( pValue != std::cend(aInfo) )
pValue->Value >>= _rsAutoIncrementValue;
- pValue =std::find_if(aInfo.begin(), aInfo.end(),
+ pValue =std::find_if(std::cbegin(aInfo), std::cend(aInfo),
[](const PropertyValue& lhs)
{return lhs.Name == "IsAutoRetrievingEnabled";} );
- if ( pValue != aInfo.end() )
+ if ( pValue != std::cend(aInfo) )
pValue->Value >>= _rAutoIncrementValueEnabled;
}
@@ -1040,39 +1051,50 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons
Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier();
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
OSL_ENSURE(pSupplierImpl,"No Supplier!");
if ( pSupplierImpl )
{
SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
- pFormatter->SetEvalDateFormat(NF_EVALDATEFORMAT_FORMAT);
+ pFormatter->SetEvalDateFormat(NfEvalDateFormat::Format);
}
}
+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 ? std::move(pFallback) : queryTypeInfoByType(DataType::VARCHAR, _rTypeInfo);
OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!");
return pTypeInfo;
@@ -1144,13 +1166,13 @@ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rType
if ( !pTypeInfo )
{
bool bForce = true;
- pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,OUString(),"x",50,0,false,bForce);
+ pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,OUString(),u"x"_ustr,50,0,false,bForce);
}
OSL_ENSURE(pTypeInfo,"Wrong DataType supplied!");
return pTypeInfo;
}
-sal_Int32 askForUserAction(weld::Window* pParent, const char* pTitle, const char* pText, bool _bAll, const OUString& _sName)
+sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool _bAll, std::u16string_view _sName)
{
SolarMutexGuard aGuard;
OUString aMsg = DBA_RES(pText);
@@ -1207,11 +1229,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())
@@ -1253,7 +1275,7 @@ Reference<XPropertySet> createView( const OUString& _rName, const Reference< XCo
return createView( _rName, _rxConnection, sCommand );
}
-bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentContext >& _rxContext,
+bool insertHierarchyElement(weld::Window* pParent, const Reference< XComponentContext >& _rxContext,
const Reference<XHierarchicalNameContainer>& _xNames,
const OUString& _sParentFolder,
bool _bForm,
@@ -1261,7 +1283,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
const Reference<XContent>& _xContent,
bool _bMove)
{
- OSL_ENSURE( _xNames.is(), "insertHierachyElement: illegal name container!" );
+ OSL_ENSURE( _xNames.is(), "insertHierarchyElement: illegal name container!" );
if ( !_xNames.is() )
return false;
@@ -1274,7 +1296,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
xNameAccess.set(xChild->getParent(),UNO_QUERY);
}
- OSL_ENSURE( xNameAccess.is(), "insertHierachyElement: could not find the proper name container!" );
+ OSL_ENSURE( xNameAccess.is(), "insertHierarchyElement: could not find the proper name container!" );
if ( !xNameAccess.is() )
return false;
@@ -1285,9 +1307,9 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
if ( !_bMove || sNewName.isEmpty() )
{
- OUString sTargetName,sLabel;
if ( sNewName.isEmpty() || xNameAccess->hasByName(sNewName) )
{
+ OUString sLabel, sTargetName;
if ( !sNewName.isEmpty() )
sTargetName = sNewName;
else
@@ -1296,7 +1318,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
sTargetName = ::dbtools::createUniqueName(xNameAccess,sTargetName);
// here we have everything needed to create a new query object ...
- HierarchicalNameCheck aNameChecker( _xNames.get(), _sParentFolder );
+ HierarchicalNameCheck aNameChecker( _xNames, _sParentFolder );
// ... ehm, except a new name
OSaveAsDlg aAskForName(pParent,
_rxContext,
@@ -1315,7 +1337,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
{
OUString sError(DBA_RES(STR_NAME_ALREADY_EXISTS));
sError = sError.replaceFirst("#",sNewName);
- throw SQLException(sError,nullptr,"S1000",0,Any());
+ throw SQLException(sError,nullptr,u"S1000"_ustr,0,Any());
}
try
@@ -1327,11 +1349,11 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
{"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/UpdateHelperImpl.hxx b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
index 48780724604a..9f8d0d39981e 100644
--- a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
+++ b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_MISC_UPDATEHELPERIMPL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_MISC_UPDATEHELPERIMPL_HXX
+#pragma once
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
@@ -72,6 +71,4 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_MISC_UPDATEHELPERIMPL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 35c8a7fe0f18..123db5efc548 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;
@@ -42,19 +41,19 @@ using namespace ::com::sun::star::sdbcx;
namespace CopyTableOperation = css::sdb::application::CopyTableOperation;
OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/copytablepage.ui", "CopyTablePage")
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/copytablepage.ui"_ustr, u"CopyTablePage"_ustr)
, m_bPKeyAllowed(false)
, m_bUseHeaderAllowed(true)
, m_nOldOperation(0)
- , m_xEdTableName(m_xBuilder->weld_entry("name"))
- , m_xRB_DefData(m_xBuilder->weld_radio_button("defdata"))
- , m_xRB_Def(m_xBuilder->weld_radio_button("def"))
- , m_xRB_View(m_xBuilder->weld_radio_button("view"))
- , m_xRB_AppendData(m_xBuilder->weld_radio_button("data"))
- , m_xCB_UseHeaderLine(m_xBuilder->weld_check_button("firstline"))
- , m_xCB_PrimaryColumn(m_xBuilder->weld_check_button("primarykey"))
- , m_xFT_KeyName(m_xBuilder->weld_label("keynamelabel"))
- , m_xEdKeyName(m_xBuilder->weld_entry("keyname"))
+ , m_xEdTableName(m_xBuilder->weld_entry(u"name"_ustr))
+ , m_xRB_DefData(m_xBuilder->weld_radio_button(u"defdata"_ustr))
+ , m_xRB_Def(m_xBuilder->weld_radio_button(u"def"_ustr))
+ , m_xRB_View(m_xBuilder->weld_radio_button(u"view"_ustr))
+ , m_xRB_AppendData(m_xBuilder->weld_radio_button(u"data"_ustr))
+ , m_xCB_UseHeaderLine(m_xBuilder->weld_check_button(u"firstline"_ustr))
+ , m_xCB_PrimaryColumn(m_xBuilder->weld_check_button(u"primarykey"_ustr))
+ , m_xFT_KeyName(m_xBuilder->weld_label(u"keynamelabel"_ustr))
+ , m_xEdKeyName(m_xBuilder->weld_entry(u"keyname"_ustr))
{
if ( m_pParent->m_xDestConnection.is() )
{
@@ -66,17 +65,16 @@ OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard)
m_xCB_PrimaryColumn->set_sensitive(m_bPKeyAllowed);
- m_xRB_AppendData->connect_clicked( LINK( this, OCopyTable, AppendDataClickHdl ) );
+ m_xRB_AppendData->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_DefData->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_Def->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_View->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_xRB_DefData->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_xRB_Def->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_xRB_View->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
-
- m_xCB_PrimaryColumn->connect_clicked(LINK( this, OCopyTable, KeyClickHdl ) );
+ m_xCB_PrimaryColumn->connect_toggled(LINK( this, OCopyTable, KeyClickHdl ) );
m_xFT_KeyName->set_sensitive(false);
m_xEdKeyName->set_sensitive(false);
- m_xEdKeyName->set_text(m_pParent->createUniqueName("ID"));
+ m_xEdKeyName->set_text(m_pParent->createUniqueName(u"ID"_ustr));
const sal_Int32 nMaxLen = m_pParent->getMaxColumnNameLength();
m_xEdKeyName->set_max_length(nMaxLen);
@@ -89,11 +87,6 @@ OCopyTable::~OCopyTable()
{
}
-IMPL_LINK_NOARG( OCopyTable, AppendDataClickHdl, weld::Button&, void )
-{
- SetAppendDataRadio();
-}
-
void OCopyTable::SetAppendDataRadio()
{
m_pParent->EnableNextButton(true);
@@ -103,10 +96,17 @@ void OCopyTable::SetAppendDataRadio()
m_pParent->setOperation(CopyTableOperation::AppendData);
}
-IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Button&, rButton, void)
+IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Toggleable&, rButton, void)
{
- m_pParent->EnableNextButton(&rButton != m_xRB_View.get());
- bool bKey = m_bPKeyAllowed && &rButton != m_xRB_View.get();
+ if (!rButton.get_active())
+ return;
+ if (m_xRB_AppendData->get_active())
+ {
+ SetAppendDataRadio();
+ return;
+ }
+ 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);
@@ -121,7 +121,7 @@ IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Button&, rButton, void)
m_pParent->setOperation( CopyTableOperation::CreateAsView );
}
-IMPL_LINK_NOARG( OCopyTable, KeyClickHdl, weld::Button&, void )
+IMPL_LINK_NOARG( OCopyTable, KeyClickHdl, weld::Toggleable&, void )
{
m_xEdKeyName->set_sensitive(m_xCB_PrimaryColumn->get_active());
m_xFT_KeyName->set_sensitive(m_xCB_PrimaryColumn->get_active());
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 8941119e9234..d12b8752d1a5 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -21,22 +21,18 @@
#include <strings.hrc>
#include <osl/diagnose.h>
#include <WCopyTable.hxx>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <core_resource.hxx>
#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)
@@ -49,13 +45,13 @@ OWizardPage::~OWizardPage()
// OWizColumnSelect
OWizColumnSelect::OWizColumnSelect(weld::Container* pPage, OCopyTableWizard* pWizard)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/applycolpage.ui", "ApplyColPage")
- , m_xOrgColumnNames(m_xBuilder->weld_tree_view("from"))
- , m_xColumn_RH(m_xBuilder->weld_button("colrh"))
- , m_xColumns_RH(m_xBuilder->weld_button("colsrh"))
- , m_xColumn_LH(m_xBuilder->weld_button("collh"))
- , m_xColumns_LH(m_xBuilder->weld_button("colslh"))
- , m_xNewColumnNames(m_xBuilder->weld_tree_view("to"))
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/applycolpage.ui"_ustr, u"ApplyColPage"_ustr)
+ , m_xOrgColumnNames(m_xBuilder->weld_tree_view(u"from"_ustr))
+ , m_xColumn_RH(m_xBuilder->weld_button(u"colrh"_ustr))
+ , m_xColumns_RH(m_xBuilder->weld_button(u"colsrh"_ustr))
+ , m_xColumn_LH(m_xBuilder->weld_button(u"collh"_ustr))
+ , m_xColumns_LH(m_xBuilder->weld_button(u"colslh"_ustr))
+ , m_xNewColumnNames(m_xBuilder->weld_tree_view(u"to"_ustr))
{
m_xColumn_RH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
m_xColumn_LH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
@@ -73,7 +69,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 +86,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 +117,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 +136,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 +271,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 +286,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 +297,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 +328,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);
@@ -346,7 +342,7 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
// been removed earlier and adjust accordingly. Based on the
// algorithm employed in moveColumn().
sal_Int32 OWizColumnSelect::adjustColumnPosition(weld::TreeView const * _pLeft,
- const OUString& _sColumnName,
+ std::u16string_view _sColumnName,
ODatabaseExport::TColumnVector::size_type nCurrentPos,
const ::comphelper::UStringMixEqual& _aCase)
{
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index f395a59d2ba9..c8a7e023c366 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -20,7 +20,6 @@
#include <strings.hrc>
#include <strings.hxx>
#include <core_resource.hxx>
-#include <sqlmessage.hxx>
#include <UITools.hxx>
#include <WColumnSelect.hxx>
#include <WCopyTable.hxx>
@@ -53,7 +52,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;
@@ -130,21 +132,21 @@ 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)
+ static constexpr OUString aCopyProperties[] {
+ PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF
};
- for (const auto & aCopyPropertie : aCopyProperties)
+ for (const auto & aCopyProperty : aCopyProperties)
{
- if ( m_xObjectPSI->hasPropertyByName( aCopyPropertie ) )
- _rxObject->setPropertyValue( aCopyPropertie, m_xObject->getPropertyValue( aCopyPropertie ) );
+ if ( m_xObjectPSI->hasPropertyByName( aCopyProperty ) )
+ _rxObject->setPropertyValue( aCopyProperty, m_xObject->getPropertyValue( aCopyProperty ) );
}
}
void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _xConnection,const Reference< XPropertySet >& _rxObject ) const
{
- std::pair< OUString, OUString > aProperties[] = {
- std::pair< OUString, OUString >(PROPERTY_FILTER,OUString(" AND "))
- ,std::pair< OUString, OUString >(PROPERTY_ORDER,OUString(" ORDER BY "))
+ static constexpr std::pair< OUString, OUString > aProperties[] {
+ std::pair< OUString, OUString >(PROPERTY_FILTER,u" AND "_ustr)
+ ,std::pair< OUString, OUString >(PROPERTY_ORDER,u" ORDER BY "_ustr)
};
try
@@ -155,17 +157,17 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _
OUStringBuffer sStatement = "SELECT * FROM " + sTargetName + " WHERE 0=1";
- for (const std::pair<OUString,OUString> & aPropertie : aProperties)
+ for (const std::pair<OUString,OUString> & aProperty : aProperties)
{
- if ( m_xObjectPSI->hasPropertyByName( aPropertie.first ) )
+ if ( m_xObjectPSI->hasPropertyByName( aProperty.first ) )
{
OUString sFilter;
- m_xObject->getPropertyValue( aPropertie.first ) >>= sFilter;
+ m_xObject->getPropertyValue( aProperty.first ) >>= sFilter;
if ( !sFilter.isEmpty() )
{
- sStatement.append(aPropertie.second);
+ sStatement.append(aProperty.second);
sFilter = sFilter.replaceFirst(sSourceName,sTargetNameTemp);
- _rxObject->setPropertyValue( aPropertie.first, makeAny(sFilter) );
+ _rxObject->setPropertyValue( aProperty.first, Any(sFilter) );
sStatement.append(sFilter);
}
}
@@ -210,27 +212,21 @@ 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
const OUString sQuote = m_xMetaData->getIdentifierQuoteString();
Sequence< OUString > aColumnNames = getColumnNames();
- const OUString* pColumnName = aColumnNames.getConstArray();
- const OUString* pEnd = pColumnName + aColumnNames.getLength();
- for ( ; pColumnName != pEnd; )
+ for (sal_Int32 i = 0; i < aColumnNames.getLength(); ++i)
{
- aSQL.append( ::dbtools::quoteName( sQuote, *pColumnName++ ) );
-
- if ( pColumnName == pEnd )
- aSQL.append( " " );
- else
- aSQL.append( ", " );
+ if (i > 0)
+ aSQL.append(", ");
+ aSQL.append(::dbtools::quoteName(sQuote, aColumnNames[i]));
}
- aSQL.append( "FROM " ).append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
+ aSQL.append( " FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
sSelectStatement = aSQL.makeStringAndClear();
}
@@ -248,11 +244,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_aColumnInfo()
+ ,m_sTableName(std::move( _sTableName ))
{
::dbtools::qualifiedNameComponents( m_xMetaData, m_sTableName, m_sTableCatalog, m_sTableSchema, m_sTableBareName, ::dbtools::EComposeRule::Complete );
impl_ensureColumnInfo_throw();
@@ -268,7 +263,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() );
@@ -328,9 +323,8 @@ void NamedTableCopySource::impl_ensureColumnInfo_throw()
Sequence< OUString > NamedTableCopySource::getColumnNames() const
{
Sequence< OUString > aNames( m_aColumnInfo.size() );
- size_t nPos = 0;
- for (auto const& elem : m_aColumnInfo)
- aNames[ nPos++ ] = elem.GetName();
+ std::transform(m_aColumnInfo.begin(), m_aColumnInfo.end(), aNames.getArray(),
+ [](const auto& elem) { return elem.GetName(); });
return aNames;
}
@@ -341,13 +335,13 @@ 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() )
{
sal_Int32 len( aPKColNames.getLength() );
aPKColNames.realloc( len + 1 );
- aPKColNames[ len ] = xPKDescRow->getString( 4 ); // COLUMN_NAME
+ aPKColNames.getArray()[ len ] = xPKDescRow->getString( 4 ); // COLUMN_NAME
}
}
catch( const Exception& )
@@ -369,12 +363,8 @@ OFieldDescription* NamedTableCopySource::createFieldDescription( const OUString&
OUString NamedTableCopySource::getSelectStatement() const
{
- OUStringBuffer aSQL;
- aSQL.append( "SELECT * FROM " );
-
- aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ) );
-
- return aSQL.makeStringAndClear();
+ return "SELECT * FROM " +
+ ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName );
}
::utl::SharedUNOComponent< XPreparedStatement > NamedTableCopySource::getPreparedSelectStatement() const
@@ -490,7 +480,7 @@ OCopyTableWizard::OCopyTableWizard(weld::Window* pParent, const OUString& _rDefa
const Reference< XConnection >& _xConnection, const Reference< XComponentContext >& _rxContext,
const Reference< XInteractionHandler>& _xInteractionHandler)
: vcl::RoadmapWizardMachine(pParent)
- , m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ , m_mNameMapping(comphelper::UStringMixLess(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()))
, m_xDestConnection( _xConnection )
, m_rSourceObject( _rSourceObject )
, m_xFormatter( getNumberFormatter( _xConnection, _rxContext ) )
@@ -582,18 +572,18 @@ 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,
- const ODatabaseExport::TColumns& _rSourceColumns, const ODatabaseExport::TColumnVector& _rSourceColVec,
+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 )
: vcl::RoadmapWizardMachine(pParent)
- , m_vSourceColumns(_rSourceColumns)
- , m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ , m_vSourceColumns(std::move(_rSourceColumns))
+ , m_mNameMapping(comphelper::UStringMixLess(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()))
, m_xDestConnection( _xConnection )
, m_rSourceObject( DummyCopySource::Instance() )
, m_xFormatter(_xFormatter)
@@ -602,7 +592,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)
@@ -655,9 +645,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_button(nullptr, m_xNextPage.get());
else
- m_xFinish->set_has_default(true);
+ m_xAssistant->change_default_button(nullptr, m_xFinish.get());
m_pTypeInfo = std::make_shared<OTypeInfo>();
m_pTypeInfo->aUIName = m_sTypeNames.getToken(TYPE_OTHER, ';');
@@ -675,6 +665,7 @@ OCopyTableWizard::~OCopyTableWizard()
m_aTypeInfoIndex.clear();
m_aTypeInfo.clear();
m_aDestTypeInfoIndex.clear();
+ m_aDestTypeInfo.clear();
}
IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl, weld::Button&, void)
@@ -740,6 +731,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);
@@ -845,16 +837,15 @@ 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.get() );
+ xRequest->addContinuation( xYes );
xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort;
- xRequest->addContinuation( xAbort.get() );
+ xRequest->addContinuation( xAbort );
- m_xInteractionHandler->handle( xRequest.get() );
+ m_xInteractionHandler->handle( xRequest );
if ( xYes->wasSelected() )
{
@@ -995,19 +986,15 @@ 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.
// On Add and Drop all lines can be edited.
- Sequence< OUString > aColumns( _rSourceObject.getColumnNames() );
- const OUString* pColumn = aColumns.getConstArray();
- const OUString* pColumnEnd = pColumn + aColumns.getLength();
-
- for ( ; pColumn != pColumnEnd; ++pColumn )
+ for (auto& column : _rSourceObject.getColumnNames())
{
// get the properties of the column
- pActFieldDescr = _rSourceObject.createFieldDescription( *pColumn );
+ pActFieldDescr = _rSourceObject.createFieldDescription(column);
OSL_ENSURE( pActFieldDescr, "OCopyTableWizard::loadData: illegal field description!" );
if ( !pActFieldDescr )
continue;
@@ -1029,13 +1016,9 @@ void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject,
}
// determine which columns belong to the primary key
- Sequence< OUString > aPrimaryKeyColumns( _rSourceObject.getPrimaryKeyColumnNames() );
- const OUString* pKeyColName = aPrimaryKeyColumns.getConstArray();
- const OUString* pKeyColEnd = pKeyColName + aPrimaryKeyColumns.getLength();
-
- for( ; pKeyColName != pKeyColEnd; ++pKeyColName )
+ for (auto& keyColName : _rSourceObject.getPrimaryKeyColumnNames())
{
- ODatabaseExport::TColumns::const_iterator keyPos = _rColumns.find( *pKeyColName );
+ ODatabaseExport::TColumns::const_iterator keyPos = _rColumns.find(keyColName);
if ( keyPos != _rColumns.end() )
{
keyPos->second->SetPrimaryKey( true );
@@ -1078,7 +1061,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;
@@ -1113,7 +1096,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())
@@ -1143,7 +1126,7 @@ Reference< XPropertySet > OCopyTableWizard::returnTable()
return createTable();
}
-Reference< XPropertySet > OCopyTableWizard::getTable()
+Reference< XPropertySet > OCopyTableWizard::getTable() const
{
Reference< XPropertySet > xTable;
@@ -1198,16 +1181,16 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
if(xMetaData->getDatabaseProductName() == "MySQL")
{
Reference< XStatement > xSelect = m_xDestConnection->createStatement();
- Reference< XResultSet > xRs = xSelect->executeQuery("select database()");
+ Reference< XResultSet > xRs = xSelect->executeQuery(u"select database()"_ustr);
(void)xRs->next(); // first and only result
Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
sSchema = xRow->getString(1);
}
}
- 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
@@ -1251,12 +1234,10 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
// set column mappings
Reference<XNameAccess> xNameAccess = xSuppDestinationColumns->getColumns();
Sequence< OUString> aSeq = xNameAccess->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(sal_Int32 nNewPos=1;pIter != pEnd;++pIter,++nNewPos)
+ for (sal_Int32 i = 0; i < aSeq.getLength(); ++i)
{
- ODatabaseExport::TColumns::const_iterator aDestIter = m_vDestColumns.find(*pIter);
+ ODatabaseExport::TColumns::const_iterator aDestIter = m_vDestColumns.find(aSeq[i]);
if ( aDestIter != m_vDestColumns.end() )
{
@@ -1273,7 +1254,7 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
if ( m_vColumnPositions.end() != aPosFind )
{
- aPosFind->second = nNewPos;
+ aPosFind->second = i + 1;
OSL_ENSURE( m_vColumnTypes.size() > o3tl::make_unsigned( aPosFind - m_vColumnPositions.begin() ),
"Invalid index for vector!" );
m_vColumnTypes[ aPosFind - m_vColumnPositions.begin() ] = (*aFind)->second->GetType();
@@ -1362,7 +1343,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;
@@ -1495,7 +1476,7 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType, bool& _bN
if ( !pType )
{
_bNotConvert = false;
- pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,"x",50,0,false,bForce);
+ pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,u"x"_ustr,50,0,false,bForce);
if ( !pType )
pType = m_pTypeInfo;
}
@@ -1525,7 +1506,7 @@ OUString OCopyTableWizard::createUniqueName(const OUString& _sName)
return sName;
}
-void OCopyTableWizard::showColumnTypeNotSupported(const OUString& _rColumnName)
+void OCopyTableWizard::showColumnTypeNotSupported(std::u16string_view _rColumnName)
{
OUString sMessage( DBA_RES( STR_UNKNOWN_TYPE_FOUND ) );
sMessage = sMessage.replaceFirst("#1",_rColumnName);
@@ -1545,7 +1526,7 @@ void OCopyTableWizard::showError(const Any& _aError)
try
{
::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( _aError ) );
- m_xInteractionHandler->handle( xRequest.get() );
+ m_xInteractionHandler->handle( xRequest );
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/misc/WExtendPages.cxx b/dbaccess/source/ui/misc/WExtendPages.cxx
index f34661cabd7d..c7eac9181e00 100644
--- a/dbaccess/source/ui/misc/WExtendPages.cxx
+++ b/dbaccess/source/ui/misc/WExtendPages.cxx
@@ -31,7 +31,7 @@ void OWizHTMLExtend::createReaderAndCallParser(sal_Int32 _nRows)
{
tools::SvRef<OHTMLReader> xParser = new OHTMLReader(*m_pParserStream,
_nRows,
- m_pParent->GetColumnPositions(),
+ std::vector(m_pParent->GetColumnPositions()),
m_pParent->GetFormatter(),
m_pParent->GetComponentContext(),
&m_pParent->getDestVector(),
@@ -44,7 +44,7 @@ void OWizRTFExtend::createReaderAndCallParser(sal_Int32 _nRows)
{
tools::SvRef<ORTFReader> xParser = new ORTFReader(*m_pParserStream,
_nRows,
- m_pParent->GetColumnPositions(),
+ std::vector(m_pParent->GetColumnPositions()),
m_pParent->GetFormatter(),
m_pParent->GetComponentContext(),
&m_pParent->getDestVector(),
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 75ff6e3372f1..5eba2844b625 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -30,17 +30,17 @@ using namespace ::dbaui;
// OWizColumnSelect
OWizNameMatching::OWizNameMatching(weld::Container* pPage, OCopyTableWizard* pWizard)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/namematchingpage.ui", "NameMatching")
- , m_xTABLE_LEFT(m_xBuilder->weld_label("leftlabel"))
- , m_xTABLE_RIGHT(m_xBuilder->weld_label("rightlabel"))
- , m_xCTRL_LEFT(m_xBuilder->weld_tree_view("left"))
- , m_xCTRL_RIGHT(m_xBuilder->weld_tree_view("right"))
- , m_xColumn_up(m_xBuilder->weld_button("up"))
- , m_xColumn_down(m_xBuilder->weld_button("down"))
- , m_xColumn_up_right(m_xBuilder->weld_button("up_right"))
- , m_xColumn_down_right(m_xBuilder->weld_button("down_right"))
- , m_xAll(m_xBuilder->weld_button("all"))
- , m_xNone(m_xBuilder->weld_button("none"))
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/namematchingpage.ui"_ustr, u"NameMatching"_ustr)
+ , m_xTABLE_LEFT(m_xBuilder->weld_label(u"leftlabel"_ustr))
+ , m_xTABLE_RIGHT(m_xBuilder->weld_label(u"rightlabel"_ustr))
+ , m_xCTRL_LEFT(m_xBuilder->weld_tree_view(u"left"_ustr))
+ , m_xCTRL_RIGHT(m_xBuilder->weld_tree_view(u"right"_ustr))
+ , m_xColumn_up(m_xBuilder->weld_button(u"up"_ustr))
+ , m_xColumn_down(m_xBuilder->weld_button(u"down"_ustr))
+ , m_xColumn_up_right(m_xBuilder->weld_button(u"up_right"_ustr))
+ , m_xColumn_down_right(m_xBuilder->weld_button(u"down_right"_ustr))
+ , m_xAll(m_xBuilder->weld_button(u"all"_ustr))
+ , m_xNone(m_xBuilder->weld_button(u"none"_ustr))
{
OUString aImgUp(BMP_UP);
OUString aImgDown(BMP_DOWN);
@@ -60,8 +60,8 @@ OWizNameMatching::OWizNameMatching(weld::Container* pPage, OCopyTableWizard* pWi
m_xCTRL_LEFT->enable_toggle_buttons(weld::ColumnToggleType::Check);
- m_xCTRL_LEFT->connect_changed(LINK(this,OWizNameMatching,TableListClickHdl));
- m_xCTRL_RIGHT->connect_changed(LINK(this,OWizNameMatching,TableListRightSelectHdl));
+ m_xCTRL_LEFT->connect_selection_changed(LINK(this, OWizNameMatching, TableListClickHdl));
+ m_xCTRL_RIGHT->connect_selection_changed(LINK(this, OWizNameMatching, TableListRightSelectHdl));
m_sSourceText = m_xTABLE_LEFT->get_label() + "\n";
m_sDestText = m_xTABLE_RIGHT->get_label() + "\n";
@@ -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 f42521524d60..4224ea66b9f8 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -19,27 +19,27 @@
#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>
#include <strings.hrc>
#include <tools/stream.hxx>
#include <vcl/commandevent.hxx>
+#include <vcl/svapp.hxx>
#include <UITools.hxx>
#include <core_resource.hxx>
#include <FieldControls.hxx>
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;
// OWizTypeSelectControl
OWizTypeSelectControl::OWizTypeSelectControl(weld::Container* pPage, OWizTypeSelect* pParentTabPage)
- : OFieldDescControl(pPage, nullptr, nullptr)
+ : OFieldDescControl(pPage, nullptr)
, m_pParentTabPage(pParentTabPage)
{
}
@@ -76,7 +76,7 @@ void OWizTypeSelectControl::DeactivateAggregate( EControlType eType )
}
}
-void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
+void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
{
OSL_ENSURE(nRow == -1,"nRow must be -1!");
@@ -85,7 +85,7 @@ void OWizTypeSelectControl::CellModified(long 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;
@@ -152,7 +152,7 @@ void OWizTypeSelectControl::CellModified(long 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);
}
@@ -202,15 +202,14 @@ 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(VclPtr<OWizTypeSelectControl>::Create(m_xControlContainer.get(), this))
- , m_xAutoType(m_xBuilder->weld_label("autotype"))
- , m_xAutoFt(m_xBuilder->weld_label("autolabel"))
- , m_xAutoEt(m_xBuilder->weld_spin_button("auto"))
- , m_xAutoPb(m_xBuilder->weld_button("autobutton"))
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/typeselectpage.ui"_ustr, u"TypeSelect"_ustr)
+ , m_xColumnNames(new OWizTypeSelectList(m_xBuilder->weld_tree_view(u"columnnames"_ustr)))
+ , m_xControlContainer(m_xBuilder->weld_container(u"control_container"_ustr))
+ , m_xTypeControl(new OWizTypeSelectControl(m_xControlContainer.get(), this))
+ , m_xAutoType(m_xBuilder->weld_label(u"autotype"_ustr))
+ , m_xAutoFt(m_xBuilder->weld_label(u"autolabel"_ustr))
+ , m_xAutoEt(m_xBuilder->weld_spin_button(u"auto"_ustr))
+ , m_xAutoPb(m_xBuilder->weld_button(u"autobutton"_ustr))
, m_pParserStream(pStream)
, m_nDisplayRow(0)
, m_bAutoIncrementEnabled(false)
@@ -218,10 +217,9 @@ OWizTypeSelect::OWizTypeSelect(weld::Container* pPage, OCopyTableWizard* pWizard
{
m_xColumnNames->connect_changed(LINK(this,OWizTypeSelect,ColumnSelectHdl));
- m_xTypeControl->Show();
m_xTypeControl->Init();
- m_xAutoEt->set_text("10");
+ m_xAutoEt->set_text(u"10"_ustr);
m_xAutoEt->set_digits(0);
m_xAutoPb->connect_clicked(LINK(this,OWizTypeSelect,ButtonClickHdl));
m_xColumnNames->set_selection_mode(SelectionMode::Multiple);
@@ -239,7 +237,6 @@ OWizTypeSelect::OWizTypeSelect(weld::Container* pPage, OCopyTableWizard* pWizard
OWizTypeSelect::~OWizTypeSelect()
{
- m_xTypeControl.disposeAndClear();
}
OUString OWizTypeSelect::GetTitle() const
@@ -249,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);
@@ -266,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);
@@ -289,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);
@@ -340,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;
}
@@ -368,14 +365,14 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
if (!IsPrimaryKeyAllowed())
return false;
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xControl.get(), "dbaccess/ui/keymenu.ui"));
- auto xContextMenu = xBuilder->weld_menu("menu");
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xControl.get(), u"dbaccess/ui/keymenu.ui"_ustr));
+ auto xContextMenu = xBuilder->weld_menu(u"menu"_ustr);
// Should primary key checkbox be checked?
const sal_Int32 nCount = m_xControl->n_children();
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.
@@ -389,28 +386,28 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
}
if (bCheckOk)
- xContextMenu->set_active("primarykey", true);
+ xContextMenu->set_active(u"primarykey"_ustr, true);
- OString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
- if (sCommand == "primarykey")
+ 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)
{
- for (sal_Int32 j = 0 ; j < nCount; ++j)
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
+ if (pFieldDescr)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
- if (pFieldDescr)
+ if(!bCheckOk && m_xControl->is_selected(j))
{
- if(!bCheckOk && m_xControl->is_selected(j))
- {
- setPrimaryKey(pFieldDescr,j,true);
- }
- else
- {
- setPrimaryKey(pFieldDescr,j);
- }
+ setPrimaryKey(pFieldDescr,j,true);
+ }
+ else
+ {
+ setPrimaryKey(pFieldDescr,j);
}
}
- m_aChangeHdl.Call(*m_xControl);
}
+ m_aChangeHdl.Call(*m_xControl);
return true;
}
diff --git a/dbaccess/source/ui/misc/asyncmodaldialog.cxx b/dbaccess/source/ui/misc/asyncmodaldialog.cxx
index 3c59a58f8b85..2c7db57be16e 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
{
@@ -65,7 +65,7 @@ namespace dbaui
{
try
{
- m_xDialog->execute();
+ (void)m_xDialog->execute();
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/misc/charsets.cxx b/dbaccess/source/ui/misc/charsets.cxx
index 86e55b226df0..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
{
@@ -30,8 +31,7 @@ namespace dbaui
// OCharsetDisplay
OCharsetDisplay::OCharsetDisplay()
- : OCharsetMap()
- , m_aSystemDisplayName(DBA_RES( STR_RSC_CHARSETS ))
+ : m_aSystemDisplayName(DBA_RES( STR_RSC_CHARSETS ))
{
}
@@ -62,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 );
@@ -87,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 599398e5d00f..cfca8f73413e 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;
@@ -104,9 +103,6 @@ namespace dbaui
{
explicit ControllerFrame_Data( IController& _rController )
:m_rController( _rController )
- ,m_xFrame()
- ,m_xDocEventBroadcaster()
- ,m_pListener()
,m_bActive( false )
,m_bIsTopLevelDocumentWindow( false )
{
@@ -212,7 +208,7 @@ namespace dbaui
{
if ( _rData.m_xDocEventBroadcaster.is() )
{
- OUString sEventName = _bActive ? OUString("OnFocus") : OUString("OnUnfocus");
+ OUString sEventName = _bActive ? u"OnFocus"_ustr : u"OnUnfocus"_ustr;
Reference< XController2 > xController( _rData.m_rController.getXController(), UNO_QUERY_THROW );
_rData.m_xDocEventBroadcaster->notifyDocumentEvent( sEventName, xController, Any() );
}
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 49d3cfe5591a..112c79947393 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,12 +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_xFrameLoader ( )
,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!" );
@@ -72,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,
@@ -104,21 +104,10 @@ namespace dbaui
if ( !m_xFrameLoader.is() )
{
Reference< XSingleServiceFactory > xFact = TaskCreator::create(m_xORB);
- Sequence< Any > lArgs(3);
- NamedValue aProp;
- sal_Int32 nArg = 0;
-
- aProp.Name = "ParentFrame";
- aProp.Value <<= m_xParentFrame;
- lArgs[nArg++] <<= aProp;
-
- aProp.Name = "TopWindow";
- aProp.Value <<= true;
- lArgs[nArg++] <<= aProp;
-
- aProp.Name = "SupportPersistentWindowState";
- aProp.Value <<= true;
- lArgs[nArg++] <<= aProp;
+ Sequence< Any > lArgs{ Any(NamedValue(u"ParentFrame"_ustr, Any(m_xParentFrame))),
+ Any(NamedValue(u"TopWindow"_ustr, Any(true))),
+ Any(NamedValue(u"SupportPersistentWindowState"_ustr,
+ Any(true))) };
m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW);
@@ -135,7 +124,7 @@ namespace dbaui
Reference< XComponentLoader > xFrameLoader( m_xFrameLoader, UNO_SET_THROW );
xReturn = xFrameLoader->loadComponentFromURL(
m_sComponentURL,
- "_self",
+ u"_self"_ustr,
0,
i_rDispatchArgs.getPropertyValues()
);
@@ -158,20 +147,20 @@ namespace dbaui
Reference<XDataSource> xDataSource;
if ( _aDataSource >>= sDataSource )
{
- i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCENAME), sDataSource );
+ i_rDispatchArgs.put( PROPERTY_DATASOURCENAME, sDataSource );
}
else if ( _aDataSource >>= xDataSource )
{
- i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCE), xDataSource );
+ i_rDispatchArgs.put( PROPERTY_DATASOURCE, xDataSource );
}
- i_rDispatchArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), getConnection() );
+ i_rDispatchArgs.put( PROPERTY_ACTIVE_CONNECTION, getConnection() );
}
// 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 )
{
}
@@ -185,22 +174,22 @@ namespace dbaui
const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( PROPERTY_GRAPHICAL_DESIGN, true );
const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign;
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), m_nCommandType );
+ i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, m_nCommandType );
if ( bIncludeQueryName )
{
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rObjectName );
+ i_rDispatchArgs.put( PROPERTY_COMMAND, _rObjectName );
}
if ( bEditViewAsSQLCommand )
{
- i_rDispatchArgs.put( OUString(PROPERTY_ESCAPE_PROCESSING), false );
+ i_rDispatchArgs.put( PROPERTY_ESCAPE_PROCESSING, false );
}
}
// 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 )
{
}
@@ -211,7 +200,7 @@ namespace dbaui
if ( !_rObjectName.isEmpty() )
{
- i_rDispatchArgs.put( OUString(PROPERTY_CURRENTTABLE), _rObjectName );
+ i_rDispatchArgs.put( PROPERTY_CURRENTTABLE, _rObjectName );
}
}
@@ -254,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)
{
}
@@ -264,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( OUString(PROPERTY_COMMAND_TYPE), (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rQualifiedName );
- i_rDispatchArgs.put( OUString(PROPERTY_ENABLE_BROWSER), false );
+ i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName );
+ i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false );
if ( m_bTable )
{
- i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_CATALOGNAME), sCatalog );
- i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_SCHEMANAME), sSchema );
- i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_TABLENAME), sTable );
+ 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..715d7077e173 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -30,10 +30,11 @@
#include <connectivity/dbexception.hxx>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <UITools.hxx>
-#include <vcl/outdev.hxx>
+#include <utility>
+#include <vcl/mnemonic.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 +60,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 ))
{
}
@@ -118,7 +119,7 @@ namespace dbaui
Reference< XModel > xModel( getDataSourceOrModel( _xDataSource ), UNO_QUERY_THROW );
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
+ Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( u"InteractionHandler"_ustr, Reference< XInteractionHandler >() ) );
if ( !xHandler.is() )
{
@@ -155,11 +156,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 +173,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;
}
}
@@ -187,7 +183,7 @@ namespace dbaui
{
if ( _pErrorInfo )
{
- *_pErrorInfo = aInfo;
+ *_pErrorInfo = std::move(aInfo);
}
else
{
diff --git a/dbaccess/source/ui/misc/dbaundomanager.cxx b/dbaccess/source/ui/misc/dbaundomanager.cxx
index d8659ce6157d..9ed72bbdf477 100644
--- a/dbaccess/source/ui/misc/dbaundomanager.cxx
+++ b/dbaccess/source/ui/misc/dbaundomanager.cxx
@@ -47,7 +47,6 @@ namespace dbaui
,rParent( i_parent )
,rMutex( i_mutex )
,bDisposed( false )
- ,aUndoManager()
,aUndoHelper( *this )
{
}
@@ -166,12 +165,12 @@ namespace dbaui
return m_xImpl->aUndoManager;
}
- void SAL_CALL UndoManager::acquire( ) throw ()
+ void SAL_CALL UndoManager::acquire( ) noexcept
{
m_xImpl->rParent.acquire();
}
- void SAL_CALL UndoManager::release( ) throw ()
+ void SAL_CALL UndoManager::release( ) noexcept
{
m_xImpl->rParent.release();
}
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index 63e30d06ad3b..2571e8c02e50 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -33,16 +33,15 @@
#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbmetadata.hxx>
#include <connectivity/dbtools.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <rtl/ustrbuf.hxx>
#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>
@@ -124,7 +123,7 @@ namespace dbaui
public:
::dbtools::SQLExceptionInfo m_aCurrentError;
- ::comphelper::OInterfaceContainerHelper2
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener>
m_aModifyListeners;
// <properties>
@@ -141,8 +140,7 @@ namespace dbaui
bool m_bNotAttached;
explicit DBSubComponentController_Impl(osl::Mutex& i_rMutex)
- :m_aDocScriptSupport()
- ,m_aModifyListeners( i_rMutex )
+ :m_aModifyListeners( i_rMutex )
,m_nDocStartNumber(0)
,m_bSuspended( false )
,m_bEditable(true)
@@ -153,14 +151,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 );
}
@@ -177,11 +175,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 );
@@ -211,7 +207,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();
}
@@ -223,11 +219,12 @@ namespace dbaui
Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() );
if ( !m_pImpl->documentHasScriptSupport() )
{
- auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
+ auto [begin, end] = asNonConstRange(aTypes);
+ auto newEnd = std::remove_if( begin, end,
[](const Type& type)
{ return type == cppu::UnoType<XScriptInvocationContext>::get(); } );
- aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
- }
+ aTypes.realloc( std::distance(begin, newEnd) );
+ }
return aTypes;
}
@@ -447,7 +444,7 @@ namespace dbaui
Reference< XWindow > xWindow = getTopMostContainerWindow();
vcl::Window* pWin = nullptr;
if ( xWindow.is() )
- pWin = VCLUnoHelper::GetWindow(xWindow).get();
+ pWin = VCLUnoHelper::GetWindow(xWindow);
if ( !pWin )
pWin = getView()->Window::GetParent();
@@ -535,8 +532,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 34fac13d18d5..9b8853f2d63f 100644
--- a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
+++ b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
@@ -32,10 +32,10 @@
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <memory>
+#include <string_view>
namespace dbaui
{
@@ -46,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;
@@ -57,31 +56,22 @@ namespace dbaui
// helper
namespace
{
- void lcl_fillNameExistsError( const OUString& _rObjectName, SQLExceptionInfo& _out_rErrorToDisplay )
+ 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();
}
@@ -94,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& )
@@ -114,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()
@@ -144,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 58831f081185..dfd86ae92a72 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -19,8 +19,8 @@
#include <dsmeta.hxx>
#include <connectivity/DriversConfig.hxx>
-#include <dsntypes.hxx>
#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
#include <map>
#include <utility>
@@ -28,7 +28,6 @@
namespace dbaui
{
- using namespace dbaccess;
using namespace ::com::sun::star;
namespace {
@@ -53,45 +52,39 @@ namespace dbaui
{
/// one of the items from dsitems.hxx
ItemID nItemID;
- const char* pAsciiFeatureName;
+ OUString pAsciiFeatureName;
};
- }
-
// global tables
- static const FeatureMapping* lcl_getFeatureMappings()
- {
- static const FeatureMapping s_aMappings[] = {
- { DSID_AUTORETRIEVEENABLED, "GeneratedValues" },
- { DSID_AUTOINCREMENTVALUE, "GeneratedValues" },
- { DSID_AUTORETRIEVEVALUE, "GeneratedValues" },
- { DSID_SQL92CHECK, "UseSQL92NamingConstraints" },
- { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" },
- { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" },
- { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" },
- { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" },
- { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" },
- { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" },
- { DSID_CATALOG, "UseCatalogInSelect" },
- { DSID_SCHEMA, "UseSchemaInSelect" },
- { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" },
- { DSID_DOSLINEENDS, "UseDOSLineEnds" },
- { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" },
- { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" },
- { DSID_IGNORECURRENCY, "IgnoreCurrency" },
- { DSID_ESCAPE_DATETIME, "EscapeDateTime" },
- { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
- { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" },
- { DSID_MAX_ROW_SCAN, "MaxRowScan" },
- { 0, nullptr }
- };
- return s_aMappings;
+ constexpr FeatureMapping s_aMappings[] = {
+ { DSID_AUTORETRIEVEENABLED, u"GeneratedValues"_ustr },
+ { DSID_AUTOINCREMENTVALUE, u"GeneratedValues"_ustr },
+ { DSID_AUTORETRIEVEVALUE, u"GeneratedValues"_ustr },
+ { DSID_SQL92CHECK, u"UseSQL92NamingConstraints"_ustr },
+ { DSID_APPEND_TABLE_ALIAS, u"AppendTableAliasInSelect"_ustr },
+ { DSID_AS_BEFORE_CORRNAME, u"UseKeywordAsBeforeAlias"_ustr },
+ { DSID_ENABLEOUTERJOIN, u"UseBracketedOuterJoinSyntax"_ustr },
+ { DSID_IGNOREDRIVER_PRIV, u"IgnoreDriverPrivileges"_ustr },
+ { DSID_PARAMETERNAMESUBST, u"ParameterNameSubstitution"_ustr },
+ { DSID_SUPPRESSVERSIONCL, u"DisplayVersionColumns"_ustr },
+ { DSID_CATALOG, u"UseCatalogInSelect"_ustr },
+ { DSID_SCHEMA, u"UseSchemaInSelect"_ustr },
+ { DSID_INDEXAPPENDIX, u"UseIndexDirectionKeyword"_ustr },
+ { DSID_DOSLINEENDS, u"UseDOSLineEnds"_ustr },
+ { DSID_BOOLEANCOMPARISON, u"BooleanComparisonMode"_ustr },
+ { DSID_CHECK_REQUIRED_FIELDS, u"FormsCheckRequiredFields"_ustr },
+ { DSID_IGNORECURRENCY, u"IgnoreCurrency"_ustr },
+ { DSID_ESCAPE_DATETIME, u"EscapeDateTime"_ustr },
+ { DSID_PRIMARY_KEY_SUPPORT, u"PrimaryKeySupport"_ustr },
+ { DSID_RESPECTRESULTSETTYPE, u"RespectDriverResultSetType"_ustr },
+ { DSID_MAX_ROW_SCAN, u"MaxRowScan"_ustr },
+ };
}
static const FeatureSet& lcl_getFeatureSet( const OUString& _rURL )
{
typedef std::map< OUString, FeatureSet > FeatureSets;
- static FeatureSets s_aFeatureSets = [&]()
+ static FeatureSets s_aFeatureSets = []()
{
FeatureSets tmp;
::connectivity::DriversConfig aDriverConfig( ::comphelper::getProcessComponentContext() );
@@ -101,15 +94,13 @@ namespace dbaui
FeatureSet aCurrentSet;
const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( pattern ).getNamedValues() );
- const FeatureMapping* pFeatureMapping = lcl_getFeatureMappings();
- while ( pFeatureMapping->pAsciiFeatureName )
+ for ( const FeatureMapping& rFeatureMapping : s_aMappings )
{
- if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) )
- aCurrentSet.put( pFeatureMapping->nItemID );
- ++pFeatureMapping;
+ if ( aCurrentFeatures.has( rFeatureMapping.pAsciiFeatureName ) )
+ aCurrentSet.put( rFeatureMapping.nItemID );
}
- tmp[ pattern ] = aCurrentSet;
+ tmp[pattern] = std::move(aCurrentSet);
}
return tmp;
}();
@@ -120,27 +111,24 @@ namespace dbaui
static AuthenticationMode getAuthenticationMode( const OUString& _sURL )
{
- static std::map< OUString, FeatureSupport > s_aSupport = [&]()
+ static std::map< OUString, FeatureSupport > s_aSupport = []()
{
std::map< OUString, FeatureSupport > tmp;
::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessComponentContext());
- const uno::Sequence< OUString > aURLs = aDriverConfig.getURLs();
- const OUString* pIter = aURLs.getConstArray();
- const OUString* pEnd = pIter + aURLs.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& url : aDriverConfig.getURLs())
{
FeatureSupport aInit( AuthNone );
- const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(*pIter);
- if ( aMetaData.has("Authentication") )
+ const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(url);
+ if ( aMetaData.has(u"Authentication"_ustr) )
{
OUString sAuth;
- aMetaData.get("Authentication") >>= sAuth;
+ aMetaData.get(u"Authentication"_ustr) >>= sAuth;
if ( sAuth == "UserPassword" )
aInit = FeatureSupport(AuthUserPwd);
else if ( sAuth == "Password" )
aInit = FeatureSupport(AuthPwd);
}
- tmp.insert(std::make_pair(*pIter,aInit));
+ tmp.insert(std::make_pair(url, aInit));
}
return tmp;
}();
@@ -148,26 +136,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 )
{
}
@@ -177,7 +148,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 8cd3b397e12c..6cba1b80ca30 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& )
{
@@ -116,33 +106,6 @@ namespace dbaui
}
}
- void ImageProvider::getImages( const OUString& _rName, const sal_Int32 _nDatabaseObjectType, Image& _out_rImage )
- {
- if ( _nDatabaseObjectType != DatabaseObject::TABLE )
- {
- // for types other than tables, the icon does not depend on the concrete object
- _out_rImage = getDefaultImage( _nDatabaseObjectType );
- }
- else
- {
- // check whether the connection can give us an icon
- Reference< XGraphic > xGraphic;
- lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic );
- if ( xGraphic.is() )
- _out_rImage = Image( xGraphic );
-
- if ( !_out_rImage )
- {
- // no -> determine by type
- OUString sImageResourceID;
- lcl_getTableImageResourceID_nothrow( *m_pData, _rName, sImageResourceID );
-
- if (!sImageResourceID.isEmpty() && !_out_rImage)
- _out_rImage = Image(StockImage::Yes, sImageResourceID);
- }
- }
- }
-
OUString ImageProvider::getImageId(const OUString& _rName, const sal_Int32 _nDatabaseObjectType)
{
if (_nDatabaseObjectType != DatabaseObject::TABLE)
@@ -154,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;
}
}
@@ -165,20 +128,11 @@ 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;
}
- Image ImageProvider::getDefaultImage( sal_Int32 _nDatabaseObjectType )
- {
- Image aObjectImage;
- OUString sImageResourceID( getDefaultImageResourceID( _nDatabaseObjectType) );
- if (!sImageResourceID.isEmpty())
- aObjectImage = Image(StockImage::Yes, sImageResourceID);
- return aObjectImage;
- }
-
OUString ImageProvider::getDefaultImageResourceID( sal_Int32 _nDatabaseObjectType)
{
OUString sImageResourceID;
@@ -203,34 +157,6 @@ namespace dbaui
return sImageResourceID;
}
- Image ImageProvider::getFolderImage( sal_Int32 _nDatabaseObjectType )
- {
- OUString sImageResourceID;
- switch ( _nDatabaseObjectType )
- {
- case DatabaseObject::QUERY:
- sImageResourceID = QUERYFOLDER_TREE_ICON;
- break;
- case DatabaseObject::FORM:
- sImageResourceID = FORMFOLDER_TREE_ICON;
- break;
- case DatabaseObject::REPORT:
- sImageResourceID = REPORTFOLDER_TREE_ICON;
- break;
- case DatabaseObject::TABLE:
- sImageResourceID = TABLEFOLDER_TREE_ICON;
- break;
- default:
- OSL_FAIL( "ImageProvider::getDefaultImage: invalid database object type!" );
- break;
- }
-
- Image aFolderImage;
- if (!sImageResourceID.isEmpty())
- aFolderImage = Image(StockImage::Yes, sImageResourceID);
- return aFolderImage;
- }
-
OUString ImageProvider::getFolderImageId( sal_Int32 _nDatabaseObjectType )
{
OUString sImageResourceID;
@@ -256,9 +182,9 @@ namespace dbaui
return sImageResourceID;
}
- Image ImageProvider::getDatabaseImage()
+ const OUString & ImageProvider::getDatabaseImage()
{
- return Image(StockImage::Yes, DATABASE_TREE_ICON);
+ return DATABASE_TREE_ICON;
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index fb83377f1740..5c29759fd182 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 const char s_sNamePropertyName[] = "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(u"IsUnique"_ustr, 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(u"IsAscending"_ustr, css::uno::Any(field.bSortAscending));
+ xColDescriptor->setPropertyValue(s_sNamePropertyName, Any(field.sFieldName));
xAppendCols->appendByDescriptor(xColDescriptor);
}
}
@@ -219,9 +219,9 @@ namespace dbaui
void OIndexCollection::implFillIndexInfo(OIndex& _rIndex, const Reference< XPropertySet >& _rxDescriptor)
{
- _rIndex.bPrimaryKey = ::cppu::any2bool(_rxDescriptor->getPropertyValue("IsPrimaryKeyIndex"));
- _rIndex.bUnique = ::cppu::any2bool(_rxDescriptor->getPropertyValue("IsUnique"));
- _rxDescriptor->getPropertyValue("Catalog") >>= _rIndex.sDescription;
+ _rIndex.bPrimaryKey = ::cppu::any2bool(_rxDescriptor->getPropertyValue(u"IsPrimaryKeyIndex"_ustr));
+ _rIndex.bUnique = ::cppu::any2bool(_rxDescriptor->getPropertyValue(u"IsUnique"_ustr));
+ _rxDescriptor->getPropertyValue(u"Catalog"_ustr) >>= _rIndex.sDescription;
// the columns
Reference< XColumnsSupplier > xSuppCols(_rxDescriptor, UNO_QUERY);
@@ -233,32 +233,25 @@ namespace dbaui
return;
Sequence< OUString > aFieldNames = xCols->getElementNames();
- _rIndex.aFields.resize(aFieldNames.getLength());
+ _rIndex.aFields.clear();
+ _rIndex.aFields.reserve(aFieldNames.getLength());
- const OUString* pFieldNames = aFieldNames.getConstArray();
- const OUString* pFieldNamesEnd = pFieldNames + aFieldNames.getLength();
- IndexFields::iterator aCopyTo = _rIndex.aFields.begin();
-
- Reference< XPropertySet > xIndexColumn;
- for (;pFieldNames < pFieldNamesEnd; ++pFieldNames, ++aCopyTo)
+ for (auto& fieldName : aFieldNames)
{
// extract the column
- xIndexColumn.clear();
- xCols->getByName(*pFieldNames) >>= xIndexColumn;
+ Reference<XPropertySet> xIndexColumn;
+ xCols->getByName(fieldName) >>= xIndexColumn;
if (!xIndexColumn.is())
{
OSL_FAIL("OIndexCollection::implFillIndexInfo: invalid index column!");
- --aCopyTo;
continue;
}
// get the relevant properties
- aCopyTo->sFieldName = *pFieldNames;
- aCopyTo->bSortAscending = ::cppu::any2bool(xIndexColumn->getPropertyValue("IsAscending"));
+ _rIndex.aFields.push_back({ .sFieldName = fieldName,
+ .bSortAscending = cppu::any2bool(
+ xIndexColumn->getPropertyValue(u"IsAscending"_ustr)) });
}
-
- _rIndex.aFields.resize(aCopyTo - _rIndex.aFields.begin());
- // (just in case some fields were invalid ...)
}
void OIndexCollection::resetIndex(const Indexes::iterator& _rPos)
@@ -289,7 +282,7 @@ namespace dbaui
OSL_ENSURE(end() == find(_rName), "OIndexCollection::insert: invalid new name!");
OIndex aNewIndex((OUString())); // the empty string indicates the index is a new one
aNewIndex.sName = _rName;
- m_aIndexes.push_back(aNewIndex);
+ m_aIndexes.push_back(std::move(aNewIndex));
return m_aIndexes.end() - 1; // the last element is the new one ...
}
@@ -302,14 +295,11 @@ namespace dbaui
return;
// loop through all the indexes
- Sequence< OUString > aNames = m_xIndexes->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for (; pNames < pEnd; ++pNames)
+ for (auto& name : m_xIndexes->getElementNames())
{
// extract the index object
Reference< XPropertySet > xIndex;
- m_xIndexes->getByName(*pNames) >>= xIndex;
+ m_xIndexes->getByName(name) >>= xIndex;
if (!xIndex.is())
{
OSL_FAIL("OIndexCollection::implConstructFrom: got an invalid index object ... ignoring!");
@@ -317,9 +307,9 @@ namespace dbaui
}
// fill the OIndex structure
- OIndex aCurrentIndex(*pNames);
- implFillIndexInfo(aCurrentIndex);
- m_aIndexes.push_back(aCurrentIndex);
+ OIndex aCurrentIndex(name);
+ implFillIndexInfo(aCurrentIndex, xIndex);
+ m_aIndexes.push_back(std::move(aCurrentIndex));
}
}
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 13effe4ccd93..d2fda9527144 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -20,8 +20,7 @@
#include <core_resource.hxx>
#include <linkeddocuments.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
-#include <unotools/confignode.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -34,10 +33,10 @@
#include <comphelper/types.hxx>
#include <strings.hrc>
#include <strings.hxx>
-#include <svl/filenotation.hxx>
#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 +50,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
{
@@ -65,24 +61,22 @@ namespace dbaui
sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 )
{
- Sequence< sal_Int8 > aResult( 16 );
- aResult[0] = static_cast<sal_Int8>(n1 >> 24);
- aResult[1] = static_cast<sal_Int8>(( n1 << 8 ) >> 24);
- aResult[2] = static_cast<sal_Int8>(( n1 << 16 ) >> 24);
- aResult[3] = static_cast<sal_Int8>(( n1 << 24 ) >> 24);
- aResult[4] = static_cast<sal_Int8>(n2 >> 8);
- aResult[5] = static_cast<sal_Int8>(( n2 << 8 ) >> 8);
- aResult[6] = static_cast<sal_Int8>(n3 >> 8);
- aResult[7] = static_cast<sal_Int8>(( n3 << 8 ) >> 8);
- aResult[8] = b8;
- aResult[9] = b9;
- aResult[10] = b10;
- aResult[11] = b11;
- aResult[12] = b12;
- aResult[13] = b13;
- aResult[14] = b14;
- aResult[15] = b15;
-
+ Sequence< sal_Int8 > aResult{ /* [ 0] */ static_cast<sal_Int8>(n1 >> 24),
+ /* [ 1] */ static_cast<sal_Int8>(( n1 << 8 ) >> 24),
+ /* [ 2] */ static_cast<sal_Int8>(( n1 << 16 ) >> 24),
+ /* [ 3] */ static_cast<sal_Int8>(( n1 << 24 ) >> 24),
+ /* [ 4] */ static_cast<sal_Int8>(n2 >> 8),
+ /* [ 5] */ static_cast<sal_Int8>(( n2 << 8 ) >> 8),
+ /* [ 6] */ static_cast<sal_Int8>(n3 >> 8),
+ /* [ 7] */ static_cast<sal_Int8>(( n3 << 8 ) >> 8),
+ /* [ 8] */ static_cast<sal_Int8>(b8),
+ /* [ 9] */ static_cast<sal_Int8>(b9),
+ /* [10] */ static_cast<sal_Int8>(b10),
+ /* [11] */ static_cast<sal_Int8>(b11),
+ /* [12] */ static_cast<sal_Int8>(b12),
+ /* [13] */ static_cast<sal_Int8>(b13),
+ /* [14] */ static_cast<sal_Int8>(b14),
+ /* [15] */ static_cast<sal_Int8>(b15) };
return aResult;
}
}
@@ -90,13 +84,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!");
@@ -119,15 +113,15 @@ namespace dbaui
OUString sOpenMode;
switch ( _eOpenMode )
{
- case E_OPEN_NORMAL:
+ case ElementOpenMode::Normal:
sOpenMode = "open";
break;
- case E_OPEN_FOR_MAIL:
- aArguments.put( "Hidden", true );
+ case ElementOpenMode::Mail:
+ aArguments.put( u"Hidden"_ustr, true );
[[fallthrough]];
- case E_OPEN_DESIGN:
+ case ElementOpenMode::Design:
sOpenMode = "openDesign";
break;
@@ -135,9 +129,9 @@ namespace dbaui
OSL_FAIL( "OLinkedDocumentsAccess::implOpen: invalid open mode!" );
break;
}
- aArguments.put( "OpenMode", sOpenMode );
+ aArguments.put( u"OpenMode"_ustr, sOpenMode );
- aArguments.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection );
+ aArguments.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection );
Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY);
if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) )
@@ -151,36 +145,35 @@ namespace dbaui
return xRet;
}
- void OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService,
- const sal_Int32 _nCommandType, const OUString& _rObjectName )
+ void OLinkedDocumentsAccess::impl_newWithPilot(const OUString& rWizardService,
+ const sal_Int32 _nCommandType,
+ const OUString& _rObjectName)
{
try
{
::comphelper::NamedValueCollection aArgs;
- aArgs.put( "DataSourceName", m_sDataSourceName );
+ aArgs.put( u"DataSourceName"_ustr, m_sDataSourceName );
if ( m_xConnection.is() )
- aArgs.put( "ActiveConnection", m_xConnection );
+ aArgs.put( u"ActiveConnection"_ustr, m_xConnection );
if ( !_rObjectName.isEmpty() && ( _nCommandType != -1 ) )
{
- aArgs.put( "CommandType", _nCommandType );
- aArgs.put( "Command", _rObjectName );
+ aArgs.put( u"CommandType"_ustr, _nCommandType );
+ aArgs.put( u"Command"_ustr, _rObjectName );
}
- aArgs.put( "DocumentUI", m_xDocumentUI );
+ aArgs.put( u"DocumentUI"_ustr, m_xDocumentUI );
Reference< XJobExecutor > xWizard;
{
weld::WaitObject aWaitCursor(m_pDialogParent);
- xWizard.set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
- OUString::createFromAscii( _pWizardService ),
- aArgs.getWrappedPropertyValues(),
- m_xContext
- ), UNO_QUERY_THROW );
+ xWizard.set(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ rWizardService, aArgs.getWrappedPropertyValues(), m_xContext),
+ UNO_QUERY_THROW);
}
- xWizard->trigger( "start" );
+ xWizard->trigger( u"start"_ustr );
::comphelper::disposeComponent( xWizard );
}
catch(const Exception&)
@@ -190,20 +183,22 @@ namespace dbaui
}
void OLinkedDocumentsAccess::newFormWithPilot( const sal_Int32 _nCommandType,const OUString& _rObjectName )
{
- impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _nCommandType, _rObjectName );
+ impl_newWithPilot(u"com.sun.star.wizards.form.CallFormWizard"_ustr, _nCommandType,
+ _rObjectName);
}
void OLinkedDocumentsAccess::newReportWithPilot( const sal_Int32 _nCommandType, const OUString& _rObjectName )
{
- impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _nCommandType, _rObjectName );
+ impl_newWithPilot(u"com.sun.star.wizards.report.CallReportWizard"_ustr, _nCommandType,
+ _rObjectName);
}
void OLinkedDocumentsAccess::newTableWithPilot()
{
- impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", -1, OUString() );
+ impl_newWithPilot(u"com.sun.star.wizards.table.CallTableWizard"_ustr, -1, OUString());
}
void OLinkedDocumentsAccess::newQueryWithPilot()
{
- impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", -1, OUString() );
+ impl_newWithPilot(u"com.sun.star.wizards.query.CallQueryWizard"_ustr, -1, OUString());
}
Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 i_nActionID,
const ::comphelper::NamedValueCollection& i_rCreationArgs, Reference< XComponent >& o_rDefinition )
@@ -211,9 +206,9 @@ namespace dbaui
OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::newDocument: invalid document container!");
// determine the class ID to use for the new document
Sequence<sal_Int8> aClassId;
- if ( !i_rCreationArgs.has( "ClassID" )
- && !i_rCreationArgs.has( "MediaType" )
- && !i_rCreationArgs.has( "DocumentServiceName" )
+ if ( !i_rCreationArgs.has( u"ClassID"_ustr )
+ && !i_rCreationArgs.has( u"MediaType"_ustr )
+ && !i_rCreationArgs.has( u"DocumentServiceName"_ustr )
)
{
switch ( i_nActionID )
@@ -252,15 +247,15 @@ namespace dbaui
{
::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs );
if ( aClassId.hasElements() )
- aCreationArgs.put( "ClassID", aClassId );
- aCreationArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection );
+ aCreationArgs.put( u"ClassID"_ustr, aClassId );
+ aCreationArgs.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection );
// separate values which are real creation args from args relevant for opening the doc
::comphelper::NamedValueCollection aCommandArgs;
- if ( aCreationArgs.has( "Hidden" ) )
+ if ( aCreationArgs.has( u"Hidden"_ustr ) )
{
- aCommandArgs.put( "Hidden", aCreationArgs.get( "Hidden" ) );
- aCreationArgs.remove( "Hidden" );
+ aCommandArgs.put( u"Hidden"_ustr, aCreationArgs.get( u"Hidden"_ustr ) );
+ aCreationArgs.remove( u"Hidden"_ustr );
}
Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments(
@@ -274,7 +269,7 @@ namespace dbaui
// put the OpenMode into the OpenArgs
OpenCommandArgument aOpenModeArg;
aOpenModeArg.Mode = OpenMode::DOCUMENT;
- aCommandArgs.put( "OpenMode", aOpenModeArg );
+ aCommandArgs.put( u"OpenMode"_ustr, aOpenModeArg );
Command aCommand;
aCommand.Name = "openDesign";
@@ -304,16 +299,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
@@ -331,13 +323,11 @@ 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
- aInfo.prepend(" \n");
+ aInfo.prepend(u" \n"_ustr);
OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC);
sMessage = sMessage.replaceFirst("$file$",_rLinkName);
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index c07da46c955f..13c28ed6229f 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -18,7 +18,6 @@
*/
#include <dbaccess/dbaundomanager.hxx>
-#include <dbaccess/dataview.hxx>
#include <core_resource.hxx>
#include <singledoccontroller.hxx>
#include <browserids.hxx>
@@ -35,22 +34,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 +49,7 @@ namespace dbaui
{
OSingleDocumentController_Base::disposing();
ClearUndoManager();
- m_pData->m_pUndoManager->disposing();
+ m_pUndoManager->disposing();
}
void OSingleDocumentController::ClearUndoManager()
@@ -72,7 +59,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 +78,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
@@ -123,8 +110,9 @@ namespace dbaui
{
size_t nCount(GetUndoManager().GetUndoActionCount());
Sequence<OUString> aSeq(nCount);
+ auto aSeqRange = asNonConstRange(aSeq);
for (size_t n = 0; n < nCount; ++n)
- aSeq[n] = GetUndoManager().GetUndoActionComment(n);
+ aSeqRange[n] = GetUndoManager().GetUndoActionComment(n);
aReturn.aValue <<= aSeq;
aReturn.bEnabled = true;
break;
@@ -134,8 +122,9 @@ namespace dbaui
{
size_t nCount(GetUndoManager().GetRedoActionCount());
Sequence<OUString> aSeq(nCount);
+ auto aSeqRange = asNonConstRange(aSeq);
for (size_t n = 0; n < nCount; ++n)
- aSeq[n] = GetUndoManager().GetRedoActionComment(n);
+ aSeqRange[n] = GetUndoManager().GetRedoActionComment(n);
aReturn.aValue <<= aSeq;
aReturn.bEnabled = true;
break;
diff --git a/dbaccess/source/ui/misc/stringlistitem.cxx b/dbaccess/source/ui/misc/stringlistitem.cxx
index c5da8c21968e..97e75fe6d4b6 100644
--- a/dbaccess/source/ui/misc/stringlistitem.cxx
+++ b/dbaccess/source/ui/misc/stringlistitem.cxx
@@ -21,19 +21,18 @@
namespace dbaui
{
-
using namespace ::com::sun::star::uno;
// OStringListItem
-OStringListItem::OStringListItem(sal_Int16 _nWhich, const Sequence< OUString >& _rList)
- :SfxPoolItem(_nWhich)
- ,m_aList(_rList)
+OStringListItem::OStringListItem(sal_Int16 _nWhich, const Sequence<OUString>& _rList)
+ : SfxPoolItem(_nWhich)
+ , m_aList(_rList)
{
}
OStringListItem::OStringListItem(const OStringListItem& _rSource)
- :SfxPoolItem(_rSource)
- ,m_aList(_rSource.m_aList)
+ : SfxPoolItem(_rSource)
+ , m_aList(_rSource.m_aList)
{
}
@@ -41,12 +40,12 @@ bool OStringListItem::operator==(const SfxPoolItem& _rItem) const
{
if (!SfxPoolItem::operator==(_rItem))
return false;
- const OStringListItem* pCompare = static_cast<const OStringListItem*>( &_rItem );
+ const OStringListItem* pCompare = static_cast<const OStringListItem*>(&_rItem);
if (pCompare->m_aList.getLength() != m_aList.getLength())
return false;
// compare all strings individually
- for (sal_Int32 i=0; i<m_aList.getLength(); ++i)
+ for (sal_Int32 i = 0; i < m_aList.getLength(); ++i)
if (m_aList[i] != pCompare->m_aList[i])
return false;
@@ -58,6 +57,6 @@ OStringListItem* OStringListItem::Clone(SfxItemPool* /* _pPool */) const
return new OStringListItem(*this);
}
-} // namespace dbaui
+} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index cf5af7def510..c34940e8d5cc 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -22,15 +22,15 @@
#include <TableWindow.hxx>
#include <TableWindowListBox.hxx>
#include <TableConnection.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
-#include <math.h>
#include <osl/diagnose.h>
#include <vcl/lineinfo.hxx>
#include <vcl/settings.hxx>
using namespace dbaui;
-const long DESCRIPT_LINE_WIDTH = 15;
-const long HIT_SENSITIVE_RADIUS = 5;
+const tools::Long DESCRIPT_LINE_WIDTH = 15;
+const tools::Long HIT_SENSITIVE_RADIUS = 5;
namespace
{
@@ -55,7 +55,7 @@ namespace
tools::Rectangle aReturn;
if ( pListBox )
{
- const long nRowHeight = pListBox->GetEntryHeight();
+ const tools::Long nRowHeight = pListBox->get_widget().get_height_rows(1);
aReturn.SetTop( _aConnPos.Y() - nRowHeight );
aReturn.SetBottom( aReturn.Top() + nRowHeight );
if (_aDescrLinePos.X() < _aConnPos.X())
@@ -74,29 +74,41 @@ namespace
}
/** calcPointsYValue calculate the points Y value in relation to the listbox entry
@param _pWin the corresponding window
- @param _pEntry the source or dest entry
+ @param _nEntry the source or dest entry
@param _rNewConPos (in/out) the connection pos
@param _rNewDescrPos (in/out) the description pos
*/
- void calcPointsYValue(const OTableWindow* _pWin,SvTreeListEntry* _pEntry,Point& _rNewConPos,Point& _rNewDescrPos)
+ void calcPointsYValue(const OTableWindow* _pWin, int _nEntry, Point& _rNewConPos, Point& _rNewDescrPos)
{
const OTableWindowListBox* pListBox = _pWin->GetListBox();
_rNewConPos.setY( _pWin->GetPosPixel().Y() );
- if ( _pEntry )
+
+ std::unique_ptr<weld::TreeIter> xEntry;
+ const weld::TreeView& rTreeView = pListBox->get_widget();
+
+ if (_nEntry != -1)
{
- const long nRowHeight = pListBox->GetEntryHeight();
_rNewConPos.AdjustY(pListBox->GetPosPixel().Y() );
- long nEntryPos = pListBox->GetEntryPosition( _pEntry ).Y();
+ xEntry = rTreeView.make_iterator();
+ if (!rTreeView.get_iter_first(*xEntry) || !rTreeView.iter_nth_sibling(*xEntry, _nEntry))
+ xEntry.reset();
+ }
+
+ if (xEntry)
+ {
+ auto nEntryPos = rTreeView.get_row_area(*xEntry).Center().Y();
if( nEntryPos >= 0 )
{
- _rNewConPos.AdjustY(nEntryPos );
- _rNewConPos.AdjustY(static_cast<long>( 0.5 * nRowHeight ) );
+ _rNewConPos.AdjustY(nEntryPos);
}
else
- _rNewConPos.AdjustY( -static_cast<long>( 0.5 * nRowHeight ) );
+ {
+ const auto nRowHeight = rTreeView.get_height_rows(1);
+ _rNewConPos.AdjustY( -static_cast<tools::Long>( 0.5 * nRowHeight ) );
+ }
- long nListBoxBottom = _pWin->GetPosPixel().Y()
+ tools::Long nListBoxBottom = _pWin->GetPosPixel().Y()
+ pListBox->GetPosPixel().Y()
+ pListBox->GetSizePixel().Height();
if( _rNewConPos.Y() > nListBoxBottom )
@@ -109,9 +121,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 ))
{
}
@@ -213,15 +225,15 @@ bool OConnectionLine::RecalcLine()
if( !pSourceWin || !pDestWin )
return false;
- SvTreeListEntry* pSourceEntry = pSourceWin->GetListBox()->GetEntryFromText( GetData()->GetSourceFieldName() );
- SvTreeListEntry* pDestEntry = pDestWin->GetListBox()->GetEntryFromText( GetData()->GetDestFieldName() );
+ int nSourceEntry = pSourceWin->GetListBox()->GetEntryFromText( GetData()->GetSourceFieldName() );
+ int nDestEntry = pDestWin->GetListBox()->GetEntryFromText( GetData()->GetDestFieldName() );
// determine X-coordinates
Point aSourceCenter( 0, 0 );
Point aDestCenter( 0, 0 );
- aSourceCenter.setX( pSourceWin->GetPosPixel().X() + static_cast<long>( 0.5*pSourceWin->GetSizePixel().Width() ) );
- aDestCenter.setX( pDestWin->GetPosPixel().X() + static_cast<long>( 0.5*pDestWin->GetSizePixel().Width() ) );
+ aSourceCenter.setX( pSourceWin->GetPosPixel().X() + static_cast<tools::Long>( 0.5*pSourceWin->GetSizePixel().Width() ) );
+ aDestCenter.setX( pDestWin->GetPosPixel().X() + static_cast<tools::Long>( 0.5*pDestWin->GetSizePixel().Width() ) );
const OTableWindow* pFirstWin = pDestWin;
const OTableWindow* pSecondWin = pSourceWin;
@@ -239,17 +251,17 @@ bool OConnectionLine::RecalcLine()
pSecondDescrPos = &m_aDestDescrLinePos;
}
- if ( pFirstWin == pSecondWin && pSourceEntry != pDestEntry )
+ if (pFirstWin == pSecondWin && nSourceEntry != nDestEntry)
calcPointX2(pFirstWin,*pFirstConPos,*pFirstDescrPos);
else
calcPointX1(pFirstWin,*pFirstConPos,*pFirstDescrPos);
calcPointX2(pSecondWin,*pSecondConPos,*pSecondDescrPos);
// determine aSourceConnPosY
- calcPointsYValue(pSourceWin,pSourceEntry,m_aSourceConnPos,m_aSourceDescrLinePos);
+ calcPointsYValue(pSourceWin, nSourceEntry, m_aSourceConnPos,m_aSourceDescrLinePos);
// determine aDestConnPosY
- calcPointsYValue(pDestWin,pDestEntry,m_aDestConnPos,m_aDestDescrLinePos);
+ calcPointsYValue(pDestWin, nDestEntry, m_aDestConnPos,m_aDestDescrLinePos);
return true;
}
@@ -295,12 +307,12 @@ 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);
- q.setX( long(p1.X() + a * v.X()) );
- q.setY( long(p1.Y() + a * v.Y()) );
+ q.setX( tools::Long(p1.X() + a * v.X()) );
+ q.setY( tools::Long(p1.Y() + a * v.Y()) );
return l;
}
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index 763e53990276..881cf498f5ea 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)
,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";
+ return u"org.openoffice.comp.dbu.ConnectionLineAccessibility"_ustr;
}
// 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
@@ -97,7 +86,7 @@ namespace dbaui
}
OUString SAL_CALL OConnectionLineAccess::getAccessibleDescription( )
{
- return "Relation";
+ return u"Relation"_ustr;
}
Reference< XAccessibleRelationSet > SAL_CALL OConnectionLineAccess::getAccessibleRelationSet( )
{
@@ -109,30 +98,13 @@ namespace dbaui
{
return Reference< XAccessible >();
}
- awt::Rectangle SAL_CALL OConnectionLineAccess::getBounds( )
+
+ awt::Rectangle OConnectionLineAccess::implGetBounds()
{
- ::osl::MutexGuard aGuard( m_aMutex );
tools::Rectangle aRect(m_pLine ? m_pLine->GetBoundingRect() : tools::Rectangle());
- return awt::Rectangle(aRect.getX(),aRect.getY(),aRect.getWidth(),aRect.getHeight());
- }
- awt::Point SAL_CALL OConnectionLineAccess::getLocation( )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- Point aPoint(m_pLine ? m_pLine->GetBoundingRect().TopLeft() : Point());
- return awt::Point(aPoint.X(),aPoint.Y());
- }
- awt::Point SAL_CALL OConnectionLineAccess::getLocationOnScreen( )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- Point aPoint(m_pLine ? m_pLine->GetParent()->ScreenToOutputPixel(m_pLine->GetBoundingRect().TopLeft()) : Point());
- return awt::Point(aPoint.X(),aPoint.Y());
- }
- awt::Size SAL_CALL OConnectionLineAccess::getSize( )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- Size aSize(m_pLine ? m_pLine->GetBoundingRect().GetSize() : Size());
- return awt::Size(aSize.Width(),aSize.Height());
+ return awt::Rectangle(aRect.Left(),aRect.Top(),aRect.getOpenWidth(),aRect.getOpenHeight());
}
+
// XAccessibleRelationSet
sal_Int32 SAL_CALL OConnectionLineAccess::getRelationCount( )
{
@@ -144,26 +116,26 @@ namespace dbaui
if( nIndex < 0 || nIndex >= getRelationCount() )
throw IndexOutOfBoundsException();
- Sequence< Reference<XInterface> > aSeq(m_pLine ? 2 : 0);
+ Sequence<Reference<XAccessible>> aSeq;
if( m_pLine )
{
- aSeq[0] = m_pLine->GetSourceWin()->GetAccessible();
- aSeq[1] = m_pLine->GetDestWin()->GetAccessible();
+ aSeq = { m_pLine->GetSourceWin()->GetAccessible(),
+ m_pLine->GetDestWin()->GetAccessible() };
}
- return AccessibleRelation(AccessibleRelationType::CONTROLLED_BY,aSeq);
+ return AccessibleRelation(AccessibleRelationType_CONTROLLED_BY,aSeq);
}
- sal_Bool SAL_CALL OConnectionLineAccess::containsRelation( sal_Int16 aRelationType )
+ sal_Bool SAL_CALL OConnectionLineAccess::containsRelation(AccessibleRelationType eRelationType)
{
- return AccessibleRelationType::CONTROLLED_BY == aRelationType;
+ return AccessibleRelationType_CONTROLLED_BY == eRelationType;
}
- AccessibleRelation SAL_CALL OConnectionLineAccess::getRelationByType( sal_Int16 aRelationType )
+ AccessibleRelation SAL_CALL OConnectionLineAccess::getRelationByType(AccessibleRelationType eRelationType)
{
- if( AccessibleRelationType::CONTROLLED_BY == aRelationType )
+ if (AccessibleRelationType_CONTROLLED_BY == eRelationType)
return getRelation(0);
return AccessibleRelation();
}
- Reference< XAccessible > OTableConnection::CreateAccessible()
+ rtl::Reference<comphelper::OAccessible> OTableConnection::CreateAccessible()
{
return new OConnectionLineAccess(this);
}
@@ -175,13 +147,9 @@ namespace dbaui
{
// clear vector
clearLineData();
- m_pParent.clear();
+ m_pParent.reset();
vcl::Window::dispose();
}
- Reference< XAccessibleContext > SAL_CALL OConnectionLineAccess::getAccessibleContext( )
- {
- return this;
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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..c538fcf16c8c 100644
--- a/dbaccess/source/ui/querydesign/JAccess.cxx
+++ b/dbaccess/source/ui/querydesign/JAccess.cxx
@@ -29,17 +29,16 @@ 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)
- ,m_pTableView(_pTableView)
+ : VCLXAccessibleComponent(_pTableView)
+ , m_pTableView(_pTableView)
{
}
OUString SAL_CALL OJoinDesignViewAccess::getImplementationName()
{
- return "org.openoffice.comp.dbu.JoinViewAccessibility";
+ return u"org.openoffice.comp.dbu.JoinViewAccessibility"_ustr;
}
void OJoinDesignViewAccess::clearTableView()
{
@@ -47,45 +46,37 @@ 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;
+ rtl::Reference<comphelper::OAccessible> pRet;
::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);
- aRet = aIter->second->GetAccessible();
+ pRet = aIter->second->GetAccessible();
}
else if( o3tl::make_unsigned(i - nTableWindowCount) < m_pTableView->getTableConnections().size() )
- aRet = m_pTableView->getTableConnections()[i - nTableWindowCount]->GetAccessible();
- return aRet;
+ pRet = m_pTableView->getTableConnections()[i - nTableWindowCount]->GetAccessible();
+ return pRet;
}
sal_Int16 SAL_CALL OJoinDesignViewAccess::getAccessibleRole( )
{
return AccessibleRole::VIEW_PORT;
}
- Reference< XAccessibleContext > SAL_CALL OJoinDesignViewAccess::getAccessibleContext( )
- {
- 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 49ad53027729..df9f7e03aae7 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -19,8 +19,6 @@
#include <browserids.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <connectivity/dbexception.hxx>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <JoinController.hxx>
#include <TableWindowData.hxx>
#include <TableWindow.hxx>
@@ -34,12 +32,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;
@@ -157,7 +151,7 @@ void OJoinController::impl_onModifyChanged()
InvalidateFeature( SID_RELATION_ADD_RELATION );
}
-void OJoinController::SaveTabWinPosSize(OTableWindow const * pTabWin, long nOffsetX, long nOffsetY)
+void OJoinController::SaveTabWinPosSize(OTableWindow const * pTabWin, tools::Long nOffsetX, tools::Long nOffsetY)
{
// the data for the window
const TTableWindowData::value_type& pData = pTabWin->GetData();
@@ -204,6 +198,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;
}
@@ -262,7 +257,7 @@ void OJoinController::runDialogAsync()
});
}
-void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY )
+void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, tools::Long nOffsetX, tools::Long nOffsetY )
{
// Deletion and recreation of the old implementation with the current model is not correct anymore:
// The TabWins have a pointer to their data, but they are managed by me. When I delete the old ones, the TabWins suddenly have a pointer to objects, which no longer exist.
@@ -277,19 +272,19 @@ 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()
{
OJoinController_BASE::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:Redo", ID_BROWSER_REDO, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:AddTable", ID_BROWSER_ADDTABLE,CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS );
- implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS );
+ implDescribeSupportedFeature( u".uno:Redo"_ustr, ID_BROWSER_REDO, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Save"_ustr, ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:Undo"_ustr, ID_BROWSER_UNDO, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:AddTable"_ustr, ID_BROWSER_ADDTABLE,CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:EditDoc"_ustr, ID_BROWSER_EDITDOC, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:GetUndoStrings"_ustr, SID_GETUNDOSTRINGS );
+ implDescribeSupportedFeature( u".uno:GetRedoStrings"_ustr, SID_GETREDOSTRINGS );
}
sal_Bool SAL_CALL OJoinController::suspend(sal_Bool _bSuspend)
@@ -317,14 +312,9 @@ void OJoinController::loadTableWindows( const ::comphelper::NamedValueCollection
m_aMinimumTableViewSize = Point();
- Sequence< PropertyValue > aWindowData;
- aWindowData = i_rViewSettings.getOrDefault( "Tables", aWindowData );
-
- const PropertyValue* pTablesIter = aWindowData.getConstArray();
- const PropertyValue* pTablesEnd = pTablesIter + aWindowData.getLength();
- for ( ; pTablesIter != pTablesEnd; ++pTablesIter )
+ for (auto& table : i_rViewSettings.getOrDefault(u"Tables"_ustr, Sequence<PropertyValue>()))
{
- ::comphelper::NamedValueCollection aSingleTableData( pTablesIter->Value );
+ ::comphelper::NamedValueCollection aSingleTableData(table.Value);
loadTableWindow( aSingleTableData );
}
if ( m_aMinimumTableViewSize != Point() )
@@ -340,14 +330,14 @@ void OJoinController::loadTableWindow( const ::comphelper::NamedValueCollection&
OUString sComposedName,sTableName,sWindowName;
bool bShowAll = false;
- sComposedName = i_rTableWindowSettings.getOrDefault( "ComposedName", sComposedName );
- sTableName = i_rTableWindowSettings.getOrDefault( "TableName", sTableName );
- sWindowName = i_rTableWindowSettings.getOrDefault( "WindowName", sWindowName );
- nY = i_rTableWindowSettings.getOrDefault( "WindowTop", nY );
- nX = i_rTableWindowSettings.getOrDefault( "WindowLeft", nX );
- nWidth = i_rTableWindowSettings.getOrDefault( "WindowWidth", nWidth );
- nHeight = i_rTableWindowSettings.getOrDefault( "WindowHeight", nHeight );
- bShowAll = i_rTableWindowSettings.getOrDefault( "ShowAll", bShowAll );
+ sComposedName = i_rTableWindowSettings.getOrDefault( u"ComposedName"_ustr, sComposedName );
+ sTableName = i_rTableWindowSettings.getOrDefault( u"TableName"_ustr, sTableName );
+ sWindowName = i_rTableWindowSettings.getOrDefault( u"WindowName"_ustr, sWindowName );
+ nY = i_rTableWindowSettings.getOrDefault( u"WindowTop"_ustr, nY );
+ nX = i_rTableWindowSettings.getOrDefault( u"WindowLeft"_ustr, nX );
+ nWidth = i_rTableWindowSettings.getOrDefault( u"WindowWidth"_ustr, nWidth );
+ nHeight = i_rTableWindowSettings.getOrDefault( u"WindowHeight"_ustr, nHeight );
+ bShowAll = i_rTableWindowSettings.getOrDefault( u"ShowAll"_ustr, bShowAll );
TTableWindowData::value_type pData = createTableWindowData(sComposedName,sTableName,sWindowName);
if ( pData )
@@ -355,7 +345,7 @@ void OJoinController::loadTableWindow( const ::comphelper::NamedValueCollection&
pData->SetPosition(Point(nX,nY));
pData->SetSize( Size( nWidth, nHeight ) );
pData->ShowAll(bShowAll);
- m_vTableData.push_back(pData);
+ m_vTableData.push_back(std::move(pData));
if ( m_aMinimumTableViewSize.X() < (nX+nWidth) )
m_aMinimumTableViewSize.setX( nX+nWidth );
if ( m_aMinimumTableViewSize.Y() < (nY+nHeight) )
@@ -374,20 +364,20 @@ void OJoinController::saveTableWindows( ::comphelper::NamedValueCollection& o_rV
for (auto const& elem : m_vTableData)
{
::comphelper::NamedValueCollection aWindowData;
- aWindowData.put( "ComposedName", elem->GetComposedName() );
- aWindowData.put( "TableName", elem->GetTableName() );
- aWindowData.put( "WindowName", elem->GetWinName() );
- aWindowData.put( "WindowTop", static_cast<sal_Int32>(elem->GetPosition().Y()) );
- aWindowData.put( "WindowLeft", static_cast<sal_Int32>(elem->GetPosition().X()) );
- aWindowData.put( "WindowWidth", static_cast<sal_Int32>(elem->GetSize().Width()) );
- aWindowData.put( "WindowHeight", static_cast<sal_Int32>(elem->GetSize().Height()) );
- aWindowData.put( "ShowAll", elem->IsShowAll() );
+ aWindowData.put( u"ComposedName"_ustr, elem->GetComposedName() );
+ aWindowData.put( u"TableName"_ustr, elem->GetTableName() );
+ aWindowData.put( u"WindowName"_ustr, elem->GetWinName() );
+ aWindowData.put( u"WindowTop"_ustr, static_cast<sal_Int32>(elem->GetPosition().Y()) );
+ aWindowData.put( u"WindowLeft"_ustr, static_cast<sal_Int32>(elem->GetPosition().X()) );
+ aWindowData.put( u"WindowWidth"_ustr, static_cast<sal_Int32>(elem->GetSize().Width()) );
+ aWindowData.put( u"WindowHeight"_ustr, static_cast<sal_Int32>(elem->GetSize().Height()) );
+ aWindowData.put( u"ShowAll"_ustr, elem->IsShowAll() );
const OUString sTableName( "Table" + OUString::number( i++ ) );
aAllTablesData.put( sTableName, aWindowData.getPropertyValues() );
}
- o_rViewSettings.put( "Tables", aAllTablesData.getPropertyValues() );
+ o_rViewSettings.put( u"Tables"_ustr, aAllTablesData.getPropertyValues() );
}
TTableWindowData::value_type OJoinController::createTableWindowData(const OUString& _sComposedName,const OUString& _sTableName,const OUString& _sWindowName)
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 312c9d8e9958..8b218ccf269f 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -20,37 +20,25 @@
#include <JoinExchange.hxx>
#include <sot/formats.hxx>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::datatransfer;
- OJoinExchObj::OJoinExchObj(const OJoinExchangeData& jxdSource,bool _bFirstEntry)
- :m_bFirstEntry(_bFirstEntry)
- ,m_jxdSourceDescription(jxdSource)
- ,m_pDragListener(nullptr)
+ void OJoinExchObj::setDescriptors(const OJoinExchangeData& jxdSource,bool _bFirstEntry)
{
- // add available types to list
+ m_bFirstEntry = _bFirstEntry;
+ m_jxdSourceDescription = jxdSource;
}
- OJoinExchObj::~OJoinExchObj()
- {
- }
-
- void OJoinExchObj::StartDrag( vcl::Window* _pWindow, sal_Int8 _nDragSourceActions, IDragTransferableListener* _pListener )
+ OJoinExchObj::OJoinExchObj()
+ : m_bFirstEntry(false)
{
- m_pDragListener = _pListener;
- TransferableHelper::StartDrag(_pWindow, _nDragSourceActions);
}
- void OJoinExchObj::DragFinished( sal_Int8 /*nDropAction*/ )
+ OJoinExchObj::~OJoinExchObj()
{
- if (m_pDragListener)
- m_pDragListener->dragFinished();
- m_pDragListener = nullptr;
}
bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector& _rFormats ,SotClipboardFormatId _nSlotID)
@@ -66,25 +54,21 @@ namespace dbaui
OJoinExchangeData OJoinExchObj::GetSourceDescription(const Reference< XTransferable >& _rxObject)
{
OJoinExchangeData aReturn;
- auto pImplementation = comphelper::getUnoTunnelImplementation<OJoinExchObj>(_rxObject);
+ auto pImplementation = comphelper::getFromUnoTunnel<OJoinExchObj>(_rxObject);
if (pImplementation)
aReturn = pImplementation->m_jxdSourceDescription;
return aReturn;
}
- Sequence< sal_Int8 > OJoinExchObj::getUnoTunnelId()
+ const Sequence< sal_Int8 > & OJoinExchObj::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
sal_Int64 SAL_CALL OJoinExchObj::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
{
- if (isUnoTunnelId<OJoinExchObj>(_rIdentifier))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
+ return comphelper::getSomethingImpl(_rIdentifier, this);
}
void OJoinExchObj::AddSupportedFormats()
@@ -108,20 +92,20 @@ namespace dbaui
Any SAL_CALL OJoinExchObj::queryInterface( const Type& _rType )
{
- Any aReturn = TransferableHelper::queryInterface(_rType);
+ Any aReturn = TransferDataContainer::queryInterface(_rType);
if (!aReturn.hasValue())
aReturn = OJoinExchObj_Base::queryInterface(_rType);
return aReturn;
}
- void SAL_CALL OJoinExchObj::acquire( ) throw()
+ void SAL_CALL OJoinExchObj::acquire( ) noexcept
{
- TransferableHelper::acquire( );
+ TransferDataContainer::acquire( );
}
- void SAL_CALL OJoinExchObj::release( ) throw()
+ void SAL_CALL OJoinExchObj::release( ) noexcept
{
- TransferableHelper::release( );
+ TransferDataContainer::release( );
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 54ea53f0e18f..8c4a91206e73 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -38,7 +38,7 @@
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
#include <vcl/ptrstyle.hxx>
-#include <vcl/builder.hxx>
+#include <vcl/weldutils.hxx>
#include <TableWindowData.hxx>
#include <JAccess.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
@@ -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,8 +95,7 @@ void OScrollWindowHelper::dispose()
{
m_aHScrollBar.disposeAndClear();
m_aVScrollBar.disposeAndClear();
- m_pCornerWindow.disposeAndClear();
- m_pTableView.clear();
+ m_pTableView.reset();
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)
@@ -122,8 +119,8 @@ void OScrollWindowHelper::Resize()
Window::Resize();
Size aTotalOutputSize = GetOutputSizePixel();
- long nHScrollHeight = GetHScrollBar().GetSizePixel().Height();
- long nVScrollWidth = GetVScrollBar().GetSizePixel().Width();
+ tools::Long nHScrollHeight = GetHScrollBar().GetSizePixel().Height();
+ tools::Long nVScrollWidth = GetVScrollBar().GetSizePixel().Width();
GetHScrollBar().SetPosSizePixel(
Point( 0, aTotalOutputSize.Height()-nHScrollHeight ),
@@ -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() );
@@ -147,7 +139,7 @@ void OScrollWindowHelper::Resize()
GetVScrollBar().SetVisibleSize( aTotalOutputSize.Height() );
// adjust the ranges of the scrollbars if necessary
- long lRange = GetHScrollBar().GetRange().Max() - GetHScrollBar().GetRange().Min();
+ tools::Long lRange = GetHScrollBar().GetRange().Max() - GetHScrollBar().GetRange().Min();
if (m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() > lRange)
GetHScrollBar().SetRangeMax(m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() + GetHScrollBar().GetRange().Min());
@@ -162,6 +154,7 @@ void OScrollWindowHelper::Resize()
OJoinTableView::OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView )
:Window( pParent,WB_BORDER )
,DropTargetHelper(this)
+ ,m_aDragScrollIdle("dbaccess OJoinTableView m_aDragScrollIdle")
,m_aDragOffset( Point(0,0) )
,m_aScrollOffset( Point(0,0) )
,m_pDragWin( nullptr )
@@ -169,7 +162,6 @@ OJoinTableView::OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView )
,m_pSelectedConn( nullptr )
,m_pLastFocusTabWin(nullptr)
,m_pView( pView )
- ,m_pAccessible(nullptr)
{
SetSizePixel( Size(1000, 1000) );
@@ -192,19 +184,25 @@ void OJoinTableView::dispose()
}
// delete lists
clearLayoutInformation();
- m_pDragWin.clear();
- m_pSizingWin.clear();
- m_pSelectedConn.clear();
- m_pLastFocusTabWin.clear();
- m_pView.clear();
+ m_pDragWin.reset();
+ m_pSizingWin.reset();
+ m_pSelectedConn.reset();
+ m_pLastFocusTabWin.reset();
+ m_pView.reset();
m_vTableConnection.clear();
vcl::Window::dispose();
}
-IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar, void )
+IMPL_LINK(OJoinTableView, HorzScrollHdl, weld::Scrollbar&, rScrollbar, void)
{
// move all windows
- ScrollPane( pScrollBar->GetDelta(), (pScrollBar == &GetHScrollBar()), false );
+ ScrollPane(rScrollbar.adjustment_get_value() - m_aScrollOffset.X(), true, false);
+}
+
+IMPL_LINK(OJoinTableView, VertScrollHdl, weld::Scrollbar&, rScrollbar, void)
+{
+ // move all windows
+ 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();
}
@@ -257,9 +255,9 @@ bool OJoinTableView::RemoveConnection(VclPtr<OTableConnection>& rConn, bool _bDe
modified();
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(xConn->GetAccessible()),
- Any());
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD, Any(css::uno::Reference<XAccessible>(xConn->GetAccessible())),
+ Any());
if (_bDelete)
xConn->disposeOnce();
@@ -324,9 +322,9 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
VclPtr<OTableWindow> pNewTabWin = createWindow( pNewTabWinData );
if ( pNewTabWin->Init() )
{
- m_pView->getController().getTableWindowData().push_back( pNewTabWinData);
+ m_pView->getController().getTableWindowData().push_back(std::move(pNewTabWinData));
// when we already have a table with this name insert the full qualified one instead
- if(m_aTableMap.find(rWinName) != m_aTableMap.end())
+ if(m_aTableMap.contains(rWinName))
m_aTableMap[_rComposedName] = pNewTabWin;
else
m_aTableMap[rWinName] = pNewTabWin;
@@ -336,9 +334,9 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
modified();
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- Any(),
- makeAny(pNewTabWin->GetAccessible()));
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD, Any(),
+ Any(css::uno::Reference<XAccessible>(pNewTabWin->GetAccessible())));
}
else
{
@@ -373,9 +371,9 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
if ( bRemove )
{
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(pTabWin->GetAccessible()),Any()
- );
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD,
+ Any(css::uno::Reference<XAccessible>(pTabWin->GetAccessible())), Any());
pTabWin->Hide();
OJoinController& rController = m_pView->getController();
@@ -402,13 +400,13 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
namespace
{
- bool isScrollAllowed( OJoinTableView* _pView,long nDelta, bool bHoriz)
+ 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();
- long nOldThumbPos = rBar.GetThumbPos();
- long nNewThumbPos = nOldThumbPos + nDelta;
+ tools::Long nOldThumbPos = rBar.GetThumbPos();
+ tools::Long nNewThumbPos = nOldThumbPos + nDelta;
if( nNewThumbPos < 0 )
nNewThumbPos = 0;
else if( nNewThumbPos > rBar.GetRangeMax() )
@@ -424,7 +422,7 @@ namespace
return true;
}
- bool getMovementImpl(OJoinTableView* _pView,const Point& _rPoint,const Size& _rSize,long& _nScrollX,long& _nScrollY)
+ bool getMovementImpl(OJoinTableView* _pView,const Point& _rPoint,const Size& _rSize,tools::Long& _nScrollX,tools::Long& _nScrollY)
{
_nScrollY = _nScrollX = 0;
// data about the tab win
@@ -486,21 +484,21 @@ namespace
bool OJoinTableView::isMovementAllowed(const Point& _rPoint,const Size& _rSize)
{
- long nX,nY;
+ tools::Long nX,nY;
return getMovementImpl(this,_rPoint,_rSize,nX,nY);
}
void OJoinTableView::EnsureVisible(const OTableWindow* _pWin)
{
// data about the tab win
- TTableWindowData::value_type pData = _pWin->GetData();
+ const TTableWindowData::value_type& pData = _pWin->GetData();
EnsureVisible( pData->GetPosition() , pData->GetSize());
Invalidate(InvalidateFlags::NoChildren);
}
void OJoinTableView::EnsureVisible(const Point& _rPoint,const Size& _rSize)
{
- long nScrollX,nScrollY;
+ tools::Long nScrollX,nScrollY;
if ( getMovementImpl(this,_rPoint,_rSize,nScrollX,nScrollY) )
{
@@ -581,9 +579,9 @@ void OJoinTableView::SetDefaultTabWinPosSize( OTableWindow* pTabWin )
aBottom.AdjustX(aNewSize.Width() );
aBottom.AdjustY(aNewSize.Height() );
- if(!GetHScrollBar().GetRange().IsInside(aBottom.X()))
+ if(!GetHScrollBar().GetRange().Contains(aBottom.X()))
GetHScrollBar().SetRange( Range(0, aBottom.X()) );
- if(!GetVScrollBar().GetRange().IsInside(aBottom.Y()))
+ if(!GetVScrollBar().GetRange().Contains(aBottom.Y()))
GetVScrollBar().SetRange( Range(0, aBottom.Y()) );
pTabWin->SetPosSizePixel( aNewPos, aNewSize );
@@ -638,7 +636,7 @@ void OJoinTableView::BeginChildSizing( OTableWindow* pTabWin, PointerStyle nPoin
StartTracking();
}
-bool OJoinTableView::ScrollPane( long nDelta, bool bHoriz, bool bPaintScrollBars )
+bool OJoinTableView::ScrollPane( tools::Long nDelta, bool bHoriz, bool bPaintScrollBars )
{
bool bRet = true;
@@ -647,8 +645,8 @@ bool OJoinTableView::ScrollPane( long nDelta, bool bHoriz, bool bPaintScrollBars
{
if( bHoriz )
{
- long nOldThumbPos = GetHScrollBar().GetThumbPos();
- long nNewThumbPos = nOldThumbPos + nDelta;
+ tools::Long nOldThumbPos = GetHScrollBar().GetThumbPos();
+ tools::Long nNewThumbPos = nOldThumbPos + nDelta;
if( nNewThumbPos < 0 )
{
nNewThumbPos = 0;
@@ -664,8 +662,8 @@ bool OJoinTableView::ScrollPane( long nDelta, bool bHoriz, bool bPaintScrollBars
}
else
{
- long nOldThumbPos = GetVScrollBar().GetThumbPos();
- long nNewThumbPos = nOldThumbPos+nDelta;
+ tools::Long nOldThumbPos = GetVScrollBar().GetThumbPos();
+ tools::Long nNewThumbPos = nOldThumbPos+nDelta;
if( nNewThumbPos < 0 )
{
nNewThumbPos = 0;
@@ -861,11 +859,11 @@ void OJoinTableView::DeselectConn(OTableConnection* pConn)
// deselect the corresponding entries in the ListBox of the table window
OTableWindow* pWin = pConn->GetSourceWin();
if (pWin && pWin->GetListBox())
- pWin->GetListBox()->SelectAll(false);
+ pWin->GetListBox()->get_widget().unselect_all();
pWin = pConn->GetDestWin();
if (pWin && pWin->GetListBox())
- pWin->GetListBox()->SelectAll(false);
+ pWin->GetListBox()->get_widget().unselect_all();
pConn->Deselect();
m_pSelectedConn = nullptr;
@@ -890,11 +888,10 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
if (!(pSourceBox && pDestBox))
return;
- pSourceBox->SelectAll(false);
- pDestBox->SelectAll(false);
+ pSourceBox->get_widget().unselect_all();
+ pDestBox->get_widget().unselect_all();
- SvTreeListEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView();
- SvTreeListEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView();
+ bool bScrolled = false;
const std::vector<std::unique_ptr<OConnectionLine>>& rLines = pConn->GetConnLineList();
auto aIter = rLines.rbegin();
@@ -902,27 +899,29 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
{
if ((*aIter)->IsValid())
{
- SvTreeListEntry* pSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName());
- if (pSourceEntry)
+ int nSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName());
+ if (nSourceEntry != -1)
{
- pSourceBox->Select(pSourceEntry);
- pSourceBox->MakeVisible(pSourceEntry);
+ pSourceBox->get_widget().select(nSourceEntry);
+ pSourceBox->get_widget().scroll_to_row(nSourceEntry);
+ bScrolled = true;
}
- SvTreeListEntry* pDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName());
- if (pDestEntry)
+ int nDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName());
+ if (nDestEntry != -1)
{
- pDestBox->Select(pDestEntry);
- pDestBox->MakeVisible(pDestEntry);
+ pDestBox->get_widget().select(nDestEntry);
+ pDestBox->get_widget().scroll_to_row(nDestEntry);
+ bScrolled = true;
}
-
}
}
- if ((pFirstSourceVisible != pSourceBox->GetFirstEntryInView())
- || (pFirstDestVisible != pDestBox->GetFirstEntryInView()))
+ if (bScrolled)
+ {
// scrolling was done -> redraw
Invalidate(InvalidateFlags::NoChildren);
+ }
}
void OJoinTableView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
@@ -1116,12 +1115,13 @@ bool OJoinTableView::IsAddAllowed()
return true;
}
-void OJoinTableView::executePopup(const Point& _aPos, VclPtr<OTableConnection>& rSelConnection)
+void OJoinTableView::executePopup(const Point& rPos, VclPtr<OTableConnection>& rSelConnection)
{
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/joinviewmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- aContextMenu->Execute(this, _aPos);
- OString sIdent = aContextMenu->GetCurItemIdent();
+ ::tools::Rectangle aRect(rPos, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/joinviewmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "delete")
RemoveConnection(rSelConnection, true);
else if (sIdent == "edit")
@@ -1177,7 +1177,7 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
Window::Command(rEvt);
}
-OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTableWindow* pRhs,bool _bSupressCrossOrNaturalJoin) const
+OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTableWindow* pRhs,bool _bSuppressCrossOrNaturalJoin) const
{
OTableConnection* pConn = nullptr;
OSL_ENSURE(pRhs || pLhs, "OJoinTableView::GetTabConn : invalid args !");
@@ -1199,9 +1199,9 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab
)
)
{
- if ( _bSupressCrossOrNaturalJoin )
+ if ( _bSuppressCrossOrNaturalJoin )
{
- if ( supressCrossNaturalJoin(pData->GetData()) )
+ if ( suppressCrossNaturalJoin(pData->GetData()) )
continue;
}
pConn = pData;
@@ -1217,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)
@@ -1234,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
@@ -1362,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
@@ -1433,7 +1433,7 @@ void OJoinTableView::StateChanged( StateChangedType nType )
vcl::Font aFont = rStyleSettings.GetGroupFont();
if ( IsControlFont() )
aFont.Merge( GetControlFont() );
- SetZoomedPointFont(*this, aFont);
+ SetZoomedPointFont(*GetOutDev(), aFont);
for (auto const& elem : m_aTableMap)
{
@@ -1512,7 +1512,7 @@ void OJoinTableView::GetFocus()
GrabTabWinFocus();
}
-Reference< XAccessible > OJoinTableView::CreateAccessible()
+rtl::Reference<comphelper::OAccessible> OJoinTableView::CreateAccessible()
{
m_pAccessible = new OJoinDesignViewAccess(this);
return m_pAccessible;
@@ -1542,9 +1542,9 @@ void OJoinTableView::addConnection(OTableConnection* _pConnection,bool _bAddData
modified();
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- Any(),
- makeAny(_pConnection->GetAccessible()));
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD, Any(),
+ Any(css::uno::Reference<XAccessible>(_pConnection->GetAccessible())));
}
bool OJoinTableView::allowQueries() const
@@ -1558,7 +1558,7 @@ void OJoinTableView::onNoColumns_throw()
throw SQLException();
}
-bool OJoinTableView::supressCrossNaturalJoin(const TTableConnectionData::value_type& ) const
+bool OJoinTableView::suppressCrossNaturalJoin(const TTableConnectionData::value_type& ) const
{
return false;
}
diff --git a/dbaccess/source/ui/querydesign/QTableConnection.hxx b/dbaccess/source/ui/querydesign/QTableConnection.hxx
index b15a26102bb5..c6bd2e10d408 100644
--- a/dbaccess/source/ui/querydesign/QTableConnection.hxx
+++ b/dbaccess/source/ui/querydesign/QTableConnection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLECONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLECONNECTION_HXX
+#pragma once
#include <TableConnection.hxx>
#include "QTableConnectionData.hxx"
@@ -43,6 +42,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLECONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
index f96a5b1cd033..16f426d99152 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
@@ -20,13 +20,10 @@
#include "QTableConnectionData.hxx"
#include "QTableWindow.hxx"
-#include <osl/diagnose.h>
-
using namespace dbaui;
OQueryTableConnectionData::OQueryTableConnectionData()
- : OTableConnectionData()
- , m_nFromEntryIndex(0)
+ : m_nFromEntryIndex(0)
, m_nDestEntryIndex(0)
, m_eJoinType (INNER_JOIN)
, m_bNatural(false)
@@ -88,8 +85,8 @@ void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft
// convert Information in rDrag into parameters for the base class init
OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow());
OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow());
- OSL_ENSURE(pSourceWin,"NO Source window found!");
- OSL_ENSURE(pDestWin,"NO Dest window found!");
+ assert(pSourceWin && "NO Source window found!");
+ assert(pDestWin && "NO Dest window found!");
m_pReferencingTable = pSourceWin->GetData();
m_pReferencedTable = pDestWin->GetData();
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
index 41639470f1c1..7ccbb03acdfb 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLECONNECTIONDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLECONNECTIONDATA_HXX
+#pragma once
#include <TableConnectionData.hxx>
#include <TableFieldDescription.hxx>
@@ -64,6 +63,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLECONNECTIONDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 6d2916683db9..ed490860c3ea 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -30,12 +30,10 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include "TableFieldInfo.hxx"
#include <comphelper/stl_types.hxx>
-#include <vcl/treelistentry.hxx>
#include <comphelper/types.hxx>
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)
@@ -105,22 +103,20 @@ void OQueryTableWindow::deleteUserData(void*& _pUserData)
_pUserData = nullptr;
}
-void OQueryTableWindow::OnEntryDoubleClicked(SvTreeListEntry* pEntry)
+void OQueryTableWindow::OnEntryDoubleClicked(weld::TreeIter& rEntry)
{
- OSL_ENSURE(pEntry != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : pEntry must not be NULL !");
- // you could also scan that and then return, but like this it could possibly hint to faults at the caller
-
if (getTableView()->getDesignView()->getController().isReadOnly())
return;
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
- OSL_ENSURE(pInf != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ OTableFieldInfo* pInf = weld::fromId<OTableFieldInfo*>(rTreeView.get_id(rEntry));
+ assert(pInf && "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
// build up DragInfo
- OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), m_xListBox->GetEntryText(pEntry));
+ OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), rTreeView.get_text(rEntry));
aInfo->SetTabWindow(this);
aInfo->SetAlias(GetAliasName());
- aInfo->SetFieldIndex(m_xListBox->GetModel()->GetAbsPos(pEntry));
+ aInfo->SetFieldIndex(rTreeView.get_iter_index_in_parent(rEntry));
aInfo->SetDataType(pInf->GetDataType());
// and insert corresponding field
@@ -135,29 +131,31 @@ bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDes
bool bExists = false;
if(xConnection.is())
{
- SvTreeListEntry* pEntry = m_xListBox->First();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ bool bEntry = rTreeView.get_iter_first(*xEntry);
try
{
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
- while (pEntry)
+ while (bEntry)
{
- if (bCase(strFieldName,m_xListBox->GetEntryText(pEntry)))
+ if (bCase(strFieldName, rTreeView.get_text(*xEntry)))
{
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
+ OTableFieldInfo* pInf = weld::fromId<OTableFieldInfo*>(rTreeView.get_id(*xEntry));
assert(pInf && "OQueryTableWindow::ExistsField : field doesn't have FieldInfo !");
rInfo->SetTabWindow(this);
rInfo->SetField(strFieldName);
rInfo->SetTable(GetTableName());
rInfo->SetAlias(GetAliasName());
- rInfo->SetFieldIndex(m_xListBox->GetModel()->GetAbsPos(pEntry));
+ rInfo->SetFieldIndex(rTreeView.get_iter_index_in_parent(*xEntry));
rInfo->SetDataType(pInf->GetDataType());
bExists = true;
break;
}
- pEntry = m_xListBox->Next(pEntry);
+ bEntry = rTreeView.iter_next(*xEntry);
}
}
catch(SQLException&)
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.hxx b/dbaccess/source/ui/querydesign/QTableWindow.hxx
index e64fd2e85b7a..72c698c832b7 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.hxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLEWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLEWINDOW_HXX
+#pragma once
#include <TableWindow.hxx>
#include "QTableWindowData.hxx"
@@ -51,7 +50,7 @@ namespace dbaui
protected:
- virtual void OnEntryDoubleClicked(SvTreeListEntry* pEntry) override;
+ virtual void OnEntryDoubleClicked(weld::TreeIter& rEntry) override;
// is called from DoubleClickHdl of the ListBox
/** delete the user data with the equal type as created within createUserData
@param _pUserData
@@ -73,6 +72,5 @@ namespace dbaui
bool _bPrimaryKey) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLEWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QTableWindowData.hxx b/dbaccess/source/ui/querydesign/QTableWindowData.hxx
index 382611eeca52..327dc27f1a42 100644
--- a/dbaccess/source/ui/querydesign/QTableWindowData.hxx
+++ b/dbaccess/source/ui/querydesign/QTableWindowData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLEWINDOWDATA_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLEWINDOWDATA_HXX
+#pragma once
#include <TableWindowData.hxx>
@@ -34,7 +33,6 @@ namespace dbaui
void SetAliasName(const OUString& rNewAlias) { SetWinName(rNewAlias); }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QTABLEWINDOWDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx
index 37e13213d6c0..dd641be1da4d 100644
--- a/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx
+++ b/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYADDTABCONNUNDOACTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYADDTABCONNUNDOACTION_HXX
+#pragma once
#include "QueryTabConnUndoAction.hxx"
@@ -46,6 +45,5 @@ namespace dbaui
virtual void Redo() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYADDTABCONNUNDOACTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
index 63f09af2e508..13262f570290 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNFIELDUNDOACT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNFIELDUNDOACT_HXX
+#pragma once
#include <GeneralUndo.hxx>
#include <strings.hrc>
@@ -38,7 +37,7 @@ namespace dbaui
virtual void Redo() override = 0;
public:
- OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, const char* pCommentID);
+ OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, TranslateId pCommentID);
virtual ~OQueryDesignFieldUndoAct() override;
void SetColumnPosition(sal_uInt16 _nColumnPosition)
@@ -72,12 +71,12 @@ namespace dbaui
class OTabFieldSizedUndoAct final : public OQueryDesignFieldUndoAct
{
- long m_nNextWidth;
+ tools::Long m_nNextWidth;
public:
explicit OTabFieldSizedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_SIZE_COLUMN), m_nNextWidth(0) { }
- void SetOriginalWidth(long nWidth) { m_nNextWidth = nWidth; }
+ void SetOriginalWidth(tools::Long nWidth) { m_nNextWidth = nWidth; }
virtual void Undo() override;
virtual void Redo() override { Undo(); }
@@ -91,7 +90,7 @@ namespace dbaui
OTableFieldDescRef pDescr; // the deleted column description
public:
- OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, const char* pCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, pCommentID) { }
+ OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, TranslateId pCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, pCommentID) { }
void SetTabFieldDescr(OTableFieldDescRef const & pDescription) { pDescr = pDescription; }
};
@@ -135,6 +134,5 @@ namespace dbaui
explicit OTabFieldMovedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OTabFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_TABFIELDMOVED) { }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNFIELDUNDOACT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx
index 817e003415a8..c816ede08e06 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNUNDOACTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNUNDOACTION_HXX
+#pragma once
#include <GeneralUndo.hxx>
#include <JoinTableView.hxx>
@@ -26,16 +25,14 @@
namespace dbaui
{
// OQueryDesignUndoAction - undo base class for actions in graphical query design (without field list)
- class OJoinTableView;
class OQueryDesignUndoAction : public OCommentUndoAction
{
protected:
VclPtr<OJoinTableView> m_pOwner; // in this container it all happens
public:
- OQueryDesignUndoAction(OJoinTableView* pOwner, const char* pCommentID) : OCommentUndoAction(pCommentID), m_pOwner(pOwner) { }
+ OQueryDesignUndoAction(OJoinTableView* pOwner, TranslateId pCommentID) : OCommentUndoAction(pCommentID), m_pOwner(pOwner) { }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNUNDOACTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 035e805dbfaa..cd00da8dcf60 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>
@@ -49,14 +50,13 @@
#include <unotools/syslocale.hxx>
#include <memory>
#include <set>
+#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;
@@ -95,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() )
@@ -134,13 +134,10 @@ namespace
try
{
Reference<XNameAccess> xReferencedTableColumns(xInfoData->getReferencedTable()->getColumns());
- Sequence< OUString> aSeq = xInfoData->getReferencingTable()->getColumns()->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& column : xInfoData->getReferencingTable()->getColumns()->getElementNames())
{
- if ( xReferencedTableColumns->hasByName(*pIter) )
- xInfoData->AppendConnLine(*pIter,*pIter);
+ if (xReferencedTableColumns->hasByName(column))
+ xInfoData->AppendConnLine(column, column);
}
}
catch( const Exception& )
@@ -159,12 +156,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
@@ -238,7 +231,6 @@ namespace
bool bErg = false;
OUString aTableRange,aColumnName;
- sal_uInt16 nCntAccount;
::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController&>(_pView->getController()).getParseIterator();
rParseIter.getColumnRange( pColumnRef, aColumnName, aTableRange );
@@ -249,6 +241,7 @@ namespace
}
if ( !bErg )
{
+ sal_uInt16 nCntAccount;
bErg = static_cast<OQueryTableView*>(_pView->getTableView())->FindTableFromField(aColumnName, _rDragInfo, nCntAccount);
if ( !bErg )
bErg = _pView->HasFieldByAliasName(aColumnName, _rDragInfo);
@@ -289,11 +282,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&)
@@ -315,7 +309,7 @@ namespace
const OQueryTableWindow* _pEntryTabTo,
OUString& _rJoin )
{
- OSL_ENSURE(_pEntryConn,"TableConnection can not be null!");
+ assert(_pEntryConn && "TableConnection can not be null!");
OQueryTableConnectionData* pData = static_cast< OQueryTableConnectionData*>(_pEntryConn->GetData().get());
if ( !(pData->GetJoinType() != INNER_JOIN && _pEntryTabTo->ExistsAVisitedConn()) )
@@ -325,7 +319,7 @@ namespace
if(_rJoin.endsWith(")"))
{
bBrace = true;
- _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1,OUString(' '));
+ _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1, u" ");
}
_rJoin += C_AND + BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData);
if(bBrace)
@@ -368,7 +362,7 @@ namespace
}
OUString BuildJoin( const Reference< XConnection>& _xConnection,
const OUString& rLh,
- const OUString& rRh,
+ std::u16string_view rRh,
const OQueryTableConnectionData* pData)
{
@@ -395,7 +389,7 @@ namespace
aErg += " FULL OUTER ";
break;
}
- aErg += "JOIN " + rRh;
+ aErg += OUString::Concat("JOIN ") + rRh;
if ( CROSS_JOIN != pData->GetJoinType() && !pData->isNatural() )
{
aErg += " ON " + BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData);
@@ -657,11 +651,7 @@ namespace
if ( field->isAggregateFunction() )
{
OSL_ENSURE(!field->GetFunction().isEmpty(),"Function name must not be empty! ;-(");
- OUStringBuffer aTmpStr2( field->GetFunction());
- aTmpStr2.append("(");
- aTmpStr2.append(aTmpStr.makeStringAndClear());
- aTmpStr2.append(")");
- aTmpStr = aTmpStr2;
+ aTmpStr = field->GetFunction() + "(" + aTmpStr.makeStringAndClear() + ")";
}
if (!rFieldAlias.isEmpty() &&
@@ -669,10 +659,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(", ");
}
}
@@ -708,7 +698,7 @@ namespace
const OUString aQuote = xMetaData->getIdentifierQuoteString();
const IParseContext& rContext = static_cast<OQueryController&>(_pView->getController()).getParser().getContext();
// * must not contain a filter : have I already shown the correct warning ?
- bool bCritsOnAsterikWarning = false; // ** TMFS **
+ bool bCritsOnAsteriskWarning = false; // ** TMFS **
for (sal_uInt16 i=0 ; i < nMaxCriteria ; i++)
{
@@ -728,14 +718,14 @@ namespace
if ( aFieldName.toChar() == '*' && field->isNoneFunction() )
{
// only show the messagebox the first time
- if (!bCritsOnAsterikWarning)
+ if (!bCritsOnAsteriskWarning)
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pView->GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
DBA_RES(STR_QRY_CRITERIA_ON_ASTERISK)));
xBox->run();
}
- bCritsOnAsterikWarning = true;
+ bCritsOnAsteriskWarning = true;
continue;
}
aWork = quoteTableAlias(bMulti,field->GetAlias(),aQuote);
@@ -872,7 +862,7 @@ namespace
Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
OUString aQuote = xMetaData->getIdentifierQuoteString();
// * must not contain filter - have I already shown the warning?
- bool bCritsOnAsterikWarning = false; // ** TMFS **
+ bool bCritsOnAsteriskWarning = false; // ** TMFS **
for (auto const& field : _rFieldList)
{
EOrderDir eOrder = field->GetOrderDir();
@@ -884,14 +874,14 @@ namespace
if(aColumnName.toChar() == '*')
{
// only show the MessageBox the first time
- if (!bCritsOnAsterikWarning)
+ if (!bCritsOnAsteriskWarning)
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pView->GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
DBA_RES(STR_QRY_ORDERBY_ON_ASTERISK)));
xBox->run();
}
- bCritsOnAsterikWarning = true;
+ bCritsOnAsteriskWarning = true;
continue;
}
@@ -921,14 +911,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() )
{
@@ -1084,7 +1071,7 @@ namespace
}
if(!aTableListStr.isEmpty())
- aTableListStr = aTableListStr.replaceAt(aTableListStr.getLength()-1,1, OUString() );
+ aTableListStr = aTableListStr.replaceAt(aTableListStr.getLength()-1,1, u"" );
return aTableListStr;
}
OUString GenerateGroupBy(const OQueryDesignView* _pView,OTableFields& _rFieldList, bool bMulti )
@@ -1142,9 +1129,8 @@ namespace
}
if ( !aGroupByStr.isEmpty() )
{
- aGroupByStr = aGroupByStr.replaceAt(aGroupByStr.getLength()-1,1, OUString(' ') );
- OUString aGroupByStr2 = " GROUP BY " + aGroupByStr;
- aGroupByStr = aGroupByStr2;
+ aGroupByStr = aGroupByStr.replaceAt(aGroupByStr.getLength()-1,1, u" " );
+ aGroupByStr = " GROUP BY " + aGroupByStr;
}
}
catch(SQLException&)
@@ -1489,7 +1475,7 @@ namespace
for (auto const& table : rTabList)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(table.second.get());
- if (pTabWin->ExistsField( "*", aDragLeft ))
+ if (pTabWin->ExistsField( u"*"_ustr, aDragLeft ))
{
aDragLeft->SetAlias(OUString());
aDragLeft->SetTable(OUString());
@@ -1821,27 +1807,26 @@ namespace
else
return false;
- if ( eJoinType == CROSS_JOIN || bNatural )
- {
+ if ( eJoinType != CROSS_JOIN && !bNatural )
+ return true;
- OQueryTableWindow* pLeftWindow = static_cast<OQueryTableView*>(_pView->getTableView())->FindTable( getTableRange(_pView,pNode->getChild(0)) );
- OQueryTableWindow* pRightWindow = static_cast<OQueryTableView*>(_pView->getTableView())->FindTable( getTableRange(_pView,pRightTableRef) );
- OSL_ENSURE(pLeftWindow && pRightWindow,"Table Windows could not be found!");
- if ( !pLeftWindow || !pRightWindow )
- return false;
+ OQueryTableWindow* pLeftWindow = static_cast<OQueryTableView*>(_pView->getTableView())->FindTable( getTableRange(_pView,pNode->getChild(0)) );
+ OQueryTableWindow* pRightWindow = static_cast<OQueryTableView*>(_pView->getTableView())->FindTable( getTableRange(_pView,pRightTableRef) );
+ OSL_ENSURE(pLeftWindow && pRightWindow,"Table Windows could not be found!");
+ if ( !pLeftWindow || !pRightWindow )
+ return false;
- OTableFieldDescRef aDragLeft = new OTableFieldDesc();
- aDragLeft->SetTabWindow(pLeftWindow);
- aDragLeft->SetTable(pLeftWindow->GetTableName());
- aDragLeft->SetAlias(pLeftWindow->GetAliasName());
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
+ aDragLeft->SetTabWindow(pLeftWindow);
+ aDragLeft->SetTable(pLeftWindow->GetTableName());
+ aDragLeft->SetAlias(pLeftWindow->GetAliasName());
- OTableFieldDescRef aDragRight = new OTableFieldDesc();
- aDragRight->SetTabWindow(pRightWindow);
- aDragRight->SetTable(pRightWindow->GetTableName());
- aDragRight->SetAlias(pRightWindow->GetAliasName());
+ OTableFieldDescRef aDragRight = new OTableFieldDesc();
+ aDragRight->SetTabWindow(pRightWindow);
+ aDragRight->SetTable(pRightWindow->GetTableName());
+ aDragRight->SetAlias(pRightWindow->GetAliasName());
- insertConnection(_pView,eJoinType,aDragLeft,aDragRight,bNatural);
- }
+ insertConnection(_pView,eJoinType,aDragLeft,aDragRight,bNatural);
return true;
}
@@ -2041,7 +2026,7 @@ namespace
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(table.second.get());
OTableFieldDescRef aInfo = new OTableFieldDesc();
- if (pTabWin->ExistsField( "*", aInfo ))
+ if (pTabWin->ExistsField( u"*"_ustr, aInfo ))
{
eErrorCode = _pView->InsertField(aInfo, bFirstField);
bFirstField = false;
@@ -2137,7 +2122,7 @@ namespace
for (auto const& table : *pTabList)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(table.second.get());
- if (pTabWin->ExistsField( "*", aInfo ))
+ if (pTabWin->ExistsField( u"*"_ustr, aInfo ))
{
aInfo->SetAlias(OUString());
aInfo->SetTable(OUString());
@@ -2174,7 +2159,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);
@@ -2363,7 +2348,7 @@ namespace
OUString getParseErrorMessage( SqlParseError _eErrorCode )
{
- const char* pResId;
+ TranslateId pResId;
switch (_eErrorCode)
{
case eIllegalJoin:
@@ -2427,7 +2412,7 @@ OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent,
m_pSelectionBox = VclPtr<OSelectionBrowseBox>::Create(this);
- setNoneVisbleRow(static_cast<OQueryController&>(getController()).getVisibleRows());
+ setNoneVisibleRow(static_cast<OQueryController&>(getController()).getVisibleRows());
m_pSelectionBox->Show();
// setup Splitter
m_aSplitter->SetSplitHdl(LINK(this, OQueryDesignView,SplitHdl));
@@ -2627,7 +2612,7 @@ void OQueryDesignView::TableDeleted(const OUString& rAliasName)
static_cast<OQueryController&>(getController()).InvalidateFeature(ID_BROWSER_ADDTABLE); // inform the view again
}
-bool OQueryDesignView::HasFieldByAliasName(const OUString& rFieldName, OTableFieldDescRef const & rInfo) const
+bool OQueryDesignView::HasFieldByAliasName(std::u16string_view rFieldName, OTableFieldDescRef const & rInfo) const
{
return m_pSelectionBox->HasFieldByAliasName( rFieldName, rInfo);
}
@@ -2639,18 +2624,18 @@ SqlParseError OQueryDesignView::InsertField( const OTableFieldDescRef& rInfo, bo
sal_Int32 OQueryDesignView::getColWidth(sal_uInt16 _nColPos) const
{
- static sal_Int32 s_nDefaultWidth = GetTextWidth("0") * 15;
+ static sal_Int32 s_nDefaultWidth = GetTextWidth(u"0"_ustr) * 15;
sal_Int32 nWidth = static_cast<OQueryController&>(getController()).getColWidth(_nColPos);
if ( !nWidth )
nWidth = s_nDefaultWidth;
return nWidth;
}
-void OQueryDesignView::fillValidFields(const OUString& sAliasName, weld::ComboBox& rFieldList)
+void OQueryDesignView::fillValidFields(std::u16string_view sAliasName, weld::ComboBox& rFieldList)
{
rFieldList.clear();
- bool bAllTables = sAliasName.isEmpty();
+ bool bAllTables = sAliasName.empty();
OJoinTableView::OTableWindowMap& rTabWins = m_pTableView->GetTabWinMap();
OUString strCurrentPrefix;
@@ -2682,7 +2667,7 @@ void OQueryDesignView::fillValidFields(const OUString& sAliasName, weld::ComboBo
bool OQueryDesignView::PreNotify(NotifyEvent& rNEvt)
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
+ if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
{
if ( m_pSelectionBox && m_pSelectionBox->HasChildPathFocus() )
m_eChildFocus = SELECTION;
@@ -2764,22 +2749,19 @@ OUString OQueryDesignView::getStatement()
OUString aTmp = "( " + aJoinCrit + " )";
if(!aCriteriaListStr.isEmpty())
{
- aTmp += C_AND + aCriteriaListStr.makeStringAndClear();
+ aTmp += C_AND;
}
- aCriteriaListStr = aTmp;
+ aCriteriaListStr.insert(0, aTmp);
}
// ----------------- construct statement ----------------------
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() )
@@ -2792,8 +2774,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;
@@ -2812,7 +2793,7 @@ OUString OQueryDesignView::getStatement()
const sal_Int64 nLimit = rController.getLimit();
if( nLimit != -1 )
{
- aSqlCmd.append( " LIMIT " ).append( OUString::number(nLimit) );
+ aSqlCmd.append( " LIMIT " + OUString::number(nLimit) );
}
}
@@ -2943,7 +2924,7 @@ std::unique_ptr<OSQLParseNode> OQueryDesignView::getPredicateTreeFromEntry(const
}
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
- parse::OParseColumn* pColumn = new parse::OParseColumn( pEntry->GetField(),
+ rtl::Reference<parse::OParseColumn> pColumn = new parse::OParseColumn( pEntry->GetField(),
OUString(),
OUString(),
OUString(),
@@ -3009,9 +2990,9 @@ void OQueryDesignView::reset()
m_pTableView->ReSync();
}
-void OQueryDesignView::setNoneVisbleRow(sal_Int32 _nRows)
+void OQueryDesignView::setNoneVisibleRow(sal_Int32 _nRows)
{
- m_pSelectionBox->SetNoneVisbleRow(_nRows);
+ m_pSelectionBox->SetNoneVisibleRow(_nRows);
}
void OQueryDesignView::initByFieldDescriptions( const Sequence< PropertyValue >& i_rFieldDescriptions )
diff --git a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx
index 1e7ca6bb9525..39873281586a 100644
--- a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx
+++ b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx
@@ -23,7 +23,8 @@
using namespace dbaui;
void OJoinMoveTabWinUndoAct::TogglePosition()
{
- Point ptFrameScrollPos(m_pOwner->GetHScrollBar().GetThumbPos(), m_pOwner->GetVScrollBar().GetThumbPos());
+ Point ptFrameScrollPos(m_pOwner->GetHScrollBar().GetThumbPos(),
+ m_pOwner->GetVScrollBar().GetThumbPos());
Point ptNext = m_pTabWin->GetPosPixel() + ptFrameScrollPos;
m_pTabWin->SetPosPixel(m_ptNextPosition - ptFrameScrollPos);
diff --git a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx
index 38cca8bc61bd..b11108f85c9e 100644
--- a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYMOVETABWINUNDOACT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYMOVETABWINUNDOACT_HXX
+#pragma once
#include "QueryDesignUndoAction.hxx"
#include <strings.hrc>
@@ -29,7 +28,6 @@ namespace dbaui
{
// OQueryMoveTabWinUndoAct - Undo class for moving a TabWin
- class OTableWindow;
class OJoinMoveTabWinUndoAct final : public OQueryDesignUndoAction
{
Point m_ptNextPosition;
@@ -51,6 +49,5 @@ namespace dbaui
{
}
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYMOVETABWINUNDOACT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx
index a36eb5eb5fe9..a8c62bfa1350 100644
--- a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYSIZETABWINUNDOACT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYSIZETABWINUNDOACT_HXX
+#pragma once
#include "QueryDesignUndoAction.hxx"
#include <strings.hrc>
@@ -27,7 +26,6 @@ namespace dbaui
{
// OQuerySizeTabWinUndoAct - undo class to change size of TabWins
- class OTableWindow;
class OJoinSizeTabWinUndoAct final : public OQueryDesignUndoAction
{
Point m_ptNextPosition;
@@ -68,6 +66,4 @@ namespace dbaui
}
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYSIZETABWINUNDOACT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx
index b209a62ce5e8..e3b6cd0e94bb 100644
--- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx
@@ -29,16 +29,16 @@ using namespace dbaui;
OQueryTabConnUndoAction::~OQueryTabConnUndoAction()
{
if (m_bOwnerOfConn)
- { // I have the connection -> delete
+ { // I have the connection -> delete
m_pOwner->DeselectConn(m_pConnection);
m_pConnection.disposeAndClear();
}
}
-OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, const char* pCommentID)
- :OQueryDesignUndoAction(pOwner, pCommentID)
- ,m_pConnection(nullptr)
- ,m_bOwnerOfConn(false)
+OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, TranslateId pCommentID)
+ : OQueryDesignUndoAction(pOwner, pCommentID)
+ , m_pConnection(nullptr)
+ , m_bOwnerOfConn(false)
{
}
@@ -77,13 +77,11 @@ void OQueryDelTabConnUndoAction::Redo()
}
OQueryTabWinShowUndoAct::OQueryTabWinShowUndoAct(OQueryTableView* pOwner)
- : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW)
+ : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW)
{
}
-OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct()
-{
-}
+OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct() {}
void OQueryTabWinShowUndoAct::Undo()
{
@@ -93,28 +91,26 @@ void OQueryTabWinShowUndoAct::Undo()
void OQueryTabWinShowUndoAct::Redo()
{
- static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this,true);
+ static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this, true);
SetOwnership(false);
}
OQueryTabWinDelUndoAct::OQueryTabWinDelUndoAct(OQueryTableView* pOwner)
- : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE)
+ : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE)
{
}
-OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct()
-{
-}
+OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct() {}
void OQueryTabWinDelUndoAct::Undo()
{
- static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin( m_pTabWin, this,true );
+ static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this, true);
SetOwnership(false);
}
void OQueryTabWinDelUndoAct::Redo()
{
- static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin( m_pTabWin, this );
+ static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin(m_pTabWin, this);
SetOwnership(true);
}
diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx
index 36b1aae981a6..2905572adaed 100644
--- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx
+++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABCONNUNDOACTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABCONNUNDOACTION_HXX
+#pragma once
#include "QueryDesignUndoAction.hxx"
#include "QTableConnection.hxx"
@@ -25,7 +24,6 @@
namespace dbaui
{
- class OQueryTableConnection;
class OQueryTableView;
class OQueryTabConnUndoAction : public OQueryDesignUndoAction
{
@@ -35,7 +33,7 @@ namespace dbaui
// am I the only owner of the connection? (changes with every redo and undo)
public:
- OQueryTabConnUndoAction(OQueryTableView* pOwner, const char* pCommentID);
+ OQueryTabConnUndoAction(OQueryTableView* pOwner, TranslateId pCommentID);
virtual ~OQueryTabConnUndoAction() override;
virtual void Undo() override = 0;
@@ -46,7 +44,6 @@ namespace dbaui
void SetOwnership(bool bTakeIt) { m_bOwnerOfConn = bTakeIt; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABCONNUNDOACTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx
index 748ca7c38110..95b740de9871 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINSHOWUNDOACT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINSHOWUNDOACT_HXX
+#pragma once
#include "QueryTabWinUndoAct.hxx"
@@ -48,6 +47,5 @@ namespace dbaui
virtual void Redo() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINSHOWUNDOACT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
index 6242c94fc09f..2afe74db4232 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
@@ -20,12 +20,11 @@
#include "QueryTabWinUndoAct.hxx"
#include <osl/diagnose.h>
#include "QTableWindow.hxx"
-#include <TableConnection.hxx>
#include "QueryDesignFieldUndoAct.hxx"
#include <QueryTableView.hxx>
using namespace dbaui;
-OQueryDesignFieldUndoAct::OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, const char* pCommentID)
+OQueryDesignFieldUndoAct::OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, TranslateId pCommentID)
: OCommentUndoAction(pCommentID)
, pOwner(pSelBrwBox)
, m_nColumnPosition(BROWSER_INVALIDID)
@@ -37,7 +36,7 @@ OQueryDesignFieldUndoAct::~OQueryDesignFieldUndoAct()
pOwner = nullptr;
}
-OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, const char* pCommentID)
+OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, TranslateId pCommentID)
: OQueryDesignUndoAction(pOwner, pCommentID)
, m_pTabWin(nullptr)
, m_bOwnerOfObjects(false)
@@ -88,7 +87,7 @@ void OTabFieldSizedUndoAct::Undo()
if ( m_nColumnPosition != BROWSER_INVALIDID )
{
sal_uInt16 nColumnId = pOwner->GetColumnId(m_nColumnPosition);
- long nNextWidth = pOwner->GetColumnWidth(nColumnId);
+ tools::Long nNextWidth = pOwner->GetColumnWidth(nColumnId);
pOwner->SetColWidth(nColumnId, m_nNextWidth);
m_nNextWidth = nNextWidth;
}
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx
index 008c76260216..540f332757eb 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINUNDOACT_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINUNDOACT_HXX
+#pragma once
#include "QueryDesignUndoAction.hxx"
#include "QTableWindow.hxx"
@@ -28,8 +27,6 @@ namespace dbaui
{
// OQueryTabWinUndoAct - undo base class for all which is concerned with insert/remove TabWins
- class OQueryTableWindow;
- class OTableConnection;
class OQueryTableView;
class OQueryTabWinUndoAct : public OQueryDesignUndoAction
{
@@ -40,7 +37,7 @@ namespace dbaui
// am I the only owner of the managed objects? (changes with every redo or undo)
public:
- OQueryTabWinUndoAct(OQueryTableView* pOwner, const char* pCommentID);
+ OQueryTabWinUndoAct(OQueryTableView* pOwner, TranslateId pCommentID);
virtual ~OQueryTabWinUndoAct() override;
void SetOwnership(bool bTakeIt) { m_bOwnerOfObjects = bTakeIt; }
@@ -58,6 +55,5 @@ namespace dbaui
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINUNDOACT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 1847cfe7b5ee..3ddb54f5986d 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;
}
@@ -353,7 +353,7 @@ void OQueryTableView::AddTabWin(const OUString& _rTableName, const OUString& _rA
}
// find the table which has a foreign key with this referencedTable name
-static Reference<XPropertySet> getKeyReferencedTo(const Reference<XIndexAccess>& _rxKeys,const OUString& _rReferencedTable)
+static Reference<XPropertySet> getKeyReferencedTo(const Reference<XIndexAccess>& _rxKeys,std::u16string_view _rReferencedTable)
{
if(!_rxKeys.is())
return Reference<XPropertySet>();
@@ -428,10 +428,9 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
{
modified();
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- Any(),
- makeAny(pNewTabWin->GetAccessible())
- );
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD, Any(),
+ Any(css::uno::Reference<XAccessible>(pNewTabWin->GetAccessible())));
do {
@@ -493,10 +492,10 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
if ( pTabWinTmp == pNewTabWin )
continue;
+ assert(pTabWinTmp && "TableWindow is null!");
if ( pTabWinTmp->GetData()->isQuery() )
continue;
- OSL_ENSURE(pTabWinTmp,"TableWindow is null!");
Reference< XPropertySet > xFKKey = getKeyReferencedTo( pTabWinTmp->GetData()->getKeys(), pNewTabWin->GetComposedName() );
if ( !xFKKey.is() )
continue;
@@ -528,8 +527,10 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(jxdDest.pListBox->GetTabWin());
OUString aSourceFieldName, aDestFieldName;
- aSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
- aDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry);
+ weld::TreeView& rSourceTreeView = jxdSource.pListBox->get_widget();
+ aSourceFieldName = rSourceTreeView.get_text(jxdSource.nEntry);
+ weld::TreeView& rDestTreeView = jxdDest.pListBox->get_widget();
+ aDestFieldName = rDestTreeView.get_text(jxdDest.nEntry);
OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin,true);
if ( !pConn )
@@ -541,9 +542,9 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
// Get name/position of both affected fields ...
// Source
- nSourceFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry);
+ nSourceFieldIndex = jxdSource.nEntry;
// Dest
- nDestFieldIndex = jxdDest.pListBox->GetModel()->GetAbsPos(jxdDest.pEntry);
+ nDestFieldIndex = jxdDest.nEntry;
// ... and set them
xNewConnectionData->SetFieldIndex(JTCS_FROM, nSourceFieldIndex);
@@ -559,11 +560,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 );
@@ -690,10 +687,9 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
modified();
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(pTabWin->GetAccessible()),
- Any()
- );
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD,
+ Any(css::uno::Reference<XAccessible>(pTabWin->GetAccessible())), Any());
}
void OQueryTableView::EnsureVisible(const OTableWindow* pWin)
@@ -736,7 +732,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
@@ -753,7 +749,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
{
VclPtr<OTableConnection> xTmpEntry = *aIter2;
OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(xTmpEntry.get());
- OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
+ assert(pTmpEntry && "OQueryTableConnection is null!");
if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() ||
pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() )
{
@@ -878,7 +874,7 @@ void OQueryTableView::onNoColumns_throw()
::dbtools::throwSQLException( sError, ::dbtools::StandardSQLState::GENERAL_ERROR, nullptr );
}
-bool OQueryTableView::supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const
+bool OQueryTableView::suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const
{
OQueryTableConnectionData* pQueryData = static_cast<OQueryTableConnectionData*>(_pData.get());
return pQueryData && (pQueryData->GetJoinType() == CROSS_JOIN);
diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx
index 9633146900c6..d08de914530d 100644
--- a/dbaccess/source/ui/querydesign/QueryTextView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx
@@ -17,94 +17,159 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <svx/svxids.hrc>
#include <QueryTextView.hxx>
#include <querycontainerwindow.hxx>
+#include <helpids.h>
+#include <querycontroller.hxx>
#include <sqledit.hxx>
#include <undosqledit.hxx>
-#include <QueryDesignView.hxx>
using namespace dbaui;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
// end of temp classes
-OQueryTextView::OQueryTextView(OQueryContainerWindow* _pParent)
- :Window(_pParent)
+OQueryTextView::OQueryTextView(OQueryContainerWindow* pParent, OQueryController& rController)
+ : InterimItemWindow(pParent, u"dbaccess/ui/queryview.ui"_ustr, u"QueryView"_ustr)
+ , m_rController(rController)
+ , m_xSQL(new SQLEditView(m_xBuilder->weld_scrolled_window(u"scrolledwindow"_ustr, true)))
+ , m_xSQLEd(new weld::CustomWeld(*m_xBuilder, u"sql"_ustr, *m_xSQL))
+ , m_timerUndoActionCreation("dbaccess OQueryTextView m_timerUndoActionCreation")
+ , m_timerInvalidate("dbaccess OQueryTextView m_timerInvalidate")
+ , m_bStopTimer(false)
{
- m_pEdit = VclPtr<OSqlEdit>::Create(this);
- m_pEdit->SetRightToLeft(false);
- m_pEdit->ClearModifyFlag();
- m_pEdit->SaveValue();
- m_pEdit->SetPosPixel( Point( 0, 0 ) );
- m_pEdit->Show();
+ 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));
+
+ m_timerInvalidate.SetTimeout(200);
+ m_timerInvalidate.SetInvokeHandler(LINK(this, OQueryTextView, OnInvalidateTimer));
+ m_timerInvalidate.Start();
}
-OQueryTextView::~OQueryTextView()
+IMPL_LINK_NOARG(OQueryTextView, ModifyHdl, LinkParamNone*, void)
{
- disposeOnce();
+ if (m_timerUndoActionCreation.IsActive())
+ m_timerUndoActionCreation.Stop();
+ m_timerUndoActionCreation.Start();
+
+ if (!m_rController.isModified())
+ m_rController.setModified(true);
+
+ m_rController.InvalidateFeature(SID_SBA_QRY_EXECUTE);
+ m_rController.InvalidateFeature(SID_CUT);
+ m_rController.InvalidateFeature(SID_COPY);
}
-void OQueryTextView::dispose()
+IMPL_LINK_NOARG(OQueryTextView, OnUndoActionTimer, Timer*, void)
{
- m_pEdit.disposeAndClear();
- vcl::Window::dispose();
+ OUString aText = m_xSQL->GetText();
+ if (aText == m_strOrigText)
+ return;
+
+ SfxUndoManager& rUndoMgr = m_rController.GetUndoManager();
+ std::unique_ptr<OSqlEditUndoAct> xUndoAct(new OSqlEditUndoAct(*this));
+
+ xUndoAct->SetOriginalText(m_strOrigText);
+ rUndoMgr.AddUndoAction(std::move(xUndoAct));
+
+ m_rController.InvalidateFeature(SID_UNDO);
+ m_rController.InvalidateFeature(SID_REDO);
+
+ m_strOrigText = aText;
}
-void OQueryTextView::GetFocus()
+IMPL_LINK_NOARG(OQueryTextView, OnInvalidateTimer, Timer*, void)
{
- if ( m_pEdit )
- m_pEdit->GrabFocus();
+ m_rController.InvalidateFeature(SID_CUT);
+ m_rController.InvalidateFeature(SID_COPY);
+ if (!m_bStopTimer)
+ m_timerInvalidate.Start();
}
-void OQueryTextView::Resize()
+void OQueryTextView::startTimer()
{
- Window::Resize();
- m_pEdit->SetSizePixel( GetOutputSizePixel() );
+ m_bStopTimer = false;
+ if (!m_timerInvalidate.IsActive())
+ m_timerInvalidate.Start();
}
-OUString OQueryTextView::getStatement() const
+void OQueryTextView::stopTimer()
{
- return m_pEdit->GetText();
+ m_bStopTimer = true;
+ if (m_timerInvalidate.IsActive())
+ m_timerInvalidate.Stop();
}
-void OQueryTextView::clear()
-{
- std::unique_ptr<OSqlEditUndoAct> pUndoAct(new OSqlEditUndoAct( m_pEdit ));
+OQueryTextView::~OQueryTextView() { disposeOnce(); }
- pUndoAct->SetOriginalText( m_pEdit->GetText() );
- getContainerWindow()->getDesignView()->getController().addUndoActionAndInvalidate( std::move(pUndoAct) );
+void OQueryTextView::dispose()
+{
+ if (m_timerUndoActionCreation.IsActive())
+ m_timerUndoActionCreation.Stop();
- m_pEdit->SetText(OUString());
+ m_xSQLEd.reset();
+ m_xSQL.reset();
+ InterimItemWindow::dispose();
}
-void OQueryTextView::setStatement(const OUString& _rsStatement)
+void OQueryTextView::GetFocus()
{
- m_pEdit->SetText(_rsStatement);
+ if (m_xSQL)
+ {
+ m_xSQL->GrabFocus();
+ m_strOrigText = m_xSQL->GetText();
+ }
+ InterimItemWindow::GetFocus();
}
-void OQueryTextView::copy()
+OUString OQueryTextView::getStatement() const { return m_xSQL->GetText(); }
+
+void OQueryTextView::clear()
{
- if(!m_pEdit->IsInAccelAct() )
- m_pEdit->Copy();
+ std::unique_ptr<OSqlEditUndoAct> xUndoAct(new OSqlEditUndoAct(*this));
+
+ xUndoAct->SetOriginalText(m_xSQL->GetText());
+ m_rController.addUndoActionAndInvalidate(std::move(xUndoAct));
+
+ SetSQLText(OUString());
}
-bool OQueryTextView::isCutAllowed() const
+void OQueryTextView::setStatement(const OUString& rsStatement) { SetSQLText(rsStatement); }
+
+OUString OQueryTextView::GetSQLText() const { return m_xSQL->GetText(); }
+
+void OQueryTextView::SetSQLText(const OUString& rNewText)
{
- return !m_pEdit->GetSelected().isEmpty();
+ if (m_timerUndoActionCreation.IsActive())
+ {
+ // create the trailing undo-actions
+ m_timerUndoActionCreation.Stop();
+ OnUndoActionTimer(nullptr);
+ }
+
+ m_xSQL->SetTextAndUpdate(rNewText);
+
+ m_strOrigText = rNewText;
}
+void OQueryTextView::copy() { m_xSQL->Copy(); }
+
+bool OQueryTextView::isCutAllowed() const { return m_xSQL->HasSelection(); }
+
void OQueryTextView::cut()
{
- if(!m_pEdit->IsInAccelAct() )
- m_pEdit->Cut();
- getContainerWindow()->getDesignView()->getController().setModified(true);
+ m_xSQL->Cut();
+ m_rController.setModified(true);
}
void OQueryTextView::paste()
{
- if(!m_pEdit->IsInAccelAct() )
- m_pEdit->Paste();
- getContainerWindow()->getDesignView()->getController().setModified(true);
+ m_xSQL->Paste();
+ m_rController.setModified(true);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index e7d6758f480f..a51f2941addb 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -23,7 +23,6 @@
#include <querycontainerwindow.hxx>
#include <adtabdlg.hxx>
#include <querycontroller.hxx>
-#include <sqledit.hxx>
using namespace dbaui;
using namespace ::com::sun::star::uno;
@@ -33,7 +32,7 @@ OQueryViewSwitch::OQueryViewSwitch(OQueryContainerWindow* _pParent, OQueryContro
: m_bAddTableDialogWasVisible(false)
{
- m_pTextView = VclPtr<OQueryTextView>::Create(_pParent);
+ m_pTextView = VclPtr<OQueryTextView>::Create(_pParent, _rController);
m_pDesignView = VclPtr<OQueryDesignView>::Create( _pParent, _rController, _rxContext );
}
@@ -154,7 +153,7 @@ void OQueryViewSwitch::impl_forceSQLView()
// tell the views they're in/active
m_pDesignView->stopTimer();
- m_pTextView->getSqlEdit()->startTimer();
+ m_pTextView->startTimer();
// set the most recent statement at the text view
m_pTextView->clear();
@@ -170,7 +169,7 @@ void OQueryViewSwitch::forceInitialView()
else
{
// tell the text view it's inactive now
- m_pTextView->getSqlEdit()->stopTimer();
+ m_pTextView->stopTimer();
// update the "Add Table" dialog
OAddTableDlg* pAddTabDialog( getAddTableDialog() );
@@ -199,7 +198,7 @@ bool OQueryViewSwitch::switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo )
else
{
// tell the text view it's inactive now
- m_pTextView->getSqlEdit()->stopTimer();
+ m_pTextView->stopTimer();
// update the "Add Table" dialog
OAddTableDlg* pAddTabDialog( getAddTableDialog() );
@@ -284,10 +283,10 @@ void OQueryViewSwitch::reset()
switchView( nullptr );
}
-void OQueryViewSwitch::setNoneVisbleRow(sal_Int32 _nRows)
+void OQueryViewSwitch::setNoneVisibleRow(sal_Int32 _nRows)
{
if(m_pDesignView)
- m_pDesignView->setNoneVisbleRow(_nRows);
+ m_pDesignView->setNoneVisibleRow(_nRows);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index bb7bd9584115..5ffe2cf16718 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "SelectionBrowseBox.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -42,9 +46,10 @@
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <i18nlangtag/languagetag.hxx>
-#include <vcl/treelistentry.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/svapp.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::svt;
using namespace ::dbaui;
@@ -52,26 +57,24 @@ 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
-#define DEFAULT_SIZE GetTextWidth("0") * 30
+#define DEFAULT_SIZE GetTextWidth(u"0"_ustr) * 30
#define HANDLE_ID 0
#define HANDLE_COLUMN_WIDTH 70
#define SORT_COLUMN_NONE 0xFFFFFFFF
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;
}
@@ -99,6 +102,7 @@ namespace
OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
:EditBrowseBox( pParent,EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT, WB_3DLOOK, BrowserMode::COLUMNSELECTION | BrowserMode::KEEPHIGHLIGHT | BrowserMode::HIDESELECT |
BrowserMode::HIDECURSOR | BrowserMode::HLINES | BrowserMode::VLINES )
+ ,m_timerInvalidate("dbaccess OSelectionBrowseBox m_timerInvalidate")
,m_nSeekRow(0)
,m_nMaxColumns(0)
,m_aFunctionStrings(DBA_RES(STR_QUERY_FUNCTIONS))
@@ -141,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);
@@ -251,7 +255,7 @@ namespace
public:
explicit OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent);
virtual ~OSelectionBrwBoxHeader() override { disposeOnce(); }
- virtual void dispose() override { m_pBrowseBox.clear(); ::svt::EditBrowserHeader::dispose(); }
+ virtual void dispose() override { m_pBrowseBox.reset(); ::svt::EditBrowserHeader::dispose(); }
};
OSelectionBrwBoxHeader::OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent)
: ::svt::EditBrowserHeader(pParent,WB_BUTTONSTYLE|WB_DRAG)
@@ -356,7 +360,7 @@ void OSelectionBrowseBox::Init()
SetDataRowHeight(aHeight.Height());
SetTitleLines(1);
// get number of visible rows
- for(long i=0;i<BROW_ROW_CNT;i++)
+ for(tools::Long i=0;i<BROW_ROW_CNT;i++)
{
if(m_bVisibleRow[i])
m_nVisibleCount++;
@@ -376,7 +380,7 @@ void OSelectionBrowseBox::Init()
}
catch(const SQLException&)
{
- OSL_FAIL("Caught Exception when asking for database metadata options!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "Caught Exception when asking for database metadata options!");
m_nMaxColumns = 0;
}
}
@@ -430,7 +434,7 @@ void OSelectionBrowseBox::SetReadOnly(bool bRO)
}
}
-CellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId)
+CellController* OSelectionBrowseBox::GetController(sal_Int32 nRow, sal_uInt16 nColId)
{
if ( nColId > getFields().size() )
return nullptr;
@@ -443,7 +447,7 @@ CellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId)
if (static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
return nullptr;
- long nCellIndex = GetRealRow(nRow);
+ sal_Int32 nCellIndex = GetRealRow(nRow);
switch (nCellIndex)
{
case BROW_FIELD_ROW:
@@ -461,7 +465,7 @@ CellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId)
}
}
-void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColId)
+void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, sal_Int32 nRow, sal_uInt16 nColId)
{
OSL_ENSURE(nColId != BROWSER_INVALIDID,"An Invalid Id was set!");
if ( nColId == BROWSER_INVALIDID )
@@ -471,7 +475,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
return;
OTableFieldDescRef pEntry = getFields()[nPos-1];
OSL_ENSURE(pEntry.is(), "OSelectionBrowseBox::InitController : invalid FieldDescription !");
- long nCellIndex = GetRealRow(nRow);
+ sal_Int32 nCellIndex = GetRealRow(nRow);
switch (nCellIndex)
{
@@ -487,7 +491,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
getDesignView()->fillValidFields(aTable, rComboBox);
// replace with alias.*
- if (aField.trim() == "*")
+ if (o3tl::trim(aField) == u"*")
{
aField = aTable + ".*";
}
@@ -555,14 +559,14 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
Controller()->SaveValue();
}
-void OSelectionBrowseBox::notifyTableFieldChanged(const OUString& _sOldAlias, const OUString& _sAlias, bool& _bListAction, sal_uInt16 _nColumnId)
+void OSelectionBrowseBox::notifyTableFieldChanged(const OUString& _sOldAlias, std::u16string_view _sAlias, bool& _bListAction, sal_uInt16 _nColumnId)
{
appendUndoAction(_sOldAlias,_sAlias,BROW_TABLE_ROW,_bListAction);
if ( m_bVisibleRow[BROW_TABLE_ROW] )
RowModified(GetBrowseRow(BROW_TABLE_ROW), _nColumnId);
}
-void OSelectionBrowseBox::notifyFunctionFieldChanged(const OUString& _sOldFunctionName, const OUString& _sFunctionName, bool& _bListAction, sal_uInt16 _nColumnId)
+void OSelectionBrowseBox::notifyFunctionFieldChanged(const OUString& _sOldFunctionName, std::u16string_view _sFunctionName, bool& _bListAction, sal_uInt16 _nColumnId)
{
appendUndoAction(_sOldFunctionName,_sFunctionName,BROW_FUNCTION_ROW,_bListAction);
if ( !m_bVisibleRow[BROW_FUNCTION_ROW] )
@@ -570,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;
@@ -596,12 +600,12 @@ bool OSelectionBrowseBox::fillColumnRef(const OSQLParseNode* _pColumnRef, const
return fillColumnRef(sColumnName,sTableRange,_rxConnection->getMetaData(),_pEntry,_bListAction);
}
-bool OSelectionBrowseBox::fillColumnRef(const OUString& _sColumnName, const OUString& _sTableRange, const Reference<XDatabaseMetaData>& _xMetaData, OTableFieldDescRef const & _pEntry, bool& _bListAction)
+bool OSelectionBrowseBox::fillColumnRef(const OUString& _sColumnName, std::u16string_view _sTableRange, const Reference<XDatabaseMetaData>& _xMetaData, OTableFieldDescRef const & _pEntry, bool& _bListAction)
{
bool bError = false;
::comphelper::UStringMixEqual bCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
// check if the table name is the same
- if ( !_sTableRange.isEmpty() && (bCase(_pEntry->GetTable(),_sTableRange) || bCase(_pEntry->GetAlias(),_sTableRange)) )
+ if ( !_sTableRange.empty() && (bCase(_pEntry->GetTable(),_sTableRange) || bCase(_pEntry->GetAlias(),_sTableRange)) )
{ // a table was already inserted and the tables contains that column name
if ( !_pEntry->GetTabWindow() )
@@ -703,7 +707,7 @@ bool OSelectionBrowseBox::saveField(OUString& _sFieldName ,OTableFieldDescRef co
bool bQuote = ( nPass <= 2 );
bool bInternational = ( nPass % 2 ) == 0;
- OUString sSql {"SELECT "};
+ OUString sSql {u"SELECT "_ustr};
if ( bQuote )
sSql += sQuotedFullFieldName;
else
@@ -807,7 +811,7 @@ bool OSelectionBrowseBox::saveField(OUString& _sFieldName ,OTableFieldDescRef co
if ( nFunCount == 4 && SQL_ISRULE(pColumnRef->getChild(3),column_ref) )
bError = fillColumnRef( pColumnRef->getChild(3), xConnection, aSelEntry, _bListAction );
else if ( nFunCount == 3 ) // we have a COUNT(*) here, so take the first table
- bError = fillColumnRef( "*", OUString(), xMetaData, aSelEntry, _bListAction );
+ bError = fillColumnRef( u"*"_ustr, std::u16string_view(), xMetaData, aSelEntry, _bListAction );
else
{
nFunctionType |= FKT_NUMERIC;
@@ -906,15 +910,17 @@ bool OSelectionBrowseBox::SaveModified()
{
// for the Undo-action
OUString strOldCellContents,sNewValue;
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
bool bAppendRow = false;
switch (nRow)
{
case BROW_VIS_ROW:
{
bool bOldValue = m_pVisibleCell->GetBox().get_saved_state() != TRISTATE_FALSE;
- strOldCellContents = bOldValue ? OUStringLiteral("1") : OUStringLiteral("0");
- sNewValue = !bOldValue ? OUStringLiteral("1") : OUStringLiteral("0");
+ strOldCellContents
+ = bOldValue ? std::u16string_view(u"1") : std::u16string_view(u"0");
+ sNewValue
+ = !bOldValue ? std::u16string_view(u"1") : std::u16string_view(u"0");
}
if((m_bOrderByUnRelated || pEntry->GetOrderDir() == ORDER_NONE) &&
(m_bGroupByUnRelated || !pEntry->IsGroupBy()))
@@ -1046,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
{
@@ -1057,7 +1063,7 @@ bool OSelectionBrowseBox::SaveModified()
// we have to change the visible flag, so we must append also an undo action
pEntry->SetVisible();
m_pVisibleCell->GetBox().set_active(true);
- appendUndoAction("0","1",BROW_VIS_ROW,bListAction);
+ appendUndoAction(u"0"_ustr,u"1",BROW_VIS_ROW,bListAction);
RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId());
}
@@ -1198,7 +1204,7 @@ bool OSelectionBrowseBox::SaveModified()
{
// Default to visible
pEntry->SetVisible();
- appendUndoAction("0","1",BROW_VIS_ROW,bListAction);
+ appendUndoAction(u"0"_ustr,u"1",BROW_VIS_ROW,bListAction);
RowModified(BROW_VIS_ROW, GetCurColumnId());
// if required add empty columns
@@ -1212,7 +1218,7 @@ bool OSelectionBrowseBox::SaveModified()
return pEntry != nullptr && !bError;
}
-bool OSelectionBrowseBox::SeekRow(long nRow)
+bool OSelectionBrowseBox::SeekRow(sal_Int32 nRow)
{
m_nSeekRow = nRow;
return nRow < m_nVisibleCount;
@@ -1230,7 +1236,7 @@ void OSelectionBrowseBox::PaintCell(OutputDevice& rDev, const tools::Rectangle&
if (!pEntry.is())
return;
- long nRow = GetRealRow(m_nSeekRow);
+ sal_Int32 nRow = GetRealRow(m_nSeekRow);
if (nRow == BROW_VIS_ROW)
PaintTristate(rRect, pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
else
@@ -1261,7 +1267,7 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 _nColumnId)
// ColId is synonymous to Position, and the condition should be valid
sal_uInt16 nCurCol = GetCurColumnId();
- long nCurrentRow = GetCurRow();
+ sal_Int32 nCurrentRow = GetCurRow();
DeactivateCell();
@@ -1447,7 +1453,7 @@ void OSelectionBrowseBox::DeleteFields(const OUString& rAliasName)
ActivateCell(nRow , nColId);
}
-void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth)
+void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, tools::Long nNewWidth)
{
bool bWasEditing = IsEditing();
if (bWasEditing)
@@ -1480,11 +1486,11 @@ tools::Rectangle OSelectionBrowseBox::GetInvalidRect( sal_uInt16 nColId )
void OSelectionBrowseBox::InsertColumn(const OTableFieldDescRef& pEntry, sal_uInt16& _nColumnPosition)
{
// the control should have exactly one more column: the HandleColumn
- OSL_ENSURE(_nColumnPosition == BROWSER_INVALIDID || (_nColumnPosition <= static_cast<long>(getFields().size())), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId.");
+ OSL_ENSURE(_nColumnPosition == BROWSER_INVALIDID || (_nColumnPosition <= static_cast<tools::Long>(getFields().size())), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId.");
// -1 means at the end. Count means at the end, others denotes a correct position
sal_uInt16 nCurCol = GetCurColumnId();
- long nCurrentRow = GetCurRow();
+ sal_Int32 nCurrentRow = GetCurRow();
DeactivateCell();
@@ -1500,7 +1506,9 @@ void OSelectionBrowseBox::InsertColumn(const OTableFieldDescRef& pEntry, sal_uIn
getFields().size());
}
else
- ++_nColumnPosition; // within the list
+ {
+ _nColumnPosition = static_cast<sal_uInt16>(_nColumnPosition + 1); // within the list
+ }
nColumnId = GetColumnId(_nColumnPosition);
pEntry->SetColumnId( nColumnId );
getFields()[ _nColumnPosition - 1] = pEntry;
@@ -1546,9 +1554,10 @@ OTableFieldDescRef OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxd
return nullptr;
// name and position of the selected field
- OUString aFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
- sal_uInt32 nFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry);
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(jxdSource.pEntry->GetUserData());
+ weld::TreeView& rTreeView = jxdSource.pListBox->get_widget();
+ OUString aFieldName = rTreeView.get_text(jxdSource.nEntry);
+ sal_uInt32 nFieldIndex = jxdSource.nEntry;
+ 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);
@@ -1609,7 +1618,7 @@ OTableFieldDescRef OSelectionBrowseBox::FindFirstFreeCol(sal_uInt16& _rColumnPos
for (auto const& field : getFields())
{
- ++_rColumnPosition;
+ _rColumnPosition = static_cast<sal_uInt16>(_rColumnPosition + 1);
OTableFieldDescRef pEntry = field;
if ( pEntry.is() && pEntry->IsEmpty() )
return pEntry;
@@ -1857,7 +1866,7 @@ bool OSelectionBrowseBox::Save()
void OSelectionBrowseBox::CellModified()
{
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_VIS_ROW:
@@ -1928,7 +1937,7 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
}
sal_uInt16 nColId = GetColumnId(GetColumnAtXPosPixel( aMenuPos.X() ));
- long nRow = GetRowAtYPosPixel( aMenuPos.Y() );
+ sal_Int32 nRow = GetRowAtYPosPixel( aMenuPos.Y() );
if (nRow < 0 && nColId > HANDLE_ID )
{
@@ -1940,12 +1949,14 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
{
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/querycolmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- sal_uInt16 nItemId = aContextMenu->Execute(this, aMenuPos);
- if (nItemId == aContextMenu->GetItemId("delete"))
+ ::tools::Rectangle aRect(aMenuPos, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/querycolmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
+ if (sIdent == "delete")
RemoveField(nColId);
- else if (nItemId == aContextMenu->GetItemId("width"))
+ else if (sIdent == "width")
adjustBrowseBoxColumnWidth( this, nColId );
}
}
@@ -1953,16 +1964,16 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
{
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
{
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/queryfuncmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- aContextMenu->CheckItem("functions", m_bVisibleRow[BROW_FUNCTION_ROW]);
- aContextMenu->CheckItem("tablename", m_bVisibleRow[BROW_TABLE_ROW]);
- aContextMenu->CheckItem("alias", m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
- aContextMenu->CheckItem("distinct", static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
-
- aContextMenu->Execute(this, aMenuPos);
-
- OString sIdent = aContextMenu->GetCurItemIdent();
+ ::tools::Rectangle aRect(aMenuPos, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/queryfuncmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+ xContextMenu->set_active(u"functions"_ustr, m_bVisibleRow[BROW_FUNCTION_ROW]);
+ xContextMenu->set_active(u"tablename"_ustr, m_bVisibleRow[BROW_TABLE_ROW]);
+ xContextMenu->set_active(u"alias"_ustr, m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
+ xContextMenu->set_active(u"distinct"_ustr, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
+
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "functions")
{
SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW));
@@ -2018,7 +2029,7 @@ void OSelectionBrowseBox::SetRowVisible(sal_uInt16 _nWhich, bool _bVis)
// do this before removing or inserting rows, as this triggers ActivateCell-calls, which rely on m_bVisibleRow
m_bVisibleRow[_nWhich] = !m_bVisibleRow[_nWhich];
- long nId = GetBrowseRow(_nWhich);
+ tools::Long nId = GetBrowseRow(_nWhich);
if (_bVis)
{
RowInserted(nId);
@@ -2034,10 +2045,10 @@ void OSelectionBrowseBox::SetRowVisible(sal_uInt16 _nWhich, bool _bVis)
ActivateCell();
}
-long OSelectionBrowseBox::GetBrowseRow(long nRowId) const
+sal_Int32 OSelectionBrowseBox::GetBrowseRow(sal_Int32 nRowId) const
{
- sal_uInt16 nCount(0);
- for(long i = 0 ; i < nRowId ; ++i)
+ sal_Int32 nCount(0);
+ for(sal_Int32 i = 0 ; i < nRowId ; ++i)
{
if ( m_bVisibleRow[i] )
++nCount;
@@ -2045,20 +2056,20 @@ long OSelectionBrowseBox::GetBrowseRow(long nRowId) const
return nCount;
}
-long OSelectionBrowseBox::GetRealRow(long nRowId) const
+sal_Int32 OSelectionBrowseBox::GetRealRow(sal_Int32 nRowId) const
{
- long nErg=0,i;
- const long nCount = m_bVisibleRow.size();
+ sal_Int32 nErg=0,i;
+ const sal_Int32 nCount = m_bVisibleRow.size();
for(i=0;i < nCount; ++i)
{
if(m_bVisibleRow[i] && nErg++ == nRowId)
break;
}
- OSL_ENSURE(nErg <= long(m_bVisibleRow.size()),"nErg cannot be greater than BROW_ROW_CNT!");
+ OSL_ENSURE(nErg <= tools::Long(m_bVisibleRow.size()),"nErg cannot be greater than BROW_ROW_CNT!");
return i;
}
-const long nVisibleRowMask[] =
+const tools::Long nVisibleRowMask[] =
{
0x0001,
0x0002,
@@ -2077,8 +2088,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];
@@ -2086,18 +2097,20 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const
return nErg;
}
-void OSelectionBrowseBox::SetNoneVisbleRow(long nRows)
+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]);
}
-OUString OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const
+OUString OSelectionBrowseBox::GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const
{
sal_uInt16 nPos = GetColumnPos(nColId);
+ if ( nPos == 0 || nPos == BROWSER_INVALIDID || nPos > getFields().size() )
+ return OUString();
OTableFieldDescRef pEntry = getFields()[nPos-1];
OSL_ENSURE(pEntry != nullptr, "OSelectionBrowseBox::GetCellText : invalid column id, prepare for GPF ... ");
@@ -2225,7 +2238,7 @@ OUString OSelectionBrowseBox::GetCellContents(sal_Int32 nCellIndex, sal_uInt16 n
switch (nCellIndex)
{
case BROW_VIS_ROW :
- return pEntry->IsVisible() ? OUStringLiteral("1") : OUStringLiteral("0");
+ return OUString(pEntry->IsVisible() ? std::u16string_view(u"1") : std::u16string_view(u"0"));
case BROW_ORDER_ROW:
{
sal_Int32 nIdx = m_pOrderCell->get_widget().get_active();
@@ -2269,16 +2282,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() )
{
@@ -2290,7 +2303,7 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con
pEntry->SetCriteria(sal_uInt16(nRow - BROW_CRIT1_ROW), strNewText);
}
- long nCellIndex = GetRealRow(nRow);
+ tools::Long nCellIndex = GetRealRow(nRow);
if(IsRowVisible(static_cast<sal_uInt16>(nRow)))
RowModified(nCellIndex, nColId);
@@ -2333,7 +2346,7 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId)
}
}
-sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRowId, sal_uInt16 nColId)
+sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(sal_Int32 nRowId, sal_uInt16 nColId)
{
sal_uInt16 nPos = GetColumnPos(nColId);
OSL_ENSURE((nPos == 0) || (nPos <= getFields().size()), "OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId");
@@ -2341,7 +2354,7 @@ sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRowId, sal_uInt16 nColId
OTableFieldDescRef pEntry = getFields()[nPos-1];
OSL_ENSURE(pEntry.is(), "OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription !");
- long nRow = GetRealRow(nRowId);
+ sal_Int32 nRow = GetRealRow(nRowId);
OUString strText(GetCellText(nRow, nColId));
return GetDataWindow().LogicToPixel(Size(GetDataWindow().GetTextWidth(strText),0)).Width();
}
@@ -2349,7 +2362,7 @@ sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRowId, sal_uInt16 nColId
bool OSelectionBrowseBox::isCutAllowed() const
{
bool bCutAllowed = false;
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_VIS_ROW:
@@ -2377,7 +2390,7 @@ bool OSelectionBrowseBox::isCutAllowed() const
void OSelectionBrowseBox::cut()
{
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_FIELD_ROW:
@@ -2400,7 +2413,7 @@ void OSelectionBrowseBox::cut()
void OSelectionBrowseBox::paste()
{
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_FIELD_ROW:
@@ -2423,7 +2436,7 @@ void OSelectionBrowseBox::paste()
bool OSelectionBrowseBox::isPasteAllowed() const
{
bool bPasteAllowed = true;
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_VIS_ROW:
@@ -2443,7 +2456,7 @@ bool OSelectionBrowseBox::isCopyAllowed() const
void OSelectionBrowseBox::copy()
{
- long nRow = GetRealRow(GetCurRow());
+ sal_Int32 nRow = GetRealRow(GetCurRow());
switch (nRow)
{
case BROW_FIELD_ROW:
@@ -2461,7 +2474,7 @@ void OSelectionBrowseBox::copy()
}
}
-void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue, const OUString& _rNewValue, sal_Int32 _nRow, bool& _bListAction)
+void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue, std::u16string_view _rNewValue, sal_Int32 _nRow, bool& _bListAction)
{
if ( !m_bInUndoMode && _rNewValue != _rOldValue )
{
@@ -2474,7 +2487,7 @@ void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue, const OUS
}
}
-void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue,const OUString& _rNewValue,sal_Int32 _nRow)
+void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue,std::u16string_view _rNewValue,sal_Int32 _nRow)
{
if ( !m_bInUndoMode && _rNewValue != _rOldValue )
{
@@ -2523,7 +2536,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);
@@ -2589,12 +2602,12 @@ OUString OSelectionBrowseBox::GetRowDescription( sal_Int32 _nRow ) const
return aLabel.getToken(nToken, ';');
}
-OUString OSelectionBrowseBox::GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType _eObjType,sal_Int32 _nPosition) const
+OUString OSelectionBrowseBox::GetAccessibleObjectName( AccessibleBrowseBoxObjType _eObjType,sal_Int32 _nPosition) const
{
OUString sRetText;
switch( _eObjType )
{
- case ::vcl::BBTYPE_ROWHEADERCELL:
+ case AccessibleBrowseBoxObjType::RowHeaderCell:
sRetText = GetRowDescription(_nPosition);
break;
default:
@@ -2679,10 +2692,11 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry)
}
}
-Reference< XAccessible > OSelectionBrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible>
+OSelectionBrowseBox::CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos)
{
OTableFieldDescRef pEntry;
- if(getFields().size() > o3tl::make_unsigned(_nColumnPos - 1))
+ if ( _nColumnPos != 0 && _nColumnPos != BROWSER_INVALIDID && _nColumnPos <= getFields().size() )
pEntry = getFields()[_nColumnPos - 1];
if ( _nRow == BROW_VIS_ROW && pEntry.is() )
@@ -2691,7 +2705,7 @@ Reference< XAccessible > OSelectionBrowseBox::CreateAccessibleCell( sal_Int32 _n
return EditBrowseBox::CreateAccessibleCell( _nRow, _nColumnPos );
}
-bool OSelectionBrowseBox::HasFieldByAliasName(const OUString& rFieldName, OTableFieldDescRef const & rInfo) const
+bool OSelectionBrowseBox::HasFieldByAliasName(std::u16string_view rFieldName, OTableFieldDescRef const & rInfo) const
{
for (auto const& field : getFields())
{
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index 325554b6f0bc..a799ca65e171 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -16,8 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_SELECTIONBROWSEBOX_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_SELECTIONBROWSEBOX_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
#include <svtools/editbrowsebox.hxx>
#include <TableFieldDescription.hxx>
@@ -53,7 +56,7 @@ namespace dbaui
std::vector<bool> m_bVisibleRow; // at pos we find the RowId
Timer m_timerInvalidate;
- long m_nSeekRow;
+ sal_Int32 m_nSeekRow;
BrowserMode m_nMode; // remember the BrowseModes
VclPtr< ::svt::EditControl> m_pTextCell;
VclPtr< ::svt::CheckBoxControl> m_pVisibleCell;
@@ -87,7 +90,7 @@ namespace dbaui
void RemoveColumn( sal_uInt16 _nColumnId );
void DeleteFields( const OUString& rAliasName );
- bool HasFieldByAliasName(const OUString& rFieldName, OTableFieldDescRef const & rInfo) const;
+ bool HasFieldByAliasName(std::u16string_view rFieldName, OTableFieldDescRef const & rInfo) const;
// AddGroupBy:: inserts a field with function == grouping. If the fields already exists and uses an aggregate function,
// the flag is not set
@@ -105,14 +108,14 @@ namespace dbaui
OQueryDesignView* getDesignView() const;
sal_uInt16 FieldsCount();
- void SetColWidth(sal_uInt16 nColId, long lNewWidth);
+ void SetColWidth(sal_uInt16 nColId, tools::Long lNewWidth);
// unlike SetColumnWidth of the base class it checks an active cell in this column
OUString GetCellContents(sal_Int32 nCellIndex, sal_uInt16 nColId);
void SetCellContents(sal_Int32 nCellIndex, sal_uInt16 nColId, const OUString& strNewText);
// cell content (formatted as string) set/return
sal_Int32 GetNoneVisibleRows() const;
- void SetNoneVisbleRow(long nRows);
+ void SetNoneVisibleRow(sal_Int32 nRows);
bool IsRowVisible(sal_uInt16 _nWhich) const;
void SetRowVisible(sal_uInt16 _nWhich, bool _bVis);
@@ -151,7 +154,7 @@ namespace dbaui
@return
the text out of the cell
*/
- virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const override;
+ virtual OUString GetCellText(sal_Int32 _nRow, sal_uInt16 _nColId) const override;
/** returns the description of the row.
@param _nRow
@@ -169,17 +172,18 @@ namespace dbaui
@return
The name of the specified object.
*/
- virtual OUString GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+ virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
// IAccessibleTableProvider
/** Creates the accessible object of a data table cell.
@param nRow The row index of the cell.
@param nColumnId The column ID of the cell.
- @return The XAccessible interface of the specified cell. */
- virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+ @return The accessible object of the specified cell. */
+ virtual rtl::Reference<comphelper::OAccessible>
+ CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override;
private:
- virtual bool SeekRow( long nRow ) override;
+ virtual bool SeekRow( sal_Int32 nRow ) override;
virtual void PaintStatusCell(OutputDevice& rDev, const tools::Rectangle& rRect) const override;
virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect,
@@ -192,14 +196,14 @@ namespace dbaui
virtual void KeyInput( const KeyEvent& rEvt ) override;
virtual void Command(const CommandEvent& rEvt) override;
- virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) override;
- virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol) override;
+ virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override;
+ virtual void InitController(::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol) override;
virtual void CellModified() override;
virtual bool SaveModified() override;
virtual void Init() override;
virtual void ColumnResized( sal_uInt16 nColId ) override;
- virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) override;
+ virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
// if you want to have an own header ...
virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
@@ -217,14 +221,14 @@ namespace dbaui
void RemoveField( sal_uInt16 nId );
tools::Rectangle GetInvalidRect( sal_uInt16 nColId );
- long GetRealRow(long nRow) const;
- long GetBrowseRow(long nRowId) const;
+ sal_Int32 GetRealRow(sal_Int32 nRow) const;
+ sal_Int32 GetBrowseRow(sal_Int32 nRowId) const;
bool GetFunctionName(sal_uInt32 _nFunctionTokenId, OUString& rFkt);
- void appendUndoAction(const OUString& _rOldValue,const OUString& _rNewValue,sal_Int32 _nRow, bool& _bListAction);
- void appendUndoAction(const OUString& _rOldValue,const OUString& _rNewValue,sal_Int32 _nRow);
+ void appendUndoAction(const OUString& _rOldValue,std::u16string_view _rNewValue,sal_Int32 _nRow, bool& _bListAction);
+ 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);
@@ -269,7 +273,7 @@ namespace dbaui
OTableFieldDescRef const & _pEntry,
bool& _bListAction);
bool fillColumnRef( const OUString& _sColumnName,
- const OUString& _sTableRange,
+ std::u16string_view _sTableRange,
const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData,
OTableFieldDescRef const & _pEntry,
bool& _bListAction);
@@ -282,7 +286,7 @@ namespace dbaui
@param _bListAction
Will be set to <TRUE/> when we are in a list action otherwise <FALSE/>
*/
- void notifyTableFieldChanged(const OUString& _sOldAlias,const OUString& _sAlias, bool& _bListAction,sal_uInt16 _nColumnId);
+ void notifyTableFieldChanged(const OUString& _sOldAlias,std::u16string_view _sAlias, bool& _bListAction,sal_uInt16 _nColumnId);
/** append an undo action for the function field
@param _sOldFunctionName
@@ -292,7 +296,7 @@ namespace dbaui
@param _bListAction
Will be set to <TRUE/> when we are in a list action otherwise <FALSE/>
*/
- void notifyFunctionFieldChanged(const OUString& _sOldFunctionName,const OUString& _sFunctionName, bool& _bListAction,sal_uInt16 _nColumnId);
+ void notifyFunctionFieldChanged(const OUString& _sOldFunctionName,std::u16string_view _sFunctionName, bool& _bListAction,sal_uInt16 _nColumnId);
/** clears the function fields of the submitted entry if it doesn't match the SQL standard and append an undo action.
E.q. AGGREGATE functions are only valid when the field name isn't an asterisk
@@ -303,7 +307,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
@@ -317,6 +321,5 @@ namespace dbaui
using ::svt::EditBrowseBox::MouseButtonUp;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_SELECTIONBROWSEBOX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 95476cafd51e..61052d01c1da 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -20,11 +20,8 @@
#include <TableFieldDescription.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/sdbc/DataType.hpp>
#include <comphelper/namedvaluecollection.hxx>
-#include <vcl/window.hxx>
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace comphelper;
@@ -132,23 +129,23 @@ void OTableFieldDesc::Load( const css::beans::PropertyValue& i_rSettings, const
{
::comphelper::NamedValueCollection aFieldDesc( i_rSettings.Value );
- m_aAliasName = aFieldDesc.getOrDefault( "AliasName", m_aAliasName );
- m_aTableName = aFieldDesc.getOrDefault( "TableName", m_aTableName );
- m_aFieldName = aFieldDesc.getOrDefault( "FieldName", m_aFieldName );
- m_aFieldAlias = aFieldDesc.getOrDefault( "FieldAlias", m_aFieldAlias );
- m_aFunctionName = aFieldDesc.getOrDefault( "FunctionName", m_aFunctionName );
- m_eDataType = aFieldDesc.getOrDefault( "DataType", m_eDataType );
- m_eFunctionType = aFieldDesc.getOrDefault( "FunctionType", m_eFunctionType );
- m_nColWidth = aFieldDesc.getOrDefault( "ColWidth", m_nColWidth );
- m_bGroupBy = aFieldDesc.getOrDefault( "GroupBy", m_bGroupBy );
- m_bVisible = aFieldDesc.getOrDefault( "Visible", m_bVisible );
-
- m_eFieldType = static_cast< ETableFieldType >( aFieldDesc.getOrDefault( "FieldType", static_cast< sal_Int32 >( m_eFieldType ) ) );
- m_eOrderDir = static_cast< EOrderDir >( aFieldDesc.getOrDefault( "OrderDir", static_cast< sal_Int32 >( m_eOrderDir ) ) );
+ m_aAliasName = aFieldDesc.getOrDefault( u"AliasName"_ustr, m_aAliasName );
+ m_aTableName = aFieldDesc.getOrDefault( u"TableName"_ustr, m_aTableName );
+ m_aFieldName = aFieldDesc.getOrDefault( u"FieldName"_ustr, m_aFieldName );
+ m_aFieldAlias = aFieldDesc.getOrDefault( u"FieldAlias"_ustr, m_aFieldAlias );
+ m_aFunctionName = aFieldDesc.getOrDefault( u"FunctionName"_ustr, m_aFunctionName );
+ m_eDataType = aFieldDesc.getOrDefault( u"DataType"_ustr, m_eDataType );
+ m_eFunctionType = aFieldDesc.getOrDefault( u"FunctionType"_ustr, m_eFunctionType );
+ m_nColWidth = aFieldDesc.getOrDefault( u"ColWidth"_ustr, m_nColWidth );
+ m_bGroupBy = aFieldDesc.getOrDefault( u"GroupBy"_ustr, m_bGroupBy );
+ m_bVisible = aFieldDesc.getOrDefault( u"Visible"_ustr, m_bVisible );
+
+ m_eFieldType = static_cast< ETableFieldType >( aFieldDesc.getOrDefault( u"FieldType"_ustr, static_cast< sal_Int32 >( m_eFieldType ) ) );
+ m_eOrderDir = static_cast< EOrderDir >( aFieldDesc.getOrDefault( u"OrderDir"_ustr, static_cast< sal_Int32 >( m_eOrderDir ) ) );
if ( i_bIncludingCriteria )
{
- const Sequence< PropertyValue > aCriteria( aFieldDesc.getOrDefault( "Criteria", Sequence< PropertyValue >() ) );
+ const Sequence< PropertyValue > aCriteria( aFieldDesc.getOrDefault( u"Criteria"_ustr, Sequence< PropertyValue >() ) );
m_aCriteria.resize( aCriteria.getLength() );
std::transform(
aCriteria.begin(),
@@ -162,18 +159,18 @@ void OTableFieldDesc::Load( const css::beans::PropertyValue& i_rSettings, const
void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings, const bool i_bIncludingCriteria )
{
- o_rSettings.put( "AliasName", m_aAliasName );
- o_rSettings.put( "TableName", m_aTableName );
- o_rSettings.put( "FieldName", m_aFieldName );
- o_rSettings.put( "FieldAlias", m_aFieldAlias );
- o_rSettings.put( "FunctionName", m_aFunctionName );
- o_rSettings.put( "DataType", m_eDataType );
- o_rSettings.put( "FunctionType", m_eFunctionType );
- o_rSettings.put( "FieldType", static_cast<sal_Int32>(m_eFieldType) );
- o_rSettings.put( "OrderDir", static_cast<sal_Int32>(m_eOrderDir) );
- o_rSettings.put( "ColWidth", m_nColWidth );
- o_rSettings.put( "GroupBy", m_bGroupBy );
- o_rSettings.put( "Visible", m_bVisible );
+ o_rSettings.put( u"AliasName"_ustr, m_aAliasName );
+ o_rSettings.put( u"TableName"_ustr, m_aTableName );
+ o_rSettings.put( u"FieldName"_ustr, m_aFieldName );
+ o_rSettings.put( u"FieldAlias"_ustr, m_aFieldAlias );
+ o_rSettings.put( u"FunctionName"_ustr, m_aFunctionName );
+ o_rSettings.put( u"DataType"_ustr, m_eDataType );
+ o_rSettings.put( u"FunctionType"_ustr, m_eFunctionType );
+ o_rSettings.put( u"FieldType"_ustr, static_cast<sal_Int32>(m_eFieldType) );
+ o_rSettings.put( u"OrderDir"_ustr, static_cast<sal_Int32>(m_eOrderDir) );
+ o_rSettings.put( u"ColWidth"_ustr, m_nColWidth );
+ o_rSettings.put( u"GroupBy"_ustr, m_bGroupBy );
+ o_rSettings.put( u"Visible"_ustr, m_bVisible );
if ( !i_bIncludingCriteria )
return;
@@ -183,14 +180,15 @@ void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings, con
sal_Int32 c = 0;
Sequence< PropertyValue > aCriteria( m_aCriteria.size() );
+ auto pCriteria = aCriteria.getArray();
for (auto const& criteria : m_aCriteria)
{
- aCriteria[c].Name = "Criterion_" + OUString::number( c );
- aCriteria[c].Value <<= criteria;
+ pCriteria[c].Name = "Criterion_" + OUString::number( c );
+ pCriteria[c].Value <<= criteria;
++c;
}
- o_rSettings.put( "Criteria", aCriteria );
+ o_rSettings.put( u"Criteria"_ustr, aCriteria );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/TableFieldInfo.cxx b/dbaccess/source/ui/querydesign/TableFieldInfo.cxx
index 15c60b83352d..808862c11c4e 100644
--- a/dbaccess/source/ui/querydesign/TableFieldInfo.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldInfo.cxx
@@ -21,12 +21,9 @@
using namespace dbaui;
-OTableFieldInfo::OTableFieldInfo() :
- m_eFieldType(TAB_NORMAL_FIELD), m_eDataType(1000)
-{
-}
-
-OTableFieldInfo::~OTableFieldInfo()
+OTableFieldInfo::OTableFieldInfo()
+ : m_eFieldType(TAB_NORMAL_FIELD)
+ , m_eDataType(1000)
{
}
diff --git a/dbaccess/source/ui/querydesign/TableFieldInfo.hxx b/dbaccess/source/ui/querydesign/TableFieldInfo.hxx
index 7d0e83b4c0e4..e7d2c9b72da4 100644
--- a/dbaccess/source/ui/querydesign/TableFieldInfo.hxx
+++ b/dbaccess/source/ui/querydesign/TableFieldInfo.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_TABLEFIELDINFO_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_TABLEFIELDINFO_HXX
+#pragma once
#include <QEnumTypes.hxx>
#include <sal/types.h>
@@ -32,7 +31,6 @@ namespace dbaui
public:
OTableFieldInfo();
- ~OTableFieldInfo();
ETableFieldType GetKeyType() const { return m_eFieldType; }
void SetKey(ETableFieldType bKey) { m_eFieldType = bKey; }
@@ -40,7 +38,6 @@ namespace dbaui
void SetDataType(sal_Int32 eTyp) { m_eDataType = eTyp; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_TABLEFIELDINFO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index d32ba27b90ca..8fd3ef1b8d2e 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -25,12 +25,15 @@
#include <JoinTableView.hxx>
#include <JoinDesignView.hxx>
#include <osl/diagnose.h>
+#include <utility>
#include <vcl/svapp.hxx>
-#include <vcl/wall.hxx>
#include <vcl/settings.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
#include <vcl/ptrstyle.hxx>
+#include <vcl/wall.hxx>
+#include <vcl/weldutils.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -39,19 +42,13 @@
#include <bitmaps.hlst>
#include <TableWindowAccess.hxx>
#include <connectivity/dbtools.hxx>
-#include <vcl/treelistentry.hxx>
-#include <vcl/builder.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,17 +83,15 @@ void Draw3DBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR
}
-OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData )
- : ::comphelper::OContainerListener(m_aMutex)
- ,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
- ,m_aTypeImage( VclPtr<FixedImage>::Create(this) )
- ,m_xTitle( VclPtr<OTableWindowTitle>::Create(this) )
- ,m_pData( pTabWinData )
- ,m_nMoveCount(0)
- ,m_nMoveIncrement(1)
- ,m_nSizingFlags( SizingFlags::NONE )
+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(std::move( pTabWinData ))
+ , m_nMoveCount(0)
+ , m_nMoveIncrement(1)
+ , m_nSizingFlags( SizingFlags::NONE )
{
-
// Set position and size
if( GetData()->HasPosition() )
SetPosPixel( GetData()->GetPosition() );
@@ -123,13 +118,12 @@ void OTableWindow::dispose()
{
if (m_xListBox)
{
- OSL_ENSURE(m_xListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
+ OSL_ENSURE(m_xListBox->get_widget().n_children()==0,"Forgot to call EmptyListbox()!");
}
m_xListBox.disposeAndClear();
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
- m_aTypeImage.disposeAndClear();
m_xTitle.disposeAndClear();
vcl::Window::dispose();
}
@@ -179,7 +173,10 @@ void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
void OTableWindow::FillListBox()
{
- m_xListBox->Clear();
+ clearListBox();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ assert(!rTreeView.n_children());
+
if ( !m_pContainerListener.is() )
{
Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY);
@@ -188,12 +185,11 @@ void OTableWindow::FillListBox()
}
// mark all primary keys with special image
- Image aPrimKeyImage(StockImage::Yes, BMP_PRIMARY_KEY);
+ OUString aPrimKeyImage(BMP_PRIMARY_KEY);
if (GetData()->IsShowAll())
{
- SvTreeListEntry* pEntry = m_xListBox->InsertEntry( OUString("*") );
- pEntry->SetUserData( createUserData(nullptr,false) );
+ rTreeView.append(weld::toId(createUserData(nullptr,false)), u"*"_ustr);
}
Reference<XNameAccess> xPKeyColumns;
@@ -203,36 +199,34 @@ void OTableWindow::FillListBox()
}
catch(Exception&)
{
- OSL_FAIL("Exception occurred!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "");
}
try
{
Reference< XNameAccess > xColumns = m_pData->getColumns();
if( xColumns.is() )
{
- Sequence< OUString> aColumns = xColumns->getElementNames();
- const OUString* pIter = aColumns.getConstArray();
- const OUString* pEnd = pIter + aColumns.getLength();
-
- SvTreeListEntry* pEntry = nullptr;
- for (; pIter != pEnd; ++pIter)
+ for (auto& column : xColumns->getElementNames())
{
- bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName( *pIter );
+ bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName(column);
+
+ OUString sId;
+ Reference<XPropertySet> xColumn(xColumns->getByName(column), UNO_QUERY);
+ if (xColumn.is())
+ sId = weld::toId(createUserData(xColumn, bPrimaryKeyColumn));
+
+ rTreeView.append(sId, column);
+
// is this column in the primary key
if ( bPrimaryKeyColumn )
- pEntry = m_xListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage);
- else
- pEntry = m_xListBox->InsertEntry(*pIter);
-
- Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
- if ( xColumn.is() )
- pEntry->SetUserData( createUserData(xColumn,bPrimaryKeyColumn) );
+ rTreeView.set_image(rTreeView.n_children() - 1, aPrimKeyImage);
}
+
}
}
catch(Exception&)
{
- OSL_FAIL("Exception occurred!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "");
}
}
@@ -252,33 +246,22 @@ void OTableWindow::clearListBox()
if ( !m_xListBox )
return;
- SvTreeListEntry* pEntry = m_xListBox->First();
-
- while(pEntry)
- {
- void* pUserData = pEntry->GetUserData();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ rTreeView.all_foreach([this, &rTreeView](weld::TreeIter& rEntry){
+ void* pUserData = weld::fromId<void*>(rTreeView.get_id(rEntry));
deleteUserData(pUserData);
- SvTreeListEntry* pNextEntry = m_xListBox->Next(pEntry);
- m_xListBox->GetModel()->Remove(pEntry);
- pEntry = pNextEntry;
- }
+ return false;
+ });
+
+ rTreeView.clear();
}
void OTableWindow::impl_updateImage()
{
+ weld::Image& rImage = m_xTitle->GetImage();
ImageProvider aImageProvider( getDesignView()->getController().getConnection() );
-
- Image aImage;
- aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage );
-
- if ( !aImage )
- {
- OSL_FAIL( "OTableWindow::impl_updateImage: no images!" );
- return;
- }
-
- m_aTypeImage->SetModeImage( aImage );
- m_aTypeImage->Show();
+ rImage.set_from_icon_name(aImageProvider.getImageId(GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE));
+ rImage.show();
}
bool OTableWindow::Init()
@@ -287,20 +270,21 @@ bool OTableWindow::Init()
if ( !m_xListBox )
{
m_xListBox = VclPtr<OTableWindowListBox>::Create(this);
- OSL_ENSURE( m_xListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" );
- m_xListBox->SetSelectionMode( SelectionMode::Multiple );
+ assert(m_xListBox && "OTableWindow::Init() : CreateListBox returned NULL !");
+ m_xListBox->get_widget().set_selection_mode(SelectionMode::Multiple);
}
// Set the title
- m_xTitle->SetText( m_pData->GetWinName() );
+ weld::Label& rLabel = m_xTitle->GetLabel();
+ rLabel.set_label(m_pData->GetWinName());
+ rLabel.set_tooltip_text(GetComposedName());
m_xTitle->Show();
m_xListBox->Show();
// add the fields to the ListBox
- clearListBox();
FillListBox();
- m_xListBox->SelectAll( false );
+ m_xListBox->get_widget().unselect_all();
impl_updateImage();
@@ -428,25 +412,20 @@ void OTableWindow::Resize()
Size aOutSize = GetOutputSizePixel();
aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height()));
- long nTitleHeight = CalcZoom( GetTextHeight() )+ CalcZoom( 4 );
+ tools::Long nTitleHeight = CalcZoom( GetTextHeight() )+ CalcZoom( 4 );
// Set the title and ListBox
- long n5Pos = CalcZoom(5);
- long nPositionX = n5Pos;
- long nPositionY = n5Pos;
-
- // position the image which indicates the type
- m_aTypeImage->SetPosPixel( Point( nPositionX, nPositionY ) );
- Size aImageSize( m_aTypeImage->GetImage().GetSizePixel() );
- m_aTypeImage->SetSizePixel( aImageSize );
+ tools::Long n5Pos = CalcZoom(5);
+ tools::Long nPositionX = n5Pos;
+ tools::Long nPositionY = n5Pos;
- if ( nTitleHeight < aImageSize.Height() )
- nTitleHeight = aImageSize.Height();
+ Size aPreferredSize = m_xTitle->get_preferred_size();
+ if (nTitleHeight < aPreferredSize.Height())
+ nTitleHeight = aPreferredSize.Height();
- nPositionX += aImageSize.Width() + CalcZoom( 2 );
m_xTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
- long nTitleToList = CalcZoom( 3 );
+ tools::Long nTitleToList = CalcZoom( 3 );
m_xListBox->SetPosSizePixel(
Point( n5Pos, nPositionY + nTitleHeight + nTitleToList ),
@@ -458,10 +437,10 @@ void OTableWindow::Resize()
void OTableWindow::SetBoldTitle( bool bBold )
{
- vcl::Font aFont = m_xTitle->GetFont();
- aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL );
- m_xTitle->SetFont( aFont );
- m_xTitle->Invalidate();
+ weld::Label& rLabel = m_xTitle->GetLabel();
+ vcl::Font aFont = rLabel.get_font();
+ aFont.SetWeight(bBold ? WEIGHT_BOLD : WEIGHT_NORMAL);
+ rLabel.set_font(aFont);
}
void OTableWindow::GetFocus()
@@ -475,8 +454,12 @@ void OTableWindow::GetFocus()
void OTableWindow::setActive(bool _bActive)
{
SetBoldTitle( _bActive );
- if (!_bActive && m_xListBox && m_xListBox->GetSelectionCount() != 0)
- m_xListBox->SelectAll(false);
+ if (_bActive || !m_xListBox)
+ return;
+
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ if (rTreeView.get_selected_index() != -1)
+ rTreeView.unselect_all();
}
void OTableWindow::Remove()
@@ -488,23 +471,6 @@ void OTableWindow::Remove()
pTabWinCont->Invalidate();
}
-bool OTableWindow::HandleKeyInput( const KeyEvent& rEvt )
-{
- const vcl::KeyCode& rCode = rEvt.GetKeyCode();
- sal_uInt16 nCode = rCode.GetCode();
- bool bShift = rCode.IsShift();
- bool bCtrl = rCode.IsMod1();
-
- bool bHandle = false;
-
- if( !bCtrl && !bShift && (nCode==KEY_DELETE) )
- {
- Remove();
- bHandle = true;
- }
- return bHandle;
-}
-
bool OTableWindow::ExistsAConn() const
{
return getTableView()->ExistsAConn(this);
@@ -513,17 +479,13 @@ bool OTableWindow::ExistsAConn() const
void OTableWindow::EnumValidFields(std::vector< OUString>& arrstrFields)
{
arrstrFields.clear();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+
// This default implementation counts every item in the ListBox ... for any other behaviour it must be over-written
- if ( m_xListBox )
- {
- arrstrFields.reserve(m_xListBox->GetEntryCount());
- SvTreeListEntry* pEntryLoop = m_xListBox->First();
- while (pEntryLoop)
- {
- arrstrFields.push_back(m_xListBox->GetEntryText(pEntryLoop));
- pEntryLoop = m_xListBox->Next(pEntryLoop);
- }
- }
+ rTreeView.all_foreach([&rTreeView, &arrstrFields](weld::TreeIter& rEntry){
+ arrstrFields.push_back(rTreeView.get_text(rEntry));
+ return false;
+ });
}
void OTableWindow::StateChanged( StateChangedType nType )
@@ -540,7 +502,7 @@ void OTableWindow::StateChanged( StateChangedType nType )
vcl::Font aFont = rStyleSettings.GetGroupFont();
if ( IsControlFont() )
aFont.Merge( GetControlFont() );
- SetZoomedPointFont(*this, aFont);
+ SetZoomedPointFont(*GetOutDev(), aFont);
m_xTitle->SetZoom(GetZoom());
m_xListBox->SetZoom(GetZoom());
@@ -548,7 +510,7 @@ void OTableWindow::StateChanged( StateChangedType nType )
Invalidate();
}
-Reference< XAccessible > OTableWindow::CreateAccessible()
+rtl::Reference<comphelper::OAccessible> OTableWindow::CreateAccessible()
{
return new OTableWindowAccess(this);
}
@@ -567,16 +529,19 @@ void OTableWindow::Command(const CommandEvent& rEvt)
ptWhere = rEvt.GetMousePosPixel();
else
{
- SvTreeListEntry* pCurrent = m_xListBox->GetCurEntry();
- if ( pCurrent )
- ptWhere = m_xListBox->GetEntryPosition(pCurrent);
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ std::unique_ptr<weld::TreeIter> xCurrent = rTreeView.make_iterator();
+ if (rTreeView.get_cursor(xCurrent.get()))
+ ptWhere = rTreeView.get_row_area(*xCurrent).Center();
else
ptWhere = m_xTitle->GetPosPixel();
}
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/jointablemenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- if (aContextMenu->Execute(this, ptWhere))
+ ::tools::Rectangle aRect(ptWhere, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/jointablemenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+ if (!xContextMenu->popup_at_rect(pPopupParent, aRect).isEmpty())
Remove();
}
break;
@@ -591,7 +556,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
bool bHandled = false;
switch (rNEvt.GetType())
{
- case MouseNotifyEvent::KEYINPUT:
+ case NotifyEventType::KEYINPUT:
{
if ( getDesignView()->getController().isReadOnly() )
break;
@@ -701,7 +666,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
}
break;
}
- case MouseNotifyEvent::KEYUP:
+ case NotifyEventType::KEYUP:
{
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
@@ -723,7 +688,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
OUString OTableWindow::getTitle() const
{
- return m_xTitle->GetText();
+ return m_xTitle->GetLabel().get_label();
}
void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ )
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index 3cd87ded7a61..c1932469d72c 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -24,18 +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)
,m_pTable(_pTable)
{
}
@@ -54,29 +53,19 @@ 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";
+ return u"org.openoffice.comp.dbu.TableWindowAccessibility"_ustr;
}
Sequence< OUString > SAL_CALL OTableWindowAccess::getSupportedServiceNames()
{
- return { "com.sun.star.accessibility.Accessible",
- "com.sun.star.accessibility.AccessibleContext" };
+ return { u"com.sun.star.accessibility.AccessibleContext"_ustr };
}
// 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;
@@ -85,11 +74,11 @@ 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;
- if (m_pTable && !m_pTable->IsDisposed())
+ rtl::Reference<comphelper::OAccessible> pRet;
+ if (m_pTable && !m_pTable->isDisposed())
{
switch(i)
{
@@ -97,26 +86,26 @@ namespace dbaui
{
VclPtr<OTableWindowTitle> xCtrl(m_pTable->GetTitleCtrl());
if (xCtrl)
- aRet = xCtrl->GetAccessible();
+ pRet = xCtrl->GetAccessible();
break;
}
case 1:
{
VclPtr<OTableWindowListBox> xCtrl(m_pTable->GetListBox());
if (xCtrl)
- aRet = xCtrl->GetAccessible();
+ pRet = xCtrl->GetAccessible();
break;
}
default:
throw IndexOutOfBoundsException();
}
}
- return aRet;
+ return pRet;
}
- 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
@@ -147,19 +136,19 @@ namespace dbaui
Reference< XAccessible > SAL_CALL OTableWindowAccess::getAccessibleAtPoint( const awt::Point& _aPoint )
{
::osl::MutexGuard aGuard( m_aMutex );
- Reference< XAccessible > aRet;
- if(m_pTable && !m_pTable->IsDisposed())
+ rtl::Reference<comphelper::OAccessible> pRet;
+ if(m_pTable && !m_pTable->isDisposed())
{
- Point aPoint(_aPoint.X,_aPoint.Y);
- tools::Rectangle aRect(m_pTable->GetDesktopRectPixel());
- if( aRect.IsInside(aPoint) )
- aRet = this;
- else if( m_pTable->GetListBox()->GetDesktopRectPixel().IsInside(aPoint))
- aRet = m_pTable->GetListBox()->GetAccessible();
+ AbsoluteScreenPixelPoint aPoint(_aPoint.X,_aPoint.Y);
+ AbsoluteScreenPixelRectangle aRect(m_pTable->GetDesktopRectPixel());
+ if( aRect.Contains(aPoint) )
+ pRet = this;
+ else if( m_pTable->GetListBox()->GetDesktopRectPixel().Contains(aPoint))
+ pRet = m_pTable->GetListBox()->GetAccessible();
}
- return aRet;
+ return pRet;
}
- Reference< XAccessible > OTableWindowAccess::getParentChild(sal_Int32 _nIndex)
+ Reference< XAccessible > OTableWindowAccess::getParentChild(sal_Int64 _nIndex)
{
Reference< XAccessible > xReturn;
Reference< XAccessible > xParent = getAccessibleParent();
@@ -190,41 +179,40 @@ namespace dbaui
{
OJoinTableView* pView = m_pTable->getTableView();
auto aIter = pView->getTableConnections(m_pTable) + nIndex;
- aRet.TargetSet.realloc(1);
- aRet.TargetSet[0] = getParentChild(aIter - pView->getTableConnections().begin());
- aRet.RelationType = AccessibleRelationType::CONTROLLER_FOR;
+ aRet.TargetSet = { getParentChild(aIter - pView->getTableConnections().begin()) };
+ aRet.RelationType = AccessibleRelationType_CONTROLLER_FOR;
}
return aRet;
}
- sal_Bool SAL_CALL OTableWindowAccess::containsRelation( sal_Int16 aRelationType )
+ sal_Bool SAL_CALL OTableWindowAccess::containsRelation(AccessibleRelationType eRelationType)
{
::osl::MutexGuard aGuard( m_aMutex );
- return AccessibleRelationType::CONTROLLER_FOR == aRelationType
+ return AccessibleRelationType_CONTROLLER_FOR == eRelationType
&& m_pTable && m_pTable->getTableView()->ExistsAConn(m_pTable);
}
- AccessibleRelation SAL_CALL OTableWindowAccess::getRelationByType( sal_Int16 aRelationType )
+ AccessibleRelation SAL_CALL OTableWindowAccess::getRelationByType(AccessibleRelationType eRelationType)
{
::osl::MutexGuard aGuard( m_aMutex );
- if( AccessibleRelationType::CONTROLLER_FOR == aRelationType && m_pTable)
+ if (AccessibleRelationType_CONTROLLER_FOR == eRelationType && m_pTable)
{
OJoinTableView* pView = m_pTable->getTableView();
const auto& rConnectionList = pView->getTableConnections();
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();
}
@@ -240,11 +228,6 @@ namespace dbaui
sAccessibleName = m_pTable->getTitle();
return sAccessibleName;
}
- Reference< XAccessibleContext > SAL_CALL OTableWindowAccess::getAccessibleContext( )
- {
- return this;
- }
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a4ba5f0022ae..0141b8ed89f4 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include <vcl/svapp.hxx>
#include <vcl/commandevent.hxx>
-#include <vcl/event.hxx>
+#include <o3tl/string_view.hxx>
using namespace dbaui;
using namespace ::com::sun::star::sdbc;
@@ -37,41 +37,49 @@ using namespace ::com::sun::star::datatransfer;
OJoinExchangeData::OJoinExchangeData(OTableWindowListBox* pBox)
: pListBox(pBox)
- , pEntry(pBox->FirstSelected())
-{ }
-
-const sal_uLong SCROLLING_TIMESPAN = 500;
-const long LISTBOX_SCROLLING_AREA = 6;
-OTableWindowListBox::OTableWindowListBox( OTableWindow* pParent )
- :SvTreeListBox( pParent, WB_HASBUTTONS | WB_BORDER)
- ,m_aMousePos( Point(0,0) )
- ,m_pTabWin( pParent )
- ,m_nDropEvent(nullptr)
- ,m_nUiEvent(nullptr)
- ,m_bReallyScrolled( false )
+ , nEntry(pBox->get_widget().get_selected_index())
{
- m_aScrollTimer.SetTimeout( SCROLLING_TIMESPAN );
- SetDoubleClickHdl( LINK(this, OTableWindowListBox, OnDoubleClick) );
+}
- SetSelectionMode(SelectionMode::Single);
+OTableWindowListBox::OTableWindowListBox(OTableWindow* pParent)
+ : InterimItemWindow(pParent, u"dbaccess/ui/tablelistbox.ui"_ustr, u"TableListBox"_ustr)
+ , m_xTreeView(m_xBuilder->weld_tree_view(u"treeview"_ustr))
+ , m_xDragDropTargetHelper(new TableWindowListBoxHelper(*this, m_xTreeView->get_drop_target()))
+ , m_pTabWin(pParent)
+ , m_nDropEvent(nullptr)
+ , m_nUiEvent(nullptr)
+{
+ m_xTreeView->connect_row_activated(LINK(this, OTableWindowListBox, OnDoubleClick));
+ m_xTreeView->connect_visible_range_changed(LINK(this, OTableWindowListBox, ScrollHdl));
+ m_xTreeView->connect_popup_menu(LINK(this, OTableWindowListBox, CommandHdl));
+
+ m_xHelper.set(new OJoinExchObj);
+ rtl::Reference<TransferDataContainer> xHelper(m_xHelper);
+ m_xTreeView->enable_drag_source(xHelper, DND_ACTION_LINK);
+ m_xTreeView->connect_drag_begin(LINK(this, OTableWindowListBox, DragBeginHdl));
+}
- SetHighlightRange( );
+IMPL_LINK(OTableWindowListBox, CommandHdl, const CommandEvent&, rCEvt, bool)
+{
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
+ return false;
+ m_pTabWin->Command(rCEvt);
+ return true;
}
-void OTableWindowListBox::dragFinished( )
+void OTableWindowListBox::dragFinished()
{
// first show the error msg when existing
- m_pTabWin->getDesignView()->getController().showError(m_pTabWin->getDesignView()->getController().clearOccurredError());
+ m_pTabWin->getDesignView()->getController().showError(
+ m_pTabWin->getDesignView()->getController().clearOccurredError());
// second look for ui activities which should happen after d&d
if (m_nUiEvent)
Application::RemoveUserEvent(m_nUiEvent);
- m_nUiEvent = Application::PostUserEvent(LINK(this, OTableWindowListBox, LookForUiHdl), nullptr, true);
+ m_nUiEvent
+ = Application::PostUserEvent(LINK(this, OTableWindowListBox, LookForUiHdl), nullptr, true);
}
-OTableWindowListBox::~OTableWindowListBox()
-{
- disposeOnce();
-}
+OTableWindowListBox::~OTableWindowListBox() { disposeOnce(); }
void OTableWindowListBox::dispose()
{
@@ -79,17 +87,15 @@ void OTableWindowListBox::dispose()
Application::RemoveUserEvent(m_nDropEvent);
if (m_nUiEvent)
Application::RemoveUserEvent(m_nUiEvent);
- if( m_aScrollTimer.IsActive() )
- m_aScrollTimer.Stop();
- m_pTabWin.clear();
- SvTreeListBox::dispose();
+ m_pTabWin.reset();
+ m_xDragDropTargetHelper.reset();
+ m_xTreeView.reset();
+ InterimItemWindow::dispose();
}
-SvTreeListEntry* OTableWindowListBox::GetEntryFromText( const OUString& rEntryText )
+int OTableWindowListBox::GetEntryFromText(std::u16string_view rEntryText)
{
// iterate through the list
- SvTreeList* pTreeList = GetModel();
- SvTreeListEntry* pEntry = pTreeList->First();
OJoinDesignView* pView = m_pTabWin->getDesignView();
OJoinController& rController = pView->getController();
@@ -97,258 +103,174 @@ SvTreeListEntry* OTableWindowListBox::GetEntryFromText( const OUString& rEntryTe
{
bool bCase = false;
const Reference<XConnection>& xConnection = rController.getConnection();
- if(xConnection.is())
+ if (xConnection.is())
{
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
- if(xMeta.is())
+ if (xMeta.is())
bCase = xMeta->supportsMixedCaseQuotedIdentifiers();
}
- while( pEntry )
+ for (int nEntry = 0, nCount = m_xTreeView->n_children(); nEntry < nCount; ++nEntry)
{
- if(bCase ? rEntryText == GetEntryText(pEntry) : rEntryText.equalsIgnoreAsciiCase(GetEntryText(pEntry)))
- {
- return pEntry;
- }
- pEntry = pTreeList->Next(pEntry);
+ if (bCase ? rEntryText == m_xTreeView->get_text(nEntry)
+ : o3tl::equalsIgnoreAsciiCase(rEntryText, m_xTreeView->get_text(nEntry)))
+ return nEntry;
}
}
- catch(SQLException&)
+ catch (SQLException&)
{
}
- return nullptr;
+ return -1;
}
-void OTableWindowListBox::NotifyScrolled()
+IMPL_LINK_NOARG(OTableWindowListBox, ScrollHdl, weld::TreeView&, void)
{
- m_bReallyScrolled = true;
-}
-
-void OTableWindowListBox::NotifyEndScroll()
-{
- if (m_bReallyScrolled)
- // connections of this table, if any, should be redrawn
- m_pTabWin->getTableView()->Invalidate(InvalidateFlags::NoChildren);
-
- // without InvalidateFlags::NoChildren all tables would be redrawn,
- // so: flickering
- m_bReallyScrolled = false;
+ // connections of this table, if any, should be redrawn
+ m_pTabWin->getTableView()->Invalidate(InvalidateFlags::NoChildren);
}
-bool OTableWindowListBox::PreNotify(NotifyEvent& rNEvt)
+IMPL_LINK(OTableWindowListBox, DragBeginHdl, bool&, rUnsetDragIcon, bool)
{
- bool bHandled = false;
- switch (rNEvt.GetType())
+ rUnsetDragIcon = false;
+ if (m_xTreeView->get_selected_index() == -1)
{
- case MouseNotifyEvent::KEYINPUT:
- {
- const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
- const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
-
- if (rCode.GetCode() != KEY_RETURN)
- {
- if(m_pTabWin)
- {
- bHandled = m_pTabWin->HandleKeyInput(*pKeyEvent);
- }
- break;
- }
-
- if (rCode.IsMod1() || rCode.IsMod2() || rCode.IsShift())
- break;
- if (FirstSelected())
- static_cast<OTableWindow*>(Window::GetParent())->OnEntryDoubleClicked(FirstSelected());
- break;
- }
- default:
- break;
+ // no drag without a field
+ return true;
}
- if (!bHandled)
- return SvTreeListBox::PreNotify(rNEvt);
- return true;
-}
-
-IMPL_LINK_NOARG( OTableWindowListBox, ScrollUpHdl, Timer*, void )
-{
- SvTreeListEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
- return;
-
- if( pEntry != Last() )
- {
- ScrollOutputArea( -1 );
- pEntry = GetEntry( m_aMousePos );
- Select( pEntry );
- }
-}
-
-IMPL_LINK_NOARG( OTableWindowListBox, ScrollDownHdl, Timer*, void )
-{
- SvTreeListEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
- return;
-
- if( pEntry != Last() )
- {
- ScrollOutputArea( 1 );
- pEntry = GetEntry( m_aMousePos );
- Select( pEntry );
- }
-}
-
-void OTableWindowListBox::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ )
-{
OJoinTableView* pCont = m_pTabWin->getTableView();
- if (!pCont->getDesignView()->getController().isReadOnly() && pCont->getDesignView()->getController().isConnected())
+ if (!pCont->getDesignView()->getController().isReadOnly()
+ && pCont->getDesignView()->getController().isConnected())
{
// asterisk was not allowed to be copied to selection browsebox
- bool bFirstNotAllowed = FirstSelected() == First() && m_pTabWin->GetData()->IsShowAll();
- EndSelection();
+ bool bFirstNotAllowed = m_xTreeView->is_selected(0) && m_pTabWin->GetData()->IsShowAll();
// create a description of the source
OJoinExchangeData jxdSource(this);
- // put it into an exchange object
- rtl::Reference<OJoinExchObj> pJoin = new OJoinExchObj(jxdSource,bFirstNotAllowed);
- pJoin->StartDrag(this, DND_ACTION_LINK, this);
+ // update the exchange object
+ m_xHelper->setDescriptors(jxdSource, bFirstNotAllowed);
+
+ return false;
}
+
+ return true;
}
-sal_Int8 OTableWindowListBox::AcceptDrop( const AcceptDropEvent& _rEvt )
+sal_Int8 OTableWindowListBox::AcceptDrop(const AcceptDropEvent& _rEvt)
{
+ // to enable the autoscroll when we're close to the edges
+ std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
+ bool bHasDestRow = m_xTreeView->get_dest_row_at_pos(_rEvt.maPosPixel, xEntry.get(), true);
+
sal_Int8 nDND_Action = DND_ACTION_NONE;
// check the format
- if ( !OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SotClipboardFormatId::SBA_TABID) // this means that the first entry is to be dragged
- && OJoinExchObj::isFormatAvailable(GetDataFlavorExVector()) )
- { // don't drop into the window if it's the drag source itself
+ if (!OJoinExchObj::isFormatAvailable(
+ m_xDragDropTargetHelper->GetDataFlavorExVector(),
+ SotClipboardFormatId::SBA_TABID) // this means that the first entry is to be dragged
+ && OJoinExchObj::isFormatAvailable(m_xDragDropTargetHelper->GetDataFlavorExVector()))
+ { // don't drop into the window if it's the drag source itself
// remove the selection if the dragging operation is leaving the window
if (_rEvt.mbLeaving)
- SelectAll(false);
+ m_xTreeView->unselect_all();
else
{
- // hit test
- m_aMousePos = _rEvt.maPosPixel;
- Size aOutputSize = GetOutputSizePixel();
- SvTreeListEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
+ if (!bHasDestRow)
return DND_ACTION_NONE;
- // Scrolling Areas
- tools::Rectangle aBottomScrollArea( Point(0, aOutputSize.Height()-LISTBOX_SCROLLING_AREA),
- Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
- tools::Rectangle aTopScrollArea( Point(0,0), Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
-
- // scroll up if the pointer is on the upper scroll area
- if( aBottomScrollArea.IsInside(m_aMousePos) )
- {
- if( !m_aScrollTimer.IsActive() )
- {
- m_aScrollTimer.SetInvokeHandler( LINK(this, OTableWindowListBox, ScrollUpHdl) );
- ScrollUpHdl( nullptr );
- }
- }
- // scroll down if the pointer is on the lower scroll area
- else if( aTopScrollArea.IsInside(m_aMousePos) )
- {
- if( !m_aScrollTimer.IsActive() )
- {
- m_aScrollTimer.SetInvokeHandler( LINK(this, OTableWindowListBox, ScrollDownHdl) );
- ScrollDownHdl( nullptr );
- }
- }
- else
- {
- if( m_aScrollTimer.IsActive() )
- m_aScrollTimer.Stop();
- }
-
// automatically select right entry when dragging
- if ((FirstSelected() != pEntry) || NextSelected(FirstSelected()))
- SelectAll(false);
- Select(pEntry);
+ m_xTreeView->unselect_all();
+ m_xTreeView->select(*xEntry);
// one cannot drop on the first (*) entry
- if(!( m_pTabWin->GetData()->IsShowAll() && (pEntry==First()) ))
+ if (!(m_pTabWin->GetData()->IsShowAll()
+ && (m_xTreeView->get_iter_index_in_parent(*xEntry) == 0)))
nDND_Action = DND_ACTION_LINK;
}
}
return nDND_Action;
}
-IMPL_LINK_NOARG( OTableWindowListBox, LookForUiHdl, void*, void )
+IMPL_LINK_NOARG(OTableWindowListBox, LookForUiHdl, void*, void)
{
m_nUiEvent = nullptr;
m_pTabWin->getTableView()->lookForUiActivities();
}
-IMPL_LINK_NOARG( OTableWindowListBox, DropHdl, void*, void )
+IMPL_LINK_NOARG(OTableWindowListBox, DropHdl, void*, void)
{
// create the connection
m_nDropEvent = nullptr;
- OSL_ENSURE(m_pTabWin,"No TableWindow!");
+ OSL_ENSURE(m_pTabWin, "No TableWindow!");
try
{
OJoinTableView* pCont = m_pTabWin->getTableView();
- OSL_ENSURE(pCont,"No QueryTableView!");
+ OSL_ENSURE(pCont, "No QueryTableView!");
pCont->AddConnection(m_aDropInfo.aSource, m_aDropInfo.aDest);
}
- catch(const SQLException& e)
+ catch (const SQLException& e)
{
// remember the exception so that we can show them later when d&d is finished
- m_pTabWin->getDesignView()->getController().setErrorOccurred(::dbtools::SQLExceptionInfo(e));
+ m_pTabWin->getDesignView()->getController().setErrorOccurred(
+ ::dbtools::SQLExceptionInfo(e));
}
}
-sal_Int8 OTableWindowListBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
+sal_Int8 OTableWindowListBox::ExecuteDrop(const ExecuteDropEvent& _rEvt)
{
TransferableDataHelper aDropped(_rEvt.maDropEvent.Transferable);
- if ( OJoinExchObj::isFormatAvailable(aDropped.GetDataFlavorExVector()))
- { // don't drop into the window if it's the drag source itself
+ if (OJoinExchObj::isFormatAvailable(aDropped.GetDataFlavorExVector()))
+ { // don't drop into the window if it's the drag source itself
m_aDropInfo.aSource = OJoinExchangeData(this);
- m_aDropInfo.aDest = OJoinExchObj::GetSourceDescription(_rEvt.maDropEvent.Transferable);
+ m_aDropInfo.aDest = OJoinExchObj::GetSourceDescription(_rEvt.maDropEvent.Transferable);
if (m_nDropEvent)
Application::RemoveUserEvent(m_nDropEvent);
- m_nDropEvent = Application::PostUserEvent(LINK(this, OTableWindowListBox, DropHdl), nullptr, true);
+ m_nDropEvent
+ = Application::PostUserEvent(LINK(this, OTableWindowListBox, DropHdl), nullptr, true);
+
+ dragFinished();
- return DND_ACTION_LINK;
+ return DND_ACTION_NONE;
}
return DND_ACTION_NONE;
}
void OTableWindowListBox::LoseFocus()
{
- if(m_pTabWin)
+ if (m_pTabWin)
m_pTabWin->setActive(false);
- SvTreeListBox::LoseFocus();
+ InterimItemWindow::LoseFocus();
}
void OTableWindowListBox::GetFocus()
{
- if(m_pTabWin)
+ if (m_pTabWin)
m_pTabWin->setActive();
- if (GetCurEntry() != nullptr)
+ if (m_xTreeView)
{
- if ( GetSelectionCount() == 0 || GetCurEntry() != FirstSelected() )
+ std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->make_iterator();
+ if (m_xTreeView->get_cursor(xCurrent.get()))
{
- if ( FirstSelected() )
- Select(FirstSelected(), false);
- Select(GetCurEntry());
+ m_xTreeView->unselect_all();
+ m_xTreeView->select(*xCurrent);
}
- else
- ShowFocusRect(FirstSelected());
}
- SvTreeListBox::GetFocus();
+
+ InterimItemWindow::GetFocus();
}
-IMPL_LINK_NOARG( OTableWindowListBox, OnDoubleClick, SvTreeListBox *, bool )
+IMPL_LINK_NOARG(OTableWindowListBox, OnDoubleClick, weld::TreeView&, bool)
{
// tell my parent
vcl::Window* pParent = Window::GetParent();
OSL_ENSURE(pParent != nullptr, "OTableWindowListBox::OnDoubleClick : have no Parent !");
- static_cast<OTableWindow*>(pParent)->OnEntryDoubleClicked(GetHdlEntry());
+ std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->make_iterator();
+ if (!m_xTreeView->get_cursor(xCurrent.get()))
+ return false;
+
+ static_cast<OTableWindow*>(pParent)->OnEntryDoubleClicked(*xCurrent);
return false;
}
@@ -363,7 +285,7 @@ void OTableWindowListBox::Command(const CommandEvent& rEvt)
break;
}
default:
- SvTreeListBox::Command(rEvt);
+ InterimItemWindow::Command(rEvt);
}
}
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 952063d5d3cc..90f2c615dcba 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -19,9 +19,6 @@
#include <TableWindowTitle.hxx>
#include <TableWindow.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/help.hxx>
-#include <vcl/settings.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
#include <TableWindowListBox.hxx>
@@ -29,20 +26,13 @@
#include <JoinController.hxx>
using namespace dbaui;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::uno;
-OTableWindowTitle::OTableWindowTitle( OTableWindow* pParent ) :
- FixedText( pParent, WB_3DLOOK|WB_LEFT|WB_NOLABEL|WB_VCENTER )
- ,m_pTabWin( pParent )
+OTableWindowTitle::OTableWindowTitle(OTableWindow* pParent)
+ : InterimItemWindow(pParent, u"dbaccess/ui/tabletitle.ui"_ustr, u"TableTitle"_ustr)
+ , m_pTabWin( pParent )
+ , m_xLabel(m_xBuilder->weld_label(u"label"_ustr))
+ , m_xImage(m_xBuilder->weld_image(u"image"_ustr))
{
- // set background- and text colour
- StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
- SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
- SetTextColor(aSystemStyle.GetButtonTextColor());
-
- vcl::Font aFont( GetFont() );
- aFont.SetTransparent( true );
- SetFont( aFont );
+ m_xLabel->connect_mouse_press(LINK(this, OTableWindowTitle, MousePressHdl));
}
OTableWindowTitle::~OTableWindowTitle()
@@ -52,88 +42,29 @@ OTableWindowTitle::~OTableWindowTitle()
void OTableWindowTitle::dispose()
{
- m_pTabWin.clear();
- FixedText::dispose();
-}
-
-void OTableWindowTitle::GetFocus()
-{
- if(m_pTabWin)
- m_pTabWin->GetFocus();
- else
- FixedText::GetFocus();
-}
-
-void OTableWindowTitle::LoseFocus()
-{
- if (m_pTabWin)
- m_pTabWin->LoseFocus();
- else
- FixedText::LoseFocus();
-}
-
-void OTableWindowTitle::RequestHelp( const HelpEvent& rHEvt )
-{
- if(!m_pTabWin)
- return;
-
- OUString aHelpText = m_pTabWin->GetComposedName();
- if( aHelpText.isEmpty())
- return;
-
- // show help
- tools::Rectangle aItemRect(Point(0,0),GetSizePixel());
- aItemRect = LogicToPixel( aItemRect );
- Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
- aItemRect.SetLeft( aPt.X() );
- aItemRect.SetTop( aPt.Y() );
- aPt = OutputToScreenPixel( aItemRect.BottomRight() );
- aItemRect.SetRight( aPt.X() );
- aItemRect.SetBottom( aPt.Y() );
- if( rHEvt.GetMode() == HelpEventMode::BALLOON )
- Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText);
- else
- Help::ShowQuickHelp( this, aItemRect, aHelpText );
-}
-
-void OTableWindowTitle::Command( const CommandEvent& rEvt )
-{
- if ( rEvt.GetCommand() == CommandEventId::ContextMenu )
- {
- GrabFocus();
- if ( m_pTabWin )
- {
- // tdf#94709 - protect shutdown code-path.
- VclPtr<OTableWindow> xTabWin(m_pTabWin);
- xTabWin->Command( rEvt );
- }
- else
- Control::Command(rEvt);
- }
-}
-
-void OTableWindowTitle::KeyInput( const KeyEvent& rEvt )
-{
- if ( m_pTabWin )
- m_pTabWin->KeyInput( rEvt );
+ m_xImage.reset();
+ m_xLabel.reset();
+ m_pTabWin.reset();
+ InterimItemWindow::dispose();
}
-void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt )
+IMPL_LINK(OTableWindowTitle, MousePressHdl, const MouseEvent&, rEvt, bool)
{
- if( rEvt.IsLeft() )
+ if (rEvt.IsLeft())
{
if( rEvt.GetClicks() == 2)
{
Size aSize(GetTextWidth(GetText()) + 20,
m_pTabWin->GetSizePixel().Height() - m_pTabWin->GetListBox()->GetSizePixel().Height());
- aSize.AdjustHeight((m_pTabWin->GetListBox()->GetEntryCount() + 2) * m_pTabWin->GetListBox()->GetEntryHeight() );
- if(m_pTabWin->GetSizePixel() != aSize)
+ weld::TreeView& rTreeView = m_pTabWin->GetListBox()->get_widget();
+ aSize.AdjustHeight(rTreeView.get_height_rows(rTreeView.n_children() + 2));
+ if (m_pTabWin->GetSizePixel() != aSize)
{
m_pTabWin->SetSizePixel(aSize);
OJoinTableView* pView = m_pTabWin->getTableView();
- OSL_ENSURE(pView,"No OJoinTableView!");
+ assert(pView && "No OJoinTableView!");
for (auto& conn : pView->getTableConnections())
conn->RecalcLines();
@@ -150,38 +81,15 @@ void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt )
OSL_ENSURE(pView,"No OJoinTableView!");
pView->NotifyTitleClicked( static_cast<OTableWindow*>(GetParent()), aPos );
}
- GrabFocus();
}
- else
- Control::MouseButtonDown( rEvt );
-}
-
-void OTableWindowTitle::DataChanged(const DataChangedEvent& rDCEvt)
-{
- if (rDCEvt.GetType() == DataChangedEventType::SETTINGS)
+ else if (rEvt.IsRight())
{
- // assume worst-case: colours have changed, therefore I have to adept
- StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
- SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
- SetTextColor(aSystemStyle.GetButtonTextColor());
- }
-}
-
-void OTableWindowTitle::StateChanged( StateChangedType nType )
-{
- Window::StateChanged( nType );
-
- if ( nType == StateChangedType::Zoom )
- {
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- vcl::Font aFont = rStyleSettings.GetGroupFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont(*this, aFont);
-
- Resize();
+ CommandEvent aCEvt(rEvt.GetPosPixel(), CommandEventId::ContextMenu, true);
+ // tdf#94709 - protect shutdown code-path.
+ VclPtr<OTableWindow> xTabWin(m_pTabWin);
+ xTabWin->Command(aCEvt);
}
+ return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index 74d01b71134c..ac61359cd67c 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -8,20 +8,18 @@
*/
#include "limitboxcontroller.hxx"
-#include <apitools.hxx>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <comphelper/propertyvalue.hxx>
#include <vcl/InterimItemWindow.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <comphelper/processfactory.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
@@ -53,10 +51,12 @@ class LimitBox final : public InterimItemWindow
{
public:
LimitBox(vcl::Window* pParent, LimitBoxController* pCtrl)
- : InterimItemWindow(pParent, "dbaccess/ui/limitbox.ui", "LimitBox")
+ : InterimItemWindow(pParent, u"dbaccess/ui/limitbox.ui"_ustr, u"LimitBox"_ustr)
, m_pControl( pCtrl )
- , m_xWidget(m_xBuilder->weld_combo_box("limit"))
+ , m_xWidget(m_xBuilder->weld_combo_box(u"limit"_ustr))
{
+ InitControlBase(m_xWidget.get());
+
LoadDefaultLimits();
m_xWidget->connect_key_press(LINK(this, LimitBox, KeyInputHdl));
@@ -83,13 +83,6 @@ public:
m_xWidget->set_sensitive(bSensitive);
}
- virtual void GetFocus() override
- {
- if (m_xWidget)
- m_xWidget->grab_focus();
- InterimItemWindow::GetFocus();
- }
-
void set_value(int nLimit)
{
if (nLimit < 0)
@@ -112,8 +105,6 @@ private:
{
if (!m_xWidget->get_value_changed_from_saved())
return;
- uno::Sequence< beans::PropertyValue > aArgs( 1 );
- aArgs[0].Name = "DBLimit.Value";
sal_Int64 nLimit;
OUString sActiveText = m_xWidget->get_active_text();
if (sActiveText == DBA_RES(STR_QUERY_LIMIT_ALL))
@@ -125,8 +116,7 @@ private:
nLimit = -1;
}
set_value(nLimit);
- aArgs[0].Value <<= nLimit;
- m_pControl->dispatchCommand( aArgs );
+ m_pControl->dispatchCommand({ comphelper::makePropertyValue(u"DBLimit.Value"_ustr, nLimit) });
}
///Initialize entries
@@ -183,7 +173,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 )
@@ -194,38 +184,25 @@ 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() throw ()
-{
- ToolboxController::acquire();
-}
-
-void SAL_CALL LimitBoxController::release() throw ()
-{
- ToolboxController::release();
-}
-
-
/// XServiceInfo
OUString SAL_CALL LimitBoxController::getImplementationName()
{
- return "org.libreoffice.comp.dbu.LimitBoxController";
+ return u"org.libreoffice.comp.dbu.LimitBoxController"_ustr;
}
-IMPLEMENT_SERVICE_INFO_SUPPORTS(LimitBoxController)
+sal_Bool SAL_CALL LimitBoxController::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
css::uno::Sequence< OUString > SAL_CALL LimitBoxController::getSupportedServiceNames()
{
- return { "com.sun.star.frame.ToolbarController" };
+ return { u"com.sun.star.frame.ToolbarController"_ustr };
}
/// XComponent
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
index 9899c3bb7855..142280937235 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
@@ -7,14 +7,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_LIMITBOXCONTROLLER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_LIMITBOXCONTROLLER_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <connectivity/CommonTools.hxx>
#include <svtools/toolboxcontroller.hxx>
-#include <rtl/ustring.hxx>
#include <vcl/vclptr.hxx>
namespace dbaui
@@ -27,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() throw () override;
- virtual void SAL_CALL release() throw () override;
-
/// XServiceInfo
DECLARE_SERVICE_INFO();
@@ -65,6 +57,4 @@ class LimitBoxController: public svt::ToolboxController,
} ///dbaui namespace
-#endif /// INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_LIMITBOXCONTROLLER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
index 9481f6518cf5..b755dc886aef 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;
@@ -65,7 +64,7 @@ namespace dbaui
}
if ( m_pBeamer )
::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- m_pBeamer.clear();
+ m_pBeamer.reset();
if ( m_xBeamer.is() )
{
Reference< css::util::XCloseable > xCloseable(m_xBeamer,UNO_QUERY);
@@ -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);
@@ -184,7 +183,7 @@ namespace dbaui
Reference < XPropertySet > xLMPropSet(m_xBeamer->getLayoutManager(), UNO_QUERY);
if ( xLMPropSet.is() )
{
- xLMPropSet->setPropertyValue( "AutomaticToolbars", Any( false ));
+ xLMPropSet->setPropertyValue( u"AutomaticToolbars"_ustr, Any( false ));
}
}
catch( Exception& )
@@ -201,7 +200,7 @@ namespace dbaui
Size aSize = GetOutputSizePixel();
Size aBeamer(aSize.Width(),sal_Int32(aSize.Height()*0.33));
- const long nFrameHeight = LogicToPixel(Size(0, 3), MapMode(MapUnit::MapAppFont)).Height();
+ const tools::Long nFrameHeight = LogicToPixel(Size(0, 3), MapMode(MapUnit::MapAppFont)).Height();
Point aPos(0,aBeamer.Height()+nFrameHeight);
m_pBeamer->SetPosSizePixel(Point(0,0),aBeamer);
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 17c8f1933354..981ff5f458a2 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -30,7 +30,6 @@
#include <QueryDesignView.hxx>
#include <QueryTableView.hxx>
#include <sqlmessage.hxx>
-#include <TableConnectionData.hxx>
#include <TableFieldDescription.hxx>
#include <UITools.hxx>
#include <QueryPropertiesDialog.hxx>
@@ -49,13 +48,11 @@
#include <com/sun/star/sdbcx/XDrop.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/util/VetoException.hpp>
#include <com/sun/star/ui/XUIElement.hpp>
#include <comphelper/propertysequence.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/property.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
@@ -63,12 +60,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>
@@ -93,11 +92,11 @@ namespace dbaui
{
virtual OUString SAL_CALL getImplementationName() override
{
- return "org.openoffice.comp.dbu.OViewDesign";
+ return u"org.openoffice.comp.dbu.OViewDesign"_ustr;
}
virtual Sequence< OUString> SAL_CALL getSupportedServiceNames() override
{
- return { "com.sun.star.sdb.ViewDesign" };
+ return { u"com.sun.star.sdb.ViewDesign"_ustr };
}
public:
@@ -120,7 +119,7 @@ namespace dbaui
namespace
{
- OUString lcl_getObjectResourceString(const char* pResId, sal_Int32 _nCommandType)
+ OUString lcl_getObjectResourceString(TranslateId pResId, sal_Int32 _nCommandType)
{
OUString sMessageText = DBA_RES(pResId);
OUString sObjectType = DBA_RES(RSC_QUERY_OBJECT_TYPE[_nCommandType]);
@@ -129,13 +128,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;
@@ -150,8 +147,8 @@ namespace
return;
xLayoutManager->lock();
- static const char s_sDesignToolbar[] = "private:resource/toolbar/designobjectbar";
- static const char s_sSqlToolbar[] = "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 );
@@ -174,7 +171,7 @@ namespace
void grabFocusFromLimitBox( OQueryController& _rController )
{
Reference< XLayoutManager > xLayoutManager = OGenericUnoController::getLayoutManager( _rController.getFrame() );
- Reference< XUIElement > xUIElement = xLayoutManager->getElement("private:resource/toolbar/designobjectbar");
+ Reference< XUIElement > xUIElement = xLayoutManager->getElement(u"private:resource/toolbar/designobjectbar"_ustr);
if (xUIElement.is())
{
Reference< XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
@@ -189,12 +186,12 @@ namespace
OUString SAL_CALL OQueryController::getImplementationName()
{
- return "org.openoffice.comp.dbu.OQueryDesign";
+ return u"org.openoffice.comp.dbu.OQueryDesign"_ustr;
}
Sequence< OUString> SAL_CALL OQueryController::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.QueryDesign" };
+ return { u"com.sun.star.sdb.QueryDesign"_ustr };
}
OQueryController::OQueryController(const Reference< XComponentContext >& _rM)
@@ -245,18 +242,18 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i
case PROPERTY_ID_CURRENT_QUERY_DESIGN:
{
::comphelper::NamedValueCollection aCurrentDesign;
- aCurrentDesign.put( "GraphicalDesign", isGraphicalDesign() );
- aCurrentDesign.put( OUString(PROPERTY_ESCAPE_PROCESSING), m_bEscapeProcessing );
+ aCurrentDesign.put( u"GraphicalDesign"_ustr, isGraphicalDesign() );
+ aCurrentDesign.put( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing );
if ( isGraphicalDesign() )
{
getContainer()->SaveUIConfig();
saveViewSettings( aCurrentDesign, true );
- aCurrentDesign.put( "Statement", m_sStatement );
+ aCurrentDesign.put( u"Statement"_ustr, m_sStatement );
}
else
{
- aCurrentDesign.put( "Statement", getContainer()->getStatement() );
+ aCurrentDesign.put( u"Statement"_ustr, getContainer()->getStatement() );
}
o_rValue <<= aCurrentDesign.getPropertyValues();
@@ -282,16 +279,17 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i
// one additional property:
const sal_Int32 nLength = aProps.getLength();
aProps.realloc( nLength + 1 );
- aProps[ nLength ] = Property(
- "CurrentQueryDesign",
+ auto pProps = aProps.getArray();
+ pProps[ nLength ] = Property(
+ u"CurrentQueryDesign"_ustr,
PROPERTY_ID_CURRENT_QUERY_DESIGN,
::cppu::UnoType< Sequence< PropertyValue > >::get(),
PropertyAttribute::READONLY
);
std::sort(
- aProps.begin(),
- aProps.end(),
+ pProps,
+ pProps + aProps.getLength(),
::comphelper::PropertyCompareByName()
);
@@ -463,7 +461,6 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
SQLExceptionInfo aError;
try
{
- OUString aErrorMsg;
setStatement_fireEvent( getContainer()->getStatement() );
if(m_sStatement.isEmpty() && m_pSqlIterator)
{
@@ -475,9 +472,11 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
}
else
{
+ OUString aErrorMsg;
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();
@@ -494,7 +493,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
aError = SQLException(
DBA_RES(STR_QRY_NOSELECT),
nullptr,
- "S1000",
+ u"S1000"_ustr,
1000,
Any()
);
@@ -517,7 +516,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
aError = SQLException(
DBA_RES(STR_QRY_SYNTAX),
nullptr,
- "S1000",
+ u"S1000"_ustr,
1000,
Any()
);
@@ -611,11 +610,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 );
}
@@ -635,7 +632,7 @@ void OQueryController::impl_setViewMode( ::dbtools::SQLExceptionInfo* _pErrorInf
// don't pass &aError here, this would overwrite the error which the first switchView call
// returned in this location.
if ( _pErrorInfo )
- *_pErrorInfo = aError;
+ *_pErrorInfo = std::move(aError);
else
showError( aError );
}
@@ -647,11 +644,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;
@@ -660,7 +655,7 @@ void OQueryController::impl_initialize()
// legacy parameters first (later overwritten by regular parameters)
OUString sIndependentSQLCommand;
- if ( rArguments.get_ensureType( "IndependentSQLCommand", sIndependentSQLCommand ) )
+ if ( rArguments.get_ensureType( u"IndependentSQLCommand"_ustr, sIndependentSQLCommand ) )
{
OSL_FAIL( "OQueryController::impl_initialize: IndependentSQLCommand is regognized for compatibility only!" );
sCommand = sIndependentSQLCommand;
@@ -668,7 +663,7 @@ void OQueryController::impl_initialize()
}
OUString sCurrentQuery;
- if ( rArguments.get_ensureType( "CurrentQuery", sCurrentQuery ) )
+ if ( rArguments.get_ensureType( u"CurrentQuery"_ustr, sCurrentQuery ) )
{
OSL_FAIL( "OQueryController::impl_initialize: CurrentQuery is regognized for compatibility only!" );
sCommand = sCurrentQuery;
@@ -676,7 +671,7 @@ void OQueryController::impl_initialize()
}
bool bCreateView( false );
- if ( rArguments.get_ensureType( "CreateView", bCreateView ) && bCreateView )
+ if ( rArguments.get_ensureType( u"CreateView"_ustr, bCreateView ) && bCreateView )
{
OSL_FAIL( "OQueryController::impl_initialize: CurrentQuery is regognized for compatibility only!" );
m_nCommandType = CommandType::TABLE;
@@ -692,8 +687,6 @@ void OQueryController::impl_initialize()
switch ( m_nCommandType )
{
case CommandType::QUERY:
- m_sName = sCommand;
- break;
case CommandType::TABLE:
m_sName = sCommand;
break;
@@ -730,24 +723,24 @@ void OQueryController::impl_initialize()
// initial design
bool bForceInitialDesign = false;
Sequence< PropertyValue > aCurrentQueryDesignProps;
- aCurrentQueryDesignProps = rArguments.getOrDefault( "CurrentQueryDesign", aCurrentQueryDesignProps );
+ aCurrentQueryDesignProps = rArguments.getOrDefault( u"CurrentQueryDesign"_ustr, aCurrentQueryDesignProps );
if ( aCurrentQueryDesignProps.hasElements() )
{
::comphelper::NamedValueCollection aCurrentQueryDesign( aCurrentQueryDesignProps );
- if ( aCurrentQueryDesign.has( OUString(PROPERTY_GRAPHICAL_DESIGN) ) )
+ if ( aCurrentQueryDesign.has( PROPERTY_GRAPHICAL_DESIGN ) )
{
aCurrentQueryDesign.get_ensureType( PROPERTY_GRAPHICAL_DESIGN, m_bGraphicalDesign );
}
- if ( aCurrentQueryDesign.has( OUString(PROPERTY_ESCAPE_PROCESSING) ) )
+ if ( aCurrentQueryDesign.has( PROPERTY_ESCAPE_PROCESSING ) )
{
aCurrentQueryDesign.get_ensureType( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing );
}
- if ( aCurrentQueryDesign.has( "Statement" ) )
+ if ( aCurrentQueryDesign.has( u"Statement"_ustr ) )
{
OUString sStatement;
- aCurrentQueryDesign.get_ensureType( "Statement", sStatement );
- aCurrentQueryDesign.remove( "Statement" );
+ aCurrentQueryDesign.get_ensureType( u"Statement"_ustr, sStatement );
+ aCurrentQueryDesign.remove( u"Statement"_ustr );
setStatement_fireEvent( sStatement );
}
@@ -874,7 +867,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;
@@ -922,23 +915,23 @@ OJoinDesignView* OQueryController::getJoinView()
void OQueryController::describeSupportedFeatures()
{
OJoinController::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:SbaNativeSql", ID_BROWSER_ESCAPEPROCESSING,CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:DBViewFunctions", SID_QUERY_VIEW_FUNCTIONS, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBViewTableNames", SID_QUERY_VIEW_TABLES, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBViewAliases", SID_QUERY_VIEW_ALIASES, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBDistinctValues", SID_QUERY_DISTINCT_VALUES, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:DBChangeDesignMode",ID_BROWSER_SQL, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBClearQuery", SID_BROWSER_CLEAR_QUERY, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:SbaExecuteSql", ID_BROWSER_QUERY_EXECUTE, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBAddRelation", SID_RELATION_ADD_RELATION, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBQueryPreview", SID_DB_QUERY_PREVIEW, CommandGroup::VIEW );
- implDescribeSupportedFeature( ".uno:DBLimit", SID_QUERY_LIMIT, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:DBQueryPropertiesDialog", SID_QUERY_PROP_DLG, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( u".uno:SaveAs"_ustr, ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:SbaNativeSql"_ustr, ID_BROWSER_ESCAPEPROCESSING,CommandGroup::FORMAT );
+ implDescribeSupportedFeature( u".uno:DBViewFunctions"_ustr, SID_QUERY_VIEW_FUNCTIONS, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBViewTableNames"_ustr, SID_QUERY_VIEW_TABLES, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBViewAliases"_ustr, SID_QUERY_VIEW_ALIASES, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBDistinctValues"_ustr, SID_QUERY_DISTINCT_VALUES, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( u".uno:DBChangeDesignMode"_ustr,ID_BROWSER_SQL, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBClearQuery"_ustr, SID_BROWSER_CLEAR_QUERY, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:SbaExecuteSql"_ustr, ID_BROWSER_QUERY_EXECUTE, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBAddRelation"_ustr, SID_RELATION_ADD_RELATION, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBQueryPreview"_ustr, SID_DB_QUERY_PREVIEW, CommandGroup::VIEW );
+ implDescribeSupportedFeature( u".uno:DBLimit"_ustr, SID_QUERY_LIMIT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( u".uno:DBQueryPropertiesDialog"_ustr, SID_QUERY_PROP_DLG, CommandGroup::FORMAT );
#if OSL_DEBUG_LEVEL > 0
- implDescribeSupportedFeature( ".uno:DBShowParseTree", ID_EDIT_QUERY_SQL );
- implDescribeSupportedFeature( ".uno:DBMakeDisjunct", ID_EDIT_QUERY_DESIGN );
+ implDescribeSupportedFeature( u".uno:DBShowParseTree"_ustr, ID_EDIT_QUERY_SQL );
+ implDescribeSupportedFeature( u".uno:DBMakeDisjunct"_ustr, ID_EDIT_QUERY_DESIGN );
#endif
}
@@ -1013,18 +1006,18 @@ void OQueryController::saveViewSettings( ::comphelper::NamedValueCollection& o_r
++i;
}
- o_rViewSettings.put( "Fields", aAllFieldsData.getPropertyValues() );
- o_rViewSettings.put( "SplitterPosition", m_nSplitPos );
- o_rViewSettings.put( "VisibleRows", m_nVisibleRows );
+ o_rViewSettings.put( u"Fields"_ustr, aAllFieldsData.getPropertyValues() );
+ o_rViewSettings.put( u"SplitterPosition"_ustr, m_nSplitPos );
+ o_rViewSettings.put( u"VisibleRows"_ustr, m_nVisibleRows );
}
void OQueryController::loadViewSettings( const ::comphelper::NamedValueCollection& o_rViewSettings )
{
loadTableWindows( o_rViewSettings );
- m_nSplitPos = o_rViewSettings.getOrDefault( "SplitterPosition", m_nSplitPos );
- m_nVisibleRows = o_rViewSettings.getOrDefault( "VisibleRows", m_nVisibleRows );
- m_aFieldInformation = o_rViewSettings.getOrDefault( "Fields", m_aFieldInformation );
+ m_nSplitPos = o_rViewSettings.getOrDefault( u"SplitterPosition"_ustr, m_nSplitPos );
+ m_nVisibleRows = o_rViewSettings.getOrDefault( u"VisibleRows"_ustr, m_nVisibleRows );
+ m_aFieldInformation = o_rViewSettings.getOrDefault( u"Fields"_ustr, m_aFieldInformation );
}
void OQueryController::execute_QueryPropDlg()
@@ -1114,15 +1107,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 +1255,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 +1280,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 +1308,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 +1373,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) {}
};
}
@@ -1550,7 +1543,7 @@ OUString OQueryController::translateStatement( bool _bFireStatementChange )
}
else if(m_sStatement.isEmpty())
{
- showError(SQLException(DBA_RES(STR_QRY_NOSELECT), nullptr, "S1000", 1000, Any()));
+ showError(SQLException(DBA_RES(STR_QRY_NOSELECT), nullptr, u"S1000"_ustr, 1000, Any()));
}
else
sTranslatedStmt = m_sStatement;
@@ -1680,7 +1673,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;
}
@@ -1711,7 +1704,7 @@ void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings
setQueryComposer();
OSL_ENSURE(m_pSqlIterator,"No SQLIterator set!");
- getContainer()->setNoneVisbleRow(m_nVisibleRows);
+ getContainer()->setNoneVisibleRow(m_nVisibleRows);
}
void OQueryController::reset()
@@ -1723,9 +1716,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 +1730,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 +1754,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 +1767,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 422eeb9354fc..5eb7bc96319f 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>
@@ -45,14 +45,14 @@ DlgQryJoin::DlgQryJoin(const OQueryTableView* pParent,
const OJoinTableView::OTableWindowMap* _pTableMap,
const Reference< XConnection >& _xConnection,
bool _bAllowTableSelect)
- : GenericDialogController(pParent->GetFrameWeld(), "dbaccess/ui/joindialog.ui", "JoinDialog")
+ : GenericDialogController(pParent->GetFrameWeld(), u"dbaccess/ui/joindialog.ui"_ustr, u"JoinDialog"_ustr)
, eJoinType(static_cast<OQueryTableConnectionData*>(_pData.get())->GetJoinType())
, m_pOrigConnData(_pData)
, m_xConnection(_xConnection)
- , m_xML_HelpText(m_xBuilder->weld_label("helptext"))
- , m_xPB_OK(m_xBuilder->weld_button("ok"))
- , m_xLB_JoinType(m_xBuilder->weld_combo_box("type"))
- , m_xCBNatural(m_xBuilder->weld_check_button("natural"))
+ , m_xML_HelpText(m_xBuilder->weld_label(u"helptext"_ustr))
+ , m_xPB_OK(m_xBuilder->weld_button(u"ok"_ustr))
+ , m_xLB_JoinType(m_xBuilder->weld_combo_box(u"type"_ustr))
+ , m_xCBNatural(m_xBuilder->weld_check_button(u"natural"_ustr))
{
Size aSize(m_xML_HelpText->get_approximate_digit_width() * 44,
m_xML_HelpText->get_text_height() * 6);
@@ -150,7 +150,7 @@ IMPL_LINK_NOARG( DlgQryJoin, LBChangeHdl, weld::ComboBox&, void )
OUString sFirstWinName = m_pConnData->getReferencingTable()->GetWinName();
OUString sSecondWinName = m_pConnData->getReferencedTable()->GetWinName();
const EJoinType eOldJoinType = eJoinType;
- const char* pResId = nullptr;
+ TranslateId pResId;
const sal_Int32 nPos = m_xLB_JoinType->get_active();
const sal_Int32 nJoinType = m_xLB_JoinType->get_id(nPos).toInt32();
bool bAddHint = true;
@@ -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;
@@ -188,7 +184,7 @@ IMPL_LINK_NOARG( DlgQryJoin, LBChangeHdl, weld::ComboBox&, void )
m_xTableControl->lateInit();
m_xCBNatural->set_active(false);
m_xTableControl->enableRelation(false);
- m_pConnData->AppendConnLine("","");
+ m_pConnData->AppendConnLine(u""_ustr,u""_ustr);
m_xPB_OK->set_sensitive(true);
}
break;
@@ -230,7 +226,7 @@ IMPL_LINK_NOARG(DlgQryJoin, OKClickHdl, weld::Button&, void)
m_xDialog->response(RET_OK);
}
-IMPL_LINK_NOARG(DlgQryJoin, NaturalToggleHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(DlgQryJoin, NaturalToggleHdl, weld::Toggleable&, void)
{
bool bChecked = m_xCBNatural->get_active();
static_cast<OQueryTableConnectionData*>(m_pConnData.get())->setNatural(bChecked);
@@ -242,13 +238,10 @@ IMPL_LINK_NOARG(DlgQryJoin, NaturalToggleHdl, weld::ToggleButton&, void)
try
{
Reference<XNameAccess> xReferencedTableColumns(m_pConnData->getReferencedTable()->getColumns());
- Sequence< OUString> aSeq = m_pConnData->getReferencingTable()->getColumns()->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& column : m_pConnData->getReferencingTable()->getColumns()->getElementNames())
{
- if ( xReferencedTableColumns->hasByName(*pIter) )
- m_pConnData->AppendConnLine(*pIter,*pIter);
+ if (xReferencedTableColumns->hasByName(column))
+ m_pConnData->AppendConnLine(column, column);
}
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/querydesign/querydlg.hxx b/dbaccess/source/ui/querydesign/querydlg.hxx
index 4631d7fbe29f..3da416c6e927 100644
--- a/dbaccess/source/ui/querydesign/querydlg.hxx
+++ b/dbaccess/source/ui/querydesign/querydlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDLG_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -47,7 +46,7 @@ namespace dbaui
DECL_LINK(OKClickHdl, weld::Button&, void);
DECL_LINK(LBChangeHdl, weld::ComboBox&, void);
- DECL_LINK(NaturalToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(NaturalToggleHdl, weld::Toggleable&, void);
/** setJoinType enables and set the new join type
@param _eNewJoinType the new jointype
@@ -73,7 +72,6 @@ namespace dbaui
virtual void notifyConnectionChange() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
index b4bc2cfe10ab..4b8086f5111f 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -51,13 +51,13 @@ void ORelationTableConnection::Draw(vcl::RenderContext& rRenderContext, const to
{
OTableConnection::Draw(rRenderContext, rRect);
ORelationTableConnectionData* pData = static_cast< ORelationTableConnectionData* >(GetData().get());
- if (pData && (pData->GetCardinality() == Cardinality::Undefined))
+ if (!pData || pData->GetCardinality() == Cardinality::Undefined)
return;
// search lines for top line
tools::Rectangle aBoundingRect;
- long nTop = GetBoundingRect().Bottom();
- long nTemp;
+ tools::Long nTop = GetBoundingRect().Bottom();
+ tools::Long nTemp;
const OConnectionLine* pTopLine = nullptr;
const std::vector<std::unique_ptr<OConnectionLine>>& rConnLineList = GetConnLineList();
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.hxx b/dbaccess/source/ui/relationdesign/RTableConnection.hxx
index dabdfe47d2a1..0448d494f467 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.hxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_RELATIONDESIGN_RTABLECONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_RELATIONDESIGN_RTABLECONNECTION_HXX
+#pragma once
#include <TableConnection.hxx>
@@ -37,6 +36,5 @@ namespace dbaui
using OTableConnection::Draw;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_RELATIONDESIGN_RTABLECONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index e9b87f28eca1..e936e9e16cdc 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -38,11 +38,9 @@ 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()
- :OTableConnectionData()
- ,m_nUpdateRules(KeyRule::NO_ACTION)
+ :m_nUpdateRules(KeyRule::NO_ACTION)
,m_nDeleteRules(KeyRule::NO_ACTION)
,m_nCardinality(Cardinality::Undefined)
{
@@ -77,7 +75,7 @@ void ORelationTableConnectionData::DropRelation()
::osl::MutexGuard aGuard( m_aMutex );
// delete relation
Reference< XIndexAccess> xKeys = getReferencingTable()->getKeys();
- if( !(!m_aConnName.isEmpty() && xKeys.is()) )
+ if( m_aConnName.isEmpty() || !xKeys.is() )
return;
const sal_Int32 nCount = xKeys->getCount();
@@ -113,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()
@@ -148,15 +144,13 @@ bool ORelationTableConnectionData::checkPrimaryKey(const Reference< XPropertySet
if ( xKeyColumns.is() )
{
Sequence< OUString> aKeyColumns = xKeyColumns->getElementNames();
- const OUString* pKeyIter = aKeyColumns.getConstArray();
- const OUString* pKeyEnd = pKeyIter + aKeyColumns.getLength();
- for(;pKeyIter != pKeyEnd;++pKeyIter)
+ for (auto& keyColumn : aKeyColumns)
{
for (auto const& elem : m_vConnLineData)
{
++nValidLinesCount;
- if ( elem->GetFieldName(_eEConnectionSide) == *pKeyIter )
+ if (elem->GetFieldName(_eEConnectionSide) == keyColumn)
{
++nPrimKeysCount;
break;
@@ -257,11 +251,12 @@ 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));
+ // get the full name of the tables to ensure uniqueness across catalogs and schema
+ xKey->setPropertyValue(PROPERTY_REFERENCEDTABLE,Any(getReferencedTable()->GetComposedName()));
+ xKey->setPropertyValue(PROPERTY_UPDATERULE, Any(GetUpdateRules()));
+ xKey->setPropertyValue(PROPERTY_DELETERULE, Any(GetDeleteRules()));
}
Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
@@ -279,8 +274,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);
}
}
@@ -304,35 +299,28 @@ bool ORelationTableConnectionData::Update()
{
OUString sReferencedTable;
xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
- if ( sReferencedTable == getReferencedTable()->GetTableName() )
+ if ( sReferencedTable == getReferencedTable()->GetComposedName() )
{
xColSup.set(xKey,UNO_QUERY_THROW);
try
{
Reference<XNameAccess> xColumns = xColSup->getColumns();
Sequence< OUString> aNames = xColumns->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
+ const OUString* pIter = aNames.begin();
+ const OUString* pEnd = aNames.end();
- Reference<XPropertySet> xColumn;
OUString sName,sRelatedColumn;
for ( ; pIter != pEnd ; ++pIter )
{
- xColumn.set(xColumns->getByName(*pIter),UNO_QUERY_THROW);
+ Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY_THROW);
xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn;
- bool bFoundElem = false;
- for (auto const& elem : m_vConnLineData)
- {
- if( elem->GetSourceFieldName() == sName
- && elem->GetDestFieldName() == sRelatedColumn )
- {
- bFoundElem = true;
- break;
- }
- }
- if (!bFoundElem)
+ if (std::none_of(m_vConnLineData.begin(), m_vConnLineData.end(),
+ [&sName, &sRelatedColumn](auto& elem) {
+ return elem->GetSourceFieldName() == sName
+ && elem->GetDestFieldName() == sRelatedColumn;
+ }))
break;
}
if ( pIter == pEnd )
@@ -365,16 +353,14 @@ bool ORelationTableConnectionData::Update()
OConnectionLineDataVec().swap(m_vConnLineData);
Reference<XNameAccess> xColumns = xColSup->getColumns();
Sequence< OUString> aNames = xColumns->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
m_vConnLineData.reserve( aNames.getLength() );
Reference<XPropertySet> xColumn;
OUString sName,sRelatedColumn;
- for(;pIter != pEnd;++pIter)
+ for (auto& colName : aNames)
{
- xColumns->getByName(*pIter) >>= xColumn;
+ xColumns->getByName(colName) >>= xColumn;
if ( xColumn.is() )
{
OConnectionLineDataRef pNewData = new OConnectionLineData();
diff --git a/dbaccess/source/ui/relationdesign/RTableWindow.hxx b/dbaccess/source/ui/relationdesign/RTableWindow.hxx
index 3b59a9d9d588..25b8d05a1bc2 100644
--- a/dbaccess/source/ui/relationdesign/RTableWindow.hxx
+++ b/dbaccess/source/ui/relationdesign/RTableWindow.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_RELATIONDESIGN_RTABLEWINDOW_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_RELATIONDESIGN_RTABLEWINDOW_HXX
+#pragma once
#include <TableWindow.hxx>
@@ -36,7 +35,6 @@ namespace dbaui
virtual OUString GetName() const override { return GetComposedName(); }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_RELATIONDESIGN_RTABLEWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index d6181459ca6f..9aea133bd04e 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -19,7 +19,6 @@
#include <sal/config.h>
-#include <iterator>
#include <map>
#include <strings.hrc>
@@ -30,13 +29,11 @@
#include <comphelper/types.hxx>
#include <core_resource.hxx>
#include <connectivity/dbtools.hxx>
-#include <comphelper/processfactory.hxx>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbcx/KeyType.hpp>
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbmetadata.hxx>
#include <sqlmessage.hxx>
@@ -46,7 +43,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>
@@ -60,16 +57,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;
@@ -77,12 +71,12 @@ using namespace ::osl;
OUString SAL_CALL ORelationController::getImplementationName()
{
- return "org.openoffice.comp.dbu.ORelationDesign";
+ return u"org.openoffice.comp.dbu.ORelationDesign"_ustr;
}
Sequence< OUString> SAL_CALL ORelationController::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.RelationDesign" };
+ return { u"com.sun.star.sdb.RelationDesign"_ustr };
}
ORelationController::ORelationController(const Reference< XComponentContext >& _rM)
@@ -140,7 +134,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);
}
}
@@ -161,9 +155,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
@@ -223,8 +217,8 @@ short ORelationController::saveModified()
short nSaved = RET_YES;
if(haveDataSource() && isModified())
{
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/designsavemodifieddialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DesignSaveModifiedDialog"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), u"dbaccess/ui/designsavemodifieddialog.ui"_ustr));
+ std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(u"DesignSaveModifiedDialog"_ustr));
nSaved = xQuery->run();
if(nSaved == RET_YES)
Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>());
@@ -235,7 +229,7 @@ short ORelationController::saveModified()
void ORelationController::describeSupportedFeatures()
{
OJoinController::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:DBAddRelation", SID_RELATION_ADD_RELATION, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:DBAddRelation"_ustr, SID_RELATION_ADD_RELATION, CommandGroup::EDIT );
}
namespace
@@ -259,7 +253,7 @@ namespace
,const Sequence< OUString>& _aTableList
,const sal_Int32 _nStartIndex
,const sal_Int32 _nEndIndex)
- :m_aTableData(_xMetaData.is() && _xMetaData->supportsMixedCaseQuotedIdentifiers())
+ :m_aTableData(comphelper::UStringMixLess(_xMetaData.is() && _xMetaData->supportsMixedCaseQuotedIdentifiers()))
,m_aTableList(_aTableList)
,m_pParent(_pParent)
,m_xMetaData(_xMetaData)
@@ -298,10 +292,15 @@ namespace
try
{
Reference< XResultSet > xResult = m_xMetaData->getImportedKeys(aCatalog, sSchema,sTable);
- if ( xResult.is() && xResult->next() )
+ if ( xResult.is() )
{
- ::comphelper::disposeComponent(xResult);
- loadTableData(m_xTables->getByName(m_aTableList[i]));
+ if ( xResult->next() )
+ loadTableData(m_xTables->getByName(m_aTableList[i]));
+ Reference<XCloseable> xCloseable(xResult,UNO_QUERY);
+ if (xCloseable.is())
+ xCloseable->close();
+ else
+ ::comphelper::disposeComponent(xResult);
}
}
catch( const Exception& )
@@ -494,7 +493,7 @@ void ORelationController::loadData()
}
}
-TTableWindowData::value_type ORelationController::existsTable(const OUString& _rComposedTableName) const
+TTableWindowData::value_type ORelationController::existsTable(std::u16string_view _rComposedTableName) const
{
::comphelper::UStringMixEqual bCase(true);
for (auto const& elem : m_vTableData)
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 a55222096368..909b5edef03b 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -26,8 +26,8 @@
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <connectivity/dbtools.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <helpids.h>
#include <RelationDesignView.hxx>
#include <JoinController.hxx>
@@ -50,7 +50,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;
@@ -73,7 +72,7 @@ void ORelationTableView::dispose()
{
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
- m_pExistingConnection.clear();
+ m_pExistingConnection.reset();
OJoinTableView::dispose();
}
@@ -98,7 +97,7 @@ void ORelationTableView::ReSync()
TTableWindowData::const_reverse_iterator aIter = rTabWinDataList.rbegin();
for(;aIter != rTabWinDataList.rend();++aIter)
{
- TTableWindowData::value_type pData = *aIter;
+ const TTableWindowData::value_type& pData = *aIter;
VclPtr<OTableWindow> pTabWin = createWindow(pData);
if (!pTabWin->Init())
@@ -107,9 +106,10 @@ void ORelationTableView::ReSync()
// it should be cleaned up, including its data in the document
pTabWin->clearListBox();
pTabWin.disposeAndClear();
- arrInvalidTables.push_back(pData->GetTableName());
+ // get the full name of the tables to ensure uniqueness across catalogs and schema
+ arrInvalidTables.push_back(pData->GetComposedName());
- rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
+ std::erase(rTabWinDataList, *aIter);
continue;
}
@@ -131,15 +131,15 @@ void ORelationTableView::ReSync()
if ( !arrInvalidTables.empty() )
{
// do the tables to the connection exist?
- OUString strTabExistenceTest = pTabConnData->getReferencingTable()->GetTableName();
+ OUString strTabExistenceTest = pTabConnData->getReferencingTable()->GetComposedName();
bool bInvalid = std::find(arrInvalidTables.begin(),arrInvalidTables.end(),strTabExistenceTest) != arrInvalidTables.end();
- strTabExistenceTest = pTabConnData->getReferencedTable()->GetTableName();
+ strTabExistenceTest = pTabConnData->getReferencedTable()->GetComposedName();
bInvalid = bInvalid || std::find(arrInvalidTables.begin(),arrInvalidTables.end(),strTabExistenceTest) != arrInvalidTables.end();
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;
}
}
@@ -178,8 +178,10 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
pDestWin->GetData());
// the names of the affected fields
- OUString sSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
- OUString sDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry);
+ weld::TreeView& rSourceTreeView = jxdSource.pListBox->get_widget();
+ OUString sSourceFieldName = rSourceTreeView.get_text(jxdSource.nEntry);
+ weld::TreeView& rDestTreeView = jxdDest.pListBox->get_widget();
+ OUString sDestFieldName = rDestTreeView.get_text(jxdDest.nEntry);
// the number of PKey-Fields in the source
const Reference< XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(pSourceWin->GetData()->getTable());
@@ -188,7 +190,7 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
pTabConnData->SetConnLine( 0, sSourceFieldName, sDestFieldName );
if ( bAskUser || m_pExistingConnection )
- m_pCurrentlyTabConnData = pTabConnData; // this implies that we ask the user what to do
+ m_pCurrentlyTabConnData = std::move(pTabConnData); // this implies that we ask the user what to do
else
{
try
@@ -206,7 +208,7 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
}
catch(const Exception&)
{
- OSL_FAIL("ORelationTableView::AddConnection: Exception occurred!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ORelationTableView::AddConnection");
}
}
}
@@ -267,7 +269,7 @@ bool ORelationTableView::RemoveConnection(VclPtr<OTableConnection>& rConn, bool
}
catch(Exception&)
{
- OSL_FAIL("ORelationTableView::RemoveConnection: Something other than SQLException occurred!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ORelationTableView::RemoveConnection: Something other than SQLException occurred!");
}
return false;
}
@@ -287,14 +289,15 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
}
// enter the new data structure into DocShell
- TTableWindowData::value_type pNewTabWinData(createTableWindowData( _rComposedName, rWinName,rWinName ));
+ // show the table's full name as window name to ensure uniqueness across catalogs and schema
+ TTableWindowData::value_type pNewTabWinData(createTableWindowData( _rComposedName, rWinName, _rComposedName ));
pNewTabWinData->ShowAll(false);
// link new window into the window list
VclPtr<OTableWindow> pNewTabWin = createWindow( pNewTabWinData );
if(pNewTabWin->Init())
{
- m_pView->getController().getTableWindowData().push_back( pNewTabWinData);
+ m_pView->getController().getTableWindowData().push_back(std::move(pNewTabWinData));
// when we already have a table with this name insert the full qualified one instead
GetTabWinMap()[_rComposedName] = pNewTabWin;
@@ -304,9 +307,9 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
modified();
if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- Any(),
- makeAny(pNewTabWin->GetAccessible()));
+ m_pAccessible->notifyAccessibleEvent(
+ AccessibleEventId::CHILD, Any(),
+ Any(css::uno::Reference<XAccessible>(pNewTabWin->GetAccessible())));
}
else
{
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
deleted file mode 100644
index 1a052c19007a..000000000000
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "FieldDescGenWin.hxx"
-#include <osl/diagnose.h>
-#include <helpids.h>
-#include <TableDesignHelpBar.hxx>
-#include "TableFieldControl.hxx"
-#include <TableDesignView.hxx>
-#include "TEditControl.hxx"
-
-using namespace dbaui;
-
-OFieldDescGenWin::OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelp ) :
- TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
-{
- m_pFieldControl = VclPtr<OTableFieldControl>::Create(this,pHelp);
- m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
- m_pFieldControl->Show();
-}
-
-OFieldDescGenWin::~OFieldDescGenWin()
-{
- disposeOnce();
-}
-
-void OFieldDescGenWin::dispose()
-{
- m_pFieldControl.disposeAndClear();
- TabPage::dispose();
-}
-
-void OFieldDescGenWin::Init()
-{
- OSL_ENSURE(GetEditorCtrl() != nullptr, "OFieldDescGenWin::Init : have no editor control !");
-
- m_pFieldControl->Init();
-}
-
-void OFieldDescGenWin::Resize()
-{
- m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
- m_pFieldControl->Resize();
-}
-
-void OFieldDescGenWin::SetReadOnly( bool bReadOnly )
-{
-
- m_pFieldControl->SetReadOnly(bReadOnly);
-}
-
-void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const OUString& rText )
-{
- // set texts of the controls
- m_pFieldControl->SetControlText(nControlId,rText);
-}
-
-void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr )
-{
- m_pFieldControl->DisplayData(pFieldDescr);
-}
-
-OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl()
-{
- OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent());
- return pDesignWin->GetEditorCtrl();
-}
-
-void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr )
-{
- m_pFieldControl->SaveData(pFieldDescr);
-}
-
-void OFieldDescGenWin::GetFocus()
-{
- // sets the focus to the control that was active last
- TabPage::GetFocus();
- if(m_pFieldControl)
- m_pFieldControl->GetFocus();
-
-}
-
-void OFieldDescGenWin::LoseFocus()
-{
- if (m_pFieldControl)
- m_pFieldControl->LoseFocus();
- TabPage::LoseFocus();
-}
-
-OUString OFieldDescGenWin::BoolStringPersistent(const OUString& rUIString) const
-{
- return m_pFieldControl->BoolStringPersistent(rUIString);
-}
-
-OUString OFieldDescGenWin::BoolStringUI(const OUString& rPersistentString) const
-{
- return m_pFieldControl->BoolStringUI(rPersistentString);
-}
-
-bool OFieldDescGenWin::isCopyAllowed()
-{
- return (m_pFieldControl && m_pFieldControl->isCutAllowed());
-}
-
-bool OFieldDescGenWin::isCutAllowed()
-{
- return (m_pFieldControl && m_pFieldControl->isCutAllowed());
-}
-
-bool OFieldDescGenWin::isPasteAllowed()
-{
- return (m_pFieldControl && m_pFieldControl->isPasteAllowed());
-}
-
-void OFieldDescGenWin::cut()
-{
- if(m_pFieldControl)
- m_pFieldControl->cut();
-}
-
-void OFieldDescGenWin::copy()
-{
- if(m_pFieldControl)
- m_pFieldControl->copy();
-}
-
-void OFieldDescGenWin::paste()
-{
- if(m_pFieldControl)
- m_pFieldControl->paste();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
deleted file mode 100644
index b43f8d1fa841..000000000000
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
-
-#include <vcl/tabpage.hxx>
-#include <IClipBoardTest.hxx>
-
-namespace dbaui
-{
- class OTableDesignHelpBar;
- class OFieldDescription;
- class OTableFieldControl;
- class OTableEditorCtrl;
- class OFieldDescGenWin : public TabPage
- ,public IClipboardTest
- {
-
- VclPtr<OTableFieldControl> m_pFieldControl;
- protected:
- virtual void Resize() override;
-
- public:
- OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar );
- virtual ~OFieldDescGenWin() override;
- virtual void dispose() override;
-
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
- void Init();
-
- void DisplayData( OFieldDescription* pFieldDescr );
- void SaveData( OFieldDescription* pFieldDescr );
- void SetControlText( sal_uInt16 nControlId, const OUString& rText );
- void SetReadOnly( bool bReadOnly );
- OTableEditorCtrl* GetEditorCtrl();
-
- // short GetFormatCategory(OFieldDescription* pFieldDescr);
- // gives you one of the CAT_xxx-values (CAT_NUMBER, CAT_DATE ...) belonging to the format specified by the field
-
- OUString BoolStringPersistent(const OUString& rUIString) const;
- OUString BoolStringUI(const OUString& rPersistentString) const;
-
- // IClipboardTest
- virtual bool isCutAllowed() override;
- virtual bool isCopyAllowed() override;
- virtual bool isPasteAllowed() override;
-
- virtual void copy() override;
- virtual void cut() override;
- virtual void paste() override;
-
- OTableFieldControl* getFieldControl() const { return m_pFieldControl; }
- };
-}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index ba04bfa22cb0..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>
@@ -38,8 +38,7 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
OFieldDescription::OFieldDescription()
- :m_pType()
- ,m_nType(DataType::VARCHAR)
+ :m_nType(DataType::VARCHAR)
,m_nPrecision(0)
,m_nScale(0)
,m_nIsNullable(ColumnValue::NULLABLE)
@@ -81,8 +80,7 @@ OFieldDescription::~OFieldDescription()
}
OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedCol,bool _bUseAsDest)
- :m_pType()
- ,m_nType(DataType::VARCHAR)
+ :m_nType(DataType::VARCHAR)
,m_nPrecision(0)
,m_nScale(0)
,m_nIsNullable(ColumnValue::NULLABLE)
@@ -189,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));
@@ -237,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;
}
@@ -252,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;
}
@@ -267,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;
}
@@ -310,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;
}
@@ -329,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;
}
@@ -344,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;
@@ -362,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;
}
@@ -377,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;
}
@@ -392,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;
}
@@ -407,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;
}
@@ -422,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::mapTextAllign(_rHorJustify)));
+ m_xDest->setPropertyValue(PROPERTY_ALIGN,Any( dbaui::mapTextAlign(_rHorJustify)));
else
m_eHorJustify = _rHorJustify;
}
@@ -437,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;
}
@@ -604,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;
}
@@ -622,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::mapTextAllign(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());
@@ -635,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 ee2cb2c1fdf2..062c0f5baa14 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -21,7 +21,6 @@
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <core_resource.hxx>
#include <strings.hrc>
@@ -36,8 +35,9 @@
#include <connectivity/dbtools.hxx>
#include <SqlNameEdit.hxx>
#include <TableRowExchange.hxx>
-#include <sot/storage.hxx>
-#include <svx/svxids.hrc>
+#include <o3tl/safeint.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <tools/stream.hxx>
#include <UITools.hxx>
#include "TableFieldControl.hxx"
#include <dsntypes.hxx>
@@ -48,14 +48,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
@@ -69,7 +65,8 @@ using namespace ::com::sun::star::sdb;
#define MAX_DESCR_LEN 256
OTableEditorCtrl::ClipboardInvalidator::ClipboardInvalidator(OTableEditorCtrl* _pOwner)
-: m_pOwner(_pOwner)
+: m_aInvalidateTimer("dbaccess ClipboardInvalidator")
+, m_pOwner(_pOwner)
{
m_aInvalidateTimer.SetTimeout(500);
@@ -123,8 +120,9 @@ void OTableEditorCtrl::Init()
RowInserted(0, m_pRowList->size());
}
-OTableEditorCtrl::OTableEditorCtrl(vcl::Window* pWindow)
+OTableEditorCtrl::OTableEditorCtrl(vcl::Window* pWindow, OTableDesignView* pView)
:OTableRowView(pWindow)
+ ,m_pView(pView)
,pNameCell(nullptr)
,pTypeCell(nullptr)
,pHelpTextCell(nullptr)
@@ -140,7 +138,6 @@ OTableEditorCtrl::OTableEditorCtrl(vcl::Window* pWindow)
,bReadOnly(true)
,m_aInvalidate(this)
{
-
SetHelpId(HID_TABDESIGN_BACKGROUND);
GetDataWindow().SetHelpId(HID_CTL_TABLEEDIT);
@@ -165,7 +162,7 @@ void OTableEditorCtrl::SetReadOnly( bool bRead )
bReadOnly = bRead;
// Disable active cells
- long nRow(GetCurRow());
+ sal_Int32 nRow(GetCurRow());
sal_uInt16 nCol(GetCurColumnId());
DeactivateCell();
@@ -183,7 +180,7 @@ void OTableEditorCtrl::SetReadOnly( bool bRead )
void OTableEditorCtrl::InitCellController()
{
// Cell Field name
- sal_Int32 nMaxTextLen = EDIT_NOLIMIT;
+ sal_Int32 nMaxTextLen = 0;
OUString sExtraNameChars;
Reference<XConnection> xCon;
try
@@ -191,10 +188,9 @@ void OTableEditorCtrl::InitCellController()
xCon = GetView()->getController().getConnection();
Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>();
+ // length 0 is treated by Entry::set_max_length as unlimited
nMaxTextLen = xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0;
- if( nMaxTextLen == 0 )
- nMaxTextLen = EDIT_NOLIMIT;
sExtraNameChars = xMetaData.is() ? xMetaData->getExtraNameCharacters() : OUString();
}
@@ -203,8 +199,8 @@ void OTableEditorCtrl::InitCellController()
OSL_FAIL("getMaxColumnNameLength");
}
- pNameCell = VclPtr<OSQLNameEdit>::Create(&GetDataWindow(), WB_LEFT, sExtraNameChars);
- pNameCell->SetMaxTextLen( nMaxTextLen );
+ pNameCell = VclPtr<OSQLNameEditControl>::Create(&GetDataWindow(), sExtraNameChars);
+ pNameCell->get_widget().set_max_length(nMaxTextLen);
pNameCell->setCheck( isSQL92CheckEnabled(xCon) );
// Cell type
@@ -237,7 +233,7 @@ void OTableEditorCtrl::InitCellController()
void OTableEditorCtrl::ClearModified()
{
- pNameCell->ClearModifyFlag();
+ pNameCell->get_widget().save_value();
pDescrCell->get_widget().save_value();
pHelpTextCell->get_widget().save_value();
pTypeCell->get_widget().save_value();
@@ -272,23 +268,24 @@ void OTableEditorCtrl::dispose()
pTypeCell.disposeAndClear();
pDescrCell.disposeAndClear();
pHelpTextCell.disposeAndClear();
- pDescrWin.clear();
+ pDescrWin = nullptr;
+ m_pView.reset();
OTableRowView::dispose();
}
-bool OTableEditorCtrl::SetDataPtr( long nRow )
+bool OTableEditorCtrl::SetDataPtr( sal_Int32 nRow )
{
if(nRow == -1)
return false;
- OSL_ENSURE(nRow < static_cast<long>(m_pRowList->size()),"Row is greater than size!");
- if(nRow >= static_cast<long>(m_pRowList->size()))
+ OSL_ENSURE(nRow < static_cast<tools::Long>(m_pRowList->size()),"Row is greater than size!");
+ if(nRow >= static_cast<tools::Long>(m_pRowList->size()))
return false;
pActRow = (*m_pRowList)[nRow];
return pActRow != nullptr;
}
-bool OTableEditorCtrl::SeekRow(long _nRow)
+bool OTableEditorCtrl::SeekRow(sal_Int32 _nRow)
{
// Call the Base class to remember which row must be repainted
EditBrowseBox::SeekRow(_nRow);
@@ -302,13 +299,12 @@ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const tools::Rectangle& rRe
{
const OUString aText( GetCellText( m_nCurrentPos, nColumnId ));
- rDev.Push( PushFlags::CLIPREGION );
+ auto popIt = rDev.ScopedPush(vcl::PushFlags::CLIPREGION);
rDev.SetClipRegion(vcl::Region(rRect));
rDev.DrawText( rRect, aText, DrawTextFlags::Left | DrawTextFlags::VCenter );
- rDev.Pop();
}
-CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId)
+CellController* OTableEditorCtrl::GetController(sal_Int32 nRow, sal_uInt16 nColumnId)
{
// If EditorCtrl is ReadOnly, editing is forbidden
Reference<XPropertySet> xTable = GetView()->getController().getTable();
@@ -346,7 +342,7 @@ CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId)
}
}
-void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16 nColumnId)
+void OTableEditorCtrl::InitController(CellControllerRef&, sal_Int32 nRow, sal_uInt16 nColumnId)
{
SeekRow( nRow == -1 ? GetCurRow() : nRow);
OFieldDescription* pActFieldDescr = pActRow->GetActFieldDescr();
@@ -355,11 +351,15 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16
switch (nColumnId)
{
case FIELD_NAME:
+ {
if( pActFieldDescr )
aInitString = pActFieldDescr->GetName();
- pNameCell->SetText( aInitString );
- pNameCell->SaveValue();
+
+ weld::Entry& rEntry = pNameCell->get_widget();
+ rEntry.set_text(aInitString);
+ rEntry.save_value();
break;
+ }
case FIELD_TYPE:
{
if ( pActFieldDescr && pActFieldDescr->getTypeInfo() )
@@ -399,7 +399,7 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16
}
}
-EditBrowseBox::RowStatus OTableEditorCtrl::GetRowStatus(long nRow) const
+EditBrowseBox::RowStatus OTableEditorCtrl::GetRowStatus(sal_Int32 nRow) const
{
const_cast<OTableEditorCtrl*>(this)->SetDataPtr( nRow );
if( !pActRow )
@@ -430,7 +430,7 @@ void OTableEditorCtrl::SaveCurRow()
pDescrWin->SaveData( pActRow->GetActFieldDescr() );
}
-void OTableEditorCtrl::DisplayData(long nRow)
+void OTableEditorCtrl::DisplayData(sal_Int32 nRow)
{
// go to the correct cell
SetDataPtr(nRow);
@@ -472,7 +472,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();
@@ -490,7 +490,7 @@ sal_Int32 OTableEditorCtrl::HasFieldName( const OUString& rFieldName )
return nCount;
}
-void OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
+void OTableEditorCtrl::SaveData(sal_Int32 nRow, sal_uInt16 nColId)
{
// Store the cell content
SetDataPtr( nRow == -1 ? GetCurRow() : nRow);
@@ -502,7 +502,8 @@ void OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
case FIELD_NAME:
{
// If there is no name, do nothing
- const OUString aName(pNameCell->GetText());
+ weld::Entry& rEntry = pNameCell->get_widget();
+ const OUString aName(rEntry.get_text());
if( aName.isEmpty() )
{
@@ -518,7 +519,7 @@ void OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
}
if(pActFieldDescr)
pActFieldDescr->SetName( aName );
- pNameCell->ClearModifyFlag();
+ rEntry.save_value();
break;
}
@@ -595,7 +596,7 @@ bool OTableEditorCtrl::SaveModified()
return true;
}
-bool OTableEditorCtrl::CursorMoving(long nNewRow, sal_uInt16 nNewCol)
+bool OTableEditorCtrl::CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol)
{
if (!EditBrowseBox::CursorMoving(nNewRow, nNewCol))
@@ -626,7 +627,7 @@ IMPL_LINK_NOARG( OTableEditorCtrl, InvalidateFieldType, void*, void )
Invalidate( GetFieldRectPixel(nOldDataPos, FIELD_TYPE) );
}
-void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
+void OTableEditorCtrl::CellModified( sal_Int32 nRow, sal_uInt16 nColId )
{
// If the description is null, use the default
@@ -716,7 +717,7 @@ void OTableEditorCtrl::CopyRows()
std::vector< std::shared_ptr<OTableRow> > vClipboardList;
vClipboardList.reserve(GetSelectRowCount());
- for( long nIndex=FirstSelectedRow(); nIndex != SFX_ENDOFSELECTION; nIndex=NextSelectedRow() )
+ for( tools::Long nIndex=FirstSelectedRow(); nIndex != SFX_ENDOFSELECTION; nIndex=NextSelectedRow() )
{
pRow = (*m_pRowList)[nIndex];
OSL_ENSURE(pRow,"OTableEditorCtrl::CopyRows: Row is NULL!");
@@ -728,7 +729,7 @@ void OTableEditorCtrl::CopyRows()
}
if(!vClipboardList.empty())
{
- rtl::Reference<OTableRowExchange> pData = new OTableRowExchange(vClipboardList);
+ rtl::Reference<OTableRowExchange> pData = new OTableRowExchange(std::move(vClipboardList));
pData->CopyToClipboard(GetParent());
}
}
@@ -759,7 +760,7 @@ OUString OTableEditorCtrl::GenerateName( const OUString& rName )
return aFieldName;
}
-void OTableEditorCtrl::InsertRows( long nRow )
+void OTableEditorCtrl::InsertRows( sal_Int32 nRow )
{
std::vector< std::shared_ptr<OTableRow> > vInsertedUndoRedoRows; // need for undo/redo handling
@@ -767,13 +768,12 @@ void OTableEditorCtrl::InsertRows( long nRow )
TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
if(aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED))
{
- ::tools::SvRef<SotStorageStream> 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();
- long nInsertRow = nRow;
+ sal_Int32 nInsertRow = nRow;
std::shared_ptr<OTableRow> pRow;
sal_Int32 nSize = 0;
(*aStreamRef).ReadInt32( nSize );
@@ -800,7 +800,7 @@ void OTableEditorCtrl::InsertRows( long nRow )
RowInserted( nRow,vInsertedUndoRedoRows.size() );
// Create the Undo-Action
- GetUndoManager().AddUndoAction( std::make_unique<OTableEditorInsUndoAct>(this, nRow,vInsertedUndoRedoRows) );
+ GetUndoManager().AddUndoAction( std::make_unique<OTableEditorInsUndoAct>(this, nRow, std::move(vInsertedUndoRedoRows)) );
GetView()->getController().setModified( true );
InvalidateFeatures();
}
@@ -812,7 +812,7 @@ void OTableEditorCtrl::DeleteRows()
GetUndoManager().AddUndoAction( std::make_unique<OTableEditorDelUndoAct>(this) );
// Delete all marked rows
- long nIndex = FirstSelectedRow();
+ tools::Long nIndex = FirstSelectedRow();
nOldDataPos = nIndex;
while( nIndex != SFX_ENDOFSELECTION )
@@ -839,16 +839,16 @@ void OTableEditorCtrl::DeleteRows()
InvalidateFeatures();
}
-void OTableEditorCtrl::InsertNewRows( long nRow )
+void OTableEditorCtrl::InsertNewRows( sal_Int32 nRow )
{
OSL_ENSURE(GetView()->getController().isAddAllowed(),"Call of InsertNewRows not valid here. Please check isAppendAllowed!");
// Create Undo-Action
- long nInsertRows = GetSelectRowCount();
+ sal_Int32 nInsertRows = GetSelectRowCount();
if( !nInsertRows )
nInsertRows = 1;
GetUndoManager().AddUndoAction( std::make_unique<OTableEditorInsNewUndoAct>(this, nRow, nInsertRows) );
// Insert the number of selected rows
- for( long i=nRow; i<(nRow+nInsertRows); i++ )
+ for( tools::Long i=nRow; i<(nRow+nInsertRows); i++ )
m_pRowList->insert( m_pRowList->begin()+i ,std::make_shared<OTableRow>());
RowInserted( nRow, nInsertRows );
@@ -856,7 +856,7 @@ void OTableEditorCtrl::InsertNewRows( long nRow )
InvalidateFeatures();
}
-void OTableEditorCtrl::SetControlText( long nRow, sal_uInt16 nColId, const OUString& rText )
+void OTableEditorCtrl::SetControlText( sal_Int32 nRow, sal_uInt16 nColId, const OUString& rText )
{
// Set the Browser Controls
if( nColId < FIELD_FIRST_VIRTUAL_COLUMN )
@@ -877,7 +877,7 @@ void OTableEditorCtrl::SetControlText( long nRow, sal_uInt16 nColId, const OUStr
}
}
-void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo )
+void OTableEditorCtrl::SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo )
{
// Relocate the current pointer
if( nRow == -1 )
@@ -898,7 +898,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const TOTypeIn
SetControlText(nRow,nColId,_pTypeInfo ? _pTypeInfo->aUIName : OUString());
}
-void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const css::uno::Any& _rNewData )
+void OTableEditorCtrl::SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const css::uno::Any& _rNewData )
{
// Relocate the current pointer
if( nRow == -1 )
@@ -927,7 +927,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const css::uno
case FIELD_PROPERTY_DEFAULT:
pFieldDescr->SetControlDefault( _rNewData );
- sValue = GetView()->GetDescWin()->getGenPage()->getFieldControl()->getControlDefault(pFieldDescr);
+ sValue = GetView()->GetDescWin()->getGenPage()->getControlDefault(pFieldDescr);
break;
case FIELD_PROPERTY_REQUIRED:
@@ -964,7 +964,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const css::uno
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:
@@ -978,7 +978,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const css::uno
SetControlText(nRow,nColId,sValue);
}
-Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId )
+Any OTableEditorCtrl::GetCellData( sal_Int32 nRow, sal_uInt16 nColId )
{
OFieldDescription* pFieldDescr = GetFieldDescr( nRow );
if( !pFieldDescr )
@@ -1044,22 +1044,22 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId )
break;
}
- return makeAny(sValue);
+ return Any(sValue);
}
-OUString OTableEditorCtrl::GetCellText( long nRow, sal_uInt16 nColId ) const
+OUString OTableEditorCtrl::GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const
{
OUString sCellText;
const_cast< OTableEditorCtrl* >( this )->GetCellData( nRow, nColId ) >>= sCellText;
return sCellText;
}
-sal_uInt32 OTableEditorCtrl::GetTotalCellWidth(long nRow, sal_uInt16 nColId)
+sal_uInt32 OTableEditorCtrl::GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId)
{
- return GetTextWidth(GetCellText(nRow, nColId)) + 2 * GetTextWidth("0");
+ return GetTextWidth(GetCellText(nRow, nColId)) + 2 * GetTextWidth(u"0"_ustr);
}
-OFieldDescription* OTableEditorCtrl::GetFieldDescr( long nRow )
+OFieldDescription* OTableEditorCtrl::GetFieldDescr( sal_Int32 nRow )
{
std::vector< std::shared_ptr<OTableRow> >::size_type nListCount(
m_pRowList->size());
@@ -1097,8 +1097,11 @@ bool OTableEditorCtrl::IsCutAllowed()
break;
}
case NAME:
- bIsCutAllowed = !pNameCell->GetSelected().isEmpty();
+ {
+ weld::Entry& rEntry = pNameCell->get_widget();
+ bIsCutAllowed = rEntry.get_selection_bounds(nStartPos, nEndPos);
break;
+ }
case ROW:
bIsCutAllowed = IsCopyAllowed();
break;
@@ -1126,7 +1129,10 @@ bool OTableEditorCtrl::IsCopyAllowed()
bIsCopyAllowed = rEntry.get_selection_bounds(nStartPos, nEndPos);
}
else if(m_eChildFocus == NAME)
- bIsCopyAllowed = !pNameCell->GetSelected().isEmpty();
+ {
+ weld::Entry& rEntry = pNameCell->get_widget();
+ bIsCopyAllowed = rEntry.get_selection_bounds(nStartPos, nEndPos);
+ }
else if(m_eChildFocus == ROW)
{
Reference<XPropertySet> xTable = GetView()->getController().getTable();
@@ -1135,7 +1141,7 @@ bool OTableEditorCtrl::IsCopyAllowed()
// If one of the selected rows is empty, Copy is not possible
std::shared_ptr<OTableRow> pRow;
- long nIndex = FirstSelectedRow();
+ tools::Long nIndex = FirstSelectedRow();
while( nIndex != SFX_ENDOFSELECTION )
{
pRow = (*m_pRowList)[nIndex];
@@ -1174,7 +1180,7 @@ void OTableEditorCtrl::cut()
if(GetView()->getController().isAlterAllowed())
{
SaveData(-1,FIELD_NAME);
- pNameCell->Cut();
+ pNameCell->get_widget().cut_clipboard();
CellModified(-1,FIELD_NAME);
}
}
@@ -1206,10 +1212,13 @@ void OTableEditorCtrl::cut()
void OTableEditorCtrl::copy()
{
- if(GetSelectRowCount())
+ if (GetSelectRowCount())
OTableRowView::copy();
else if(m_eChildFocus == NAME)
- pNameCell->Copy();
+ {
+ weld::Entry& rEntry = pNameCell->get_widget();
+ rEntry.copy_clipboard();
+ }
else if(HELPTEXT == m_eChildFocus )
{
weld::Entry& rEntry = pHelpTextCell->get_widget();
@@ -1235,7 +1244,7 @@ void OTableEditorCtrl::paste()
{
if(GetView()->getController().isAlterAllowed())
{
- pNameCell->Paste();
+ pNameCell->get_widget().paste_clipboard();
CellModified();
}
}
@@ -1263,7 +1272,7 @@ bool OTableEditorCtrl::IsDeleteAllowed()
return GetSelectRowCount() != 0 && GetView()->getController().isDropAllowed();
}
-bool OTableEditorCtrl::IsInsertNewAllowed( long nRow )
+bool OTableEditorCtrl::IsInsertNewAllowed( sal_Int32 nRow )
{
bool bInsertNewAllowed = GetView()->getController().isAddAllowed();
@@ -1298,7 +1307,7 @@ bool OTableEditorCtrl::IsPrimaryKeyAllowed()
// - there are no empty entries in the selection
// - No Memo or Image entries
// - DROP is not permitted (see above) and the column is not Required (not null flag is not set).
- long nIndex = FirstSelectedRow();
+ tools::Long nIndex = FirstSelectedRow();
std::shared_ptr<OTableRow> pRow;
while( nIndex != SFX_ENDOFSELECTION )
{
@@ -1359,7 +1368,7 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
if( !IsReadOnly() )
{
sal_uInt16 nColId = GetColumnId(GetColumnAtXPosPixel(aMenuPos.X()));
- long nRow = GetRowAtYPosPixel(aMenuPos.Y());
+ sal_Int32 nRow = GetRowAtYPosPixel(aMenuPos.Y());
if ( HANDLE_ID != nColId )
{
@@ -1370,30 +1379,51 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
if ( !IsColumnSelected( nColId ) )
SelectColumnId( nColId );
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/querycolmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), false);
- aContextMenu->RemoveDisabledEntries(true, true);
- if (aContextMenu->Execute(this, aMenuPos) == aContextMenu->GetItemId("width"))
+ ::tools::Rectangle aRect(aMenuPos, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/querycolmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+ xContextMenu->remove(u"delete"_ustr);
+ xContextMenu->remove(u"separator"_ustr);
+ if (xContextMenu->popup_at_rect(pPopupParent, aRect) == "width")
adjustBrowseBoxColumnWidth( this, nColId );
}
}
}
else
{
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/tabledesignrowmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
-
- aContextMenu->EnableItem(aContextMenu->GetItemId("cut"), IsCutAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("copy"), IsCopyAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("paste"), IsPasteAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), IsDeleteAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("primarykey"), IsPrimaryKeyAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("insert"), IsInsertNewAllowed(nRow));
- aContextMenu->CheckItem("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey());
-
- // remove all the disable entries
- aContextMenu->RemoveDisabledEntries(true, true);
+ ::tools::Rectangle aRect(aMenuPos, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/tabledesignrowmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+
+ if (!IsCutAllowed())
+ xContextMenu->remove(u"cut"_ustr);
+ if (!IsCopyAllowed())
+ xContextMenu->remove(u"copy"_ustr);
+ if (!IsPasteAllowed())
+ xContextMenu->remove(u"paste"_ustr);
+ if (!IsDeleteAllowed())
+ xContextMenu->remove(u"delete"_ustr);
+ // 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(u"insert"_ustr);
+
+ if (IsPrimaryKeyAllowed())
+ {
+ xContextMenu->set_active(u"primarykey"_ustr, IsRowSelected(GetCurRow()) && IsPrimaryKey());
+ }
+ else
+ {
+ xContextMenu->remove(u"primarykey"_ustr);
+ }
if( SetDataPtr(m_nDataPos) )
pDescrWin->SaveData( pActRow->GetActFieldDescr() );
@@ -1401,8 +1431,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();
- aContextMenu->Execute(this, aMenuPos);
- OString sIdent = aContextMenu->GetCurItemIdent();
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "cut")
cut();
else if (sIdent == "copy")
@@ -1531,7 +1560,7 @@ void OTableEditorCtrl::SetPrimaryKey( bool bSet )
aInsertedPrimKeys.SetTotalRange( Range(0,GetRowCount()) );
if( bSet )
{
- long nIndex = FirstSelectedRow();
+ tools::Long nIndex = FirstSelectedRow();
while( nIndex != SFX_ENDOFSELECTION )
{
// Set the key
@@ -1557,7 +1586,7 @@ void OTableEditorCtrl::SetPrimaryKey( bool bSet )
bool OTableEditorCtrl::IsPrimaryKey()
{
// Are all marked fields part of the Primary Key ?
- long nPrimaryKeys = 0;
+ tools::Long nPrimaryKeys = 0;
sal_Int32 nRow=0;
for (auto const& row : *m_pRowList)
{
@@ -1575,13 +1604,13 @@ bool OTableEditorCtrl::IsPrimaryKey()
void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
{
// if there is no assigned field name
- long nRow(GetCurRow());
+ sal_Int32 nRow(GetCurRow());
OFieldDescription* pActFieldDescr = GetFieldDescr( nRow );
if( pActFieldDescr )
// Store the old description
pDescrWin->SaveData( pActFieldDescr );
- if ( nRow < 0 || nRow > static_cast<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];
@@ -1625,21 +1654,21 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
OTableDesignView* OTableEditorCtrl::GetView() const
{
- return static_cast<OTableDesignView*>(GetParent()->GetParent());
+ return m_pView;
}
void OTableEditorCtrl::DeactivateCell(bool bUpdate)
{
OTableRowView::DeactivateCell(bUpdate);
// now we have to deactivate the field description
- long nRow(GetCurRow());
+ sal_Int32 nRow(GetCurRow());
if (pDescrWin)
pDescrWin->SetReadOnly(bReadOnly || !SetDataPtr(nRow) || GetActRow()->IsReadOnly());
}
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 69039f3d92f4..26faf0524d10 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TEDITCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TEDITCONTROL_HXX
+#pragma once
#include <TableDesignControl.hxx>
#include <TableDesignView.hxx>
@@ -25,11 +24,10 @@
#include <TableRow.hxx>
#include <TypeInfo.hxx>
-class Edit;
class SfxUndoManager;
namespace dbaui
{
- class OSQLNameEdit;
+ class OSQLNameEditControl;
class OTableEditorCtrl : public OTableRowView
{
@@ -44,11 +42,12 @@ namespace dbaui
std::vector< std::shared_ptr<OTableRow> >* m_pRowList;
- VclPtr<OSQLNameEdit> pNameCell;
+ VclPtr<OTableDesignView> m_pView;
+ VclPtr<OSQLNameEditControl> pNameCell;
VclPtr<::svt::ListBoxControl> pTypeCell;
VclPtr<::svt::EditControl> pHelpTextCell;
VclPtr<::svt::EditControl> pDescrCell;
- VclPtr<OTableFieldDescWin> pDescrWin; // properties of one column
+ OTableFieldDescWin* pDescrWin; // properties of one column
std::shared_ptr<OTableRow> pActRow;
@@ -59,7 +58,7 @@ namespace dbaui
ImplSVEvent * nInvalidateTypeEvent;
ChildFocusState m_eChildFocus;
- long nOldDataPos;
+ tools::Long nOldDataPos;
bool bReadOnly;
@@ -85,29 +84,29 @@ namespace dbaui
protected:
virtual void Command( const CommandEvent& rEvt ) override;
- virtual bool SeekRow(long nRow) override;
+ virtual bool SeekRow(sal_Int32 nRow) override;
virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect,
sal_uInt16 nColumnId ) const override;
virtual void CursorMoved() override;
- virtual RowStatus GetRowStatus(long nRow) const override;
+ virtual RowStatus GetRowStatus(sal_Int32 nRow) const override;
- virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) override;
- virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol) override;
+ virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override;
+ virtual void InitController(::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol) override;
virtual void CellModified() override;
virtual bool SaveModified() override; // is called before changing a cell (false prevents change)
- virtual OUString GetCellText(long nRow, sal_uInt16 nColId) const override;
- virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) override;
+ virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override;
+ virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
virtual void CopyRows() override;
- virtual void InsertRows( long nRow ) override;
+ virtual void InsertRows( sal_Int32 nRow ) override;
virtual void DeleteRows() override;
- virtual void InsertNewRows( long nRow ) override;
+ virtual void InsertNewRows( sal_Int32 nRow ) override;
virtual bool IsPrimaryKeyAllowed() override;
- virtual bool IsInsertNewAllowed( long nRow ) override;
+ virtual bool IsInsertNewAllowed( sal_Int32 nRow ) override;
virtual bool IsDeleteAllowed() override;
void ClearModified();
@@ -116,10 +115,10 @@ namespace dbaui
bool IsPrimaryKey();
public:
- explicit OTableEditorCtrl(vcl::Window* pParentWin);
+ explicit OTableEditorCtrl(vcl::Window* pParentWin, OTableDesignView* pView);
virtual ~OTableEditorCtrl() override;
virtual void dispose() override;
- virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) override;
+ virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol) override;
SfxUndoManager& GetUndoManager() const;
void SetDescrWin( OTableFieldDescWin* pWin )
@@ -132,19 +131,19 @@ namespace dbaui
void SwitchType( const TOTypeInfoSP& _pType );
/// force displaying of the given row
- void DisplayData( long nRow );
+ void DisplayData( sal_Int32 nRow );
- virtual void SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) override;
- virtual void SetCellData( long nRow, sal_uInt16 nColId, const css::uno::Any& _rSaveData ) override;
- virtual css::uno::Any GetCellData( long nRow, sal_uInt16 nColId ) override;
- virtual void SetControlText( long nRow, sal_uInt16 nColId, const OUString& rText ) override;
+ virtual void SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) override;
+ virtual void SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const css::uno::Any& _rSaveData ) override;
+ virtual css::uno::Any GetCellData( sal_Int32 nRow, sal_uInt16 nColId ) override;
+ virtual void SetControlText( sal_Int32 nRow, sal_uInt16 nColId, const OUString& rText ) override;
virtual OTableDesignView* GetView() const override;
std::vector< std::shared_ptr<OTableRow> >* GetRowList(){ return m_pRowList; }
const std::shared_ptr<OTableRow>& GetActRow() const { return pActRow; }
- void CellModified( long nRow, sal_uInt16 nColId );
+ void CellModified( sal_Int32 nRow, sal_uInt16 nColId );
void SetReadOnly( bool bRead );
virtual void Init() override;
@@ -154,7 +153,7 @@ namespace dbaui
bool IsCopyAllowed();
bool IsPasteAllowed() const;
bool IsReadOnly() const { return bReadOnly;}
- OFieldDescription* GetFieldDescr( long nRow );
+ OFieldDescription* GetFieldDescr( sal_Int32 nRow );
// Window overrides
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
@@ -176,11 +175,11 @@ 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( long nRow );
+ bool SetDataPtr( sal_Int32 nRow );
- void SaveData(long nRow, sal_uInt16 nColumnId);
+ void SaveData(sal_Int32 nRow, sal_uInt16 nColumnId);
/** AdjustFieldDescription set the needed values for the description
@param _pFieldDesc the field description where to set the values
@param _rMultiSel contains the positions which changed for undo/redo
@@ -200,6 +199,5 @@ namespace dbaui
void resetType();
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TEDITCONTROL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index da86fb9c1393..59b3bb492cc9 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -46,17 +46,18 @@
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <comphelper/processfactory.hxx>
#include <connectivity/dbexception.hxx>
#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>
+#include <set>
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
org_openoffice_comp_dbu_OTableDesign_get_implementation(
@@ -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;
@@ -100,17 +99,16 @@ namespace
OUString SAL_CALL OTableController::getImplementationName()
{
- return "org.openoffice.comp.dbu.OTableDesign";
+ return u"org.openoffice.comp.dbu.OTableDesign"_ustr;
}
Sequence< OUString> OTableController::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.TableDesign" };
+ return { u"com.sun.star.sdb.TableDesign"_ustr };
}
OTableController::OTableController(const Reference< XComponentContext >& _rM) : OTableController_BASE(_rM)
,m_sTypeNames(DBA_RES(STR_TABLEDESIGN_DBFIELDTYPES))
- ,m_pTypeInfo()
,m_bAllowAutoIncrementValue(false)
,m_bNew(true)
{
@@ -176,13 +174,13 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const
break;
case ID_BROWSER_CUT:
- aReturn.bEnabled = isEditable() && m_aCurrentFrame.isActive() && getView() && static_cast<OTableDesignView*>(getView())->isCutAllowed();
+ aReturn.bEnabled = isEditable() && getView() && static_cast<OTableDesignView*>(getView())->isCutAllowed();
break;
case ID_BROWSER_COPY:
- aReturn.bEnabled = m_aCurrentFrame.isActive() && getView() && static_cast<OTableDesignView*>(getView())->isCopyAllowed();
+ aReturn.bEnabled = getView() && static_cast<OTableDesignView*>(getView())->isCopyAllowed();
break;
case ID_BROWSER_PASTE:
- aReturn.bEnabled = isEditable() && m_aCurrentFrame.isActive() && getView() && static_cast<OTableDesignView*>(getView())->isPasteAllowed();
+ aReturn.bEnabled = isEditable() && getView() && static_cast<OTableDesignView*>(getView())->isPasteAllowed();
break;
case SID_INDEXDESIGN:
aReturn.bEnabled =
@@ -315,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);
@@ -455,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 );
@@ -522,8 +518,8 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/)
if ( std::any_of(m_vRowList.begin(),m_vRowList.end(),
std::mem_fn(&OTableRow::isValid)) )
{
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/tabledesignsavemodifieddialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("TableDesignSaveModifiedDialog"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), u"dbaccess/ui/tabledesignsavemodifieddialog.ui"_ustr));
+ std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(u"TableDesignSaveModifiedDialog"_ustr));
switch (xQuery->run())
{
case RET_YES:
@@ -540,8 +536,8 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/)
}
else if ( !m_bNew )
{
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/deleteallrowsdialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DeleteAllRowsDialog"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), u"dbaccess/ui/deleteallrowsdialog.ui"_ustr));
+ std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(u"DeleteAllRowsDialog"_ustr));
switch (xQuery->run())
{
case RET_YES:
@@ -575,15 +571,15 @@ void OTableController::describeSupportedFeatures()
{
OSingleDocumentController::describeSupportedFeatures();
- implDescribeSupportedFeature( ".uno:Redo", ID_BROWSER_REDO, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVEDOC, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:NewDoc", SID_NEWDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBIndexDesign", SID_INDEXDESIGN, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS );
- implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS );
+ implDescribeSupportedFeature( u".uno:Redo"_ustr, ID_BROWSER_REDO, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Save"_ustr, ID_BROWSER_SAVEDOC, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:Undo"_ustr, ID_BROWSER_UNDO, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:NewDoc"_ustr, SID_NEWDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:SaveAs"_ustr, ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( u".uno:DBIndexDesign"_ustr, SID_INDEXDESIGN, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( u".uno:EditDoc"_ustr, ID_BROWSER_EDITDOC, CommandGroup::EDIT );
+ implDescribeSupportedFeature( u".uno:GetUndoStrings"_ustr, SID_GETUNDOSTRINGS );
+ implDescribeSupportedFeature( u".uno:GetRedoStrings"_ustr, SID_GETREDOSTRINGS );
}
void OTableController::impl_onModifyChanged()
@@ -663,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;
@@ -722,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())
@@ -795,7 +791,7 @@ void OTableController::loadData()
pTabEdRow->SetReadOnly(!bIsAlterAllowed);
// search for type
bool bForce;
- TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(m_aTypeInfo,nType,sTypeName,"x",nPrecision,nScale,bIsAutoIncrement,bForce);
+ TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(m_aTypeInfo,nType,sTypeName,u"x"_ustr,nPrecision,nScale,bIsAutoIncrement,bForce);
if ( !pTypeInfo )
pTypeInfo = m_pTypeInfo;
pTabEdRow->SetFieldType( pTypeInfo, bForce );
@@ -903,18 +899,18 @@ 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" ));
+ pActFieldDescr->SetName( createUniqueName(u"ID"_ustr ));
pActFieldDescr->SetPrimaryKey( true );
m_vRowList.insert(m_vRowList.begin(),pNewRow);
@@ -1121,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::mapTextAllign(pField->GetHorJustify())));
+ xColumn->setPropertyValue(PROPERTY_ALIGN,Any(dbaui::mapTextAlign(pField->GetHorJustify())));
}
}
// second drop all columns which could be found by name
@@ -1164,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, {}, u"S1000"_ustr, 0, caughtException);
}
}
}
@@ -1326,7 +1318,7 @@ void OTableController::assignTable()
if (!xProp.is())
return;
- m_xTable = xProp;
+ m_xTable = std::move(xProp);
startTableListening();
// check if we set the table editable
@@ -1444,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& )
@@ -1482,7 +1474,7 @@ sal_Int32 OTableController::getFirstEmptyRowPosition()
auto pTabEdRow = std::make_shared<OTableRow>();
pTabEdRow->SetReadOnly(bReadRow);
nRet = m_vRowList.size();
- m_vRowList.push_back( pTabEdRow);
+ m_vRowList.push_back(std::move(pTabEdRow));
}
return nRet;
}
diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
index 2fe3e5ec906e..317956ce734f 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
@@ -22,8 +22,9 @@
#include <TableController.hxx>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <vcl/builder.hxx>
#include <vcl/commandevent.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weldutils.hxx>
#include <helpids.h>
using namespace ::dbaui;
@@ -104,32 +105,22 @@ void OTableRowView::Command(const CommandEvent& rEvt)
}
sal_uInt16 nColId = GetColumnId(GetColumnAtXPosPixel(rEvt.GetMousePosPixel().X()));
- long nRow = GetRowAtYPosPixel(rEvt.GetMousePosPixel().Y());
+ sal_Int32 nRow = GetRowAtYPosPixel(rEvt.GetMousePosPixel().Y());
if ( nColId == HANDLE_ID )
{
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/querycolmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- long nSelectRowCount = GetSelectRowCount();
- aContextMenu->EnableItem(aContextMenu->GetItemId("cut"), nSelectRowCount != 0);
- aContextMenu->EnableItem(aContextMenu->GetItemId("copy"), nSelectRowCount != 0);
- aContextMenu->EnableItem(aContextMenu->GetItemId("paste"), false);
- aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), false);
- aContextMenu->Execute(this, rEvt.GetMousePosPixel());
- OString sIdent = aContextMenu->GetCurItemIdent();
+ ::tools::Rectangle aRect(rEvt.GetMousePosPixel(), Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, u"dbaccess/ui/tabledesignrowmenu.ui"_ustr));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu(u"menu"_ustr));
+ sal_Int32 nSelectRowCount = GetSelectRowCount();
+ xContextMenu->set_sensitive(u"cut"_ustr, nSelectRowCount != 0);
+ xContextMenu->set_sensitive(u"copy"_ustr, nSelectRowCount != 0);
+ OUString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "cut")
cut();
else if (sIdent == "copy")
copy();
- else if (sIdent == "paste")
- {
- Paste( nRow );
- SetNoSelection();
- GoToRow( nRow );
- SeekRow( nRow );
- }
- else if (sIdent == "delete")
- DeleteRows();
else if (sIdent == "insert")
{
InsertNewRows( nRow );
@@ -165,12 +156,12 @@ void OTableRowView::paste()
OSL_FAIL("OTableRowView::Paste : (pseudo-) abstract method called !");
}
-void OTableRowView::Paste( long nRow )
+void OTableRowView::Paste( sal_Int32 nRow )
{
InsertRows( nRow );
}
-EditBrowseBox::RowStatus OTableRowView::GetRowStatus(long nRow) const
+EditBrowseBox::RowStatus OTableRowView::GetRowStatus(sal_Int32 nRow) const
{
if (nRow >= 0 && m_nDataPos == nRow)
return CURRENT;
diff --git a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
index 3d73ff0e6170..f81123e55d03 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
@@ -18,88 +18,45 @@
*/
#include <TableDesignHelpBar.hxx>
-#include <vcl/event.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/vclmedit.hxx>
#include <helpids.h>
using namespace dbaui;
-#define STANDARD_MARGIN 6
-OTableDesignHelpBar::OTableDesignHelpBar( vcl::Window* pParent ) :
- TabPage( pParent, WB_3DLOOK )
-{
- m_pTextWin = VclPtr<VclMultiLineEdit>::Create( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
- m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
- m_pTextWin->SetReadOnly();
- m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
- m_pTextWin->Show();
-}
-
-OTableDesignHelpBar::~OTableDesignHelpBar()
-{
- disposeOnce();
-}
-void OTableDesignHelpBar::dispose()
-{
- m_pTextWin.disposeAndClear();
- TabPage::dispose();
-}
-
-void OTableDesignHelpBar::SetHelpText( const OUString& rText )
-{
- if(m_pTextWin)
- m_pTextWin->SetText( rText );
- Invalidate();
-}
+#define DETAILS_MIN_HELP_WIDTH 200
-void OTableDesignHelpBar::Resize()
+OTableDesignHelpBar::OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin)
+ : m_xTextWin(std::move(xTextWin))
{
- // parent window dimensions
- Size aOutputSize( GetOutputSizePixel() );
-
- // adapt the TextWin
- if(m_pTextWin)
- m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
- Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
- aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );
-
+ m_xTextWin->set_size_request(DETAILS_MIN_HELP_WIDTH, -1);
+ m_xTextWin->set_help_id(HID_TAB_DESIGN_HELP_TEXT_FRAME);
}
-bool OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
+void OTableDesignHelpBar::SetHelpText(const OUString& rText)
{
- if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS)
- SetHelpText(OUString());
- return TabPage::PreNotify(rNEvt);
+ if (!m_xTextWin)
+ return;
+ m_xTextWin->set_text(rText);
}
bool OTableDesignHelpBar::isCopyAllowed()
{
- return m_pTextWin && !m_pTextWin->GetSelected().isEmpty();
+ int mStartPos, nEndPos;
+ return m_xTextWin && m_xTextWin->get_selection_bounds(mStartPos, nEndPos);
}
-bool OTableDesignHelpBar::isCutAllowed()
-{
- return false;
-}
+bool OTableDesignHelpBar::isCutAllowed() { return false; }
-bool OTableDesignHelpBar::isPasteAllowed()
-{
- return false;
-}
+bool OTableDesignHelpBar::isPasteAllowed() { return false; }
-void OTableDesignHelpBar::cut()
-{
-}
+void OTableDesignHelpBar::cut() {}
void OTableDesignHelpBar::copy()
{
- if ( m_pTextWin )
- m_pTextWin->Copy();
+ if (!m_xTextWin)
+ return;
+ m_xTextWin->copy_clipboard();
}
-void OTableDesignHelpBar::paste()
-{
-}
+void OTableDesignHelpBar::paste() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
index af223a287718..4ae94dcf6e78 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
@@ -25,34 +25,30 @@
#include "TableFieldDescWin.hxx"
#include <TableRow.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/syslocale.hxx>
-#include <vcl/settings.hxx>
#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(vcl::Window* pParent) : Window(pParent,WB_BORDER)
- ,m_aHorzSplitter( VclPtr<Splitter>::Create(this) )
+OTableBorderWindow::OTableBorderWindow(OTableDesignView* pParent)
+ : InterimItemWindow(pParent, u"dbaccess/ui/tableborderwindow.ui"_ustr, u"TableBorderWindow"_ustr, false)
+ , m_xHorzSplitter(m_xBuilder->weld_paned(u"splitter"_ustr))
+ , m_xEditorParent(m_xBuilder->weld_container(u"editor"_ustr))
+ , m_xEditorParentWin(m_xEditorParent->CreateChildFrame())
+ , m_xEditorCtrl(VclPtr<OTableEditorCtrl>::Create(VCLUnoHelper::GetWindow(m_xEditorParentWin), pParent))
+ , m_xFieldDescParent(m_xBuilder->weld_container(u"fielddesc"_ustr))
+ , m_xFieldDescWin(new OTableFieldDescWin(m_xFieldDescParent.get(), pParent))
{
+ SetStyle(GetStyle() | WB_DIALOGCONTROL);
- ImplInitSettings();
- // create children
- m_pEditorCtrl = VclPtr<OTableEditorCtrl>::Create( this);
- m_pFieldDescWin = VclPtr<OTableFieldDescWin>::Create( this );
-
- m_pFieldDescWin->SetHelpId(HID_TAB_DESIGN_DESCWIN);
+ m_xFieldDescWin->SetHelpId(HID_TAB_DESIGN_DESCWIN);
// set depending windows and controls
- m_pEditorCtrl->SetDescrWin(m_pFieldDescWin);
-
- // set up splitter
- m_aHorzSplitter->SetSplitHdl( LINK(this, OTableBorderWindow, SplitHdl) );
- m_aHorzSplitter->Show();
+ m_xEditorCtrl->SetDescrWin(m_xFieldDescWin.get());
}
OTableBorderWindow::~OTableBorderWindow()
@@ -63,93 +59,45 @@ OTableBorderWindow::~OTableBorderWindow()
void OTableBorderWindow::dispose()
{
// destroy children
- // ::dbaui::notifySystemWindow(this,m_pFieldDescWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- m_pEditorCtrl->Hide();
- m_pFieldDescWin->Hide();
- m_pEditorCtrl.disposeAndClear();
- m_pFieldDescWin.disposeAndClear();
- m_aHorzSplitter.disposeAndClear();
- vcl::Window::dispose();
+ m_xEditorCtrl.disposeAndClear();
+ m_xEditorParentWin->dispose();
+ m_xEditorParentWin.clear();
+ m_xEditorParent.reset();
+ m_xFieldDescWin.reset();
+ m_xFieldDescParent.reset();
+ m_xHorzSplitter.reset();
+ InterimItemWindow::dispose();
}
-void OTableBorderWindow::Resize()
+void OTableBorderWindow::Layout()
{
- const long nSplitterHeight(3);
-
// dimensions of parent window
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
- long nSplitPos = m_aHorzSplitter->GetSplitPosPixel();
+ auto nOutputHeight = GetSizePixel().Height();
+ auto nOldSplitPos = m_xHorzSplitter->get_position();
+ auto nSplitPos = nOldSplitPos;
// shift range of the splitter is the middle third of the output
- long nDragPosY = nOutputHeight/3;
- long nDragSizeHeight = nOutputHeight/3;
- m_aHorzSplitter->SetDragRectPixel( tools::Rectangle(Point(0,nDragPosY), Size(nOutputWidth,nDragSizeHeight) ), this );
- if( (nSplitPos < nDragPosY) || (nSplitPos > (nDragPosY+nDragSizeHeight)) )
- nSplitPos = nDragPosY+nDragSizeHeight-5;
+ auto nDragPosY = nOutputHeight/3;
+ auto nDragSizeHeight = nOutputHeight/3;
+ if (nSplitPos < nDragPosY || nSplitPos > nDragPosY + nDragSizeHeight)
+ nSplitPos = nDragPosY + nDragSizeHeight;
// set splitter
- m_aHorzSplitter->SetPosSizePixel( Point( 0, nSplitPos ), Size(nOutputWidth, nSplitterHeight));
- m_aHorzSplitter->SetSplitPosPixel( nSplitPos );
-
- // set window
- m_pEditorCtrl->SetPosSizePixel( Point(0, 0), Size(nOutputWidth , nSplitPos) );
-
- m_pFieldDescWin->SetPosSizePixel( Point(0, nSplitPos+nSplitterHeight),
- Size(nOutputWidth, nOutputHeight-nSplitPos-nSplitterHeight) );
-}
-
-IMPL_LINK( OTableBorderWindow, SplitHdl, Splitter*, pSplit, void )
-{
- if(pSplit == m_aHorzSplitter.get())
- {
- m_aHorzSplitter->SetPosPixel( Point( m_aHorzSplitter->GetPosPixel().X(),m_aHorzSplitter->GetSplitPosPixel() ) );
- Resize();
- }
-}
-
-void OTableBorderWindow::ImplInitSettings()
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ m_xHorzSplitter->set_position(nSplitPos);
- // FIXME RenderContext
+ InterimItemWindow::Layout();
- vcl::Font aFont = rStyleSettings.GetAppFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetPointFont(*this, aFont);
-
- Color aTextColor = rStyleSettings.GetButtonTextColor();
- if ( IsControlForeground() )
- aTextColor = GetControlForeground();
- SetTextColor( aTextColor );
-
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFaceColor() );
-}
-
-void OTableBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
+ if (nOldSplitPos != nSplitPos)
+ m_xHorzSplitter->set_position(nSplitPos);
}
void OTableBorderWindow::GetFocus()
{
- Window::GetFocus();
+ InterimItemWindow::GetFocus();
// forward the focus to the current cell of the editor control
- if (m_pEditorCtrl)
- m_pEditorCtrl->GrabFocus();
+ if (m_xEditorCtrl)
+ m_xEditorCtrl->GrabFocus();
}
OTableDesignView::OTableDesignView( vcl::Window* pParent,
@@ -170,6 +118,9 @@ OTableDesignView::OTableDesignView( vcl::Window* pParent,
}
m_pWin = VclPtr<OTableBorderWindow>::Create(this);
+
+ m_pWin->GetDescWin()->connect_focus_in(LINK(this, OTableDesignView, FieldDescFocusIn));
+
m_pWin->Show();
}
@@ -206,9 +157,14 @@ void OTableDesignView::resizeDocumentView(tools::Rectangle& _rPlayground)
_rPlayground.SetSize( Size( 0, 0 ) );
}
+IMPL_LINK_NOARG(OTableDesignView, FieldDescFocusIn, weld::Widget&, void)
+{
+ m_eChildFocus = DESCRIPTION;
+}
+
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/TableFieldControl.cxx b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
index cbd99179c213..fac580c2586a 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
@@ -33,21 +33,31 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace dbaui;
-OTableFieldControl::OTableFieldControl(vcl::Window* pParent, OTableDesignHelpBar* pHelpBar)
- : OFieldDescControl(nullptr, pParent, pHelpBar)
+OTableFieldControl::OTableFieldControl(weld::Container* pParent, OTableDesignHelpBar* pHelpBar, OTableDesignView* pView)
+ : OFieldDescControl(pParent, pHelpBar)
+ , m_xView(pView)
{
}
-void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId )
+void OTableFieldControl::dispose()
+{
+ m_xView.reset();
+}
+
+OTableFieldControl::~OTableFieldControl()
+{
+ dispose();
+}
+
+void OTableFieldControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
{
GetCtrl()->CellModified(nRow,nColId);
}
OTableEditorCtrl* OTableFieldControl::GetCtrl() const
{
- OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()->GetParent());
- OSL_ENSURE(pDesignWin,"no view!");
- return pDesignWin->GetEditorCtrl();
+ assert(m_xView && "no view!");
+ return m_xView->GetEditorCtrl();
}
bool OTableFieldControl::IsReadOnly()
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
index 42697bdb7815..4a232f86c3d8 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDCONTROL_HXX
+#pragma once
#include <FieldDescControl.hxx>
@@ -25,15 +24,22 @@ namespace dbaui
{
class OTableEditorCtrl;
class OTableDesignHelpBar;
+ class OTableDesignView;
+
// OTableFieldControl
class OTableFieldControl : public OFieldDescControl
{
+ VclPtr<OTableDesignView> m_xView;
+
OTableEditorCtrl* GetCtrl() const;
+
+ void dispose();
+
protected:
virtual void ActivateAggregate( EControlType eType ) override;
virtual void DeactivateAggregate( EControlType eType ) override;
// are to be implemented by the derived classes
- virtual void CellModified(long nRow, sal_uInt16 nColId ) override;
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) override;
virtual bool IsReadOnly() override;
virtual void SetModified(bool bModified) override;
virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override;
@@ -46,7 +52,8 @@ namespace dbaui
virtual OUString getAutoIncrementValue() const override;
public:
- OTableFieldControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar);
+ OTableFieldControl(weld::Container* pParent, OTableDesignHelpBar* pHelpBar, OTableDesignView* pView);
+ virtual ~OTableFieldControl() override;
using OFieldDescControl::BoolStringPersistent;
using OFieldDescControl::BoolStringUI;
@@ -55,6 +62,5 @@ namespace dbaui
virtual css::uno::Reference< css::sdbc::XConnection> getConnection() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDCONTROL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
index 9507507949e1..7aa12b498190 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
@@ -18,186 +18,58 @@
*/
#include "TableFieldDescWin.hxx"
-#include <osl/diagnose.h>
#include <FieldDescriptions.hxx>
#include <strings.hrc>
#include <TableDesignHelpBar.hxx>
-#include <vcl/event.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/settings.hxx>
#include <helpids.h>
#include <core_resource.hxx>
-#define STANDARD_MARGIN 6
-#define DETAILS_HEADER_HEIGHT 25
-#define CONTROL_SPACING_X 18 // 6
-#define CONTROL_SPACING_Y 5
-#define CONTROL_HEIGHT 20
-#define CONTROL_WIDTH_1 140 // 100
-#define CONTROL_WIDTH_3 250
-#define CONTROL_WIDTH_4 (CONTROL_WIDTH_3 - CONTROL_HEIGHT - 5)
-#define DETAILS_OPT_PAGE_WIDTH (CONTROL_WIDTH_1 + CONTROL_SPACING_X + CONTROL_WIDTH_4 + 50)
-#define DETAILS_OPT_PAGE_HEIGHT ((CONTROL_HEIGHT + CONTROL_SPACING_Y) * 5)
-#define DETAILS_MIN_HELP_WIDTH 100
-#define DETAILS_OPT_HELP_WIDTH 200
-#define DETAILS_MIN_HELP_HEIGHT 50
-#define DETAILS_OPT_HELP_HEIGHT 100
-
using namespace dbaui;
-OTableFieldDescWin::OTableFieldDescWin( vcl::Window* pParent)
- : TabPage(pParent, WB_3DLOOK)
+
+OTableFieldDescWin::OTableFieldDescWin(weld::Container* pParent, OTableDesignView* pView)
+ : OChildWindow(pParent, u"dbaccess/ui/fielddescpanel.ui"_ustr, u"FieldDescPanel"_ustr)
+ , m_aHelpBar(m_xBuilder->weld_text_view(u"textview"_ustr))
+ , m_xBox(m_xBuilder->weld_container(u"box"_ustr))
+ , m_xFieldControl(new OTableFieldControl(m_xBox.get(), &m_aHelpBar, pView))
+ , m_xHeader(m_xBuilder->weld_label(u"header"_ustr))
, m_eChildFocus(NONE)
{
// Header
- m_pHeader = VclPtr<FixedText>::Create( this, WB_CENTER );
- m_pHeader->SetText(DBA_RES(STR_TAB_PROPERTIES));
- m_pHeader->Show();
+ m_xHeader->set_label(DBA_RES(STR_TAB_PROPERTIES));
- // HelpBar
- m_pHelpBar = VclPtr<OTableDesignHelpBar>::Create( this );
- m_pHelpBar->SetHelpId(HID_TAB_DESIGN_HELP_TEXT_FRAME);
- m_pHelpBar->Show();
+ m_xFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
- m_pGenPage = VclPtr<OFieldDescGenWin>::Create( this, m_pHelpBar );
- getGenPage()->SetHelpId( HID_TABLE_DESIGN_TABPAGE_GENERAL );
- getGenPage()->Show();
+ m_aHelpBar.connect_focus_in(LINK(this, OTableFieldDescWin, HelpFocusIn));
+ m_xFieldControl->connect_focus_in(LINK(this, OTableFieldDescWin, FieldFocusIn));
}
-OTableFieldDescWin::~OTableFieldDescWin()
+bool OTableFieldDescWin::HasChildPathFocus() const
{
- disposeOnce();
+ return m_xFieldControl->HasChildPathFocus() || m_aHelpBar.HasFocus();
}
-void OTableFieldDescWin::dispose()
+OTableFieldDescWin::~OTableFieldDescWin()
{
- // destroy children
- m_pHelpBar->Hide();
- getGenPage()->Hide();
- m_pHeader->Hide();
-
- m_pGenPage.disposeAndClear();
- m_pHeader.disposeAndClear();
- m_pHelpBar.disposeAndClear();
- TabPage::dispose();
}
void OTableFieldDescWin::Init()
{
- OSL_ENSURE(getGenPage() != nullptr, "OTableFieldDescWin::Init : ups ... no GenericPage ... this will crash ...");
- getGenPage()->Init();
+ m_xFieldControl->Init();
}
void OTableFieldDescWin::SetReadOnly( bool bRead )
{
- getGenPage()->SetReadOnly( bRead );
+ m_xFieldControl->SetReadOnly( bRead );
}
void OTableFieldDescWin::DisplayData( OFieldDescription* pFieldDescr )
{
- getGenPage()->DisplayData( pFieldDescr );
+ m_xFieldControl->DisplayData( pFieldDescr );
}
void OTableFieldDescWin::SaveData( OFieldDescription* pFieldDescr )
{
- getGenPage()->SaveData( pFieldDescr );
-}
-
-void OTableFieldDescWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
-{
- // 3D-line at the top window border
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
-
- rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
- rRenderContext.DrawLine(Point(0,0), Point(GetSizePixel().Width(), 0));
-
- // 3D-line for the separation of the header
- rRenderContext.DrawLine(Point(3, DETAILS_HEADER_HEIGHT), Point(GetSizePixel().Width() - 6, DETAILS_HEADER_HEIGHT));
- rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
- rRenderContext.DrawLine(Point(3, DETAILS_HEADER_HEIGHT - 1), Point(GetSizePixel().Width() - 6, DETAILS_HEADER_HEIGHT - 1));
-}
-
-void OTableFieldDescWin::Resize()
-{
- // dimensions of the parent window
- Size aOutputSize( GetOutputSizePixel() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- // since the GenPage can scroll, but I can't, I position the HelpWindow, in case I become too slim,
- // _below_ the Genpage, not on the right side. But before that I try to make it a bit smaller
-
- long nHelpX, nHelpY;
- long nHelpWidth, nHelpHeight;
- long nPageWidth, nPageHeight;
-
- // do both fit next to each other (margin + page + margin + help)?
- if (STANDARD_MARGIN + DETAILS_OPT_PAGE_WIDTH + STANDARD_MARGIN + DETAILS_MIN_HELP_WIDTH <= nOutputWidth)
- { // yes -> then we wonder if can give the help its optimum width
- nHelpWidth = DETAILS_OPT_HELP_WIDTH;
- nPageWidth = nOutputWidth - nHelpWidth - STANDARD_MARGIN - STANDARD_MARGIN;
- if (nPageWidth < DETAILS_OPT_PAGE_WIDTH)
- { // rather resize the help from its optimal width to its minimum width
- long nTransfer = DETAILS_OPT_PAGE_WIDTH - nPageWidth;
- nPageWidth += nTransfer;
- nHelpWidth -= nTransfer;
- }
- nHelpX = nOutputWidth - nHelpWidth;
- // the heights are simple in that case...
- nHelpY = DETAILS_HEADER_HEIGHT + 1;
- nHelpHeight = nOutputHeight - nHelpY;
- nPageHeight = nOutputHeight - STANDARD_MARGIN - DETAILS_HEADER_HEIGHT - STANDARD_MARGIN;
- }
- else
- { // doesn't work next to each other, thus below each other (margin + header + page + help)
- if (STANDARD_MARGIN + DETAILS_HEADER_HEIGHT + DETAILS_OPT_PAGE_HEIGHT + DETAILS_MIN_HELP_HEIGHT <= nOutputHeight)
- { // it's at least enough, to fit both below each other (page optimal, help minimal)
- nHelpHeight = DETAILS_OPT_HELP_HEIGHT;
- nPageHeight = nOutputHeight - nHelpHeight - DETAILS_HEADER_HEIGHT - STANDARD_MARGIN;
- if (nPageHeight < DETAILS_OPT_PAGE_HEIGHT)
- { // like above: page optimal, help gets whatever is left (which is bigger/equal to its minimum)
- long nTransfer = DETAILS_OPT_PAGE_HEIGHT - nPageHeight;
- nPageHeight += nTransfer;
- nHelpHeight -= nTransfer;
- }
- nHelpY = nOutputHeight - nHelpHeight;
- // and across the entire width
- nHelpX = 0; // without margin, since the HelpCtrl has its own one
- nHelpWidth = nOutputWidth; // dito
- nPageWidth = nOutputWidth - STANDARD_MARGIN - STANDARD_MARGIN;
- }
- else
- { // unfortunately that's not even enough, to show page at its optimum and help with minimum width
- nHelpX = nHelpY = nHelpWidth = nHelpHeight = 0; // thus no help window
- nPageWidth = nOutputWidth - STANDARD_MARGIN - STANDARD_MARGIN;
- nPageHeight = nOutputHeight - STANDARD_MARGIN - DETAILS_HEADER_HEIGHT - STANDARD_MARGIN;
- }
- }
-
- m_pHeader->SetPosSizePixel( Point(0, STANDARD_MARGIN), Size(nOutputWidth, 15) );
-
- getGenPage()->SetPosSizePixel(Point ( STANDARD_MARGIN,
- STANDARD_MARGIN + DETAILS_HEADER_HEIGHT
- ),
- Size ( nPageWidth,
- nPageHeight
- )
- );
- if (nHelpHeight)
- {
- m_pHelpBar->Show();
- m_pHelpBar->SetPosSizePixel(Point ( nHelpX,
- nHelpY
- ),
- Size ( nHelpWidth,
- nHelpHeight
- )
- );
- }
- else
- {
- m_pHelpBar->Hide();
- }
- Invalidate();
+ m_xFieldControl->SaveData( pFieldDescr );
}
IClipboardTest* OTableFieldDescWin::getActiveChild() const
@@ -206,10 +78,10 @@ IClipboardTest* OTableFieldDescWin::getActiveChild() const
switch(m_eChildFocus)
{
case DESCRIPTION:
- pTest = getGenPage();
+ pTest = m_xFieldControl.get();
break;
default:
- pTest = m_pHelpBar;
+ pTest = const_cast<OTableDesignHelpBar*>(&m_aHelpBar);
break;
}
return pTest;
@@ -222,18 +94,18 @@ bool OTableFieldDescWin::isCopyAllowed()
bool OTableFieldDescWin::isCutAllowed()
{
- return (getGenPage() && getGenPage()->HasChildPathFocus() && getGenPage()->isCutAllowed());
+ return getActiveChild() && getActiveChild()->isCutAllowed();
}
bool OTableFieldDescWin::isPasteAllowed()
{
- return (getGenPage() && getGenPage()->HasChildPathFocus() && getGenPage()->isPasteAllowed());
+ return getActiveChild() && getActiveChild()->isPasteAllowed();
}
void OTableFieldDescWin::cut()
{
- if ( getGenPage() && getGenPage()->HasChildPathFocus() )
- getGenPage()->cut();
+ if (getActiveChild())
+ getActiveChild()->cut();
}
void OTableFieldDescWin::copy()
@@ -244,32 +116,25 @@ void OTableFieldDescWin::copy()
void OTableFieldDescWin::paste()
{
- if ( getGenPage() && getGenPage()->HasChildPathFocus() )
- getGenPage()->paste();
+ if (getActiveChild())
+ getActiveChild()->paste();
}
-void OTableFieldDescWin::GetFocus()
+void OTableFieldDescWin::GrabFocus()
{
- if ( getGenPage() )
- getGenPage()->GetFocus();
+ m_xFieldControl->GrabFocus();
}
-void OTableFieldDescWin::LoseFocus()
+IMPL_LINK(OTableFieldDescWin, HelpFocusIn, weld::Widget&, rWidget, void)
{
- if ( getGenPage() )
- getGenPage()->LoseFocus();
+ m_eChildFocus = HELP;
+ m_aFocusInHdl.Call(rWidget);
}
-bool OTableFieldDescWin::PreNotify( NotifyEvent& rNEvt )
+IMPL_LINK(OTableFieldDescWin, FieldFocusIn, weld::Widget&, rWidget, void)
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
- {
- if( getGenPage() && getGenPage()->HasChildPathFocus() )
- m_eChildFocus = DESCRIPTION;
- else
- m_eChildFocus = HELP;
- }
- return TabPage::PreNotify(rNEvt);
+ m_eChildFocus = DESCRIPTION;
+ m_aFocusInHdl.Call(rWidget);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
index e85557f24b16..f14e468c561e 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
@@ -16,23 +16,20 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDDESCWIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDDESCWIN_HXX
+#pragma once
-#include <vcl/tabpage.hxx>
-#include "FieldDescGenWin.hxx"
#include <IClipBoardTest.hxx>
+#include <ChildWindow.hxx>
+#include "TableFieldControl.hxx"
+#include <TableDesignHelpBar.hxx>
-class FixedText;
namespace dbaui
{
- class OFieldDescGenWin;
- class OTableDesignHelpBar;
+ class OTableDesignView;
class OFieldDescription;
- // derivative of TabPage is a trick of TH,
- // to notice a change in system colours
- class OTableFieldDescWin : public TabPage
- ,public IClipboardTest
+
+ class OTableFieldDescWin final : public OChildWindow
+ , public IClipboardTest
{
enum ChildFocusState
{
@@ -41,21 +38,22 @@ namespace dbaui
NONE
};
private:
- VclPtr<OTableDesignHelpBar> m_pHelpBar;
- VclPtr<OFieldDescGenWin> m_pGenPage;
- VclPtr<FixedText> m_pHeader;
- ChildFocusState m_eChildFocus;
+ OTableDesignHelpBar m_aHelpBar;
+ std::unique_ptr<weld::Container> m_xBox;
+ std::unique_ptr<OTableFieldControl> m_xFieldControl;
+ std::unique_ptr<weld::Label> m_xHeader;
+ Link<weld::Widget&, void> m_aFocusInHdl;
+
+ ChildFocusState m_eChildFocus;
IClipboardTest* getActiveChild() const;
- protected:
- virtual void Resize() override;
- virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ DECL_LINK(HelpFocusIn, weld::Widget&, void);
+ DECL_LINK(FieldFocusIn, weld::Widget&, void);
public:
- explicit OTableFieldDescWin( vcl::Window* pParent);
+ explicit OTableFieldDescWin(weld::Container* pParent, OTableDesignView* pView);
virtual ~OTableFieldDescWin() override;
- virtual void dispose() override;
void Init();
@@ -63,19 +61,14 @@ namespace dbaui
void SaveData( OFieldDescription* pFieldDescr );
void SetReadOnly( bool bReadOnly );
- // Window overrides
- virtual bool PreNotify( NotifyEvent& rNEvt ) override;
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
-
void SetControlText( sal_uInt16 nControlId, const OUString& rText )
- { m_pGenPage->SetControlText(nControlId,rText); }
+ { m_xFieldControl->SetControlText(nControlId,rText); }
- // short GetFormatCategory(OFieldDescription* pFieldDescr) { return m_pGenPage ? m_pGenPage->GetFormatCategory(pFieldDescr) : -1; }
- // delivers a CAT_xxx (CAT_NUMBER, CAT_DATE ...) value to a Format set in the field
+ OUString BoolStringPersistent(std::u16string_view rUIString) const { return m_xFieldControl->BoolStringPersistent(rUIString); }
+ OUString BoolStringUI(const OUString& rPersistentString) const { return m_xFieldControl->BoolStringUI(rPersistentString); }
- OUString BoolStringPersistent(const OUString& rUIString) const { return m_pGenPage->BoolStringPersistent(rUIString); }
- OUString BoolStringUI(const OUString& rPersistentString) const { return m_pGenPage->BoolStringUI(rPersistentString); }
+ virtual bool HasChildPathFocus() const override;
+ virtual void GrabFocus() override;
// IClipboardTest
virtual bool isCutAllowed() override;
@@ -86,10 +79,13 @@ namespace dbaui
virtual void cut() override;
virtual void paste() override;
- OFieldDescGenWin* getGenPage() const { return m_pGenPage; }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_aFocusInHdl = rLink;
+ }
+ OTableFieldControl* getGenPage() const { return m_xFieldControl.get(); }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDDESCWIN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx
index c84ebc834410..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 )
@@ -35,16 +33,7 @@ OTableRow::OTableRow()
{
}
-OTableRow::OTableRow(const Reference< XPropertySet >& xAffectedCol)
- :m_pActFieldDescr( nullptr )
- ,m_nPos( -1 )
- ,m_bReadOnly( false )
- ,m_bOwnsDescriptions(true)
-{
- m_pActFieldDescr = new OFieldDescription(xAffectedCol);
-}
-
-OTableRow::OTableRow( const OTableRow& rRow, long nPosition )
+OTableRow::OTableRow( const OTableRow& rRow, tools::Long nPosition )
:m_pActFieldDescr(nullptr)
,m_nPos( nPosition )
,m_bReadOnly(rRow.IsReadOnly())
@@ -139,53 +128,52 @@ namespace dbaui
_rStr.ReadInt32( _rRow.m_nPos );
sal_Int32 nValue = 0;
_rStr.ReadInt32( nValue );
- if ( nValue )
+ if ( !nValue )
+ return _rStr;
+ OFieldDescription* pFieldDesc = new OFieldDescription();
+ _rRow.m_pActFieldDescr = pFieldDesc;
+ pFieldDesc->SetName(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()));
+ pFieldDesc->SetDescription(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()));
+ pFieldDesc->SetHelpText(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()));
+
+ _rStr.ReadInt32( nValue );
+ Any aControlDefault;
+ switch ( nValue )
{
- OFieldDescription* pFieldDesc = new OFieldDescription();
- _rRow.m_pActFieldDescr = pFieldDesc;
- pFieldDesc->SetName(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()));
- pFieldDesc->SetDescription(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()));
- pFieldDesc->SetHelpText(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()));
-
- _rStr.ReadInt32( nValue );
- Any aControlDefault;
- switch ( nValue )
+ case 1:
{
- case 1:
- {
- double nControlDefault;
- _rStr.ReadDouble( nControlDefault );
- aControlDefault <<= nControlDefault;
- break;
- }
- case 2:
- aControlDefault <<= _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
- break;
+ double nControlDefault;
+ _rStr.ReadDouble( nControlDefault );
+ aControlDefault <<= nControlDefault;
+ break;
}
-
- pFieldDesc->SetControlDefault(aControlDefault);
-
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetTypeValue(nValue);
-
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetPrecision(nValue);
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetScale(nValue);
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetIsNullable(nValue);
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetFormatKey(nValue);
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetHorJustify(static_cast<SvxCellHorJustify>(nValue));
-
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetAutoIncrement(nValue != 0);
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetPrimaryKey(nValue != 0);
- _rStr.ReadInt32( nValue );
- pFieldDesc->SetCurrency(nValue != 0);
+ case 2:
+ aControlDefault <<= _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
+ break;
}
+
+ pFieldDesc->SetControlDefault(aControlDefault);
+
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetTypeValue(nValue);
+
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetPrecision(nValue);
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetScale(nValue);
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetIsNullable(nValue);
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetFormatKey(nValue);
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetHorJustify(static_cast<SvxCellHorJustify>(nValue));
+
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetAutoIncrement(nValue != 0);
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetPrimaryKey(nValue != 0);
+ _rStr.ReadInt32( nValue );
+ pFieldDesc->SetCurrency(nValue != 0);
return _rStr;
}
}
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
index 53b54cef400c..219b7cf58845 100644
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
@@ -19,29 +19,27 @@
#include <TableRowExchange.hxx>
#include <sot/formats.hxx>
-#include <sot/storage.hxx>
+#include <tools/stream.hxx>
#include <TableRow.hxx>
namespace dbaui
{
constexpr sal_uInt32 FORMAT_OBJECT_ID_SBA_TABED = 1;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
- OTableRowExchange::OTableRowExchange(const std::vector< std::shared_ptr<OTableRow> >& _rvTableRow)
- : m_vTableRow(_rvTableRow)
+ OTableRowExchange::OTableRowExchange(std::vector< std::shared_ptr<OTableRow> >&& _rvTableRow)
+ : m_vTableRow(std::move(_rvTableRow))
{
}
- bool OTableRowExchange::WriteObject( tools::SvRef<SotStorageStream>& 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 6cb71bc9502c..5a4106b4b007 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.cxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx
@@ -24,13 +24,14 @@
#include <TableController.hxx>
#include <TableDesignView.hxx>
#include <FieldDescriptions.hxx>
-#include <svx/svxids.hrc>
+#include <sfx2/sfxsids.hrc>
+#include <utility>
using namespace dbaui;
using namespace ::svt;
-OTableDesignUndoAct::OTableDesignUndoAct(OTableRowView* pOwner, const char* pCommentID)
+OTableDesignUndoAct::OTableDesignUndoAct(OTableRowView* pOwner, TranslateId pCommentID)
: OCommentUndoAction(pCommentID)
, m_pTabDgnCtrl(pOwner)
{
@@ -65,7 +66,7 @@ void OTableDesignUndoAct::Redo()
}
}
-OTableDesignCellUndoAct::OTableDesignCellUndoAct( OTableRowView* pOwner, long nRowID, sal_uInt16 nColumn ) :
+OTableDesignCellUndoAct::OTableDesignCellUndoAct( OTableRowView* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn ) :
OTableDesignUndoAct( pOwner ,STR_TABED_UNDO_CELLMODIFIED)
,m_nCol( nColumn )
,m_nRow( nRowID )
@@ -106,7 +107,7 @@ void OTableDesignCellUndoAct::Redo()
OTableDesignUndoAct::Redo();
}
-OTableEditorUndoAct::OTableEditorUndoAct(OTableEditorCtrl* pOwner, const char* pCommentID)
+OTableEditorUndoAct::OTableEditorUndoAct(OTableEditorCtrl* pOwner, TranslateId pCommentID)
: OTableDesignUndoAct(pOwner, pCommentID)
, pTabEdCtrl(pOwner)
{
@@ -116,11 +117,11 @@ OTableEditorUndoAct::~OTableEditorUndoAct()
{
}
-OTableEditorTypeSelUndoAct::OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, long 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();
@@ -212,10 +213,10 @@ void OTableEditorDelUndoAct::Redo()
}
OTableEditorInsUndoAct::OTableEditorInsUndoAct( OTableEditorCtrl* pOwner,
- long nInsertPosition ,
- const std::vector< std::shared_ptr<OTableRow> >& _vInsertedRows)
+ tools::Long nInsertPosition ,
+ std::vector< std::shared_ptr<OTableRow> >&& _vInsertedRows)
:OTableEditorUndoAct( pOwner,STR_TABED_UNDO_ROWINSERTED )
- ,m_vInsertedRows(_vInsertedRows)
+ ,m_vInsertedRows(std::move(_vInsertedRows))
,m_nInsPos( nInsertPosition )
{
}
@@ -240,7 +241,7 @@ void OTableEditorInsUndoAct::Undo()
void OTableEditorInsUndoAct::Redo()
{
// insert lines again
- long nInsertRow = m_nInsPos;
+ sal_Int32 nInsertRow = m_nInsPos;
std::shared_ptr<OTableRow> pRow;
std::vector< std::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList();
for (auto const& insertedRow : m_vInsertedRows)
@@ -256,7 +257,7 @@ void OTableEditorInsUndoAct::Redo()
OTableEditorUndoAct::Redo();
}
-OTableEditorInsNewUndoAct::OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, long nInsertPosition, long nInsertedRows ) :
+OTableEditorInsNewUndoAct::OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nInsertPosition, sal_Int32 nInsertedRows ) :
OTableEditorUndoAct( pOwner ,STR_TABED_UNDO_NEWROWINSERTED)
,m_nInsPos( nInsertPosition )
,m_nInsRows( nInsertedRows )
@@ -285,7 +286,7 @@ void OTableEditorInsNewUndoAct::Redo()
// insert lines again
std::vector< std::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList();
- for( long i=m_nInsPos; i<(m_nInsPos+m_nInsRows); i++ )
+ for( tools::Long i=m_nInsPos; i<(m_nInsPos+m_nInsRows); i++ )
pRowList->insert( pRowList->begin()+i,std::make_shared<OTableRow>() );
pTabEdCtrl->RowInserted( m_nInsPos, m_nInsRows );
@@ -310,20 +311,20 @@ void OPrimKeyUndoAct::Undo()
{
std::vector< std::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList();
std::shared_ptr<OTableRow> pRow;
- long nIndex;
+ tools::Long nIndex;
// delete inserted keys
- for( nIndex = m_aInsKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aInsKeys.NextSelected() )
+ for( nIndex = m_aInsKeys.FirstSelected(); nIndex != tools::Long(SFX_ENDOFSELECTION); nIndex=m_aInsKeys.NextSelected() )
{
- OSL_ENSURE(nIndex <= static_cast<long>(pRowList->size()),"Index for undo isn't valid!");
+ OSL_ENSURE(nIndex <= static_cast<tools::Long>(pRowList->size()),"Index for undo isn't valid!");
pRow = (*pRowList)[nIndex];
pRow->SetPrimaryKey( false );
}
// restore deleted keys
- for( nIndex = m_aDelKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aDelKeys.NextSelected() )
+ for( nIndex = m_aDelKeys.FirstSelected(); nIndex != tools::Long(SFX_ENDOFSELECTION); nIndex=m_aDelKeys.NextSelected() )
{
- OSL_ENSURE(nIndex <= static_cast<long>(pRowList->size()),"Index for undo isn't valid!");
+ OSL_ENSURE(nIndex <= static_cast<tools::Long>(pRowList->size()),"Index for undo isn't valid!");
pRow = (*pRowList)[nIndex];
pRow->SetPrimaryKey( true );
}
@@ -335,14 +336,14 @@ void OPrimKeyUndoAct::Undo()
void OPrimKeyUndoAct::Redo()
{
std::vector< std::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList();
- long nIndex;
+ tools::Long nIndex;
// delete the deleted keys
- for( nIndex = m_aDelKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aDelKeys.NextSelected() )
+ for( nIndex = m_aDelKeys.FirstSelected(); nIndex != tools::Long(SFX_ENDOFSELECTION); nIndex=m_aDelKeys.NextSelected() )
(*pRowList)[nIndex]->SetPrimaryKey( false );
// restore the inserted keys
- for( nIndex = m_aInsKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aInsKeys.NextSelected() )
+ for( nIndex = m_aInsKeys.FirstSelected(); nIndex != tools::Long(SFX_ENDOFSELECTION); nIndex=m_aInsKeys.NextSelected() )
(*pRowList)[nIndex]->SetPrimaryKey( true );
m_pEditorCtrl->InvalidateHandleColumn();
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.hxx b/dbaccess/source/ui/tabledesign/TableUndo.hxx
index d4beb0f5375c..1863555f7556 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.hxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEUNDO_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEUNDO_HXX
+#pragma once
#include <GeneralUndo.hxx>
#include <tools/multisel.hxx>
@@ -40,7 +39,7 @@ namespace dbaui
virtual void Undo() override;
virtual void Redo() override;
public:
- OTableDesignUndoAct(OTableRowView* pOwner, const char* pCommentID);
+ OTableDesignUndoAct(OTableRowView* pOwner, TranslateId pCommentID);
virtual ~OTableDesignUndoAct() override;
};
@@ -51,35 +50,35 @@ namespace dbaui
VclPtr<OTableEditorCtrl> pTabEdCtrl;
public:
- OTableEditorUndoAct(OTableEditorCtrl* pOwner, const char* pCommentID);
+ OTableEditorUndoAct(OTableEditorCtrl* pOwner, TranslateId pCommentID);
virtual ~OTableEditorUndoAct() override;
};
class OTableDesignCellUndoAct final : public OTableDesignUndoAct
{
sal_uInt16 m_nCol;
- long m_nRow;
+ sal_Int32 m_nRow;
css::uno::Any m_sOldText;
css::uno::Any m_sNewText;
virtual void Undo() override;
virtual void Redo() override;
public:
- OTableDesignCellUndoAct( OTableRowView* pOwner, long nRowID, sal_uInt16 nColumn );
+ OTableDesignCellUndoAct( OTableRowView* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn );
virtual ~OTableDesignCellUndoAct() override;
};
class OTableEditorTypeSelUndoAct final : public OTableEditorUndoAct
{
sal_uInt16 m_nCol;
- long m_nRow;
+ sal_Int32 m_nRow;
TOTypeInfoSP m_pOldType;
TOTypeInfoSP m_pNewType;
virtual void Undo() override;
virtual void Redo() override;
public:
- OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, long nRowID, sal_uInt16 nColumn, const TOTypeInfoSP& _pOldType );
+ OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nRowID, sal_uInt16 nColumn, TOTypeInfoSP _pOldType );
virtual ~OTableEditorTypeSelUndoAct() override;
};
@@ -97,26 +96,26 @@ namespace dbaui
class OTableEditorInsUndoAct final : public OTableEditorUndoAct
{
std::vector< std::shared_ptr<OTableRow> > m_vInsertedRows;
- long m_nInsPos;
+ tools::Long m_nInsPos;
virtual void Undo() override;
virtual void Redo() override;
public:
OTableEditorInsUndoAct( OTableEditorCtrl* pOwner,
- long nInsertPosition,
- const std::vector< std::shared_ptr<OTableRow> >& _vInsertedRows);
+ tools::Long nInsertPosition,
+ std::vector< std::shared_ptr<OTableRow> >&& _vInsertedRows);
virtual ~OTableEditorInsUndoAct() override;
};
class OTableEditorInsNewUndoAct final : public OTableEditorUndoAct
{
- long m_nInsPos;
- long m_nInsRows;
+ sal_Int32 m_nInsPos;
+ sal_Int32 m_nInsRows;
virtual void Undo() override;
virtual void Redo() override;
public:
- OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, long nInsertPosition, long nInsertedRows );
+ OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, sal_Int32 nInsertPosition, sal_Int32 nInsertedRows );
virtual ~OTableEditorInsNewUndoAct() override;
};
@@ -133,6 +132,5 @@ namespace dbaui
virtual ~OPrimKeyUndoAct() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEUNDO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
index a6ab43f483f7..51c3d2e9872e 100644
--- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
+++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
@@ -21,7 +21,6 @@
#include <unoadmin.hxx>
#include <advancedsettingsdlg.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/proparrhlp.hxx>
#include <vcl/svapp.hxx>
@@ -29,7 +28,6 @@ namespace dbaui
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
namespace {
@@ -74,12 +72,12 @@ namespace dbaui
OUString SAL_CALL OAdvancedSettingsDialog::getImplementationName()
{
- return "org.openoffice.comp.dbu.OAdvancedSettingsDialog";
+ return u"org.openoffice.comp.dbu.OAdvancedSettingsDialog"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL OAdvancedSettingsDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.AdvancedDatabaseSettingsDialog" };
+ return { u"com.sun.star.sdb.AdvancedDatabaseSettingsDialog"_ustr };
}
Reference<XPropertySetInfo> SAL_CALL OAdvancedSettingsDialog::getPropertySetInfo()
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
index 781fdd351d74..7e1fb6d8bdbc 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -19,9 +19,9 @@
#include "ColumnControl.hxx"
#include "ColumnPeer.hxx"
-#include <apitools.hxx>
+#include <strings.hxx>
+#include <vcl/window.hxx>
#include <com/sun/star/awt/PosSize.hpp>
-#include <comphelper/processfactory.hxx>
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_dbu_OColumnControl_get_implementation(
@@ -35,11 +35,10 @@ 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)
- :UnoControl(), m_xContext(rxContext)
+ : m_xContext(rxContext)
{
}
@@ -47,15 +46,23 @@ OUString SAL_CALL OColumnControl::getImplementationName()
{
return SERVICE_CONTROLDEFAULT;
}
-IMPLEMENT_SERVICE_INFO_SUPPORTS(OColumnControl)
+sal_Bool SAL_CALL OColumnControl::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
css::uno::Sequence< OUString > SAL_CALL OColumnControl::getSupportedServiceNames()
{
- return { "com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl" };
+ return { u"com.sun.star.awt.UnoControl"_ustr,u"com.sun.star.sdb.ColumnDescriptorControl"_ustr };
}
-OUString OColumnControl::GetComponentServiceName()
+OUString OColumnControl::GetComponentServiceName() const
{
- return "com.sun.star.sdb.ColumnDescriptorControl";
+ return u"com.sun.star.sdb.ColumnDescriptorControl"_ustr;
}
void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit*/, const Reference< XWindowPeer >& rParentPeer)
@@ -69,12 +76,12 @@ void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit
vcl::Window* pParentWin = nullptr;
if (rParentPeer.is())
{
- VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer);
+ VCLXWindow* pParent = dynamic_cast<VCLXWindow*>(rParentPeer.get());
if (pParent)
- pParentWin = pParent->GetWindow().get();
+ pParentWin = pParent->GetWindow();
}
- OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );
+ rtl::Reference<OColumnPeer> pPeer = new OColumnPeer( pParentWin, m_xContext );
OSL_ENSURE(pPeer != nullptr, "FmXGridControl::createPeer : imp_CreatePeer didn't return a peer !");
setPeer( pPeer );
diff --git a/dbaccess/source/ui/uno/ColumnControl.hxx b/dbaccess/source/ui/uno/ColumnControl.hxx
index 2b290cda9c78..63f06651284c 100644
--- a/dbaccess/source/ui/uno/ColumnControl.hxx
+++ b/dbaccess/source/ui/uno/ColumnControl.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNCONTROL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNCONTROL_HXX
+#pragma once
#include <connectivity/CommonTools.hxx>
#include <toolkit/controls/unocontrol.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
namespace com::sun::star::uno { class XComponentContext; }
@@ -35,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();
@@ -45,6 +43,4 @@ namespace dbaui
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNCONTROL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnModel.cxx b/dbaccess/source/ui/uno/ColumnModel.cxx
index cadc33075c9a..5ba3ce8a7e47 100644
--- a/dbaccess/source/ui/uno/ColumnModel.cxx
+++ b/dbaccess/source/ui/uno/ColumnModel.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <stringconstants.hxx>
+#include <strings.hxx>
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_dbu_OColumnControlModel_get_implementation(
@@ -81,7 +82,7 @@ void OColumnControlModel::registerProperties()
registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
&m_xColumn, cppu::UnoType<decltype(m_xColumn)>::get() );
- registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
+ registerMayBeVoidProperty( PROPERTY_TABSTOP2, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
&m_aTabStop, ::cppu::UnoType<sal_Int16>::get() );
registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
&m_sDefaultControl, cppu::UnoType<decltype(m_sDefaultControl)>::get() );
@@ -104,16 +105,45 @@ css::uno::Sequence<sal_Int8> OColumnControlModel::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
+css::uno::Sequence< css::uno::Type > OColumnControlModel::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OColumnControlModel_BASE::getTypes( ),
+ OPropertyContainer::getTypes( )
+ );
+}
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OColumnControlModel::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& OColumnControlModel::getInfoHelper()
+{
+ return *OColumnControlModel::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* OColumnControlModel::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
OUString SAL_CALL OColumnControlModel::getImplementationName()
{
- return "com.sun.star.comp.dbu.OColumnControlModel";
+ return u"com.sun.star.comp.dbu.OColumnControlModel"_ustr;
}
-IMPLEMENT_SERVICE_INFO_SUPPORTS(OColumnControlModel)
+sal_Bool SAL_CALL OColumnControlModel::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
css::uno::Sequence< OUString > SAL_CALL OColumnControlModel::getSupportedServiceNames()
{
- return { "com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel" };
+ return { u"com.sun.star.awt.UnoControlModel"_ustr,u"com.sun.star.sdb.ColumnDescriptorControlModel"_ustr };
}
IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType )
diff --git a/dbaccess/source/ui/uno/ColumnModel.hxx b/dbaccess/source/ui/uno/ColumnModel.hxx
index 0cbdbd1b33f6..ea31881ff09a 100644
--- a/dbaccess/source/ui/uno/ColumnModel.hxx
+++ b/dbaccess/source/ui/uno/ColumnModel.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNMODEL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNMODEL_HXX
+#pragma once
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -30,7 +29,6 @@
#include <comphelper/uno3.hxx>
#include <cppuhelper/compbase4.hxx>
#include <connectivity/CommonTools.hxx>
-#include <apitools.hxx>
namespace dbaui
{
@@ -42,8 +40,6 @@ typedef ::cppu::WeakAggComponentImplHelper4 < css::awt::XControlModel
, css::io::XPersistObject
> OColumnControlModel_BASE;
-class OColumnControlModel;
-
class OColumnControlModel : public ::comphelper::OMutexAndBroadcastHelper
,public ::comphelper::OPropertyContainer
,public ::comphelper::OPropertyArrayUsageHelper< OColumnControlModel >
@@ -86,12 +82,14 @@ public:
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream>& _rxInStream) override;
// OPropertyArrayUsageHelper
- DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNMODEL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx
index 9dc357eb2a8c..1e03cda49331 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)
@@ -36,7 +34,7 @@ OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext
{
osl_atomic_increment( &m_refCount );
{
- VclPtrInstance<OColumnControlWindow> pFieldControl(_pParent, _rxContext);
+ VclPtrInstance<OColumnControlTopLevel> pFieldControl(_pParent, _rxContext);
pFieldControl->SetComponentInterface(this);
pFieldControl->Show();
}
@@ -46,19 +44,21 @@ OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext
void OColumnPeer::setEditWidth(sal_Int32 _nWidth)
{
SolarMutexGuard aGuard;
- VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
+ VclPtr<OColumnControlTopLevel> pFieldControl = GetAs<OColumnControlTopLevel>();
if ( pFieldControl )
- pFieldControl->setEditWidth(_nWidth);
+ pFieldControl->GetControl().setEditWidth(_nWidth);
}
void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
{
SolarMutexGuard aGuard;
- VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
+ VclPtr<OColumnControlTopLevel> pFieldControl = GetAs<OColumnControlTopLevel>();
if ( !pFieldControl )
return;
+ OColumnControlWindow& rControl = pFieldControl->GetControl();
+
if ( m_pActFieldDescr )
{
delete m_pActFieldDescr;
@@ -88,22 +88,22 @@ void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
m_pActFieldDescr = new OFieldDescription(_xColumn,true);
// search for type
bool bForce;
- TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,"x",nPrecision,nScale,bAutoIncrement,bForce);
+ TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*rControl.getTypeInfo(),nType,sTypeName,u"x"_ustr,nPrecision,nScale,bAutoIncrement,bForce);
if ( !pTypeInfo )
- pTypeInfo = pFieldControl->getDefaultTyp();
+ pTypeInfo = rControl.getDefaultTyp();
m_pActFieldDescr->FillFromTypeInfo(pTypeInfo,true,false);
m_xColumn = _xColumn;
}
- pFieldControl->DisplayData(m_pActFieldDescr);
+ rControl.DisplayData(m_pActFieldDescr);
}
void OColumnPeer::setConnection(const Reference< XConnection>& _xCon)
{
SolarMutexGuard aGuard;
- VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
+ VclPtr<OColumnControlTopLevel> pFieldControl = GetAs<OColumnControlTopLevel>();
if ( pFieldControl )
- pFieldControl->setConnection(_xCon);
+ pFieldControl->GetControl().setConnection(_xCon);
}
void OColumnPeer::setProperty( const OUString& _rPropertyName, const Any& Value)
@@ -127,14 +127,14 @@ void OColumnPeer::setProperty( const OUString& _rPropertyName, const Any& Value)
Any OColumnPeer::getProperty( const OUString& _rPropertyName )
{
Any aProp;
- VclPtr< OFieldDescControl > pFieldControl = GetAs< OFieldDescControl >();
+ VclPtr<OColumnControlTopLevel> pFieldControl = GetAs<OColumnControlTopLevel>();
if (pFieldControl && _rPropertyName == PROPERTY_COLUMN)
{
aProp <<= m_xColumn;
}
else if (pFieldControl && _rPropertyName == PROPERTY_ACTIVE_CONNECTION)
{
- aProp <<= pFieldControl->getConnection();
+ aProp <<= pFieldControl->GetControl().getConnection();
}
else
aProp = VCLXWindow::getProperty(_rPropertyName);
diff --git a/dbaccess/source/ui/uno/ColumnPeer.hxx b/dbaccess/source/ui/uno/ColumnPeer.hxx
index 91ebbdc7fc50..8a92a40cdf80 100644
--- a/dbaccess/source/ui/uno/ColumnPeer.hxx
+++ b/dbaccess/source/ui/uno/ColumnPeer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNPEER_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNPEER_HXX
+#pragma once
#include <toolkit/awt/vclxwindow.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -44,6 +43,5 @@ namespace dbaui
virtual css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
};
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNPEER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
index 3d07cd48d993..dc7f25c96db6 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
@@ -19,7 +19,6 @@
#include "DBTypeWizDlg.hxx"
#include <dbwiz.hxx>
-#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
using namespace dbaui;
@@ -35,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)
@@ -50,12 +48,12 @@ Sequence<sal_Int8> SAL_CALL ODBTypeWizDialog::getImplementationId( )
OUString SAL_CALL ODBTypeWizDialog::getImplementationName()
{
- return "org.openoffice.comp.dbu.ODBTypeWizDialog";
+ return u"org.openoffice.comp.dbu.ODBTypeWizDialog"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL ODBTypeWizDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.DataSourceTypeChangeDialog" };
+ return { u"com.sun.star.sdb.DataSourceTypeChangeDialog"_ustr };
}
Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo()
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
index 95f34bcbbd38..093981a0e50b 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLG_HXX
+#pragma once
#include <unoadmin.hxx>
@@ -54,6 +53,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
index 1408e4f0046f..4ed229a3b9d7 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
@@ -21,7 +21,6 @@
#include <dbwizsetup.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
using namespace dbaui;
@@ -37,19 +36,17 @@ 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)
,m_bOpenDatabase(true)
,m_bStartTableWizard(false)
{
- registerProperty("OpenDatabase", 3, PropertyAttribute::TRANSIENT,
+ registerProperty(u"OpenDatabase"_ustr, 3, PropertyAttribute::TRANSIENT,
&m_bOpenDatabase, cppu::UnoType<bool>::get());
- registerProperty("StartTableWizard", 4, PropertyAttribute::TRANSIENT,
+ registerProperty(u"StartTableWizard"_ustr, 4, PropertyAttribute::TRANSIENT,
&m_bStartTableWizard, cppu::UnoType<bool>::get());
}
@@ -60,12 +57,12 @@ Sequence<sal_Int8> SAL_CALL ODBTypeWizDialogSetup::getImplementationId( )
OUString SAL_CALL ODBTypeWizDialogSetup::getImplementationName()
{
- return "org.openoffice.comp.dbu.ODBTypeWizDialogSetup";
+ return u"org.openoffice.comp.dbu.ODBTypeWizDialogSetup"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL ODBTypeWizDialogSetup::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.DatabaseWizardDialog" };
+ return { u"com.sun.star.sdb.DatabaseWizardDialog"_ustr };
}
Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo()
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
index a532974550f1..56bd9a08ac24 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLGSETUP_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLGSETUP_HXX
+#pragma once
#include <unoadmin.hxx>
@@ -57,6 +56,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLGSETUP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx
index 7d3a5a61a274..740566aa3873 100644
--- a/dbaccess/source/ui/uno/TableFilterDlg.cxx
+++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx
@@ -19,7 +19,6 @@
#include "TableFilterDlg.hxx"
#include <TablesSingleDlg.hxx>
-#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
using namespace dbaui;
@@ -35,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)
@@ -50,12 +48,12 @@ Sequence<sal_Int8> SAL_CALL OTableFilterDialog::getImplementationId( )
OUString SAL_CALL OTableFilterDialog::getImplementationName()
{
- return "org.openoffice.comp.dbu.OTableFilterDialog";
+ return u"org.openoffice.comp.dbu.OTableFilterDialog"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL OTableFilterDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.TableFilterDialog" };
+ return { u"com.sun.star.sdb.TableFilterDialog"_ustr };
}
Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo()
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.hxx b/dbaccess/source/ui/uno/TableFilterDlg.hxx
index 558ee5175a47..7c16a7f26819 100644
--- a/dbaccess/source/ui/uno/TableFilterDlg.hxx
+++ b/dbaccess/source/ui/uno/TableFilterDlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_TABLEFILTERDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_TABLEFILTERDLG_HXX
+#pragma once
#include <unoadmin.hxx>
@@ -55,6 +54,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_TABLEFILTERDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
index 8000add8def5..a0467de67d68 100644
--- a/dbaccess/source/ui/uno/UserSettingsDlg.cxx
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
@@ -19,7 +19,6 @@
#include "UserSettingsDlg.hxx"
#include <UserAdminDlg.hxx>
-#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
using namespace dbaui;
@@ -35,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)
@@ -50,12 +48,12 @@ Sequence<sal_Int8> SAL_CALL OUserSettingsDialog::getImplementationId( )
OUString SAL_CALL OUserSettingsDialog::getImplementationName()
{
- return "org.openoffice.comp.dbu.OUserSettingsDialog";
+ return u"org.openoffice.comp.dbu.OUserSettingsDialog"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL OUserSettingsDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.UserAdministrationDialog" };
+ return { u"com.sun.star.sdb.UserAdministrationDialog"_ustr };
}
Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo()
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.hxx b/dbaccess/source/ui/uno/UserSettingsDlg.hxx
index c29e9cf26a43..7e0780ea2bd7 100644
--- a/dbaccess/source/ui/uno/UserSettingsDlg.hxx
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_USERSETTINGSDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_USERSETTINGSDLG_HXX
+#pragma once
#include <unoadmin.hxx>
@@ -55,6 +54,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_USERSETTINGSDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx
index bd9de4b36aa7..1d396986c243 100644
--- a/dbaccess/source/ui/uno/admindlg.cxx
+++ b/dbaccess/source/ui/uno/admindlg.cxx
@@ -19,48 +19,45 @@
#include "admindlg.hxx"
#include <dbadmin.hxx>
-#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
using namespace dbaui;
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
org_openoffice_comp_dbu_ODatasourceAdministrationDialog_get_implementation(
- css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new ODataSourcePropertyDialog(context));
}
namespace dbaui
{
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::beans;
-
-ODataSourcePropertyDialog::ODataSourcePropertyDialog(const Reference< XComponentContext >& _rxORB)
- :ODatabaseAdministrationDialog(_rxORB)
+ODataSourcePropertyDialog::ODataSourcePropertyDialog(const Reference<XComponentContext>& _rxORB)
+ : ODatabaseAdministrationDialog(_rxORB)
{
}
-Sequence<sal_Int8> SAL_CALL ODataSourcePropertyDialog::getImplementationId( )
+Sequence<sal_Int8> SAL_CALL ODataSourcePropertyDialog::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
}
OUString SAL_CALL ODataSourcePropertyDialog::getImplementationName()
{
- return "org.openoffice.comp.dbu.ODatasourceAdministrationDialog";
+ return u"org.openoffice.comp.dbu.ODatasourceAdministrationDialog"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL ODataSourcePropertyDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.DatasourceAdministrationDialog" };
+ return { u"com.sun.star.sdb.DatasourceAdministrationDialog"_ustr };
}
-Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetInfo()
+Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetInfo()
{
- Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ Reference<XPropertySetInfo> xInfo(createPropertySetInfo(getInfoHelper()));
return xInfo;
}
@@ -69,24 +66,26 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI
return *getArrayHelper();
}
-::cppu::IPropertyArrayHelper* ODataSourcePropertyDialog::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper* ODataSourcePropertyDialog::createArrayHelper() const
{
- Sequence< Property > aProps;
+ Sequence<Property> aProps;
describeProperties(aProps);
return new ::cppu::OPropertyArrayHelper(aProps);
}
-std::unique_ptr<weld::DialogController> ODataSourcePropertyDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+std::unique_ptr<weld::DialogController>
+ODataSourcePropertyDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{
- std::unique_ptr<ODbAdminDialog> xDialog(new ODbAdminDialog(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext));
+ std::unique_ptr<ODbAdminDialog> xDialog(new ODbAdminDialog(
+ Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext));
// the initial selection
- if ( m_aInitialSelection.hasValue() )
+ if (m_aInitialSelection.hasValue())
xDialog->selectDataSource(m_aInitialSelection);
return xDialog;
}
-} // namespace dbaui
+} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/admindlg.hxx b/dbaccess/source/ui/uno/admindlg.hxx
index 1560a9a66476..62faabf64f90 100644
--- a/dbaccess/source/ui/uno/admindlg.hxx
+++ b/dbaccess/source/ui/uno/admindlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_ADMINDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_ADMINDLG_HXX
+#pragma once
#include <unoadmin.hxx>
@@ -54,6 +53,4 @@ private:
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_ADMINDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx
index 433b588d69b2..7af65ef8ebbe 100644
--- a/dbaccess/source/ui/uno/composerdialogs.cxx
+++ b/dbaccess/source/ui/uno/composerdialogs.cxx
@@ -24,9 +24,9 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <queryfilter.hxx>
#include <queryorder.hxx>
-#include <comphelper/processfactory.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>
@@ -49,11 +49,10 @@ namespace dbaui
#define PROPERTY_ID_QUERYCOMPOSER 100
#define PROPERTY_ID_ROWSET 101
-#define PROPERTY_QUERYCOMPOSER "QueryComposer"
-#define PROPERTY_ROWSET "RowSet"
+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;
@@ -81,7 +80,21 @@ namespace dbaui
return css::uno::Sequence<sal_Int8>();
}
- IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ComposerDialog )
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ComposerDialog::getPropertySetInfo()
+ {
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+ ::cppu::IPropertyArrayHelper& ComposerDialog::getInfoHelper()
+ {
+ return *ComposerDialog::getArrayHelper();
+ }
+ ::cppu::IPropertyArrayHelper* ComposerDialog::createArrayHelper( ) const
+ {
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+ }
std::unique_ptr<weld::DialogController> ComposerDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{
@@ -140,12 +153,20 @@ namespace dbaui
OUString SAL_CALL RowsetFilterDialog::getImplementationName()
{
- return "com.sun.star.uno.comp.sdb.RowsetFilterDialog";
+ return u"com.sun.star.uno.comp.sdb.RowsetFilterDialog"_ustr;
+ }
+ sal_Bool SAL_CALL RowsetFilterDialog::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
}
- IMPLEMENT_SERVICE_INFO_SUPPORTS(RowsetFilterDialog)
css::uno::Sequence< OUString > SAL_CALL RowsetFilterDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.FilterDialog" };
+ return { u"com.sun.star.sdb.FilterDialog"_ustr };
}
std::unique_ptr<weld::GenericDialogController> RowsetFilterDialog::createComposerDialog(weld::Window* _pParent, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxColumns )
@@ -164,9 +185,9 @@ namespace dbaui
aArguments[1] >>= xRowSet;
Reference<css::awt::XWindow> xParentWindow;
aArguments[2] >>= xParentWindow;
- setPropertyValue( "QueryComposer", makeAny( xQueryComposer ) );
- setPropertyValue( "RowSet", makeAny( xRowSet ) );
- setPropertyValue( "ParentWindow", makeAny( xParentWindow ) );
+ setPropertyValue( u"QueryComposer"_ustr, Any( xQueryComposer ) );
+ setPropertyValue( u"RowSet"_ustr, Any( xRowSet ) );
+ setPropertyValue( u"ParentWindow"_ustr, Any( xParentWindow ) );
}
else
ComposerDialog::initialize(aArguments);
@@ -188,12 +209,20 @@ namespace dbaui
OUString SAL_CALL RowsetOrderDialog::getImplementationName()
{
- return "com.sun.star.uno.comp.sdb.RowsetOrderDialog";
+ return u"com.sun.star.uno.comp.sdb.RowsetOrderDialog"_ustr;
+ }
+ sal_Bool SAL_CALL RowsetOrderDialog::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
}
- IMPLEMENT_SERVICE_INFO_SUPPORTS(RowsetOrderDialog)
css::uno::Sequence< OUString > SAL_CALL RowsetOrderDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.OrderDialog" };
+ return { u"com.sun.star.sdb.OrderDialog"_ustr };
}
std::unique_ptr<weld::GenericDialogController> RowsetOrderDialog::createComposerDialog(weld::Window* pParent, const Reference< XConnection >& rxConnection, const Reference< XNameAccess >& rxColumns)
@@ -209,13 +238,13 @@ namespace dbaui
aArguments[0] >>= xQueryComposer;
Reference<css::beans::XPropertySet> xRowSet;
aArguments[1] >>= xRowSet;
- setPropertyValue( "QueryComposer", makeAny( xQueryComposer ) );
- setPropertyValue( "RowSet", makeAny( xRowSet ) );
+ setPropertyValue( u"QueryComposer"_ustr, Any( xQueryComposer ) );
+ setPropertyValue( u"RowSet"_ustr, Any( xRowSet ) );
if (aArguments.getLength() == 3)
{
Reference<css::awt::XWindow> xParentWindow;
aArguments[2] >>= xParentWindow;
- setPropertyValue("ParentWindow", makeAny(xParentWindow));
+ setPropertyValue(u"ParentWindow"_ustr, Any(xParentWindow));
}
}
else
diff --git a/dbaccess/source/ui/uno/composerdialogs.hxx b/dbaccess/source/ui/uno/composerdialogs.hxx
index 3018c7a16ac2..4e71b1c64704 100644
--- a/dbaccess/source/ui/uno/composerdialogs.hxx
+++ b/dbaccess/source/ui/uno/composerdialogs.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_COMPOSERDIALOGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COMPOSERDIALOGS_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -28,7 +27,6 @@
#include <comphelper/proparrhlp.hxx>
#include <connectivity/CommonTools.hxx>
#include <svtools/genericunodialog.hxx>
-#include <apitools.hxx>
namespace dbaui
{
@@ -56,7 +54,9 @@ namespace dbaui
public:
virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
- DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
protected:
// own overridables
@@ -120,6 +120,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COMPOSERDIALOGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index fedcb407f7d7..13a4f050731b 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -59,12 +59,13 @@
#include <connectivity/dbtools.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.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;
@@ -338,7 +338,7 @@ private:
// other
Reference< XInteractionHandler > m_xInteractionHandler;
- ::comphelper::OInterfaceContainerHelper2
+ ::comphelper::OInterfaceContainerHelper3<XCopyTableListener>
m_aCopyTableListeners;
sal_Int16 m_nOverrideExecutionResult;
};
@@ -370,16 +370,10 @@ CopyTableWizard::CopyTableWizard( const Reference< XComponentContext >& _rxORB )
:CopyTableWizard_Base( _rxORB )
,m_xContext( _rxORB )
,m_nOperation( CopyTableOperation::CopyDefinitionAndData )
- ,m_sDestinationTable()
- ,m_aPrimaryKeyName( false, "ID" )
+ ,m_aPrimaryKeyName( false, u"ID"_ustr )
,m_bUseHeaderLineAsColumnNames( true )
- ,m_xSourceConnection()
,m_nCommandType( CommandType::COMMAND )
- ,m_pSourceObject()
- ,m_xSourceResultSet()
- ,m_aSourceSelection()
,m_bSourceSelectionBookmarks( true )
- ,m_xDestConnection()
,m_aCopyTableListeners( m_aMutex )
,m_nOverrideExecutionResult( -1 )
{
@@ -404,12 +398,12 @@ CopyTableWizard::~CopyTableWizard()
OUString SAL_CALL CopyTableWizard::getImplementationName()
{
- return "org.openoffice.comp.dbu.CopyTableWizard";
+ return u"org.openoffice.comp.dbu.CopyTableWizard"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL CopyTableWizard::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.application.CopyTableWizard" };
+ return { u"com.sun.star.sdb.application.CopyTableWizard"_ustr };
}
Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo()
@@ -578,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;
@@ -623,7 +616,7 @@ Reference< XPropertySet > CopyTableWizard::impl_ensureDataAccessDescriptor_throw
{
Reference< XServiceInfo > xSI( xDescriptor, UNO_QUERY );
bIsValid = ( xSI.is()
- && xSI->supportsService( "com.sun.star.sdb.DataAccessDescriptor" ) );
+ && xSI->supportsService( u"com.sun.star.sdb.DataAccessDescriptor"_ustr ) );
}
// it must be able to provide a connection
@@ -666,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)
{
@@ -699,7 +692,7 @@ std::unique_ptr< ICopyTableSourceObject > CopyTableWizard::impl_extractSourceObj
if ( !xPSI->hasPropertyByName( PROPERTY_COMMAND )
|| !xPSI->hasPropertyByName( PROPERTY_COMMAND_TYPE )
)
- throw IllegalArgumentException("Expecting a table or query specification.",
+ throw IllegalArgumentException(u"Expecting a table or query specification."_ustr,
// TODO: resource
*const_cast< CopyTableWizard* >( this ), 1);
@@ -775,7 +768,7 @@ void CopyTableWizard::impl_extractSourceResultSet_throw( const Reference< XPrope
const bool bHasResultSet = m_xSourceResultSet.is();
const bool bHasSelection = m_aSourceSelection.hasElements();
if ( bHasSelection && !bHasResultSet )
- throw IllegalArgumentException("A result set is needed when specifying a selection to copy.",
+ throw IllegalArgumentException(u"A result set is needed when specifying a selection to copy."_ustr,
// TODO: resource
*this, 1);
@@ -805,84 +798,84 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference<
do
{
- Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW );
- // if there's an ActiveConnection, use it
- if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) )
- {
- Reference< XConnection > xPure;
- OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure );
- xConnection.reset( xPure, SharedConnection::NoTakeOwnership );
- }
- if ( xConnection.is() )
- {
- xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler );
- SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" );
- break;
- }
-
- // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource
- OUString sDataSource, sDatabaseLocation;
- if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) )
- OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource );
- if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) )
- OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation );
-
- // need a DatabaseContext for loading the data source
- Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext );
- Reference< XDataSource > xDataSource;
- if ( !sDataSource.isEmpty() )
- xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW );
- if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() )
- xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW );
-
- if ( xDataSource.is() )
- {
- // first, try connecting with completion
- xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler );
- SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" );
- if ( xInteractionHandler.is() )
+ // if there's an ActiveConnection, use it
+ if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) )
{
- Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY );
- if ( xInteractiveConnection.is() )
- xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership );
+ Reference< XConnection > xPure;
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure );
+ xConnection.reset( xPure, SharedConnection::NoTakeOwnership );
}
+ if ( xConnection.is() )
+ {
+ xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler );
+ SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" );
+ break;
+ }
+
+ // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource
+ OUString sDataSource, sDatabaseLocation;
+ if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource );
+ if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation );
+
+ // need a DatabaseContext for loading the data source
+ Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext );
+ Reference< XDataSource > xDataSource;
+ if ( !sDataSource.isEmpty() )
+ xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW );
+ if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() )
+ xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW );
- // interactively connecting was not successful or possible -> connect without interaction
- if ( !xConnection.is() )
+ if ( xDataSource.is() )
{
- xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership );
+ // first, try connecting with completion
+ xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler );
+ SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" );
+ if ( xInteractionHandler.is() )
+ {
+ Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY );
+ if ( xInteractiveConnection.is() )
+ xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership );
+ }
+
+ // interactively connecting was not successful or possible -> connect without interaction
+ if ( !xConnection.is() )
+ {
+ xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership );
+ }
}
- }
- if ( xConnection.is() )
- break;
+ if ( xConnection.is() )
+ break;
- // finally, there could be a ConnectionResource/ConnectionInfo
- OUString sConnectionResource;
- Sequence< PropertyValue > aConnectionInfo;
- if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) )
- OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource );
- if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) )
- OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo );
-
- Reference< XDriverManager > xDriverManager;
- try {
- xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW );
- } catch( const Exception& ) { }
- if ( !xDriverManager.is() )
- // no connection pool installed
- xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW );
-
- if ( aConnectionInfo.hasElements() )
- xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW );
- else
- xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW );
+ // finally, there could be a ConnectionResource/ConnectionInfo
+ OUString sConnectionResource;
+ Sequence< PropertyValue > aConnectionInfo;
+ if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource );
+ if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo );
+
+ Reference< XDriverManager > xDriverManager;
+ try {
+ xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW );
+ } catch( const Exception& ) { }
+ if ( !xDriverManager.is() )
+ // no connection pool installed
+ xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW );
+
+ if ( aConnectionInfo.hasElements() )
+ xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW );
+ else
+ xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW );
}
while ( false );
if ( xInteractionHandler != m_xInteractionHandler )
- _out_rxDocInteractionHandler = xInteractionHandler;
+ _out_rxDocInteractionHandler = std::move(xInteractionHandler);
return xConnection;
}
@@ -891,7 +884,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference<
{
OSL_PRECOND( m_xSourceConnection.is(), "CopyTableWizard::impl_createSourceStatement_throw: illegal call!" );
if ( !m_xSourceConnection.is() )
- throw RuntimeException( "CopyTableWizard::impl_createSourceStatement_throw: illegal call!", *const_cast< CopyTableWizard* >( this ));
+ throw RuntimeException( u"CopyTableWizard::impl_createSourceStatement_throw: illegal call!"_ustr, *const_cast< CopyTableWizard* >( this ));
::utl::SharedUNOComponent< XPreparedStatement > xStatement;
switch ( m_nCommandType )
@@ -937,7 +930,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference<
default:
// this should not have survived initialization phase
- throw RuntimeException("No case matched, this should not have survived the initialization phase", *const_cast< CopyTableWizard* >( this ));
+ throw RuntimeException(u"No case matched, this should not have survived the initialization phase"_ustr, *const_cast< CopyTableWizard* >( this ));
}
return xStatement;
@@ -948,40 +941,39 @@ namespace
class ValueTransfer
{
public:
- ValueTransfer( const sal_Int32& _rSourcePos, const sal_Int32& _rDestPos, const 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( _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;
};
@@ -989,13 +981,12 @@ namespace
bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent )
{
- Reference< XCopyTableListener > xListener;
try
{
- ::comphelper::OInterfaceIteratorHelper2 aIter( m_aCopyTableListeners );
+ ::comphelper::OInterfaceIteratorHelper3 aIter( m_aCopyTableListeners );
while ( aIter.hasMoreElements() )
{
- xListener.set( aIter.next(), UNO_QUERY_THROW );
+ Reference< XCopyTableListener > xListener( aIter.next() );
sal_Int16 nListenerChoice = xListener->copyRowError( _rEvent );
switch ( nListenerChoice )
{
@@ -1020,35 +1011,31 @@ 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.get() );
+ xRequest->addContinuation( xYes );
xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
OSL_ENSURE( m_xInteractionHandler.is(),
"CopyTableWizard::impl_processCopyError_nothrow: we always should have an interaction handler!" );
if ( m_xInteractionHandler.is() )
- m_xInteractionHandler->handle( xRequest.get() );
+ m_xInteractionHandler->handle( xRequest );
if ( xYes->wasSelected() )
// continue copying
@@ -1068,12 +1055,13 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
{
OSL_PRECOND( m_xDestConnection.is(), "CopyTableWizard::impl_copyRows_throw: illegal call!" );
if ( !m_xDestConnection.is() )
- throw RuntimeException( "m_xDestConnection is set to null, CopyTableWizard::impl_copyRows_throw: illegal call!", *this );
+ throw RuntimeException( u"m_xDestConnection is set to null, CopyTableWizard::impl_copyRows_throw: illegal call!"_ustr, *this );
Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_SET_THROW );
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 );
@@ -1098,12 +1086,12 @@ 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();
- const Any* pSelectedRow = m_aSourceSelection.getConstArray();
- const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength();
+ const Any* pSelectedRow = m_aSourceSelection.begin();
+ const Any* pSelEnd = m_aSourceSelection.end();
sal_Int32 nRowCount = 0;
bool bContinue = false;
@@ -1145,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, 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;
@@ -1162,9 +1150,17 @@ 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::throwSQLException(u"Internal error: invalid column type index."_ustr,
::dbtools::StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this);
}
@@ -1172,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:
@@ -1180,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:
@@ -1263,6 +1259,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
}
catch( const Exception& )
{
+ TOOLS_WARN_EXCEPTION("dbaccess", "");
aCopyEvent.Error = ::cppu::getCaughtException();
}
@@ -1354,6 +1351,53 @@ void CopyTableWizard::impl_doCopy_nothrow()
if ( xSourceResultSet.is() )
impl_copyRows_throw( xSourceResultSet, xTable );
+
+ // tdf#119962
+ const Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_SET_THROW );
+ 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(u"SchemaName"_ustr) >>= aSchema;
+ xTable->getPropertyValue(u"Name"_ustr) >>= aTable;
+ Any aCatalog = xTable->getPropertyValue(u"CatalogName"_ustr);
+
+ const Reference< XResultSet > xResultPKCL(xDestMetaData->getPrimaryKeys(aCatalog,aSchema,aTable));
+ Reference< XRow > xRowPKCL(xResultPKCL, UNO_QUERY_THROW);
+ OUString sPKCL;
+ if ( xRowPKCL.is() )
+ {
+ if (xResultPKCL->next())
+ {
+ sPKCL = xRowPKCL->getString(4);
+ }
+ }
+
+ 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);
+
+ 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);
+
+ m_xDestConnection->createStatement()->execute(strSql);
+ }
+ }
+ }
}
break;
@@ -1369,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;
@@ -1384,7 +1429,7 @@ void CopyTableWizard::impl_doCopy_nothrow()
try
{
::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( aError ) );
- m_xInteractionHandler->handle( xRequest.get() );
+ m_xInteractionHandler->handle( xRequest );
}
catch( const Exception& )
{
@@ -1407,11 +1452,11 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference<
{
if ( !sColumns.isEmpty() )
sColumns.append(",");
- sColumns.append(sQuote).append(aDestColumnNames[rColumnPositionPair.second - 1]).append(sQuote);
+ sColumns.append(sQuote + aDestColumnNames[rColumnPositionPair.second - 1] + sQuote);
}
}
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;
}
@@ -1454,12 +1499,12 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler );
if ( xDestDocHandler.is() && !m_xInteractionHandler.is() )
- m_xInteractionHandler = xDestDocHandler;
+ m_xInteractionHandler = std::move(xDestDocHandler);
Reference< XPropertySet > xInteractionHandler(m_xInteractionHandler, UNO_QUERY);
if (xInteractionHandler.is())
{
- Any aParentWindow(xInteractionHandler->getPropertyValue("ParentWindow"));
+ Any aParentWindow(xInteractionHandler->getPropertyValue(u"ParentWindow"_ustr));
aParentWindow >>= m_xParent;
}
}
diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx
index b33c068483e7..f06e03572cc9 100644
--- a/dbaccess/source/ui/uno/dbinteraction.cxx
+++ b/dbaccess/source/ui/uno/dbinteraction.cxx
@@ -18,8 +18,7 @@
*/
#include "dbinteraction.hxx"
-#include <apitools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <connectivity/dbexception.hxx>
#include <sqlmessage.hxx>
@@ -34,7 +33,6 @@
#include <paramdialog.hxx>
#include <vcl/svapp.hxx>
#include <CollectionView.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -56,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
@@ -73,7 +69,7 @@ namespace dbaui
void SAL_CALL BasicInteractionHandler::initialize(const Sequence<Any>& rArgs)
{
comphelper::SequenceAsHashMap aMap(rArgs);
- m_xParentWindow.set(aMap.getValue("Parent"), UNO_QUERY);
+ m_xParentWindow.set(aMap.getValue(u"Parent"_ustr), UNO_QUERY);
}
sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest )
@@ -311,33 +307,32 @@ namespace dbaui
sal_Int32 BasicInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations)
{
- const Reference< XInteractionContinuation >* pContinuations = _rContinuations.getConstArray();
- for (sal_Int32 i=0; i<_rContinuations.getLength(); ++i, ++pContinuations)
+ for (sal_Int32 i = 0; i < _rContinuations.getLength(); ++i)
{
switch (_eCont)
{
case APPROVE:
- if (Reference< XInteractionApprove >(*pContinuations, UNO_QUERY).is())
+ if (Reference<XInteractionApprove>(_rContinuations[i], UNO_QUERY).is())
return i;
break;
case DISAPPROVE:
- if (Reference< XInteractionDisapprove >(*pContinuations, UNO_QUERY).is())
+ if (Reference<XInteractionDisapprove>(_rContinuations[i], UNO_QUERY).is())
return i;
break;
case RETRY:
- if (Reference< XInteractionRetry >(*pContinuations, UNO_QUERY).is())
+ if (Reference<XInteractionRetry>(_rContinuations[i], UNO_QUERY).is())
return i;
break;
case ABORT:
- if (Reference< XInteractionAbort >(*pContinuations, UNO_QUERY).is())
+ if (Reference<XInteractionAbort>(_rContinuations[i], UNO_QUERY).is())
return i;
break;
case SUPPLY_PARAMETERS:
- if (Reference< XInteractionSupplyParameters >(*pContinuations, UNO_QUERY).is())
+ if (Reference<XInteractionSupplyParameters>(_rContinuations[i], UNO_QUERY).is())
return i;
break;
case SUPPLY_DOCUMENTSAVE:
- if (Reference< XInteractionDocumentSave >(*pContinuations, UNO_QUERY).is())
+ if (Reference<XInteractionDocumentSave>(_rContinuations[i], UNO_QUERY).is())
return i;
break;
}
@@ -349,23 +344,39 @@ namespace dbaui
// SQLExceptionInteractionHandler
OUString SAL_CALL SQLExceptionInteractionHandler::getImplementationName()
{
- return "com.sun.star.comp.dbaccess.DatabaseInteractionHandler";
+ return u"com.sun.star.comp.dbaccess.DatabaseInteractionHandler"_ustr;
+ }
+ sal_Bool SAL_CALL SQLExceptionInteractionHandler::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
}
- IMPLEMENT_SERVICE_INFO_SUPPORTS(SQLExceptionInteractionHandler)
css::uno::Sequence< OUString > SAL_CALL SQLExceptionInteractionHandler::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.DatabaseInteractionHandler" };
+ return { u"com.sun.star.sdb.DatabaseInteractionHandler"_ustr };
}
// LegacyInteractionHandler
OUString SAL_CALL LegacyInteractionHandler::getImplementationName()
{
- return "com.sun.star.comp.dbaccess.LegacyInteractionHandler";
+ return u"com.sun.star.comp.dbaccess.LegacyInteractionHandler"_ustr;
+ }
+ sal_Bool SAL_CALL LegacyInteractionHandler::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
}
- IMPLEMENT_SERVICE_INFO_SUPPORTS(LegacyInteractionHandler)
css::uno::Sequence< OUString > SAL_CALL LegacyInteractionHandler::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.InteractionHandler" };
+ return { u"com.sun.star.sdb.InteractionHandler"_ustr };
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx
index 386023124af4..fdb0dbd2c946 100644
--- a/dbaccess/source/ui/uno/dbinteraction.hxx
+++ b/dbaccess/source/ui/uno/dbinteraction.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <connectivity/CommonTools.hxx>
@@ -27,7 +26,6 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/task/XInteractionHandler2.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/ParametersRequest.hpp>
#include <com/sun/star/sdb/DocumentSaveRequest.hpp>
@@ -167,6 +165,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
index a846d44b71dd..7f0053310be8 100644
--- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
+++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
@@ -18,16 +18,13 @@
*/
#include <textconnectionsettings.hxx>
-#include <apitools.hxx>
#include <unoadmin.hxx>
#include <stringconstants.hxx>
#include <propertystorage.hxx>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdb/XTextConnectionSettings.hpp>
-#include <comphelper/processfactory.hxx>
#include <comphelper/proparrhlp.hxx>
#include <connectivity/CommonTools.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -65,7 +62,6 @@ namespace dbaui
class OTextConnectionSettingsDialog
:public OTextConnectionSettingsDialog_BASE
,public OTextConnectionSettingsDialog_PBASE
- ,public ::cppu::WeakImplHelper< css::sdb::XTextConnectionSettings >
{
PropertyValues m_aPropertyValues;
@@ -75,7 +71,10 @@ namespace dbaui
virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
DECLARE_SERVICE_INFO();
- DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+
virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) override;
virtual sal_Bool SAL_CALL convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) override;
@@ -122,12 +121,20 @@ namespace dbaui
OUString SAL_CALL OTextConnectionSettingsDialog::getImplementationName()
{
- return "com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog";
+ return u"com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog"_ustr;
+ }
+ sal_Bool SAL_CALL OTextConnectionSettingsDialog::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
}
- IMPLEMENT_SERVICE_INFO_SUPPORTS(OTextConnectionSettingsDialog)
css::uno::Sequence< OUString > SAL_CALL OTextConnectionSettingsDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.TextConnectionSettings" };
+ return { u"com.sun.star.sdb.TextConnectionSettings"_ustr };
}
Reference< XPropertySetInfo > SAL_CALL OTextConnectionSettingsDialog::getPropertySetInfo()
@@ -150,44 +157,45 @@ namespace dbaui
// but whose values are stored in our item set
sal_Int32 nProp = aProps.getLength();
aProps.realloc( nProp + 6 );
+ auto pProps = aProps.getArray();
- aProps[ nProp++ ] = Property(
- "HeaderLine",
+ pProps[ nProp++ ] = Property(
+ u"HeaderLine"_ustr,
PROPERTY_ID_HEADER_LINE,
::cppu::UnoType< sal_Bool >::get(),
PropertyAttribute::TRANSIENT
);
- aProps[ nProp++ ] = Property(
- "FieldDelimiter",
+ pProps[ nProp++ ] = Property(
+ u"FieldDelimiter"_ustr,
PROPERTY_ID_FIELD_DELIMITER,
::cppu::UnoType< OUString >::get(),
PropertyAttribute::TRANSIENT
);
- aProps[ nProp++ ] = Property(
- "StringDelimiter",
+ pProps[ nProp++ ] = Property(
+ u"StringDelimiter"_ustr,
PROPERTY_ID_STRING_DELIMITER,
::cppu::UnoType< OUString >::get(),
PropertyAttribute::TRANSIENT
);
- aProps[ nProp++ ] = Property(
- "DecimalDelimiter",
+ pProps[ nProp++ ] = Property(
+ u"DecimalDelimiter"_ustr,
PROPERTY_ID_DECIMAL_DELIMITER,
::cppu::UnoType< OUString >::get(),
PropertyAttribute::TRANSIENT
);
- aProps[ nProp++ ] = Property(
- "ThousandDelimiter",
+ pProps[ nProp++ ] = Property(
+ u"ThousandDelimiter"_ustr,
PROPERTY_ID_THOUSAND_DELIMITER,
::cppu::UnoType< OUString >::get(),
PropertyAttribute::TRANSIENT
);
- aProps[ nProp++ ] = Property(
- "CharSet",
+ pProps[ nProp++ ] = Property(
+ u"CharSet"_ustr,
PROPERTY_ID_ENCODING,
::cppu::UnoType< OUString >::get(),
PropertyAttribute::TRANSIENT
diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx
index 494407a117f0..99be43c4aec5 100644
--- a/dbaccess/source/ui/uno/unoDirectSql.cxx
+++ b/dbaccess/source/ui/uno/unoDirectSql.cxx
@@ -20,13 +20,12 @@
#include <sal/config.h>
#include "unoDirectSql.hxx"
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/connection/XConnection.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <directsql.hxx>
#include <datasourceconnector.hxx>
-#include <tools/diagnose_ex.h>
-#include <comphelper/processfactory.hxx>
+#include <strings.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -40,10 +39,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
@@ -65,15 +62,38 @@ namespace dbaui
OUString SAL_CALL ODirectSQLDialog::getImplementationName()
{
- return "com.sun.star.comp.sdb.DirectSQLDialog";
+ return u"com.sun.star.comp.sdb.DirectSQLDialog"_ustr;
+ }
+ sal_Bool SAL_CALL ODirectSQLDialog::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
}
- IMPLEMENT_SERVICE_INFO_SUPPORTS(ODirectSQLDialog)
css::uno::Sequence< OUString > SAL_CALL ODirectSQLDialog::getSupportedServiceNames( )
{
return { SERVICE_SDB_DIRECTSQLDIALOG };
}
- IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
+ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODirectSQLDialog::getPropertySetInfo()
+ {
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+ ::cppu::IPropertyArrayHelper& ODirectSQLDialog::getInfoHelper()
+ {
+ return *ODirectSQLDialog::getArrayHelper();
+ }
+ ::cppu::IPropertyArrayHelper* ODirectSQLDialog::createArrayHelper( ) const
+ {
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+ }
+
std::unique_ptr<weld::DialogController> ODirectSQLDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{
diff --git a/dbaccess/source/ui/uno/unoDirectSql.hxx b/dbaccess/source/ui/uno/unoDirectSql.hxx
index d84dd5d1a704..c83f975d63dd 100644
--- a/dbaccess/source/ui/uno/unoDirectSql.hxx
+++ b/dbaccess/source/ui/uno/unoDirectSql.hxx
@@ -17,11 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_UNO_UNODIRECTSQL_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_UNO_UNODIRECTSQL_HXX
+#pragma once
#include <svtools/genericunodialog.hxx>
-#include <apitools.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <comphelper/proparrhlp.hxx>
#include <connectivity/CommonTools.hxx>
@@ -48,7 +46,9 @@ namespace dbaui
DECLARE_SERVICE_INFO();
- DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
protected:
// OGenericUnoDialog overridables
@@ -58,6 +58,4 @@ namespace dbaui
} // namespace dbaui
-#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_UNODIRECTSQL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx
index f53df65a9e99..b2c50fc3ab0e 100644
--- a/dbaccess/source/ui/uno/unoadmin.cxx
+++ b/dbaccess/source/ui/uno/unoadmin.cxx
@@ -27,29 +27,21 @@ 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_pItemPool(nullptr)
- ,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()
{
- if (m_xDialog)
- {
- ::osl::MutexGuard aGuard(m_aMutex);
- if (m_xDialog)
- {
- destroyDialog();
- ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
- }
- }
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (m_xDialog)
+ destroyDialog();
+ ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool);
}
void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx
index 85e87dbab83f..09e08878b02b 100644
--- a/dbaccess/source/ui/uno/unosqlmessage.cxx
+++ b/dbaccess/source/ui/uno/unosqlmessage.cxx
@@ -21,7 +21,6 @@
#include <unosqlmessage.hxx>
#include <stringconstants.hxx>
#include <strings.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
#include <connectivity/dbexception.hxx>
#include <vcl/svapp.hxx>
@@ -65,12 +64,12 @@ Sequence<sal_Int8> SAL_CALL OSQLMessageDialog::getImplementationId( )
OUString SAL_CALL OSQLMessageDialog::getImplementationName()
{
- return "org.openoffice.comp.dbu.OSQLMessageDialog";
+ return u"org.openoffice.comp.dbu.OSQLMessageDialog"_ustr;
}
css::uno::Sequence<OUString> SAL_CALL OSQLMessageDialog::getSupportedServiceNames()
{
- return { "com.sun.star.sdb.ErrorMessageDialog" };
+ return { u"com.sun.star.sdb.ErrorMessageDialog"_ustr };
}
void OSQLMessageDialog::initialize(Sequence<Any> const & args)