summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--automation/source/server/statemnt.cxx33
-rw-r--r--basctl/inc/basidesh.hrc1
-rw-r--r--basctl/source/basicide/basicprint.src43
-rw-r--r--basctl/source/basicide/basicrenderable.cxx197
-rw-r--r--basctl/source/basicide/basicrenderable.hxx76
-rw-r--r--basctl/source/basicide/baside2.cxx50
-rw-r--r--basctl/source/basicide/baside2.hxx7
-rw-r--r--basctl/source/basicide/baside3.cxx9
-rw-r--r--basctl/source/basicide/basides2.cxx10
-rw-r--r--basctl/source/basicide/bastypes.cxx7
-rw-r--r--basctl/source/basicide/makefile.mk5
-rw-r--r--basctl/source/dlged/dlged.cxx19
-rw-r--r--basctl/source/inc/baside3.hxx5
-rw-r--r--basctl/source/inc/basidesh.hxx4
-rw-r--r--basctl/source/inc/bastypes.hxx6
-rw-r--r--basctl/source/inc/dlged.hxx5
-rw-r--r--basic/source/app/app.cxx9
-rw-r--r--basic/source/app/makefile.mk1
-rw-r--r--basic/source/app/printer.cxx98
-rw-r--r--basic/source/app/printer.hxx22
-rw-r--r--basic/source/runtime/basrdll.cxx2
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx5
-rw-r--r--comphelper/source/property/opropertybag.cxx9
-rw-r--r--comphelper/source/property/property.cxx25
-rw-r--r--connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java31
-rw-r--r--connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java29
-rw-r--r--connectivity/inc/connectivity/BlobHelper.hxx54
-rw-r--r--connectivity/inc/connectivity/dbmetadata.hxx11
-rw-r--r--connectivity/inc/connectivity/dbtools.hxx15
-rw-r--r--connectivity/inc/connectivity/sqliterator.hxx3
-rw-r--r--connectivity/inc/connectivity/sqlnode.hxx4
-rw-r--r--connectivity/qa/connectivity/GeneralTest.java10
-rwxr-xr-xconnectivity/qa/connectivity/tools/AbstractDatabase.java31
-rw-r--r--connectivity/qa/connectivity/tools/CRMDatabase.java (renamed from dbaccess/qa/complex/dbaccess/CRMDatabase.java)98
-rw-r--r--connectivity/qa/connectivity/tools/DataSource.java40
-rwxr-xr-xconnectivity/qa/connectivity/tools/DatabaseAccess.java4
-rw-r--r--connectivity/qa/connectivity/tools/HsqlDatabase.java13
-rw-r--r--connectivity/qa/connectivity/tools/HsqlTableDescriptor.java16
-rw-r--r--connectivity/qa/connectivity/tools/makefile.mk14
-rw-r--r--connectivity/qa/connectivity/tools/sdb/Connection.java93
-rw-r--r--connectivity/source/commontools/BlobHelper.cxx72
-rw-r--r--connectivity/source/commontools/FValue.cxx134
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx21
-rw-r--r--connectivity/source/commontools/dbtools.cxx102
-rw-r--r--connectivity/source/commontools/makefile.mk1
-rw-r--r--connectivity/source/commontools/predicateinput.cxx5
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx24
-rw-r--r--connectivity/source/drivers/ado/Aolevariant.cxx93
-rwxr-xr-xconnectivity/source/drivers/ado/ado.xcu5
-rw-r--r--connectivity/source/drivers/ado/adoimp.cxx2
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx17
-rw-r--r--connectivity/source/drivers/jdbc/Boolean.cxx10
-rw-r--r--connectivity/source/drivers/jdbc/CallableStatement.cxx12
-rw-r--r--connectivity/source/drivers/jdbc/Clob.cxx7
-rw-r--r--connectivity/source/drivers/jdbc/InputStream.cxx8
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx27
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx12
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx7
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx114
-rw-r--r--connectivity/source/drivers/jdbc/Timestamp.cxx14
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.xcu5
-rw-r--r--connectivity/source/drivers/jdbc/makefile.mk1
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx57
-rwxr-xr-xconnectivity/source/drivers/odbc/odbc.xcu5
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx10
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx16
-rw-r--r--connectivity/source/drivers/odbcbase/OPreparedStatement.cxx46
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx8
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx8
-rw-r--r--connectivity/source/inc/ado/Aolevariant.hxx1
-rw-r--r--connectivity/source/inc/java/lang/Boolean.hxx1
-rw-r--r--connectivity/source/inc/java/sql/Connection.hxx5
-rw-r--r--connectivity/source/inc/java/sql/Timestamp.hxx3
-rw-r--r--connectivity/source/inc/java/tools.hxx4
-rw-r--r--connectivity/source/inc/odbc/OBoundParam.hxx6
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx1
-rw-r--r--connectivity/source/inc/odbc/OPreparedStatement.hxx3
-rw-r--r--connectivity/source/parse/sqlbison.y6
-rw-r--r--connectivity/source/parse/sqliterator.cxx98
-rw-r--r--connectivity/source/parse/sqlnode.cxx24
-rw-r--r--cui/source/inc/dbregister.hxx2
-rw-r--r--cui/source/options/dbregister.cxx147
-rw-r--r--cui/source/options/dbregisterednamesconfig.cxx171
-rw-r--r--cui/source/options/dbregistersettings.cxx18
-rw-r--r--cui/source/options/dbregistersettings.hxx40
-rw-r--r--dbaccess/inc/dbaccess_helpid.hrc2
-rw-r--r--dbaccess/qa/complex/dbaccess/ApplicationController.java19
-rw-r--r--dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java10
-rw-r--r--dbaccess/qa/complex/dbaccess/DataSource.java3
-rw-r--r--dbaccess/qa/complex/dbaccess/Query.java15
-rw-r--r--dbaccess/qa/complex/dbaccess/RowSet.java82
-rw-r--r--dbaccess/qa/complex/dbaccess/TestCase.java19
-rw-r--r--dbaccess/qa/complex/dbaccess/UISettings.java111
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx5
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.cxx206
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.hxx33
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx154
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.hxx14
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx83
-rw-r--r--dbaccess/source/core/api/KeySet.cxx80
-rw-r--r--dbaccess/source/core/api/KeySet.hxx2
-rw-r--r--dbaccess/source/core/api/RowSet.cxx54
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx10
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx38
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx1
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx21
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx6
-rw-r--r--dbaccess/source/core/api/column.cxx413
-rw-r--r--dbaccess/source/core/api/columnsettings.cxx181
-rw-r--r--dbaccess/source/core/api/datasettings.cxx29
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx1105
-rw-r--r--dbaccess/source/core/api/makefile.mk3
-rw-r--r--dbaccess/source/core/api/preparedstatement.cxx73
-rw-r--r--dbaccess/source/core/api/query.cxx9
-rw-r--r--dbaccess/source/core/api/querycontainer.cxx4
-rw-r--r--dbaccess/source/core/api/querydescriptor.cxx7
-rw-r--r--dbaccess/source/core/api/resultcolumn.cxx196
-rw-r--r--dbaccess/source/core/api/table.cxx4
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx12
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx23
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx176
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.hxx105
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx13
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx398
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.hxx50
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx25
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx2
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx84
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx361
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.hxx34
-rw-r--r--dbaccess/source/core/dataaccess/intercept.cxx130
-rw-r--r--dbaccess/source/core/dataaccess/makefile.mk1
-rw-r--r--dbaccess/source/core/inc/ContainerMediator.hxx17
-rw-r--r--dbaccess/source/core/inc/ContentHelper.hxx2
-rw-r--r--dbaccess/source/core/inc/PropertyForward.hxx36
-rw-r--r--dbaccess/source/core/inc/column.hxx187
-rw-r--r--dbaccess/source/core/inc/columnsettings.hxx108
-rw-r--r--dbaccess/source/core/inc/datasettings.hxx1
-rw-r--r--dbaccess/source/core/inc/definitioncolumn.hxx279
-rw-r--r--dbaccess/source/core/inc/querycontainer.hxx2
-rw-r--r--dbaccess/source/core/misc/ContainerMediator.cxx124
-rw-r--r--dbaccess/source/core/misc/PropertyForward.cxx192
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx10
-rw-r--r--dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx6
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx517
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx3
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx46
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx307
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx15
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx183
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx51
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx82
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx72
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hrc5
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx4
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src18
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.cxx99
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.hxx80
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx66
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk4
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.cxx75
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.hxx66
-rw-r--r--dbaccess/source/ui/inc/TypeInfo.hxx1
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx (renamed from dbaccess/source/ui/dlg/dsitems.hxx)5
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx114
-rw-r--r--dbaccess/source/ui/inc/exsrcbrw.hxx11
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx20
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx6
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx12
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx40
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx177
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx1
-rw-r--r--dbaccess/source/ui/querydesign/querycontainerwindow.cxx9
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx15
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx15
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx217
-rw-r--r--dbaccess/source/ui/tabledesign/table.src2
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx14
-rw-r--r--default_images/res/ko/lc10714.pngbin315 -> 0 bytes
-rw-r--r--default_images/res/ko/lch10714.pngbin124 -> 0 bytes
-rw-r--r--default_images/res/ko/sc10714.pngbin244 -> 0 bytes
-rw-r--r--default_images/res/ko/sch10714.pngbin243 -> 0 bytes
-rw-r--r--default_images/res/lc10616.pngbin810 -> 0 bytes
-rw-r--r--default_images/res/lc10617.pngbin734 -> 0 bytes
-rw-r--r--default_images/res/lc10618.pngbin720 -> 0 bytes
-rw-r--r--default_images/res/lc10619.pngbin810 -> 0 bytes
-rw-r--r--default_images/res/lc10620.pngbin1001 -> 0 bytes
-rw-r--r--default_images/res/lc10621.pngbin1239 -> 0 bytes
-rw-r--r--default_images/res/lc10627.pngbin1002 -> 0 bytes
-rw-r--r--default_images/res/lc10630.pngbin1876 -> 0 bytes
-rw-r--r--default_images/res/lc10714.pngbin629 -> 0 bytes
-rw-r--r--default_images/res/lc10723.pngbin1041 -> 0 bytes
-rw-r--r--default_images/res/lc10724.pngbin1603 -> 0 bytes
-rw-r--r--default_images/res/lch10616.pngbin139 -> 0 bytes
-rw-r--r--default_images/res/lch10617.pngbin127 -> 0 bytes
-rw-r--r--default_images/res/lch10618.pngbin131 -> 0 bytes
-rw-r--r--default_images/res/lch10619.pngbin130 -> 0 bytes
-rw-r--r--default_images/res/lch10620.pngbin172 -> 0 bytes
-rw-r--r--default_images/res/lch10621.pngbin186 -> 0 bytes
-rw-r--r--default_images/res/lch10627.pngbin166 -> 0 bytes
-rw-r--r--default_images/res/lch10630.pngbin209 -> 0 bytes
-rw-r--r--default_images/res/lch10714.pngbin176 -> 0 bytes
-rw-r--r--default_images/res/lch10723.pngbin179 -> 0 bytes
-rw-r--r--default_images/res/lch10724.pngbin190 -> 0 bytes
-rw-r--r--default_images/res/sc10616.pngbin530 -> 0 bytes
-rw-r--r--default_images/res/sc10617.pngbin474 -> 0 bytes
-rw-r--r--default_images/res/sc10618.pngbin467 -> 0 bytes
-rw-r--r--default_images/res/sc10619.pngbin530 -> 0 bytes
-rw-r--r--default_images/res/sc10620.pngbin662 -> 0 bytes
-rw-r--r--default_images/res/sc10621.pngbin682 -> 0 bytes
-rw-r--r--default_images/res/sc10627.pngbin688 -> 0 bytes
-rw-r--r--default_images/res/sc10630.pngbin1038 -> 0 bytes
-rw-r--r--default_images/res/sc10714.pngbin442 -> 0 bytes
-rw-r--r--default_images/res/sc10723.pngbin588 -> 0 bytes
-rw-r--r--default_images/res/sc10724.pngbin909 -> 0 bytes
-rw-r--r--default_images/res/sch10616.pngbin119 -> 0 bytes
-rw-r--r--default_images/res/sch10617.pngbin108 -> 0 bytes
-rw-r--r--default_images/res/sch10618.pngbin115 -> 0 bytes
-rw-r--r--default_images/res/sch10619.pngbin115 -> 0 bytes
-rw-r--r--default_images/res/sch10620.pngbin140 -> 0 bytes
-rw-r--r--default_images/res/sch10621.pngbin148 -> 0 bytes
-rw-r--r--default_images/res/sch10627.pngbin139 -> 0 bytes
-rw-r--r--default_images/res/sch10630.pngbin166 -> 0 bytes
-rw-r--r--default_images/res/sch10714.pngbin143 -> 0 bytes
-rw-r--r--default_images/res/sch10723.pngbin152 -> 0 bytes
-rw-r--r--default_images/res/sch10724.pngbin144 -> 0 bytes
-rw-r--r--default_images/svx/res/lc10622.pngbin1509 -> 0 bytes
-rw-r--r--default_images/svx/res/lch10622.pngbin191 -> 0 bytes
-rw-r--r--default_images/svx/res/sc10622.pngbin895 -> 0 bytes
-rw-r--r--default_images/svx/res/sch10622.pngbin144 -> 0 bytes
-rw-r--r--default_images/vcl/source/src/collate.pngbin0 -> 672 bytes
-rw-r--r--default_images/vcl/source/src/collate_h.pngbin0 -> 380 bytes
-rw-r--r--default_images/vcl/source/src/ncollate.pngbin0 -> 635 bytes
-rw-r--r--default_images/vcl/source/src/ncollate_h.pngbin0 -> 393 bytes
-rw-r--r--extensions/source/abpilot/datasourcehandling.cxx86
-rw-r--r--extensions/source/bibliography/datman.cxx39
-rw-r--r--extensions/source/bibliography/datman.hxx6
-rw-r--r--extensions/source/bibliography/framectr.cxx6
-rw-r--r--extensions/source/bibliography/framectr.hxx6
-rw-r--r--extensions/source/bibliography/general.cxx4
-rw-r--r--extensions/source/propctrlr/editpropertyhandler.cxx1
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx6
-rw-r--r--extras/source/truetype/symbol/OpenSymbol.sfd18408
-rw-r--r--extras/source/truetype/symbol/opens___.ttfbin178396 -> 198668 bytes
-rw-r--r--filter/source/pdf/impdialog.cxx331
-rw-r--r--filter/source/pdf/impdialog.hxx36
-rw-r--r--filter/source/pdf/pdfdialog.cxx10
-rw-r--r--filter/source/pdf/pdfdialog.hxx22
-rw-r--r--filter/source/pdf/pdfexport.cxx15
-rw-r--r--forms/qa/forms_all.sce1
-rw-r--r--forms/qa/integration/forms/DocumentViewHelper.java7
-rw-r--r--forms/qa/integration/forms/FormControlTest.java11
-rw-r--r--forms/qa/integration/forms/FormLayer.java48
-rw-r--r--forms/qa/integration/forms/FormPropertyBags.java10
-rw-r--r--forms/qa/integration/forms/ListBox.java290
-rw-r--r--forms/qa/integration/forms/ListSelection.java86
-rw-r--r--forms/qa/integration/forms/MasterDetailForms.java334
-rw-r--r--forms/qa/integration/forms/TestCase.java13
-rw-r--r--forms/qa/integration/forms/dbfTools.java9
-rw-r--r--forms/qa/org/openoffice/complex/forms/tools/ResultSet.java264
-rw-r--r--forms/source/component/Button.cxx14
-rw-r--r--forms/source/component/Button.hxx10
-rw-r--r--forms/source/component/Columns.cxx16
-rw-r--r--forms/source/component/DatabaseForm.cxx154
-rw-r--r--forms/source/component/FormComponent.cxx16
-rw-r--r--forms/source/component/ImageControl.cxx1
-rw-r--r--forms/source/cppugen/makefile.mk68
-rw-r--r--forms/source/helper/commanddescriptionprovider.cxx139
-rw-r--r--forms/source/helper/commandimageprovider.cxx180
-rw-r--r--forms/source/helper/formnavigation.cxx162
-rw-r--r--forms/source/helper/makefile.mk2
-rw-r--r--forms/source/inc/FormComponent.hxx106
-rw-r--r--forms/source/inc/commanddescriptionprovider.hxx68
-rw-r--r--forms/source/inc/commandimageprovider.hxx77
-rw-r--r--forms/source/inc/featuredispatcher.hxx12
-rw-r--r--forms/source/inc/formnavigation.hxx24
-rw-r--r--forms/source/inc/frm_strings.hxx2
-rw-r--r--forms/source/inc/property.hrc2
-rw-r--r--forms/source/richtext/richtextmodel.cxx12
-rw-r--r--forms/source/richtext/richtextmodel.hxx3
-rw-r--r--forms/source/runtime/formoperations.cxx2
-rw-r--r--forms/source/runtime/formoperations.hxx20
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx79
-rw-r--r--forms/source/solar/component/navbarcontrol.hxx22
-rw-r--r--forms/source/solar/control/navtoolbar.cxx254
-rw-r--r--forms/source/solar/inc/navtoolbar.hxx46
-rw-r--r--framework/inc/uielement/generictoolbarcontroller.hxx27
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx7
-rw-r--r--framework/inc/xml/menuconfiguration.hxx1
-rw-r--r--framework/inc/xml/menudocumenthandler.hxx5
-rw-r--r--framework/inc/xml/toolboxconfigurationdefines.hxx3
-rw-r--r--framework/inc/xml/toolboxdocumenthandler.hxx6
-rw-r--r--framework/source/classes/menumanager.cxx22
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx1
-rw-r--r--framework/source/services/backingwindow.cxx36
-rw-r--r--framework/source/uielement/generictoolbarcontroller.cxx66
-rw-r--r--framework/source/uielement/menubarmanager.cxx26
-rw-r--r--framework/source/uielement/toolbarmanager.cxx65
-rw-r--r--framework/source/xml/menudocumenthandler.cxx135
-rw-r--r--framework/source/xml/toolboxdocumenthandler.cxx83
-rw-r--r--goodies/source/filter.vcl/ieps/ieps.cxx68
-rw-r--r--instsetoo_native/inc_ooolangpack/windows/msi_languages/CustomAc.ulf12
-rw-r--r--instsetoo_native/util/openoffice.lst54
-rw-r--r--linguistic/source/gciterator.cxx3
-rw-r--r--offapi/com/sun/star/awt/UnoControlCurrencyFieldModel.idl11
-rw-r--r--offapi/com/sun/star/awt/UnoControlDateFieldModel.idl11
-rw-r--r--offapi/com/sun/star/awt/UnoControlEditModel.idl11
-rw-r--r--offapi/com/sun/star/awt/UnoControlFileControlModel.idl10
-rw-r--r--offapi/com/sun/star/awt/UnoControlFormattedFieldModel.idl11
-rw-r--r--offapi/com/sun/star/awt/UnoControlNumericFieldModel.idl11
-rw-r--r--offapi/com/sun/star/awt/UnoControlPatternFieldModel.idl11
-rw-r--r--offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl11
-rw-r--r--offapi/com/sun/star/form/FormController.idl105
-rw-r--r--offapi/com/sun/star/form/FormControllerDispatcher.idl170
-rw-r--r--offapi/com/sun/star/form/XFormController.idl53
-rw-r--r--offapi/com/sun/star/form/runtime/FilterEvent.idl64
-rw-r--r--offapi/com/sun/star/form/runtime/FormController.idl51
-rw-r--r--offapi/com/sun/star/form/runtime/FormOperations.idl4
-rw-r--r--offapi/com/sun/star/form/runtime/XFilterController.idl180
-rw-r--r--offapi/com/sun/star/form/runtime/XFilterControllerListener.idl84
-rw-r--r--offapi/com/sun/star/form/runtime/XFormController.idl373
-rw-r--r--offapi/com/sun/star/form/runtime/XFormControllerContext.idl57
-rw-r--r--offapi/com/sun/star/form/runtime/XFormOperations.idl6
-rw-r--r--offapi/com/sun/star/form/runtime/makefile.mk8
-rw-r--r--offapi/com/sun/star/sdb/DataSourceBrowser.idl6
-rw-r--r--offapi/com/sun/star/sdb/DatabaseContext.idl17
-rw-r--r--offapi/com/sun/star/sdb/DatabaseRegistrationEvent.idl60
-rw-r--r--offapi/com/sun/star/sdb/XDatabaseAccess.idl49
-rw-r--r--offapi/com/sun/star/sdb/XDatabaseAccessListener.idl35
-rw-r--r--offapi/com/sun/star/sdb/XDatabaseEnvironment.idl27
-rw-r--r--offapi/com/sun/star/sdb/XDatabaseRegistrations.idl158
-rw-r--r--offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl70
-rw-r--r--offapi/com/sun/star/sdb/makefile.mk3
-rw-r--r--offapi/com/sun/star/ui/ItemStyle.idl5
-rw-r--r--offapi/com/sun/star/view/DuplexMode.idl69
-rw-r--r--offapi/com/sun/star/view/PrintOptions.idl7
-rw-r--r--offapi/com/sun/star/view/XFormLayerAccess.idl8
-rw-r--r--offapi/com/sun/star/view/makefile.mk3
-rw-r--r--offapi/util/makefile.mk4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/DataAccess.xcu2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Math.xcu198
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu10
-rw-r--r--officecfg/registry/data/org/openoffice/VCL.xcu8
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs8
-rw-r--r--ooo_custom_images/industrial/lc10713.png (renamed from ooo_custom_images/industrial/res/lc10713.png)bin195 -> 195 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10616.pngbin203 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10617.pngbin165 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10618.pngbin162 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10619.pngbin195 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10620.pngbin436 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10621.pngbin224 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10627.pngbin953 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10630.pngbin582 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10712.pngbin196 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10714.pngbin380 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10723.pngbin513 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/lc10724.pngbin916 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10616.pngbin103 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10617.pngbin96 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10618.pngbin98 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10619.pngbin102 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10620.pngbin364 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10621.pngbin173 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10627.pngbin487 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10630.pngbin329 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10712.pngbin184 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10714.pngbin287 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10723.pngbin290 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/res/sc10724.pngbin539 -> 0 bytes
-rw-r--r--ooo_custom_images/industrial/sc10713.png (renamed from ooo_custom_images/industrial/res/sc10713.png)bin185 -> 185 bytes
-rw-r--r--ooo_custom_images/tango/lc10713.png (renamed from ooo_custom_images/tango/res/lc10713.png)bin180 -> 180 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10616.pngbin203 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10617.pngbin147 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10618.pngbin147 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10619.pngbin196 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10620.pngbin436 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10621.pngbin224 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10627.pngbin826 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10630.pngbin841 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10712.pngbin203 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10714.pngbin376 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10723.pngbin541 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10724.pngbin1080 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/lc10724.xcf.bz2bin2339 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10616.pngbin103 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10617.pngbin96 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10618.pngbin98 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10619.pngbin102 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10620.pngbin364 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10621.pngbin169 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10627.pngbin367 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10630.pngbin467 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10712.pngbin173 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10714.pngbin355 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10723.pngbin381 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/res/sc10724.pngbin474 -> 0 bytes
-rw-r--r--ooo_custom_images/tango/sc10713.png (renamed from ooo_custom_images/tango/res/sc10713.png)bin172 -> 172 bytes
-rw-r--r--padmin/source/padialog.cxx149
-rw-r--r--padmin/source/padialog.hxx2
-rw-r--r--qadevOOo/tests/java/ifc/view/_XFormLayerAccess.java2
-rw-r--r--reportbuilder/registry/data/org/openoffice/Office/Accelerators.xcu7
-rw-r--r--reportbuilder/registry/data/org/openoffice/Office/UI/ReportCommands.xcu8
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx16
-rw-r--r--reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx29
-rw-r--r--reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx1
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx4
-rw-r--r--reportdesign/uiconfig/dbreport/accelerator/de-DE/default.xml1
-rw-r--r--reportdesign/uiconfig/dbreport/accelerator/en-GB/default.xml1
-rw-r--r--reportdesign/uiconfig/dbreport/accelerator/en-US/default.xml1
-rw-r--r--rsc/source/parser/rscicpx.cxx1
-rw-r--r--sal/osl/unx/file_misc.cxx18
-rw-r--r--sal/util/makefile.mk6
-rw-r--r--sal/util/salalloc.list7
-rw-r--r--sc/inc/docuno.hxx5
-rw-r--r--sc/inc/sc.hrc2
-rw-r--r--sc/inc/viewuno.hxx5
-rw-r--r--sc/source/core/data/documen4.cxx12
-rw-r--r--sc/source/core/tool/printopt.cxx4
-rw-r--r--sc/source/core/tool/rechead.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx7
-rw-r--r--sc/source/ui/inc/pfuncache.hxx6
-rw-r--r--sc/source/ui/src/scstring.src26
-rw-r--r--sc/source/ui/unoobj/docuno.cxx322
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx4
-rwxr-xr-x[-rw-r--r--]sc/source/ui/view/gridwin3.cxx1
-rw-r--r--sc/source/ui/view/olkact.cxx2
-rwxr-xr-x[-rw-r--r--]sc/source/ui/view/output3.cxx3
-rw-r--r--sc/source/ui/view/pfuncache.cxx4
-rw-r--r--sc/source/ui/view/prevwsh2.cxx2
-rwxr-xr-x[-rw-r--r--]sc/source/ui/view/printfun.cxx24
-rw-r--r--sc/source/ui/view/viewfun3.cxx2
-rw-r--r--scp2/source/ooo/file_ooo.scp49
-rw-r--r--scp2/source/ooo/module_hidden_ooo.scp65
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx88
-rw-r--r--sd/source/ui/inc/DocumentRenderer.hxx85
-rw-r--r--sd/source/ui/inc/DrawController.hxx2
-rw-r--r--sd/source/ui/inc/PrintManager.hxx213
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx7
-rw-r--r--sd/source/ui/unoidl/DrawController.cxx4
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx2363
-rw-r--r--sd/source/ui/view/DocumentRenderer.hrc80
-rw-r--r--sd/source/ui/view/DocumentRenderer.src298
-rw-r--r--sd/source/ui/view/PrintManager.cxx1802
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx193
-rw-r--r--sd/source/ui/view/makefile.mk8
-rw-r--r--sd/util/makefile.mk1
-rwxr-xr-xsetup_native/source/packinfo/packinfo_office.txt88
-rw-r--r--setup_native/source/packinfo/spellchecker_selection.txt30
-rw-r--r--sfx2/inc/sfx2/event.hxx19
-rw-r--r--sfx2/inc/sfx2/objsh.hxx2
-rw-r--r--sfx2/inc/sfx2/prnmon.hxx12
-rw-r--r--sfx2/inc/sfx2/sfxbasecontroller.hxx4
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc2
-rw-r--r--sfx2/inc/sfx2/viewfrm.hxx2
-rw-r--r--sfx2/inc/sfx2/viewsh.hxx9
-rw-r--r--sfx2/source/appl/appopen.cxx2
-rw-r--r--sfx2/source/control/shell.cxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx4
-rw-r--r--sfx2/source/doc/objcont.cxx79
-rwxr-xr-xsfx2/source/doc/printhelper.cxx92
-rw-r--r--sfx2/source/view/makefile.mk3
-rw-r--r--sfx2/source/view/printer.cxx14
-rw-r--r--sfx2/source/view/prnmon.cxx6
-rw-r--r--sfx2/source/view/topfrm.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx14
-rw-r--r--sfx2/source/view/viewimp.hxx4
-rw-r--r--sfx2/source/view/viewprn.cxx816
-rw-r--r--sfx2/source/view/viewsh.cxx23
-rw-r--r--[-rwxr-xr-x]solenv/config/sdev300.ini0
-rw-r--r--solenv/inc/minor.mk6
-rw-r--r--solenv/inc/postset.mk1
-rw-r--r--sot/source/sdstor/stgstrms.cxx2
-rw-r--r--sot/source/sdstor/stgstrms.hxx3
-rw-r--r--starmath/inc/document.hxx5
-rw-r--r--starmath/inc/starmath.hrc2
-rw-r--r--starmath/inc/types.hxx102
-rw-r--r--starmath/inc/unomodel.hxx23
-rw-r--r--starmath/inc/view.hxx5
-rw-r--r--starmath/source/document.cxx11
-rw-r--r--starmath/source/format.cxx6
-rw-r--r--starmath/source/mathmlimport.cxx6379
-rw-r--r--starmath/source/node.cxx4
-rw-r--r--starmath/source/rect.cxx3
-rw-r--r--starmath/source/smres.src257
-rw-r--r--starmath/source/types.cxx214
-rw-r--r--starmath/source/unomodel.cxx149
-rw-r--r--starmath/source/view.cxx71
-rw-r--r--starmath/util/makefile.mk1
-rw-r--r--svl/inc/svl/solar.hrc11
-rw-r--r--svl/source/numbers/numhead.cxx2
-rw-r--r--svtools/inc/svtools/imapobj.hxx2
-rw-r--r--svtools/source/control/filectrl.cxx3
-rw-r--r--svtools/source/dialogs/prnsetup.cxx2
-rw-r--r--svtools/source/filter.vcl/filter/filter2.cxx3
-rw-r--r--svtools/source/misc/imap.cxx7
-rw-r--r--svtools/source/uno/unoiface.cxx80
-rw-r--r--svx/inc/fmhelp.hrc4
-rw-r--r--svx/inc/pch/precompiled_svx.hxx4
-rw-r--r--svx/inc/svx/fmdpage.hxx5
-rw-r--r--svx/inc/svx/fmgridcl.hxx5
-rw-r--r--svx/inc/svx/fmshell.hxx6
-rw-r--r--svx/inc/svx/fmtools.hxx158
-rw-r--r--svx/inc/svx/fmview.hxx6
-rw-r--r--svx/inc/svx/gridctrl.hxx7
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx7
-rw-r--r--svx/inc/svx/svdograf.hxx1
-rwxr-xr-x[-rw-r--r--]svx/inc/svx/svdpntv.hxx9
-rw-r--r--svx/source/dialog/fntctrl.cxx2
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx15
-rw-r--r--svx/source/fmcomp/fmgridif.cxx77
-rw-r--r--svx/source/fmcomp/gridcell.cxx10
-rw-r--r--svx/source/fmcomp/gridcols.cxx33
-rw-r--r--svx/source/fmcomp/gridctrl.cxx46
-rw-r--r--svx/source/form/confirmdelete.cxx138
-rw-r--r--svx/source/form/delayedevent.cxx4
-rw-r--r--svx/source/form/filtnav.cxx1112
-rw-r--r--svx/source/form/fmcontrolbordermanager.cxx3
-rw-r--r--svx/source/form/fmcontrollayout.cxx3
-rw-r--r--svx/source/form/fmobj.cxx70
-rw-r--r--svx/source/form/fmservs.cxx9
-rw-r--r--svx/source/form/fmshell.cxx11
-rw-r--r--svx/source/form/fmshimp.cxx463
-rw-r--r--svx/source/form/fmstring.src2
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx1
-rw-r--r--svx/source/form/fmtools.cxx734
-rw-r--r--svx/source/form/fmundo.cxx67
-rw-r--r--svx/source/form/fmview.cxx2
-rw-r--r--svx/source/form/fmvwimp.cxx225
-rw-r--r--svx/source/form/formcontrolfactory.cxx3
-rw-r--r--svx/source/form/formcontroller.cxx (renamed from svx/source/form/fmctrler.cxx)1761
-rw-r--r--svx/source/form/formcontrolling.cxx4
-rw-r--r--svx/source/form/formdispatchinterceptor.cxx213
-rw-r--r--svx/source/form/formfeaturedispatcher.cxx (renamed from svx/source/form/fmdispatch.cxx)48
-rw-r--r--svx/source/form/legacyformcontroller.cxx225
-rw-r--r--svx/source/form/makefile.mk9
-rw-r--r--svx/source/inc/delayedevent.hxx4
-rw-r--r--svx/source/inc/filtnav.hxx84
-rw-r--r--svx/source/inc/fmPropBrw.hxx1
-rw-r--r--svx/source/inc/fmcontrolbordermanager.hxx5
-rw-r--r--svx/source/inc/fmcontrollayout.hxx3
-rw-r--r--svx/source/inc/fmctrler.hxx617
-rw-r--r--svx/source/inc/fmexpl.hxx6
-rw-r--r--svx/source/inc/fmservs.hxx2
-rw-r--r--svx/source/inc/fmshimp.hxx28
-rw-r--r--svx/source/inc/fmsrcimp.hxx17
-rw-r--r--svx/source/inc/fmtextcontrolshell.hxx16
-rw-r--r--svx/source/inc/fmvwimp.hxx44
-rw-r--r--svx/source/inc/formcontroller.hxx592
-rw-r--r--svx/source/inc/formcontrolling.hxx15
-rw-r--r--svx/source/inc/formdispatchinterceptor.hxx118
-rw-r--r--svx/source/inc/formfeaturedispatcher.hxx (renamed from svx/source/inc/fmdispatch.hxx)23
-rw-r--r--svx/source/inc/gridcell.hxx2
-rw-r--r--svx/source/inc/tabwin.hxx3
-rwxr-xr-x[-rw-r--r--]svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx12
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx123
-rw-r--r--svx/source/src/app.src19
-rw-r--r--svx/source/svdraw/svdograf.cxx17
-rw-r--r--svx/source/svdraw/svdotext.cxx3
-rwxr-xr-x[-rw-r--r--]svx/source/svdraw/svdpntv.cxx3
-rw-r--r--svx/source/table/svdotable.cxx2
-rw-r--r--svx/source/unodraw/unoshap2.cxx4
-rw-r--r--svx/source/unodraw/unoshap4.cxx4
-rw-r--r--svx/source/unodraw/unoshape.cxx8
-rwxr-xr-xsw/inc/IDocumentDeviceAccess.hxx2
-rw-r--r--sw/inc/cmdid.h1
-rw-r--r--sw/inc/dbfld.hxx1
-rw-r--r--sw/inc/dbmgr.hxx8
-rw-r--r--sw/inc/doc.hxx18
-rwxr-xr-x[-rw-r--r--]sw/inc/docsh.hxx1
-rw-r--r--sw/inc/globals.hrc1
-rwxr-xr-x[-rw-r--r--]sw/inc/printdata.hxx293
-rw-r--r--sw/inc/rolbck.hxx3
-rw-r--r--sw/inc/swprtopt.hxx42
-rw-r--r--sw/inc/unomod.hxx2
-rwxr-xr-x[-rw-r--r--]sw/inc/unotxdoc.hxx487
-rwxr-xr-x[-rw-r--r--]sw/inc/viewopt.hxx12
-rwxr-xr-x[-rw-r--r--]sw/inc/viewsh.hxx43
-rw-r--r--sw/sdi/swriter.sdi25
-rw-r--r--sw/sdi/swslots.src6
-rw-r--r--sw/sdi/viewsh.sdi4
-rw-r--r--sw/source/core/access/accpage.cxx5
-rwxr-xr-x[-rw-r--r--]sw/source/core/doc/doc.cxx638
-rw-r--r--sw/source/core/doc/docdesc.cxx1
-rw-r--r--sw/source/core/doc/docnew.cxx33
-rw-r--r--sw/source/core/doc/notxtfrm.cxx58
-rw-r--r--sw/source/core/fields/dbfld.cxx4
-rw-r--r--sw/source/core/fields/docufld.cxx3
-rw-r--r--sw/source/core/inc/cellfrm.hxx2
-rw-r--r--sw/source/core/inc/flyfrm.hxx2
-rw-r--r--sw/source/core/inc/frame.hxx3
-rw-r--r--sw/source/core/inc/layfrm.hxx2
-rw-r--r--sw/source/core/inc/notxtfrm.hxx2
-rw-r--r--sw/source/core/inc/rootfrm.hxx2
-rw-r--r--sw/source/core/inc/tabfrm.hxx2
-rw-r--r--sw/source/core/inc/txtfrm.hxx2
-rw-r--r--sw/source/core/inc/viewimp.hxx10
-rw-r--r--sw/source/core/layout/paintfrm.cxx22
-rw-r--r--sw/source/core/layout/unusedf.cxx2
-rw-r--r--sw/source/core/layout/wsfrm.cxx5
-rw-r--r--sw/source/core/text/frmpaint.cxx2
-rw-r--r--sw/source/core/text/itrform2.cxx6
-rw-r--r--sw/source/core/text/porrst.cxx1
-rw-r--r--sw/source/core/unocore/unodraw.cxx24
-rw-r--r--sw/source/core/view/vdraw.cxx8
-rwxr-xr-x[-rw-r--r--]sw/source/core/view/viewpg.cxx744
-rw-r--r--sw/source/core/view/vnew.cxx7
-rwxr-xr-x[-rw-r--r--]sw/source/core/view/vprint.cxx1395
-rw-r--r--sw/source/filter/html/htmlform.cxx3
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx63
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx28
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx22
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.cxx20
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx31
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx66
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx2
-rw-r--r--sw/source/ui/app/docsh2.cxx2
-rw-r--r--sw/source/ui/app/docst.cxx1
-rw-r--r--sw/source/ui/app/mn.src6
-rw-r--r--sw/source/ui/config/optdlg.hrc8
-rwxr-xr-x[-rw-r--r--]sw/source/ui/config/optdlg.src103
-rwxr-xr-x[-rw-r--r--]sw/source/ui/config/optpage.cxx85
-rw-r--r--sw/source/ui/config/prtopt.cxx30
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx494
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx19
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx4
-rw-r--r--sw/source/ui/inc/cfgitems.hxx8
-rw-r--r--sw/source/ui/inc/optpage.hxx8
-rw-r--r--sw/source/ui/inc/pview.hxx2
-rwxr-xr-x[-rw-r--r--]sw/source/ui/inc/srcview.hxx10
-rw-r--r--sw/source/ui/inc/unotxvw.hxx2
-rw-r--r--sw/source/ui/inc/view.hxx9
-rw-r--r--sw/source/ui/misc/glshell.cxx8
-rw-r--r--sw/source/ui/uiview/makefile.mk1
-rw-r--r--sw/source/ui/uiview/pview.cxx75
-rw-r--r--sw/source/ui/uiview/pview.src5
-rw-r--r--sw/source/ui/uiview/srcview.cxx170
-rw-r--r--sw/source/ui/uiview/view.cxx64
-rw-r--r--sw/source/ui/uiview/viewprt.cxx304
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx1
-rw-r--r--sw/source/ui/uno/unomod.cxx38
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx832
-rw-r--r--sw/source/ui/uno/unotxvw.cxx5
-rw-r--r--sw/uiconfig/sglobal/toolbar/previewobjectbar.xml1
-rw-r--r--sw/uiconfig/sweb/toolbar/previewobjectbar.xml1
-rw-r--r--sw/uiconfig/swform/toolbar/previewobjectbar.xml1
-rw-r--r--sw/uiconfig/swreport/toolbar/previewobjectbar.xml1
-rw-r--r--sw/uiconfig/swriter/toolbar/previewobjectbar.xml1
-rw-r--r--sw/uiconfig/swxform/toolbar/previewobjectbar.xml1
-rwxr-xr-xtestautomation/chart2/required/includes/ch2_format.inc74
-rw-r--r--testautomation/chart2/tools/ch_tools_statistics.inc2
-rwxr-xr-xtestautomation/dbaccess/optional/includes/ctrl_PropertyBrowser.inc2
-rwxr-xr-xtestautomation/dbaccess/optional/includes/ctrl_Wizards.inc3
-rwxr-xr-xtestautomation/framework/optional/f_CJK_GridLayout.bas6
-rw-r--r--[-rwxr-xr-x]testautomation/framework/optional/includes/CJK_CollationDialogue_1.inc1267
-rw-r--r--[-rwxr-xr-x]testautomation/framework/optional/includes/CJK_FeatureSwitchTest_1.inc887
-rw-r--r--[-rwxr-xr-x]testautomation/framework/optional/includes/CJK_RubyDialogueProposal_1.inc271
-rwxr-xr-xtestautomation/framework/optional/includes/options_ooo_general.inc615
-rwxr-xr-xtestautomation/framework/optional/includes/options_so_4.inc707
-rwxr-xr-xtestautomation/framework/optional/includes/options_so_5.inc612
-rw-r--r--[-rwxr-xr-x]testautomation/framework/optional/includes/w_grid_layout1.inc542
-rwxr-xr-xtestautomation/framework/required/includes/help_browser.inc57
-rwxr-xr-xtestautomation/framework/tools/includes/CJK_tools.inc31
-rwxr-xr-xtestautomation/framework/tools/includes/customize_tools.inc9
-rwxr-xr-xtestautomation/framework/tools/includes/fileoperations.inc17
-rwxr-xr-xtestautomation/framework/tools/includes/help_tools.inc4
-rwxr-xr-xtestautomation/global/required/includes/g_printing.inc524
-rwxr-xr-xtestautomation/global/tools/includes/optional/t_control_objects.inc157
-rwxr-xr-xtestautomation/global/tools/includes/optional/t_docfuncs.inc43
-rwxr-xr-xtestautomation/global/tools/includes/required/t_tools2.inc4
-rwxr-xr-xtestautomation/global/win/dial_d_h.win3
-rw-r--r--[-rwxr-xr-x]testautomation/global/win/edia_p_s.win96
-rwxr-xr-xtestautomation/global/win/sys_dial.win18
-rwxr-xr-xtestautomation/global/win/tab_a_d.win8
-rwxr-xr-xtestautomation/graphics/optional/g_print.bas64
-rwxr-xr-xtestautomation/graphics/optional/includes/global/g_print.inc164
-rwxr-xr-xtestautomation/graphics/optional/includes/global/id_001.inc25
-rwxr-xr-xtestautomation/graphics/optional/includes/global/id_009.inc6
-rwxr-xr-xtestautomation/graphics/required/d_updt.bas4
-rwxr-xr-xtestautomation/graphics/required/i_updt_2.bas5
-rwxr-xr-xtestautomation/graphics/required/includes/global/id_001.inc33
-rwxr-xr-xtestautomation/graphics/required/includes/global/id_009.inc6
-rwxr-xr-xtestautomation/graphics/tools/id_tools_2.inc1
-rwxr-xr-xtestautomation/math/optional/includes/m_101_.inc21
-rwxr-xr-xtestautomation/math/required/includes/m_001_.inc22
-rwxr-xr-xtestautomation/math/required/includes/m_007_.inc4
-rwxr-xr-xtestautomation/math/required/m_updt.bas5
-rwxr-xr-xtestautomation/spreadsheet/optional/includes/printrange/c_printrange.inc26
-rwxr-xr-xtestautomation/spreadsheet/optional/includes/printscale/c_print_scale.inc16
-rwxr-xr-xtestautomation/spreadsheet/required/c_updt1.bas4
-rwxr-xr-xtestautomation/spreadsheet/required/includes/c_upd_editmenu2.inc2
-rwxr-xr-xtestautomation/spreadsheet/required/includes/c_upd_filemenu.inc71
-rwxr-xr-xtestautomation/writer/optional/includes/fields/w_fields4.inc8
-rwxr-xr-xtestautomation/writer/optional/includes/insertgraphic/w_insertgraphic1.inc122
-rwxr-xr-xtestautomation/writer/optional/includes/insertgraphic/w_insertgraphic4.inc8
-rwxr-xr-xtestautomation/writer/optional/includes/option/wh_o_1.inc150
-rwxr-xr-xtestautomation/writer/optional/includes/option/wh_o_2.inc142
-rwxr-xr-xtestautomation/writer/optional/includes/option/wr_o_1.inc52
-rwxr-xr-xtestautomation/writer/optional/includes/option/wr_o_2.inc152
-rwxr-xr-xtestautomation/writer/optional/includes/option/wr_o_3.inc12
-rwxr-xr-xtestautomation/writer/optional/includes/option/wr_o_4.inc103
-rwxr-xr-xtestautomation/writer/optional/includes/option/wr_o_a.inc7
-rw-r--r--testautomation/writer/optional/w_fields.bas3
-rw-r--r--testautomation/writer/optional/w_insertgraphic.bas1
-rw-r--r--testautomation/writer/required/includes/w_001a_.inc1062
-rwxr-xr-xtestautomation/writer/required/includes/w_011_.inc2
-rwxr-xr-xtestautomation/writer/required/w_updt.bas5
-rwxr-xr-xtestautomation/writer/tools/includes/w_tools.inc6
-rw-r--r--toolkit/inc/toolkit/awt/vclxprinter.hxx15
-rw-r--r--toolkit/source/awt/vclxprinter.cxx36
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx1
-rw-r--r--toolkit/source/controls/unocontrols.cxx2
-rw-r--r--tools/inc/tools/multisel.hxx104
-rw-r--r--tools/inc/tools/stream.hxx5
-rw-r--r--tools/source/fsys/urlobj.cxx18
-rw-r--r--tools/source/memtools/makefile.mk2
-rw-r--r--tools/source/memtools/multisel.cxx298
-rw-r--r--tools/workben/urltest.cxx14
-rw-r--r--transex3/source/inireader.cxx2
-rw-r--r--unotools/inc/unotools/confignode.hxx3
-rw-r--r--unotools/source/config/confignode.cxx23
-rwxr-xr-xvcl/aqua/inc/aquaprintview.h26
-rw-r--r--vcl/aqua/inc/salgdi.h3
-rw-r--r--vcl/aqua/inc/salprn.h41
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm1237
-rwxr-xr-xvcl/aqua/source/gdi/aquaprintview.mm11
-rw-r--r--vcl/aqua/source/gdi/makefile.mk1
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx12
-rwxr-xr-xvcl/aqua/source/gdi/salgdiutils.cxx35
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx320
-rw-r--r--vcl/inc/vcl/arrange.hxx425
-rw-r--r--vcl/inc/vcl/button.hxx16
-rw-r--r--vcl/inc/vcl/configsettings.hxx3
-rw-r--r--vcl/inc/vcl/edit.hxx1
-rw-r--r--vcl/inc/vcl/fixed.hxx1
-rw-r--r--vcl/inc/vcl/gdimtf.hxx1
-rw-r--r--vcl/inc/vcl/impprn.hxx3
-rw-r--r--vcl/inc/vcl/jobdata.hxx2
-rw-r--r--vcl/inc/vcl/jobset.h13
-rw-r--r--vcl/inc/vcl/lstbox.h5
-rw-r--r--vcl/inc/vcl/menu.hxx2
-rw-r--r--vcl/inc/vcl/oldprintadaptor.hxx (renamed from svx/source/inc/confirmdelete.hxx)44
-rw-r--r--vcl/inc/vcl/outdev.hxx5
-rw-r--r--vcl/inc/vcl/print.h23
-rw-r--r--vcl/inc/vcl/print.hxx393
-rw-r--r--vcl/inc/vcl/printerjob.hxx2
-rw-r--r--vcl/inc/vcl/prndlg.hxx306
-rw-r--r--vcl/inc/vcl/prntypes.hxx3
-rw-r--r--vcl/inc/vcl/salprn.hxx18
-rw-r--r--vcl/inc/vcl/salptype.hxx6
-rw-r--r--vcl/inc/vcl/svdata.hxx8
-rw-r--r--vcl/inc/vcl/svids.hrc100
-rw-r--r--vcl/inc/vcl/tabctrl.hxx13
-rw-r--r--vcl/inc/vcl/toolbox.hxx3
-rw-r--r--vcl/inc/vcl/virdev.hxx11
-rw-r--r--vcl/inc/vcl/window.h3
-rw-r--r--vcl/os2/inc/salprn.h5
-rw-r--r--vcl/os2/source/gdi/salprn.cxx11
-rw-r--r--vcl/prj/build.lst2
-rw-r--r--vcl/prj/d.lst2
-rw-r--r--vcl/source/app/salvtables.cxx4
-rw-r--r--vcl/source/app/svdata.cxx11
-rw-r--r--vcl/source/app/svmain.cxx20
-rw-r--r--vcl/source/control/button.cxx99
-rw-r--r--vcl/source/control/edit.cxx45
-rw-r--r--vcl/source/control/fixed.cxx8
-rw-r--r--vcl/source/control/ilstbox.cxx2
-rw-r--r--vcl/source/control/lstbox.cxx57
-rw-r--r--vcl/source/control/tabctrl.cxx189
-rw-r--r--vcl/source/gdi/bmpconv.cxx3
-rw-r--r--vcl/source/gdi/gdimtf.cxx34
-rw-r--r--vcl/source/gdi/impprn.cxx2
-rw-r--r--vcl/source/gdi/jobset.cxx26
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/makefile.mk4
-rw-r--r--vcl/source/gdi/oldprintadaptor.cxx117
-rw-r--r--vcl/source/gdi/print.cxx484
-rw-r--r--vcl/source/gdi/print2.cxx35
-rw-r--r--vcl/source/gdi/print3.cxx1765
-rw-r--r--vcl/source/gdi/virdev.cxx29
-rw-r--r--vcl/source/helper/xconnection.cxx36
-rw-r--r--vcl/source/src/images.src20
-rw-r--r--vcl/source/src/makefile.mk5
-rw-r--r--vcl/source/src/print.src495
-rw-r--r--vcl/source/src/stdtext.src7
-rw-r--r--vcl/source/window/arrange.cxx906
-rw-r--r--vcl/source/window/makefile.mk4
-rw-r--r--vcl/source/window/printdlg.cxx2489
-rw-r--r--vcl/source/window/toolbox.cxx26
-rw-r--r--vcl/source/window/window.cxx21
-rw-r--r--vcl/source/window/window2.cxx2
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx13
-rw-r--r--vcl/unx/headless/svpprn.cxx114
-rw-r--r--vcl/unx/headless/svpprn.hxx6
-rw-r--r--vcl/unx/inc/salprn.h6
-rw-r--r--vcl/unx/source/app/saldisp.cxx6
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx125
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx4
-rw-r--r--vcl/unx/source/printer/jobdata.cxx22
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx45
-rw-r--r--vcl/util/hidother.src34
-rw-r--r--vcl/util/makefile.mk1
-rw-r--r--vcl/win/inc/salprn.h5
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx61
-rw-r--r--vcl/win/source/gdi/salprn.cxx72
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java4
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java185
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java6
816 files changed, 51232 insertions, 31021 deletions
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
index 1477220d5953..be501ae901f6 100644
--- a/automation/source/server/statemnt.cxx
+++ b/automation/source/server/statemnt.cxx
@@ -91,16 +91,7 @@
#include <svtools/svtdata.hxx>
#include <tools/time.hxx>
#include <svtools/stringtransfer.hxx>
-#ifndef _PRINT_HXX //autogen
-#include <vcl/print.hxx>
-#endif
-#ifndef _PRNDLG_HXX //autogen
-#include <vcl/prndlg.hxx>
-#endif
#include <tools/stream.hxx>
-#ifndef _SV_DRAG_HXX //autogen
-//#include <vcl/drag.hxx>
-#endif
#include <tools/fsys.hxx>
#include <svl/stritem.hxx>
#include <svtools/ttprops.hxx>
@@ -4820,37 +4811,49 @@ BOOL StatementControl::Execute()
}
break;
case M_GetPage:
- pRet->GenReturn ( RET_Value, aUId, static_cast<comm_ULONG>(((TabControl*)pControl)->GetTabPage(((TabControl*)pControl)->GetCurPageId())->GetSmartUniqueOrHelpId().GetNum())); //GetNum() ULONG != comm_ULONG on 64bit
+ pRet->GenReturn ( RET_Value, aUId, ((TabControl*)pControl)->GetTabPage(((TabControl*)pControl)->GetCurPageId())->GetSmartUniqueOrHelpId().GetText());
break;
case M_SetPage :
{ // Wegen lokaler Variablen
TabControl *pTControl = ((TabControl*)pControl);
USHORT nActive = pTControl->GetCurPageId();
USHORT i,anz;
- ULONG nID = 0;
+ SmartId aID;
+ SmartId aWantedID;
+ if ( (nParams & PARAM_ULONG_1) )
+ {
+ aWantedID = SmartId( nLNr1 );
+ }
+ else if ( (nParams & PARAM_STR_1) )
+ {
+ aWantedID = SmartId( aString1 );
+ }
+ else
+ ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
+
i = pTControl->GetPagePos( pTControl->GetCurPageId() );
- for ( anz=0 ; anz < pTControl->GetPageCount() && nID != nLNr1 ; anz++ )
+ for ( anz=0 ; anz < pTControl->GetPageCount() && !aID.Matches( aWantedID ) ; anz++ )
{
pTControl->SelectTabPage( pTControl->GetPageId(i) );
/*if (pTControl->GetCurPageId())
pTControl->DeactivatePage();
pTControl->SetCurPageId( pTControl->GetPageId(i) );
pTControl->ActivatePage();*/
- nID = pTControl->GetTabPage(pTControl->GetCurPageId())->GetSmartUniqueOrHelpId().GetNum();
+ aID = pTControl->GetTabPage(pTControl->GetCurPageId())->GetSmartUniqueOrHelpId();
i++;
if ( i >= pTControl->GetPageCount() )
i = 0;
if ( !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) ) // 3 Mal aufrufen
break;
}
- if ( nID != nLNr1 )
+ if ( !aID.Matches( aWantedID ) )
{
pTControl->SelectTabPage( nActive );
/*if (pTControl->GetCurPageId())
pTControl->DeactivatePage();
pTControl->SetCurPageId( nActive );
pTControl->ActivatePage();*/
- ReportError( SmartId( nLNr1 ), GEN_RES_STR1( S_TABPAGE_NOT_FOUND, MethodString( nMethodId ) ) );
+ ReportError( aWantedID, GEN_RES_STR1( S_TABPAGE_NOT_FOUND, MethodString( nMethodId ) ) );
}
}
break;
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc
index ddff29283d2d..d4f048cda8d7 100644
--- a/basctl/inc/basidesh.hrc
+++ b/basctl/inc/basidesh.hrc
@@ -58,6 +58,7 @@
#define RID_DLG_NEWLIB ( RID_BASICIDE_START + 42 )
#define RID_DLG_EXPORT ( RID_BASICIDE_START + 43 )
#define RID_POPUP_DLGED ( RID_BASICIDE_START + 62 )
+#define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 )
#define RID_IMG_LOCKED_HC ( RID_BASICIDE_START + 6 )
#define RID_IMGBTN_REMOVEWATCH ( RID_BASICIDE_START + 8 )
diff --git a/basctl/source/basicide/basicprint.src b/basctl/source/basicide/basicprint.src
new file mode 100644
index 000000000000..be5e7d2e1de3
--- /dev/null
+++ b/basctl/source/basicide/basicprint.src
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basidesh.src,v $
+ * $Revision: 1.107 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <basidesh.hrc>
+
+StringArray RID_PRINTDLG_STRLIST
+{
+ ItemList [en-US] =
+ {
+ < "Print range"; >;
+ < "All ~Pages"; >;
+ < "Print all pages of the printable content."; >;
+ < "Pa~ges"; >;
+ < "Print only some pages of the printable content."; >;
+ };
+};
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx
new file mode 100644
index 000000000000..fa30af874cff
--- /dev/null
+++ b/basctl/source/basicide/basicrenderable.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basidesh.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_basctl.hxx"
+
+#include "basicrenderable.hxx"
+#include "bastypes.hxx"
+#include "basidesh.hrc"
+
+#include "com/sun/star/awt/XDevice.hpp"
+#include "toolkit/awt/vclxdevice.hxx"
+#include "vcl/print.hxx"
+#include "tools/multisel.hxx"
+#include "tools/resary.hxx"
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace basicide;
+
+BasicRenderable::BasicRenderable( IDEBaseWindow* pWin )
+: cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >( maMutex )
+, mpWindow( pWin )
+{
+ ResStringArray aStrings( IDEResId( RID_PRINTDLG_STRLIST ) );
+ DBG_ASSERT( aStrings.Count() >= 5, "resource incomplete" );
+ if( aStrings.Count() < 5 ) // bad resource ?
+ return;
+
+ m_aUIProperties.realloc( 3 );
+
+ // create Subgroup for print range
+ vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
+ aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
+ aPrintRangeOpt.mbInternalOnly = sal_True;
+ m_aUIProperties[0].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 0 ) ),
+ rtl::OUString(),
+ aPrintRangeOpt
+ );
+
+ // create a choice for the range to print
+ rtl::OUString aPrintContentName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
+ Sequence< rtl::OUString > aChoices( 2 );
+ Sequence< rtl::OUString > aHelpTexts( 2 );
+ aChoices[0] = aStrings.GetString( 1 );
+ aHelpTexts[0] = aStrings.GetString( 2 );
+ aChoices[1] = aStrings.GetString( 3 );
+ aHelpTexts[1] = aStrings.GetString( 4 );
+ m_aUIProperties[1].Value = getChoiceControlOpt( rtl::OUString(),
+ aHelpTexts,
+ aPrintContentName,
+ aChoices,
+ 0 );
+
+ // create a an Edit dependent on "Pages" selected
+ vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintContentName, 1, sal_True );
+ m_aUIProperties[2].Value = getEditControlOpt( rtl::OUString(),
+ rtl::OUString(),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ),
+ rtl::OUString(),
+ aPageRangeOpt
+ );
+}
+
+BasicRenderable::~BasicRenderable()
+{
+}
+
+Printer* BasicRenderable::getPrinter()
+{
+ Printer* pPrinter = NULL;
+ Any aValue( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
+ Reference<awt::XDevice> xRenderDevice;
+
+ if( aValue >>= xRenderDevice )
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice);
+ OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+ pPrinter = dynamic_cast<Printer*>(pOut);
+ }
+ return pPrinter;
+}
+
+sal_Int32 SAL_CALL BasicRenderable::getRendererCount (
+ const Any&, const Sequence<beans::PropertyValue >& i_xOptions
+ ) throw (lang::IllegalArgumentException, RuntimeException)
+{
+ processProperties( i_xOptions );
+
+ sal_Int32 nCount = 0;
+ if( mpWindow )
+ {
+ Printer* pPrinter = getPrinter();
+ if( pPrinter )
+ {
+ nCount = mpWindow->countPages( pPrinter );
+ sal_Int64 nContent = getIntValue( "PrintContent", -1 );
+ if( nContent == 1 )
+ {
+ rtl::OUString aPageRange( getStringValue( "PageRange" ) );
+ MultiSelection aSel( aPageRange );
+ long nSelCount = aSel.GetSelectCount();
+ if( nSelCount >= 0 && nSelCount < nCount )
+ nCount = nSelCount;
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+
+ return nCount;
+}
+
+Sequence<beans::PropertyValue> SAL_CALL BasicRenderable::getRenderer (
+ sal_Int32, const Any&, const Sequence<beans::PropertyValue>& i_xOptions
+ ) throw (lang::IllegalArgumentException, RuntimeException)
+{
+ processProperties( i_xOptions );
+
+ Sequence< beans::PropertyValue > aVals;
+ // insert page size here
+ Printer* pPrinter = getPrinter();
+ // no renderdevice is legal; the first call is to get our print ui options
+ if( pPrinter )
+ {
+ Size aPageSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+
+ aVals.realloc( 1 );
+ aVals[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
+ awt::Size aSize;
+ aSize.Width = aPageSize.Width();
+ aSize.Height = aPageSize.Height();
+ aVals[0].Value <<= aSize;
+ }
+
+ appendPrintUIOptions( aVals );
+
+ return aVals;
+}
+
+void SAL_CALL BasicRenderable::render (
+ sal_Int32 nRenderer, const Any&,
+ const Sequence<beans::PropertyValue>& i_xOptions
+ ) throw (lang::IllegalArgumentException, RuntimeException)
+{
+ processProperties( i_xOptions );
+
+ if( mpWindow )
+ {
+ Printer* pPrinter = getPrinter();
+ if( pPrinter )
+ {
+ sal_Int64 nContent = getIntValue( "PrintContent", -1 );
+ if( nContent == 1 )
+ {
+ rtl::OUString aPageRange( getStringValue( "PageRange" ) );
+ MultiSelection aSel( aPageRange );
+ long nSelect = aSel.FirstSelected();
+ while( nSelect != long(SFX_ENDOFSELECTION) && nRenderer-- )
+ nSelect = aSel.NextSelected();
+ if( nSelect != long(SFX_ENDOFSELECTION) )
+ mpWindow->printPage( sal_Int32(nSelect-1), pPrinter );
+ }
+ else
+ mpWindow->printPage( nRenderer, pPrinter );
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+}
+
+
diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx
new file mode 100644
index 000000000000..7cad19c784be
--- /dev/null
+++ b/basctl/source/basicide/basicrenderable.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basidesh.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BASICRENDERABLE_HXX
+#define _BASICRENDERABLE_HXX
+
+#include "com/sun/star/view/XRenderable.hpp"
+#include "cppuhelper/compbase1.hxx"
+
+#include "vcl/print.hxx"
+
+class IDEBaseWindow;
+
+namespace basicide
+{
+class BasicRenderable :
+ public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >,
+ public vcl::PrinterOptionsHelper
+{
+ IDEBaseWindow* mpWindow;
+ osl::Mutex maMutex;
+
+ Printer* getPrinter();
+public:
+ BasicRenderable( IDEBaseWindow* pWin );
+ virtual ~BasicRenderable();
+
+ // XRenderable
+ virtual sal_Int32 SAL_CALL getRendererCount (
+ const com::sun::star::uno::Any& aSelection,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue >& xOptions)
+ throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> SAL_CALL getRenderer (
+ sal_Int32 nRenderer,
+ const com::sun::star::uno::Any& rSelection,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rxOptions)
+ throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL render (
+ sal_Int32 nRenderer,
+ const com::sun::star::uno::Any& rSelection,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rxOptions)
+ throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
+
+};
+
+} // namespace
+
+#endif
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index e23cd68a75af..6612f82fb92b 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -110,7 +110,7 @@ DBG_NAME( ModulWindow )
TYPEINIT1( ModulWindow , IDEBaseWindow );
-void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle )
+void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle, bool bOutput )
{
short nLeftMargin = LMARGPRN;
Size aSz = pPrinter->GetOutputSize();
@@ -136,14 +136,16 @@ void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const S
long nXLeft = nLeftMargin-nBorder;
long nXRight = aSz.Width()-RMARGPRN+nBorder;
- pPrinter->DrawRect( Rectangle(
- Point( nXLeft, nYTop ),
- Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) );
+ if( bOutput )
+ pPrinter->DrawRect( Rectangle(
+ Point( nXLeft, nYTop ),
+ Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) );
long nY = TMARGPRN-2*nBorder;
Point aPos( nLeftMargin, nY );
- pPrinter->DrawText( aPos, rTitle );
+ if( bOutput )
+ pPrinter->DrawText( aPos, rTitle );
if ( nPages != 1 )
{
aFont.SetWeight( WEIGHT_NORMAL );
@@ -154,13 +156,15 @@ void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const S
aPageStr += String::CreateFromInt32( nCurPage );
aPageStr += ']';
aPos.X() += pPrinter->GetTextWidth( rTitle );
- pPrinter->DrawText( aPos, aPageStr );
+ if( bOutput )
+ pPrinter->DrawText( aPos, aPageStr );
}
nY = TMARGPRN-nBorder;
- pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
+ if( bOutput )
+ pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
pPrinter->SetFont( aOldFont );
pPrinter->SetFillColor( aOldFillColor );
@@ -914,8 +918,23 @@ void __EXPORT ModulWindow::UpdateData()
}
}
+sal_Int32 ModulWindow::countPages( Printer* pPrinter )
+{
+ return FormatAndPrint( pPrinter, -1 );
+}
+
+void ModulWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
+{
+ FormatAndPrint( pPrinter, nPage );
+}
-void __EXPORT ModulWindow::PrintData( Printer* pPrinter )
+/* implementation note: this is totally inefficient for the XRenderable interface
+ usage since the whole "document" will be format for every page. Should this ever
+ become a problem we should
+ - format only once for every new printer
+ - keep an index list for each page which is the starting paragraph
+*/
+sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
{
DBG_CHKTHIS( ModulWindow, 0 );
@@ -949,10 +968,8 @@ void __EXPORT ModulWindow::PrintData( Printer* pPrinter )
USHORT nPages = (USHORT) (nParas/nLinespPage+1 );
USHORT nCurPage = 1;
- pPrinter->StartJob( aTitle );
- pPrinter->StartPage();
// Header drucken...
- lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle );
+ lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 );
Point aPos( LMARGPRN, TMARGPRN );
for ( ULONG nPara = 0; nPara < nParas; nPara++ )
{
@@ -966,20 +983,19 @@ void __EXPORT ModulWindow::PrintData( Printer* pPrinter )
if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) )
{
nCurPage++;
- pPrinter->EndPage();
- pPrinter->StartPage();
- lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle );
+ lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nCurPage-1 == nPrintPage );
aPos = Point( LMARGPRN, TMARGPRN+nLineHeight );
}
- pPrinter->DrawText( aPos, aTmpLine );
+ if( nCurPage-1 == nPrintPage )
+ pPrinter->DrawText( aPos, aTmpLine );
}
aPos.Y() += nParaSpace;
}
- pPrinter->EndPage();
- pPrinter->EndJob();
pPrinter->SetFont( aOldFont );
pPrinter->SetMapMode( eOldMapMode );
+
+ return sal_Int32(nCurPage);
}
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 0c575229411e..25a04b0da6ab 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -359,6 +359,7 @@ private:
void GoOnTop();
void AssertValidEditEngine();
+ sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
protected:
virtual void Resize();
virtual void GetFocus();
@@ -380,7 +381,11 @@ public:
virtual void StoreData();
virtual void UpdateData();
virtual BOOL CanClose();
- virtual void PrintData( Printer* pPrinter );
+ // virtual void PrintData( Printer* pPrinter );
+ // return number of pages to be printed
+ virtual sal_Int32 countPages( Printer* pPrinter );
+ // print page
+ virtual void printPage( sal_Int32 nPage, Printer* pPrinter );
virtual String GetTitle();
virtual BasicEntryDescriptor CreateEntryDescriptor();
virtual BOOL AllowUndo();
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index d33310b6e339..77181a0a2044 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1368,9 +1368,14 @@ void DialogWindow::Deactivating()
BasicIDE::MarkDocumentModified( GetDocument() );
}
-void DialogWindow::PrintData( Printer* pPrinter )
+sal_Int32 DialogWindow::countPages( Printer* pPrinter )
{
- pEditor->PrintData( pPrinter, CreateQualifiedName() );
+ return pEditor->countPages( pPrinter );
+}
+
+void DialogWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
+{
+ pEditor->printPage( nPage, pPrinter, CreateQualifiedName() );
}
void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt )
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 74e1d59aad4d..eb59ca4f082b 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -38,8 +38,7 @@
#include <ide_pch.hxx>
#include <basic/sbx.hxx>
-
-#define _SOLAR__PRIVATE 1
+#include "basicrenderable.hxx"
#include <com/sun/star/frame/XTitle.hpp>
@@ -85,6 +84,12 @@ IMPL_LINK( BasicIDEShell, ObjectDialogInsertHdl, ObjectCatalog *, pObjCat )
}
*/
+Reference< view::XRenderable > BasicIDEShell::GetRenderable()
+{
+ return Reference< view::XRenderable >( new basicide::BasicRenderable( pCurWin ) );
+}
+
+#if 0
USHORT __EXPORT BasicIDEShell::Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog )
{
if ( pCurWin )
@@ -98,6 +103,7 @@ USHORT __EXPORT BasicIDEShell::Print( SfxProgress &rProgress, BOOL bIsAPI, Print
}
return 0;
}
+#endif
BOOL BasicIDEShell::HasSelection( BOOL /* bText */ ) const
{
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 3b64b11b9abc..c44d3d00fdf0 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -207,13 +207,6 @@ void __EXPORT IDEBaseWindow::UpdateData()
}
-
-void __EXPORT IDEBaseWindow::PrintData( Printer* )
-{
-}
-
-
-
String __EXPORT IDEBaseWindow::GetTitle()
{
return String();
diff --git a/basctl/source/basicide/makefile.mk b/basctl/source/basicide/makefile.mk
index 8766473d8157..c5222951da6c 100644
--- a/basctl/source/basicide/makefile.mk
+++ b/basctl/source/basicide/makefile.mk
@@ -51,7 +51,8 @@ CDEFS+=-DBASICDEBUG
# --- Allgemein ----------------------------------------------------------
-EXCEPTIONSFILES=$(SLO)$/scriptdocument.obj \
+EXCEPTIONSFILES=$(SLO)$/basicrenderable.obj \
+ $(SLO)$/scriptdocument.obj \
$(SLO)$/basidesh.obj \
$(SLO)$/basides1.obj \
$(SLO)$/basides2.obj \
@@ -84,7 +85,7 @@ SLOFILES = $(EXCEPTIONSFILES) \
$(SLO)$/objdlg.obj \
SRS1NAME=$(TARGET)
-SRC1FILES= basidesh.src macrodlg.src moptions.src moduldlg.src objdlg.src brkdlg.src tbxctl.src
+SRC1FILES= basidesh.src macrodlg.src moptions.src moduldlg.src objdlg.src brkdlg.src tbxctl.src basicprint.src
.INCLUDE : target.mk
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 423ef39079a0..80b9c26e07b4 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -1283,7 +1283,20 @@ void lcl_PrintHeader( Printer* pPrinter, const String& rTitle ) // not working y
//----------------------------------------------------------------------------
-void DlgEditor::PrintData( Printer* pPrinter, const String& rTitle ) // not working yet
+sal_Int32 DlgEditor::countPages( Printer* )
+{
+ return 1;
+}
+
+void DlgEditor::printPage( sal_Int32 nPage, Printer* pPrinter, const String& rTitle )
+{
+ if( nPage == 0 )
+ Print( pPrinter, rTitle );
+}
+
+//----------------------------------------------------------------------------
+
+void DlgEditor::Print( Printer* pPrinter, const String& rTitle ) // not working yet
{
if( pDlgEdView )
{
@@ -1304,8 +1317,6 @@ void DlgEditor::PrintData( Printer* pPrinter, const String& rTitle ) // not w
aPaperSz.Width() -= (LMARGPRN+RMARGPRN);
aPaperSz.Height() -= (TMARGPRN+BMARGPRN);
- pPrinter->StartPage();
-
lcl_PrintHeader( pPrinter, rTitle );
Bitmap aDlg;
@@ -1350,8 +1361,6 @@ void DlgEditor::PrintData( Printer* pPrinter, const String& rTitle ) // not w
pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg );
- pPrinter->EndPage();
-
pPrinter->SetMapMode( aOldMap );
pPrinter->SetFont( aOldFont );
}
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index 4c361d4545f5..7920e9ebdfc6 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -110,7 +110,10 @@ public:
virtual BOOL IsPasteAllowed();
virtual SfxUndoManager* GetUndoManager();
- virtual void PrintData( Printer* pPrinter );
+ // return number of pages to be printed
+ virtual sal_Int32 countPages( Printer* pPrinter );
+ // print page
+ virtual void printPage( sal_Int32 nPage, Printer* pPrinter );
virtual void Deactivating();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index d8e58b968398..f4f118b0b277 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -199,7 +199,9 @@ public:
SfxUndoManager* GetUndoManager();
- virtual USHORT Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog = 0 );
+ virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
+
+ // virtual USHORT Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog = 0 );
virtual SfxPrinter* GetPrinter( BOOL bCreate );
virtual USHORT SetPrinter( SfxPrinter *pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
virtual String GetSelectionText( BOOL bCompleteWords );
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index 0c542ac405ad..a9540762172d 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -205,9 +205,13 @@ public:
virtual void StoreData();
virtual void UpdateData();
- virtual void PrintData( Printer* pPrinter );
virtual BOOL CanClose();
+ // return number of pages to be printed
+ virtual sal_Int32 countPages( Printer* pPrinter ) = 0;
+ // print page
+ virtual void printPage( sal_Int32 nPage, Printer* pPrinter ) = 0;
+
virtual String GetTitle();
String CreateQualifiedName();
virtual BasicEntryDescriptor CreateEntryDescriptor() = 0;
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 9a75e80a53e2..001c689a78a5 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -102,6 +102,8 @@ private:
DECL_LINK( PaintTimeout, Timer * );
DECL_LINK( MarkTimeout, Timer * );
+ void Print( Printer* pPrinter, const String& rTitle );
+
protected:
ScrollBar* pHScroll;
ScrollBar* pVScroll;
@@ -199,7 +201,8 @@ public:
void ShowProperties();
void UpdatePropertyBrowserDelayed();
- void PrintData( Printer*, const String& rTitle ); // not working yet
+ sal_Int32 countPages( Printer* pPrinter );
+ void printPage( sal_Int32 nPage, Printer* pPrinter, const String& );
bool AdjustPageSize();
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index 31385f2f6e9e..4cc2765604fd 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -1401,19 +1401,10 @@ long BasicFrame::Command( short nID, BOOL bChecked )
// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
break;
case RID_FILEPRINT:
-#ifndef UNX
if( pWork )
pPrn->Print( pWork->GetText(), pWork->pDataEdit->GetText(), this );
-#else
- InfoBox( this, SttResId( IDS_NOPRINTERERROR ) ).Execute();
-#endif
break;
case RID_FILESETUP:
-#ifndef UNX
- pPrn->Setup();
-#else
- InfoBox( this, SttResId( IDS_NOPRINTERERROR ) ).Execute();
-#endif
break;
case RID_QUIT:
if( Close() ) aBasicApp.Quit();
diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk
index 13c3b4a8b507..3a52f402b329 100644
--- a/basic/source/app/makefile.mk
+++ b/basic/source/app/makefile.mk
@@ -61,6 +61,7 @@ OBJFILES = \
EXCEPTIONSFILES = \
$(OBJ)$/app.obj \
+ $(OBJ)$/printer.obj \
$(OBJ)$/process.obj
.IF "$(GUI)" == "WNT"
diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx
index 6f173fd53ffa..61879d628d39 100644
--- a/basic/source/app/printer.cxx
+++ b/basic/source/app/printer.cxx
@@ -64,35 +64,32 @@ public:
void ChangeMessage( short );
};
-BasicPrinter::BasicPrinter() : Printer()
+BasicPrinter::BasicPrinter() : mpPrinter( new Printer() )
{
nPage = 0; nLine = 9999;
- SetMapMode( MapMode( MAP_POINT ) );
- Size s( GetOutputSize() );
+ mpPrinter->SetMapMode( MapMode( MAP_POINT ) );
+ Size s( mpPrinter->GetOutputSize() );
// Use 10 point font
Font aFont( FAMILY_MODERN, Size( 0, 10 ) );
aFont.SetPitch( PITCH_FIXED );
- SetFont( aFont );
+ mpPrinter->SetFont( aFont );
// Output: 6 Lines/Inch = 12 Point
nLines = (short) s.Height() / 12;
nYoff = 12;
- SetStartPrintHdl( LINK( this, BasicPrinter, StartPrintHdl ) );
- SetEndPrintHdl( LINK( this, BasicPrinter, EndPrintHdl ) );
- SetPrintPageHdl( LINK( this, BasicPrinter, PrintPageHdl ) );
}
void BasicPrinter::Header()
{
- if( nPage ) EndPage();
+ if( nPage ) mpListener->EndPage();
nPage++;
- StartPage();
+ mpListener->StartPage();
String aHdr;
String aPage( SttResId( IDS_PAGE ) );
aPage.Append( String::CreateFromInt32(nPage) );
aHdr = aFile.Copy( 0, 80 - aPage.Len() );
aHdr.Expand( 80 - aPage.Len(), ' ' );
aHdr += aPage;
- DrawText( Point( 0, 0 ), aHdr );
+ mpPrinter->DrawText( Point( 0, 0 ), aHdr );
nLine = 2;
}
@@ -100,98 +97,29 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame *
{
nPage = 0; nLine = 9999;
aFile = rFile;
- // Setup dialog
- SttResId aResId( IDD_PRINT_DIALOG );
- pDlg = new PrintingDialog
- ( aBasicApp.pFrame, this, aResId, aFile );
- // Set position of dialog
- Size s1 = aBasicApp.pFrame->GetSizePixel();
- Size s2 = pDlg->GetSizePixel();
- pDlg->SetPosPixel( Point( (s1.Width() - s2.Width() ) / 2,
- (s1.Height()- s2.Height() ) / 2 ) );
// Disable PRINT-Menu
MenuBar* pBar = pFrame->GetMenuBar();
Menu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE );
pFileMenu->EnableItem( RID_FILEPRINT, FALSE );
- pDlg->ChangeMessage( 1 );
- pDlg->Show();
- StartJob( rFile );
- StartPage();
+ mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
+ mpListener->StartPage();
xub_StrLen nDone=0;
while( nDone < rText.Len() )
{
if( nLine >= nLines ) Header();
xub_StrLen nLineEnd = std::min( rText.Search( '\n', nDone ), rText.Search( '\r', nDone ) );
- DrawText( Point( 0, nLine * nYoff ), rText, nDone, nLineEnd-nDone-1 );
+ mpPrinter->DrawText( Point( 0, nLine * nYoff ), rText, nDone, nLineEnd-nDone-1 );
nDone = nLineEnd;
if( nDone <= rText.Len() && rText.GetChar(nDone) == '\r' ) nDone++;
if( nDone <= rText.Len() && rText.GetChar(nDone) == '\n' ) nDone++;
nLine++;
- Application::Reschedule();
}
- EndPage();
- EndJob();
+ mpListener->EndPage();
+
+ Printer::PrintJob( mpListener, mpPrinter->GetJobSetup() );
nPage = 1;
- while( IsPrinting() ) Application::Reschedule();
- delete pDlg; pDlg = NULL;
pFileMenu->EnableItem( RID_FILEPRINT, TRUE );
}
-IMPL_LINK_INLINE_START( BasicPrinter, StartPrintHdl, Printer *, pPrinter )
-{
- (void) pPrinter; /* avoid warning about unused parameter */
- if( pDlg != NULL )
- pDlg->Show();
- return 0;
-}
-IMPL_LINK_INLINE_END( BasicPrinter, StartPrintHdl, Printer *, pPrinter )
-
-IMPL_LINK_INLINE_START( BasicPrinter, EndPrintHdl, Printer *, pPrinter )
-{
- (void) pPrinter; /* avoid warning about unused parameter */
- if( pDlg != NULL)
- pDlg->Hide();
- return 0;
-}
-IMPL_LINK_INLINE_END( BasicPrinter, EndPrintHdl, Printer *, pPrinter )
-
-IMPL_LINK_INLINE_START( BasicPrinter, PrintPageHdl, Printer *, pPrinter )
-{
- (void) pPrinter; /* avoid warning about unused parameter */
- if( pDlg != NULL)
- pDlg->ChangeMessage( nPage );
- return 0;
-}
-IMPL_LINK_INLINE_END( BasicPrinter, PrintPageHdl, Printer *, pPrinter )
-
-IMPL_LINK_INLINE( BasicPrinter, Abort , void *, EMPTYARG,
-{
- AbortJob();
- return 0L;
-}
-)
-
-/////////////////////////////////////////////////////////////////////////
-
-PrintingDialog::PrintingDialog
- ( Window* pParent, BasicPrinter* pPrn, ResId& rId, String& rName )
-: ModelessDialog( pParent, rId )
-, aName ( rName )
-, aText ( this, ResId( RID_TEXT, *rId.GetResMgr() ) )
-, aCancel( this, ResId( RID_CANCEL, *rId.GetResMgr() ) )
-{
- FreeResource();
- aCancel.SetClickHdl( LINK( pPrn, BasicPrinter, Abort ) );
-}
-
-void PrintingDialog::ChangeMessage( short nPage )
-{
- String aMsg( SttResId( IDS_PRINTMSG ) );
- aMsg += aName;
- aMsg += CUniString("\n");
- aMsg += String( SttResId( IDS_PAGE ) );
- aMsg += String::CreateFromInt32( nPage );
- aText.SetText( aMsg );
-}
diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx
index d6db8154c57f..26b89b5278fe 100644
--- a/basic/source/app/printer.hxx
+++ b/basic/source/app/printer.hxx
@@ -31,31 +31,25 @@
#ifndef _BASICPRN_HXX
#define _BASICPRN_HXX
-#ifndef _PRINT_HXX //autogen
-#include <vcl/print.hxx>
-#endif
+#include "vcl/print.hxx"
+#include "vcl/oldprintadaptor.hxx"
-class PrintingDialog;
+class BasicPrinter
+{
+ boost::shared_ptr<Printer> mpPrinter;
+ boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
-class BasicPrinter : public Printer {
short nLine; // aktuelle Zeile
short nPage; // aktuelle Seite
short nLines; // Zeilen pro Seite
short nYoff; // Zeilenabstand in Points
String aFile; // Dateiname
- PrintingDialog* pDlg; // Druck-Dialog
+
void Header(); // Seitenkopf drucken
+ void StartPage();
public:
BasicPrinter();
void Print( const String& rFile, const String& rText, BasicFrame *pFrame );
- DECL_LINK( Abort, void * );
- DECL_LINK( StartPrintHdl, Printer * );
- DECL_LINK( EndPrintHdl, Printer * );
- DECL_LINK( PrintPageHdl, Printer * );
-#if defined( PM20 )
- // StarView-Bug, bald wieder zu entfernen:
- virtual void SetPageQueueSize( USHORT ) {}
-#endif
};
#endif
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index aa3fda6a7116..a13569ee0a9f 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -32,9 +32,7 @@
#include "precompiled_basic.hxx"
#include <tools/shl.hxx>
#include <vcl/svapp.hxx>
-#ifndef _SOLAR_HRC
#include <svl/solar.hrc>
-#endif
#include <tools/debug.hxx>
#include <vcl/msgbox.hxx>
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 5469010f2745..7a5e81a5512a 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -990,7 +990,8 @@ namespace cairocanvas
aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a));
aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex));
- doPolyPolygonImplementation( aEdge, aOperation,
+ doPolyPolygonImplementation( basegfx::B2DPolyPolygon(aEdge),
+ aOperation,
pCairo, pTextures,
mpSurfaceProvider,
xPolyPolygon->getFillRule() );
@@ -1187,7 +1188,7 @@ namespace cairocanvas
cairo_save( mpCairo.get() );
useStates( viewState, renderState, true );
- doPolyPolygonPath( xPolyPolygon, Fill, &textures );
+ doPolyPolygonPath( xPolyPolygon, Fill, false, &textures );
cairo_restore( mpCairo.get() );
}
diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx
index 8b816e8c1ce9..caa895021103 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -240,7 +240,7 @@ namespace comphelper
if ( !( _element >>= aProperty ) )
throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ClearableMutexGuard g( m_aMutex );
// check whether the type is allowed, everything else will be checked
// by m_aDynamicProperties
@@ -254,6 +254,7 @@ namespace comphelper
// our property info is dirty
m_pArrayHelper.reset();
+ g.clear();
setModified(sal_True);
}
@@ -346,7 +347,7 @@ namespace comphelper
//--------------------------------------------------------------------
void SAL_CALL OPropertyBag::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) throw (PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ClearableMutexGuard g( m_aMutex );
// check whether the type is allowed, everything else will be checked
// by m_aDynamicProperties
@@ -362,19 +363,21 @@ namespace comphelper
// our property info is dirty
m_pArrayHelper.reset();
+ g.clear();
setModified(sal_True);
}
//--------------------------------------------------------------------
void SAL_CALL OPropertyBag::removeProperty( const ::rtl::OUString& _rName ) throw (UnknownPropertyException, NotRemoveableException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ClearableMutexGuard g( m_aMutex );
m_aDynamicProperties.removeProperty( _rName );
// our property info is dirty
m_pArrayHelper.reset();
+ g.clear();
setModified(sal_True);
}
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index fe6cbaa9d767..0ccc28d4238b 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -38,15 +38,11 @@
#include <osl/diagnose.h>
#if OSL_DEBUG_LEVEL > 0
- #ifndef _RTL_STRBUF_HXX_
#include <rtl/strbuf.hxx>
- #endif
- #ifndef _CPPUHELPER_EXC_HLP_HXX_
#include <cppuhelper/exc_hlp.hxx>
- #endif
- #ifndef _OSL_THREAD_H_
#include <osl/thread.h>
- #endif
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <typeinfo>
#endif
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -71,6 +67,10 @@ namespace comphelper
using ::com::sun::star::uno::cpp_queryInterface;
using ::com::sun::star::uno::cpp_acquire;
using ::com::sun::star::uno::cpp_release;
+#if OSL_DEBUG_LEVEL > 0
+ using ::com::sun::star::lang::XServiceInfo;
+#endif
+ using ::com::sun::star::uno::UNO_QUERY;
/** === end UNO using === **/
namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
@@ -110,7 +110,18 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
::rtl::OStringBuffer aBuffer;
aBuffer.append( "::comphelper::copyProperties: could not copy property '" );
aBuffer.append( ::rtl::OString( pSourceProps->Name.getStr(), pSourceProps->Name.getLength(), RTL_TEXTENCODING_ASCII_US ) );
- aBuffer.append( "' to the destination set.\n" );
+ aBuffer.append( "' to the destination set (a '" );
+
+ Reference< XServiceInfo > xSI( _rxDest, UNO_QUERY );
+ if ( xSI.is() )
+ {
+ aBuffer.append( ::rtl::OUStringToOString( xSI->getImplementationName(), osl_getThreadTextEncoding() ) );
+ }
+ else
+ {
+ aBuffer.append( typeid( *_rxDest.get() ).name() );
+ }
+ aBuffer.append( "' implementation).\n" );
Any aException( ::cppu::getCaughtException() );
aBuffer.append( "Caught an exception of type '" );
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java
index 7fcfba0cf0a3..06f7da701f14 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java
@@ -1,4 +1,33 @@
-/*
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: StorageFileAccess.java,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ /*
* NativeInputStreamHelper.java
*
* Created on 9. September 2004, 11:51
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java
index 50697e07c6aa..5778c9ab830c 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java
@@ -1,3 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: StorageFileAccess.java,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
/*
* StorageNativeInputStream.java
*
diff --git a/connectivity/inc/connectivity/BlobHelper.hxx b/connectivity/inc/connectivity/BlobHelper.hxx
new file mode 100644
index 000000000000..2fb832823bd2
--- /dev/null
+++ b/connectivity/inc/connectivity/BlobHelper.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FValue.cxx,v $
+ * $Revision: 1.34 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_BLOBHELPER_HXX_
+#define _CONNECTIVITY_BLOBHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XBlob.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS BlobHelper : public ::cppu::WeakImplHelper1< com::sun::star::sdbc::XBlob >
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aValue;
+ public:
+ BlobHelper(const ::com::sun::star::uno::Sequence< sal_Int8 >& _val);
+ private:
+ virtual ::sal_Int64 SAL_CALL length( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int64 pos, ::sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL position( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+
+#endif //_CONNECTIVITY_BLOBHELPER_HXX_
+
diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx
index 1ee1718247ae..4cfab247c10f 100644
--- a/connectivity/inc/connectivity/dbmetadata.hxx
+++ b/connectivity/inc/connectivity/dbmetadata.hxx
@@ -121,6 +121,17 @@ namespace dbtools
*/
bool supportsSubqueriesInFrom() const;
+ /** checks whether the database supports primary keys
+
+ Since there's no dedicated API to ask a database for this, a heuristics needs to be applied.
+ First, the <code>PrimaryKeySupport<code> settings of the data source is examined. If it is <TRUE/>
+ or <FALSE/>, then value is returned. If it is <NULL/>, then the database meta data are examined
+ for support of core SQL grammar, and the result is returned. The assumption is that a database/driver
+ which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience
+ shows this is true most of the time.
+ */
+ bool supportsPrimaryKeys() const;
+
/** determines whether names in the database should be restricted to SQL-92 identifiers
Effectively, this method checks the EnableSQL92Check property of the data source settings,
diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx
index 493dc2a3802f..32ef3bcb7da1 100644
--- a/connectivity/inc/connectivity/dbtools.hxx
+++ b/connectivity/inc/connectivity/dbtools.hxx
@@ -37,6 +37,7 @@
#include <comphelper/stl_types.hxx>
#include <unotools/sharedunocomponent.hxx>
#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/FValue.hxx"
namespace com { namespace sun { namespace star {
@@ -593,6 +594,20 @@ namespace dbtools
sal_Int32 sqlType,
sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ /** call the appropiate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::connectivity::ORowSetValue& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
/** implements <method scope="com.sun.star.sdb">XParameters::setObject</method>
<p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
diff --git a/connectivity/inc/connectivity/sqliterator.hxx b/connectivity/inc/connectivity/sqliterator.hxx
index ddbf3e24af3c..e8e4c8e6a6f2 100644
--- a/connectivity/inc/connectivity/sqliterator.hxx
+++ b/connectivity/inc/connectivity/sqliterator.hxx
@@ -279,6 +279,9 @@ namespace connectivity
// return true when the tableNode is a rule like catalog_name, schema_name or table_name
sal_Bool isTableNode(const OSQLParseNode* _pTableNode) const;
+
+ // tries to find the correct type of the function
+ sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
private:
/** traverses the list of table names, and filles _rTables
*/
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx
index 0adcae01d966..cc1b27cf4f57 100644
--- a/connectivity/inc/connectivity/sqlnode.hxx
+++ b/connectivity/inc/connectivity/sqlnode.hxx
@@ -225,6 +225,10 @@ namespace connectivity
as,
op_column_commalist,
table_primary_as_range_column,
+ datetime_primary,
+ concatenation,
+ char_factor,
+ bit_value_fct,
rule_count, // letzter_wert
UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
};
diff --git a/connectivity/qa/connectivity/GeneralTest.java b/connectivity/qa/connectivity/GeneralTest.java
index 18b6cf267a43..da894ba2cbdb 100644
--- a/connectivity/qa/connectivity/GeneralTest.java
+++ b/connectivity/qa/connectivity/GeneralTest.java
@@ -30,21 +30,13 @@
package complex.connectivity;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XMultiServiceFactory;
import complexlib.ComplexTestCase;
-import java.io.PrintWriter;
-import util.utils;
-import java.util.*;
-import java.io.*;
//import complex.connectivity.DBaseStringFunctions;
public class GeneralTest extends ComplexTestCase {
@@ -63,7 +55,7 @@ public class GeneralTest extends ComplexTestCase {
public void test() throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
try
{
- XDriverManager driverManager = (XDriverManager)UnoRuntime.queryInterface(XDriverManager.class,((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.sdbc.DriverManager"));
+ XDriverManager driverManager = UnoRuntime.queryInterface( XDriverManager.class, ((XMultiServiceFactory)param.getMSF()).createInstance( "com.sun.star.sdbc.DriverManager" ) );
String databaseURL = "sdbc:calc:singin' in the rain" ;
XConnection catalogConnection = driverManager.getConnection(databaseURL);
failed();
diff --git a/connectivity/qa/connectivity/tools/AbstractDatabase.java b/connectivity/qa/connectivity/tools/AbstractDatabase.java
index d3150cd8aa07..4807860740ad 100755
--- a/connectivity/qa/connectivity/tools/AbstractDatabase.java
+++ b/connectivity/qa/connectivity/tools/AbstractDatabase.java
@@ -38,10 +38,10 @@ import com.sun.star.sdb.XDocumentDataSource;
import com.sun.star.sdb.XOfficeDatabaseDocument;
import com.sun.star.sdbc.SQLException;
import com.sun.star.sdbc.XCloseable;
-import com.sun.star.sdbc.XConnection;
import com.sun.star.sdbc.XStatement;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.CloseVetoException;
+import connectivity.tools.sdb.Connection;
import java.io.File;
/**
@@ -60,7 +60,7 @@ public abstract class AbstractDatabase implements DatabaseAccess
// the data source belonging to the database document
protected DataSource m_dataSource;
// the default connection
- protected XConnection m_connection;
+ protected Connection m_connection;
public AbstractDatabase(final XMultiServiceFactory orb) throws Exception
{
@@ -80,12 +80,10 @@ public abstract class AbstractDatabase implements DatabaseAccess
* the ownership of the connection, so you don't need to (and should not) dispose/close it.
*
*/
- public XConnection defaultConnection() throws SQLException
+ public Connection defaultConnection() throws SQLException
{
- if (m_connection == null)
- {
- m_connection = m_databaseDocument.getDataSource().getConnection("", "");
- }
+ if ( m_connection == null )
+ m_connection = new Connection( m_databaseDocument.getDataSource().getConnection("", "") );
return m_connection;
}
@@ -104,8 +102,7 @@ public abstract class AbstractDatabase implements DatabaseAccess
{
if (m_databaseDocument != null)
{
- final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
- m_databaseDocument);
+ final XStorable storeDoc = UnoRuntime.queryInterface(XStorable.class, m_databaseDocument);
storeDoc.store();
}
}
@@ -118,8 +115,8 @@ public abstract class AbstractDatabase implements DatabaseAccess
public void close()
{
// close connection
- final XCloseable closeConn = (XCloseable) UnoRuntime.queryInterface(XCloseable.class,
- m_connection);
+ final XCloseable closeConn = UnoRuntime.queryInterface( XCloseable.class,
+ m_connection != null ? m_connection.getXConnection() : null );
if (closeConn != null)
{
try
@@ -133,8 +130,7 @@ public abstract class AbstractDatabase implements DatabaseAccess
m_connection = null;
// close document
- final com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable) UnoRuntime.queryInterface(
- com.sun.star.util.XCloseable.class, m_databaseDocument);
+ final com.sun.star.util.XCloseable closeDoc = UnoRuntime.queryInterface( com.sun.star.util.XCloseable.class, m_databaseDocument );
if (closeDoc != null)
{
try
@@ -178,7 +174,7 @@ public abstract class AbstractDatabase implements DatabaseAccess
*/
public XModel getModel()
{
- return (XModel) UnoRuntime.queryInterface(XModel.class, m_databaseDocument);
+ return UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
}
public XMultiServiceFactory getORB()
@@ -191,10 +187,9 @@ public abstract class AbstractDatabase implements DatabaseAccess
{
m_databaseDocumentFile = _docURL;
- final XNameAccess dbContext = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
- m_orb.createInstance("com.sun.star.sdb.DatabaseContext"));
- final XDocumentDataSource dataSource = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class,
- dbContext.getByName(_docURL));
+ final XNameAccess dbContext = UnoRuntime.queryInterface( XNameAccess.class,
+ m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) );
+ final XDocumentDataSource dataSource = UnoRuntime.queryInterface( XDocumentDataSource.class, dbContext.getByName( _docURL ) );
m_databaseDocument = dataSource.getDatabaseDocument();
m_dataSource = new DataSource(m_orb, m_databaseDocument.getDataSource());
diff --git a/dbaccess/qa/complex/dbaccess/CRMDatabase.java b/connectivity/qa/connectivity/tools/CRMDatabase.java
index 77e2dcf6b2e2..7a6cb7e8c034 100644
--- a/dbaccess/qa/complex/dbaccess/CRMDatabase.java
+++ b/connectivity/qa/connectivity/tools/CRMDatabase.java
@@ -27,23 +27,27 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.dbaccess;
+package connectivity.tools;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyState;
import com.sun.star.container.ElementExistException;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
import com.sun.star.io.IOException;
+import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdb.XSingleSelectQueryComposer;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
import com.sun.star.sdbc.SQLException;
-import com.sun.star.sdbc.XConnection;
import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XRefreshable;
-import connectivity.tools.DataSource;
-import connectivity.tools.HsqlColumnDescriptor;
-import connectivity.tools.HsqlDatabase;
-import connectivity.tools.HsqlTableDescriptor;
-import connectivity.tools.QueryDefinition;
+import connectivity.tools.sdb.Connection;
/** implements a small Customer Relationship Management database
*
@@ -56,21 +60,52 @@ public class CRMDatabase
private final XMultiServiceFactory m_orb;
private final HsqlDatabase m_database;
private final DataSource m_dataSource;
- private final XConnection m_connection;
+ private final Connection m_connection;
/** constructs the CRM database
*/
- public CRMDatabase( XMultiServiceFactory _orb ) throws Exception
+ public CRMDatabase( XMultiServiceFactory _orb, boolean _withUI ) throws Exception
{
m_orb = _orb;
m_database = new HsqlDatabase( m_orb );
m_dataSource = m_database.getDataSource();
- m_connection = m_database.defaultConnection();
+
+ if ( _withUI )
+ {
+ final XComponentLoader loader = UnoRuntime.queryInterface( XComponentLoader.class,
+ m_orb.createInstance( "com.sun.star.frame.Desktop" ) );
+ PropertyValue[] loadArgs = new PropertyValue[] {
+ new PropertyValue( "PickListEntry", 0, false, PropertyState.DIRECT_VALUE )
+ };
+ loader.loadComponentFromURL( m_database.getDocumentURL(), "_blank", 0, loadArgs );
+ getDocumentUI().connect();
+ m_connection = new Connection( getDocumentUI().getActiveConnection() );
+ }
+ else
+ {
+ m_connection = m_database.defaultConnection();
+ }
+
createTables();
createQueries();
}
+ /**
+ * creates a CRMDatabase from an existing document, given by URL
+ * @param _orb
+ * @param _existingDocumentURL
+ * @throws Exceptio
+ */
+ public CRMDatabase( XMultiServiceFactory _orb, final String _existingDocumentURL ) throws Exception
+ {
+ m_orb = _orb;
+
+ m_database = new HsqlDatabase( m_orb, _existingDocumentURL );
+ m_dataSource = m_database.getDataSource();
+ m_connection = m_database.defaultConnection();
+ }
+
// --------------------------------------------------------------------------------------------------------
/** returns the database document underlying the CRM database
*/
@@ -82,16 +117,41 @@ public class CRMDatabase
// --------------------------------------------------------------------------------------------------------
/** returns the default connection to the database
*/
- public final XConnection getConnection()
+ public final Connection getConnection()
{
return m_connection;
}
// --------------------------------------------------------------------------------------------------------
- public void close() throws SQLException, IOException
+ public void saveAndClose() throws SQLException, IOException
{
+ XDatabaseDocumentUI ui = getDocumentUI();
+ if ( ui != null )
+ ui.closeSubComponents();
m_database.store();
- m_database.close();
+ m_database.closeAndDelete();
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public XDatabaseDocumentUI getDocumentUI()
+ {
+ XModel docModel = UnoRuntime.queryInterface( XModel.class, m_database.getDatabaseDocument() );
+ return UnoRuntime.queryInterface( XDatabaseDocumentUI.class, docModel.getCurrentController() );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public XController loadSubComponent( final int _objectType, final String _name ) throws IllegalArgumentException, SQLException, NoSuchElementException
+ {
+ XDatabaseDocumentUI docUI = getDocumentUI();
+ if ( !docUI.isConnected() )
+ docUI.connect();
+
+ XComponent subComponent = docUI.loadComponent( _objectType, _name, false );
+ XController controller = UnoRuntime.queryInterface( XController.class, subComponent );
+ if ( controller != null )
+ return controller;
+ XModel document = UnoRuntime.queryInterface( XModel.class, subComponent );
+ return document.getCurrentController();
}
// --------------------------------------------------------------------------------------------------------
@@ -161,11 +221,7 @@ public class CRMDatabase
// since we created the tables by directly executing the SQL statements, we need to refresh
// the tables container
- final XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
- XTablesSupplier.class, m_connection );
- final XRefreshable refreshTables = (XRefreshable)UnoRuntime.queryInterface(
- XRefreshable.class, suppTables.getTables() );
- refreshTables.refresh();
+ m_connection.refreshTables();
}
// --------------------------------------------------------------------------------------------------------
@@ -176,9 +232,9 @@ public class CRMDatabase
QueryDefinition unparseableQuery;
try
{
- final XMultiServiceFactory factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
- XMultiServiceFactory.class, m_database.defaultConnection() );
- composer = (XSingleSelectQueryComposer)UnoRuntime.queryInterface(
+ final XMultiServiceFactory factory = UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, m_database.defaultConnection().getXConnection() );
+ composer = UnoRuntime.queryInterface(
XSingleSelectQueryComposer.class, factory.createInstance( "com.sun.star.sdb.SingleSelectQueryComposer" ) );
unparseableQuery = m_dataSource.getQueryDefinition( "unparseable" );
}
diff --git a/connectivity/qa/connectivity/tools/DataSource.java b/connectivity/qa/connectivity/tools/DataSource.java
index 1ed8f7f98af7..23d0d142128a 100644
--- a/connectivity/qa/connectivity/tools/DataSource.java
+++ b/connectivity/qa/connectivity/tools/DataSource.java
@@ -39,10 +39,8 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.beans.XPropertySet;
import com.sun.star.sdb.XQueryDefinitionsSupplier;
import com.sun.star.sdbc.XDataSource;
-import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XRefreshable;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -57,11 +55,10 @@ public class DataSource
{
m_orb = _orb;
- final XNameAccess dbContext = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
- _orb.createInstance("com.sun.star.sdb.DatabaseContext"));
+ final XNameAccess dbContext = UnoRuntime.queryInterface(
+ XNameAccess.class, _orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) );
- m_dataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class,
- dbContext.getByName(_registeredName));
+ m_dataSource = UnoRuntime.queryInterface( XDataSource.class, dbContext.getByName( _registeredName ) );
}
public DataSource(final XMultiServiceFactory _orb,final XDataSource _dataSource)
@@ -86,13 +83,11 @@ public class DataSource
*/
public void createQuery(final String _name, final String _sqlCommand, final boolean _escapeProcessing) throws ElementExistException, WrappedTargetException, com.sun.star.lang.IllegalArgumentException
{
- final XSingleServiceFactory queryDefsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
- XSingleServiceFactory.class, getQueryDefinitions());
+ final XSingleServiceFactory queryDefsFac = UnoRuntime.queryInterface( XSingleServiceFactory.class, getQueryDefinitions() );
XPropertySet queryDef = null;
try
{
- queryDef = (XPropertySet) UnoRuntime.queryInterface(
- XPropertySet.class, queryDefsFac.createInstance());
+ queryDef = UnoRuntime.queryInterface( XPropertySet.class, queryDefsFac.createInstance() );
queryDef.setPropertyValue("Command", _sqlCommand);
queryDef.setPropertyValue("EscapeProcessing", Boolean.valueOf(_escapeProcessing));
}
@@ -101,8 +96,7 @@ public class DataSource
e.printStackTrace(System.err);
}
- final XNameContainer queryDefsContainer = (XNameContainer) UnoRuntime.queryInterface(
- XNameContainer.class, getQueryDefinitions());
+ final XNameContainer queryDefsContainer = UnoRuntime.queryInterface( XNameContainer.class, getQueryDefinitions() );
queryDefsContainer.insertByName(_name, queryDef);
}
@@ -113,8 +107,7 @@ public class DataSource
final XNameAccess allDefs = getQueryDefinitions();
try
{
- return new QueryDefinition(
- (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, allDefs.getByName(_name)));
+ return new QueryDefinition( UnoRuntime.queryInterface( XPropertySet.class, allDefs.getByName( _name) ) );
}
catch (WrappedTargetException e)
{
@@ -126,25 +119,11 @@ public class DataSource
*/
public XNameAccess getQueryDefinitions()
{
- final XQueryDefinitionsSupplier suppQueries = (XQueryDefinitionsSupplier) UnoRuntime.queryInterface(
+ final XQueryDefinitionsSupplier suppQueries = UnoRuntime.queryInterface(
XQueryDefinitionsSupplier.class, m_dataSource);
return suppQueries.getQueryDefinitions();
}
- /** refreshs the table container of a given connection
- *
- * This is usually necessary if you created tables by directly executing SQL statements,
- * bypassing the SDBCX layer.
- */
- public void refreshTables(final com.sun.star.sdbc.XConnection _connection)
- {
- final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(
- XTablesSupplier.class, _connection);
- final XRefreshable refreshTables = (XRefreshable) UnoRuntime.queryInterface(
- XRefreshable.class, suppTables.getTables());
- refreshTables.refresh();
- }
-
/** returns the name of the data source
*
* If a data source is registered at the database context, the name is the registration
@@ -157,8 +136,7 @@ public class DataSource
String name = null;
try
{
- final XPropertySet dataSourceProps = (XPropertySet) UnoRuntime.queryInterface(
- XPropertySet.class, m_dataSource);
+ final XPropertySet dataSourceProps = UnoRuntime.queryInterface( XPropertySet.class, m_dataSource );
name = (String) dataSourceProps.getPropertyValue("Name");
}
catch (Exception ex)
diff --git a/connectivity/qa/connectivity/tools/DatabaseAccess.java b/connectivity/qa/connectivity/tools/DatabaseAccess.java
index bc39bb099087..78608063e64c 100755
--- a/connectivity/qa/connectivity/tools/DatabaseAccess.java
+++ b/connectivity/qa/connectivity/tools/DatabaseAccess.java
@@ -34,7 +34,7 @@ import com.sun.star.io.IOException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdb.XOfficeDatabaseDocument;
import com.sun.star.sdbc.SQLException;
-import com.sun.star.sdbc.XConnection;
+import connectivity.tools.sdb.Connection;
/**
*
@@ -42,7 +42,7 @@ import com.sun.star.sdbc.XConnection;
*/
public interface DatabaseAccess
{
- XConnection defaultConnection() throws SQLException;
+ Connection defaultConnection() throws SQLException;
void executeSQL(final String statementString) throws SQLException;
diff --git a/connectivity/qa/connectivity/tools/HsqlDatabase.java b/connectivity/qa/connectivity/tools/HsqlDatabase.java
index 593a5ad95981..896eed1525e9 100644
--- a/connectivity/qa/connectivity/tools/HsqlDatabase.java
+++ b/connectivity/qa/connectivity/tools/HsqlDatabase.java
@@ -30,6 +30,7 @@
package connectivity.tools;
import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyState;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.ElementExistException;
import com.sun.star.frame.XStorable;
@@ -83,9 +84,9 @@ public class HsqlDatabase extends AbstractDatabase
dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
final XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, m_databaseDocument);
- storable.storeAsURL(m_databaseDocumentFile, new PropertyValue[]
- {
- });
+ storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]
+ { new PropertyValue( "PickListEntry", 0, false, PropertyState.DIRECT_VALUE )
+ } );
}
/** drops the table with a given name
@@ -208,10 +209,8 @@ public class HsqlDatabase extends AbstractDatabase
public void createTableInSDBCX(final HsqlTableDescriptor _tableDesc) throws SQLException, ElementExistException
{
final XPropertySet sdbcxDescriptor = _tableDesc.createSdbcxDescriptor(defaultConnection());
- final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(
- XTablesSupplier.class, defaultConnection());
- final XAppend appendTable = (XAppend) UnoRuntime.queryInterface(
- XAppend.class, suppTables.getTables());
+ final XTablesSupplier suppTables = UnoRuntime.queryInterface( XTablesSupplier.class, defaultConnection().getXConnection() );
+ final XAppend appendTable = UnoRuntime.queryInterface( XAppend.class, suppTables.getTables() );
appendTable.appendByDescriptor(sdbcxDescriptor);
}
}
diff --git a/connectivity/qa/connectivity/tools/HsqlTableDescriptor.java b/connectivity/qa/connectivity/tools/HsqlTableDescriptor.java
index ec6c472309d5..2c4f9d6e6466 100644
--- a/connectivity/qa/connectivity/tools/HsqlTableDescriptor.java
+++ b/connectivity/qa/connectivity/tools/HsqlTableDescriptor.java
@@ -33,11 +33,11 @@ package connectivity.tools;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.sdbc.ColumnValue;
-import com.sun.star.sdbc.XConnection;
import com.sun.star.sdbcx.XColumnsSupplier;
import com.sun.star.sdbcx.XDataDescriptorFactory;
import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.UnoRuntime;
+import connectivity.tools.sdb.Connection;
/** is a very simply descriptor of a HSQL table, to be used with a HsqlDatabase.createTable method
*/
@@ -67,12 +67,10 @@ public class HsqlTableDescriptor
return m_columns;
}
- public XPropertySet createSdbcxDescriptor( XConnection _forConnection )
+ public XPropertySet createSdbcxDescriptor( Connection _forConnection )
{
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
- XTablesSupplier.class, _forConnection );
- XDataDescriptorFactory tableDescFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(
- XDataDescriptorFactory.class, suppTables.getTables() );
+ XTablesSupplier suppTables = UnoRuntime.queryInterface( XTablesSupplier.class, _forConnection.getXConnection() );
+ XDataDescriptorFactory tableDescFac = UnoRuntime.queryInterface( XDataDescriptorFactory.class, suppTables.getTables() );
XPropertySet tableDesc = tableDescFac.createDataDescriptor();
try
@@ -81,12 +79,10 @@ public class HsqlTableDescriptor
}
catch ( Exception e ) { e.printStackTrace( System.err ); }
- XColumnsSupplier suppDescCols = (XColumnsSupplier)UnoRuntime.queryInterface(
- XColumnsSupplier.class, tableDesc );
+ XColumnsSupplier suppDescCols = UnoRuntime.queryInterface( XColumnsSupplier.class, tableDesc );
XNameAccess descColumns = suppDescCols.getColumns();
- XDataDescriptorFactory columnDescFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(
- XDataDescriptorFactory.class, descColumns );
+ XDataDescriptorFactory columnDescFac = UnoRuntime.queryInterface( XDataDescriptorFactory.class, descColumns );
HsqlColumnDescriptor[] myColumns = getColumns();
for ( int i = 0; i < myColumns.length; ++i )
diff --git a/connectivity/qa/connectivity/tools/makefile.mk b/connectivity/qa/connectivity/tools/makefile.mk
index 589a85ea385f..32aa94c77312 100644
--- a/connectivity/qa/connectivity/tools/makefile.mk
+++ b/connectivity/qa/connectivity/tools/makefile.mk
@@ -29,10 +29,10 @@
#
#*************************************************************************
-PRJ = ..$/..$/..
+PRJ = ../../..
TARGET = ConnectivityTools
PRJNAME = connectivity
-PACKAGE = connectivity$/tools
+PACKAGE = connectivity/tools
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
@@ -46,14 +46,8 @@ all:
#----- compile .java files -----------------------------------------
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunnerLight.jar
-# Do not use $/ with the $(FIND) command as for W32-4nt this leads to a backslash
-# in a posix command. In this special case use / instead of $/
-.IF "$(GUI)"=="OS2"
-JAVAFILES := $(shell @ls ./*.java)
-.ELSE
-JAVAFILES := $(shell @$(FIND) ./*.java)
-.ENDIF
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+JAVAFILES := $(shell @$(FIND) . -name "*.java")
+JAVACLASSFILES := $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:d)$(i:b).class)
#----- make a jar from compiled files ------------------------------
diff --git a/connectivity/qa/connectivity/tools/sdb/Connection.java b/connectivity/qa/connectivity/tools/sdb/Connection.java
new file mode 100644
index 000000000000..aac120fb1e73
--- /dev/null
+++ b/connectivity/qa/connectivity/tools/sdb/Connection.java
@@ -0,0 +1,93 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package connectivity.tools.sdb;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.XSingleSelectQueryComposer;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XDatabaseMetaData;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XRefreshable;
+
+/**
+ * is a convenience wrapper around a SDB-level connection object
+ */
+public class Connection
+{
+ private final XConnection m_connection;
+
+ public Connection( final XConnection _connection )
+ {
+ m_connection = _connection;
+ }
+
+ public XConnection getXConnection()
+ {
+ return m_connection;
+ }
+
+ public boolean execute( final String _sql ) throws SQLException
+ {
+ XStatement statement = createStatement();
+ return statement.execute( _sql );
+ }
+
+ public XResultSet executeQuery( final String _sql ) throws SQLException
+ {
+ XStatement statement = createStatement();
+ return statement.executeQuery( _sql );
+ }
+
+ public int executeUpdate( final String _sql ) throws SQLException
+ {
+ XStatement statement = createStatement();
+ return statement.executeUpdate( _sql );
+ }
+
+ public void refreshTables()
+ {
+ final XTablesSupplier suppTables = UnoRuntime.queryInterface(XTablesSupplier.class, m_connection);
+ final XRefreshable refresh = UnoRuntime.queryInterface( XRefreshable.class, suppTables.getTables() );
+ refresh.refresh();
+ }
+
+ public XSingleSelectQueryComposer createSingleSelectQueryComposer() throws Exception
+ {
+ final XMultiServiceFactory connectionFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, m_connection );
+ return UnoRuntime.queryInterface(
+ XSingleSelectQueryComposer.class, connectionFactory.createInstance( "com.sun.star.sdb.SingleSelectQueryComposer" ) );
+ }
+
+ public
+ XStatement createStatement() throws SQLException
+ {
+ return m_connection.createStatement();
+ }
+
+ public
+ XPreparedStatement prepareStatement( String _sql ) throws SQLException
+ {
+ return m_connection.prepareStatement( _sql );
+ }
+
+ public
+ XDatabaseMetaData getMetaData() throws SQLException
+ {
+ return m_connection.getMetaData();
+ }
+
+ public
+ void close() throws SQLException
+ {
+ m_connection.close();
+ }
+}
diff --git a/connectivity/source/commontools/BlobHelper.cxx b/connectivity/source/commontools/BlobHelper.cxx
new file mode 100644
index 000000000000..5859db9036ac
--- /dev/null
+++ b/connectivity/source/commontools/BlobHelper.cxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FValue.cxx,v $
+ * $Revision: 1.34 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+#include "connectivity/BlobHelper.hxx"
+#include <comphelper/seqstream.hxx>
+#include "connectivity/dbexception.hxx"
+
+using namespace connectivity;
+using namespace dbtools;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::uno;
+
+BlobHelper::BlobHelper(const ::com::sun::star::uno::Sequence< sal_Int8 >& _val) : m_aValue(_val)
+{
+}
+// -----------------------------------------------------------------------------
+::sal_Int64 SAL_CALL BlobHelper::length( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ return m_aValue.getLength();
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL BlobHelper::getBytes( ::sal_Int64 pos, ::sal_Int32 _length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ if ( sal_Int32(pos + _length) > m_aValue.getLength() )
+ throw ::com::sun::star::sdbc::SQLException();
+ return ::com::sun::star::uno::Sequence< ::sal_Int8 >(m_aValue.getConstArray() + sal_Int32(pos),_length);
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL BlobHelper::getBinaryStream( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ return new ::comphelper::SequenceInputStream(m_aValue);
+}
+// -----------------------------------------------------------------------------
+::sal_Int64 SAL_CALL BlobHelper::position( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& /*pattern*/, ::sal_Int64 /*start*/ ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ ::dbtools::throwFeatureNotImplementedException( "XBlob::position", *this );
+ return 0;
+}
+// -----------------------------------------------------------------------------
+::sal_Int64 SAL_CALL BlobHelper::positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& /*pattern*/, ::sal_Int64 /*start*/ ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ ::dbtools::throwFeatureNotImplementedException( "XBlob::positionOfBlob", *this );
+ return 0;
+}
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index f7943fc4cf45..f171af5ec530 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -257,6 +257,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType)
case DataType::BLOB:
case DataType::CLOB:
case DataType::OBJECT:
+ case DataType::OTHER:
(*this) = getAny();
break;
default:
@@ -847,6 +848,7 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
case DataType::BLOB:
case DataType::CLOB:
case DataType::OBJECT:
+ case DataType::OTHER:
bRet = false;
break;
default:
@@ -913,6 +915,7 @@ Any ORowSetValue::makeAny() const
case DataType::BLOB:
case DataType::CLOB:
case DataType::OBJECT:
+ case DataType::OTHER:
rValue = getAny();
break;
case DataType::BIT:
@@ -1019,6 +1022,19 @@ Any ORowSetValue::makeAny() const
else
aRet = ::rtl::OUString::valueOf((sal_Int64)*this);
break;
+ case DataType::CLOB:
+ {
+ Any aValue( getAny() );
+ Reference< XClob > xClob;
+ if ( aValue >>= xClob )
+ {
+ if ( xClob.is() )
+ {
+ aRet = xClob->getSubString(1,(sal_Int32)xClob->length() );
+ }
+ }
+ }
+ break;
}
}
return aRet;
@@ -1090,6 +1106,9 @@ sal_Bool ORowSetValue::getBool() const
case DataType::INTEGER:
bRet = m_bSigned ? (m_aValue.m_nInt32 != 0) : (*static_cast<sal_Int64*>(m_aValue.m_pValue) != sal_Int64(0));
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return bRet;
@@ -1131,6 +1150,8 @@ sal_Int8 ORowSetValue::getInt8() const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"getInt8() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1155,6 +1176,9 @@ sal_Int8 ORowSetValue::getInt8() const
else
nRet = static_cast<sal_Int8>(*static_cast<sal_Int64*>(m_aValue.m_pValue));
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return nRet;
@@ -1196,6 +1220,8 @@ sal_Int16 ORowSetValue::getInt16() const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"getInt16() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1220,6 +1246,9 @@ sal_Int16 ORowSetValue::getInt16() const
else
nRet = static_cast<sal_Int16>(*static_cast<sal_Int64*>(m_aValue.m_pValue));
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return nRet;
@@ -1261,6 +1290,8 @@ sal_Int32 ORowSetValue::getInt32() const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"getInt32() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1285,6 +1316,9 @@ sal_Int32 ORowSetValue::getInt32() const
else
nRet = static_cast<sal_Int32>(*static_cast<sal_Int64*>(m_aValue.m_pValue));
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return nRet;
@@ -1326,6 +1360,8 @@ sal_Int64 ORowSetValue::getLong() const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"getInt32() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1350,6 +1386,9 @@ sal_Int64 ORowSetValue::getLong() const
else
nRet = *(sal_Int64*)m_aValue.m_pValue;
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return nRet;
@@ -1395,6 +1434,8 @@ float ORowSetValue::getFloat() const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"getDouble() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1419,6 +1460,9 @@ float ORowSetValue::getFloat() const
else
nRet = float(*(sal_Int64*)m_aValue.m_pValue);
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return nRet;
@@ -1466,6 +1510,8 @@ double ORowSetValue::getDouble() const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"getDouble() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1490,6 +1536,9 @@ double ORowSetValue::getDouble() const
else
nRet = double(*(sal_Int64*)m_aValue.m_pValue);
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return nRet;
@@ -1551,6 +1600,8 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype)
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ case DataType::CLOB:
OSL_ASSERT(!"setFromDouble() for this type is not allowed!");
break;
case DataType::BIT:
@@ -1595,12 +1646,39 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
case DataType::BLOB:
{
Reference<XInputStream> xStream;
- Any aValue = getAny();
+ const Any aValue = makeAny();
if(aValue.hasValue())
{
- aValue >>= xStream;
+ Reference<XBlob> xBlob(aValue,UNO_QUERY);
+ if ( xBlob.is() )
+ xStream = xBlob->getBinaryStream();
+ else
+ {
+ Reference<XClob> xClob(aValue,UNO_QUERY);
+ if ( xClob.is() )
+ xStream = xClob->getCharacterStream();
+ }
if(xStream.is())
- xStream->readBytes(aSeq,xStream->available());
+ {
+ const sal_uInt32 nBytesToRead = 65535;
+ sal_uInt32 nRead;
+
+ do
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aReadSeq;
+
+ nRead = xStream->readSomeBytes( aReadSeq, nBytesToRead );
+
+ if( nRead )
+ {
+ const sal_uInt32 nOldLength = aSeq.getLength();
+ aSeq.realloc( nOldLength + nRead );
+ rtl_copyMemory( aSeq.getArray() + nOldLength, aReadSeq.getConstArray(), aReadSeq.getLength() );
+ }
+ }
+ while( nBytesToRead == nRead );
+ xStream->closeInput();
+ }
}
}
break;
@@ -1658,6 +1736,9 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
aValue.Year = pDateTime->Year;
}
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return aValue;
@@ -1696,6 +1777,10 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
break;
case DataType::TIME:
aValue = *static_cast< ::com::sun::star::util::Time*>(m_aValue.m_pValue);
+ break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return aValue;
@@ -1743,6 +1828,9 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
case DataType::TIMESTAMP:
aValue = *static_cast< ::com::sun::star::util::DateTime*>(m_aValue.m_pValue);
break;
+ default:
+ OSL_ENSURE(0,"Illegal conversion!");
+ break;
}
}
return aValue;
@@ -1833,6 +1921,9 @@ namespace detail
virtual Sequence< sal_Int8 > getBytes() const = 0;
virtual Reference< XInputStream > getBinaryStream() const = 0;
virtual Reference< XInputStream > getCharacterStream() const = 0;
+ virtual Reference< XBlob > getBlob() const = 0;
+ virtual Reference< XClob > getClob() const = 0;
+ virtual Any getObject() const = 0;
virtual sal_Bool wasNull() const = 0;
virtual ~IValueSource() { }
@@ -1862,6 +1953,9 @@ namespace detail
virtual Sequence< sal_Int8 > getBytes() const { return m_xRow->getBytes( m_nPos ); };
virtual Reference< XInputStream > getBinaryStream() const { return m_xRow->getBinaryStream( m_nPos ); };
virtual Reference< XInputStream > getCharacterStream() const { return m_xRow->getCharacterStream( m_nPos ); };
+ virtual Reference< XBlob > getBlob() const { return m_xRow->getBlob( m_nPos ); };
+ virtual Reference< XClob > getClob() const { return m_xRow->getClob( m_nPos ); };
+ virtual Any getObject() const { return m_xRow->getObject( m_nPos, NULL ); };
virtual sal_Bool wasNull() const { return m_xRow->wasNull( ); };
private:
@@ -1892,6 +1986,9 @@ namespace detail
virtual Sequence< sal_Int8 > getBytes() const { return m_xColumn->getBytes(); };
virtual Reference< XInputStream > getBinaryStream() const { return m_xColumn->getBinaryStream(); };
virtual Reference< XInputStream > getCharacterStream() const { return m_xColumn->getCharacterStream(); };
+ virtual Reference< XBlob > getBlob() const { return m_xColumn->getBlob(); };
+ virtual Reference< XClob > getClob() const { return m_xColumn->getClob(); };
+ virtual Any getObject() const { return m_xColumn->getObject( NULL ); };
virtual sal_Bool wasNull() const { return m_xColumn->wasNull( ); };
private:
@@ -1987,13 +2084,17 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const
(*this) = _rValueSource.getLong();
break;
case DataType::CLOB:
- (*this) = ::com::sun::star::uno::makeAny(_rValueSource.getCharacterStream());
+ (*this) = ::com::sun::star::uno::makeAny(_rValueSource.getClob());
setTypeKind(DataType::CLOB);
break;
case DataType::BLOB:
- (*this) = ::com::sun::star::uno::makeAny(_rValueSource.getBinaryStream());
+ (*this) = ::com::sun::star::uno::makeAny(_rValueSource.getBlob());
setTypeKind(DataType::BLOB);
break;
+ case DataType::OTHER:
+ (*this) = _rValueSource.getObject();
+ setTypeKind(DataType::OTHER);
+ break;
default:
OSL_ENSURE( false, "ORowSetValue::fill: unsupported type!" );
bReadData = false;
@@ -2139,6 +2240,29 @@ void ORowSetValue::fill(const Any& _rValue)
break;
}
+ case TypeClass_INTERFACE:
+ {
+ Reference< XClob > xClob;
+ if ( _rValue >>= xClob )
+ {
+ (*this) = _rValue;
+ setTypeKind(DataType::CLOB);
+ }
+ else
+ {
+ Reference< XBlob > xBlob;
+ if ( _rValue >>= xBlob )
+ {
+ (*this) = _rValue;
+ setTypeKind(DataType::BLOB);
+ }
+ else
+ {
+ (*this) = _rValue;
+ }
+ }
+ }
+ break;
default:
OSL_ENSURE(0,"Unknown type");
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index c5b65a9d113b..d30161da497c 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -257,6 +257,27 @@ namespace dbtools
}
//--------------------------------------------------------------------
+ bool DatabaseMetaData::supportsPrimaryKeys() const
+ {
+ lcl_checkConnected( *m_pImpl );
+
+ bool doesSupportPrimaryKeys = false;
+ try
+ {
+ Any setting;
+ if ( !( lcl_getConnectionSetting( "PrimaryKeySupport", *m_pImpl, setting ) )
+ || !( setting >>= doesSupportPrimaryKeys )
+ )
+ doesSupportPrimaryKeys = m_pImpl->xConnectionMetaData->supportsCoreSQLGrammar();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return doesSupportPrimaryKeys;
+ }
+
+ //--------------------------------------------------------------------
const ::rtl::OUString& DatabaseMetaData::getIdentifierQuoteString() const
{
return lcl_getConnectionStringSetting( *m_pImpl, m_pImpl->sCachedIdentifierQuoteString, &XDatabaseMetaData::getIdentifierQuoteString );
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index 02e6e420142f..f00cfe14a9e5 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -213,6 +213,7 @@ sal_Int32 getDefaultNumberFormat(sal_Int32 _nDataType,
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
nFormat = _xTypes->getStandardFormat(NumberFormat::TEXT, _rLocale);
break;
case DataType::DATE:
@@ -234,10 +235,10 @@ sal_Int32 getDefaultNumberFormat(sal_Int32 _nDataType,
case DataType::STRUCT:
case DataType::ARRAY:
case DataType::BLOB:
- case DataType::CLOB:
case DataType::REF:
default:
- nFormat = NumberFormat::UNDEFINED;
+ nFormat = _xTypes->getStandardFormat(NumberFormat::UNDEFINED, _rLocale);
+ //nFormat = NumberFormat::UNDEFINED;
}
return nFormat;
}
@@ -1850,9 +1851,20 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
sal_Int32 parameterIndex,
const Any& x,
sal_Int32 sqlType,
- sal_Int32 /*scale*/) throw(SQLException, RuntimeException)
+ sal_Int32 scale) throw(SQLException, RuntimeException)
+{
+ ORowSetValue aVal;
+ aVal.fill(x);
+ setObjectWithInfo(_xParams,parameterIndex,aVal,sqlType,scale);
+}
+// -----------------------------------------------------------------------------
+void setObjectWithInfo(const Reference<XParameters>& _xParams,
+ sal_Int32 parameterIndex,
+ const ::connectivity::ORowSetValue& _rValue,
+ sal_Int32 sqlType,
+ sal_Int32 scale) throw(SQLException, RuntimeException)
{
- if(!x.hasValue())
+ if ( _rValue.isNull() )
_xParams->setNull(parameterIndex,sqlType);
else
{
@@ -1860,65 +1872,62 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
{
case DataType::DECIMAL:
case DataType::NUMERIC:
- _xParams->setObjectWithInfo(parameterIndex,x,sqlType,0);
+ _xParams->setObjectWithInfo(parameterIndex,_rValue.makeAny(),sqlType,scale);
break;
case DataType::CHAR:
case DataType::VARCHAR:
- //case DataType::DECIMAL:
- //case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- _xParams->setString(parameterIndex,::comphelper::getString(x));
+ _xParams->setString(parameterIndex,_rValue);
break;
- case DataType::BIGINT:
+ case DataType::CLOB:
{
- sal_Int64 nValue = 0;
- if(x >>= nValue)
+ Any x(_rValue.makeAny());
+ ::rtl::OUString sValue;
+ if ( x >>= sValue )
+ _xParams->setString(parameterIndex,sValue);
+ else
{
- _xParams->setLong(parameterIndex,nValue);
- break;
+ Reference< XClob > xClob;
+ if(x >>= xClob)
+ _xParams->setClob(parameterIndex,xClob);
+ else
+ {
+ Reference< ::com::sun::star::io::XInputStream > xStream;
+ if(x >>= xStream)
+ _xParams->setCharacterStream(parameterIndex,xStream,xStream->available());
+ }
}
}
break;
+ case DataType::BIGINT:
+ if ( _rValue.isSigned() )
+ _xParams->setLong(parameterIndex,_rValue);
+ else
+ _xParams->setString(parameterIndex,_rValue);
+ break;
case DataType::FLOAT:
+ _xParams->setFloat(parameterIndex,_rValue);
+ break;
case DataType::REAL:
- {
- float nValue = 0;
- if(x >>= nValue)
- {
- _xParams->setFloat(parameterIndex,nValue);
- break;
- }
- }
- // run through if we couldn't set a float value
case DataType::DOUBLE:
- _xParams->setDouble(parameterIndex,::comphelper::getDouble(x));
+ _xParams->setDouble(parameterIndex,_rValue);
break;
case DataType::DATE:
- {
- ::com::sun::star::util::Date aValue;
- if(x >>= aValue)
- _xParams->setDate(parameterIndex,aValue);
- }
+ _xParams->setDate(parameterIndex,_rValue);
break;
case DataType::TIME:
- {
- ::com::sun::star::util::Time aValue;
- if(x >>= aValue)
- _xParams->setTime(parameterIndex,aValue);
- }
+ _xParams->setTime(parameterIndex,_rValue);
break;
case DataType::TIMESTAMP:
- {
- ::com::sun::star::util::DateTime aValue;
- if(x >>= aValue)
- _xParams->setTimestamp(parameterIndex,aValue);
- }
+ _xParams->setTimestamp(parameterIndex,_rValue);
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
{
+ Any x(_rValue.makeAny());
Sequence< sal_Int8> aBytes;
if(x >>= aBytes)
_xParams->setBytes(parameterIndex,aBytes);
@@ -1944,16 +1953,25 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
break;
case DataType::BIT:
case DataType::BOOLEAN:
- _xParams->setBoolean(parameterIndex,::cppu::any2bool(x));
+ _xParams->setBoolean(parameterIndex,_rValue);
break;
case DataType::TINYINT:
- _xParams->setByte(parameterIndex,(sal_Int8)::comphelper::getINT32(x));
+ if ( _rValue.isSigned() )
+ _xParams->setByte(parameterIndex,_rValue);
+ else
+ _xParams->setShort(parameterIndex,_rValue);
break;
case DataType::SMALLINT:
- _xParams->setShort(parameterIndex,(sal_Int16)::comphelper::getINT32(x));
+ if ( _rValue.isSigned() )
+ _xParams->setShort(parameterIndex,_rValue);
+ else
+ _xParams->setInt(parameterIndex,_rValue);
break;
case DataType::INTEGER:
- _xParams->setInt(parameterIndex,::comphelper::getINT32(x));
+ if ( _rValue.isSigned() )
+ _xParams->setInt(parameterIndex,_rValue);
+ else
+ _xParams->setLong(parameterIndex,_rValue);
break;
default:
{
diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk
index cb5a4ad3f7aa..1cc6cf494919 100644
--- a/connectivity/source/commontools/makefile.mk
+++ b/connectivity/source/commontools/makefile.mk
@@ -89,6 +89,7 @@ EXCEPTIONSFILES=\
$(SLO)$/ParamterSubstitution.obj \
$(SLO)$/DriversConfig.obj \
$(SLO)$/formattedcolumnvalue.obj \
+ $(SLO)$/BlobHelper.obj \
$(SLO)$/warningscontainer.obj
SLOFILES=\
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index 45e937235dd1..f5d22e2937aa 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -148,9 +148,10 @@ namespace dbtools
sal_Int32 nType = DataType::OTHER;
_rxField->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) >>= nType;
- if ( ( DataType::CHAR == nType )
- || ( DataType::VARCHAR == nType )
+ if ( ( DataType::CHAR == nType )
+ || ( DataType::VARCHAR == nType )
|| ( DataType::LONGVARCHAR == nType )
+ || ( DataType::CLOB == nType )
)
{ // yes -> force a quoted text and try again
::rtl::OUString sQuoted( _rStatement );
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index 1c53614bba04..438f3bc473cc 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -334,11 +334,9 @@ Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw
}
// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
+Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
{
-
- ::dbtools::throwFeatureNotImplementedException( "XRow::getObject", *this );
- return Any();
+ return getValue(columnIndex).makeAny();
}
// -------------------------------------------------------------------------
@@ -786,14 +784,24 @@ void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::s
}
// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
+void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateBinaryStream", *this );
+ if(!x.is())
+ ::dbtools::throwFunctionSequenceException(*this);
+
+ Sequence<sal_Int8> aSeq;
+ x->readBytes(aSeq,length);
+ updateBytes(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
+void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this );
+ if(!x.is())
+ ::dbtools::throwFunctionSequenceException(*this);
+
+ Sequence<sal_Int8> aSeq;
+ x->readBytes(aSeq,length);
+ updateBytes(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
index 09596da61bd6..b1b8235da3d8 100644
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ b/connectivity/source/drivers/ado/Aolevariant.cxx
@@ -39,8 +39,17 @@
#include "diagnose_ex.h"
#include "resource/sharedresources.hxx"
#include "resource/ado_res.hrc"
-
+#include "com/sun/star/bridge/oleautomation/Date.hpp"
+#include "com/sun/star/bridge/oleautomation/Currency.hpp"
+#include "com/sun/star/bridge/oleautomation/SCode.hpp"
+#include "com/sun/star/bridge/oleautomation/Decimal.hpp"
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::bridge::oleautomation;
using namespace connectivity::ado;
+using ::rtl::OUString;
+
OLEString::OLEString()
:m_sStr(NULL)
{
@@ -698,6 +707,88 @@ SAFEARRAY* OLEVariant::getUI1SAFEARRAYPtr() const
return V_ARRAY(&varDest);
}
// -----------------------------------------------------------------------------
+::com::sun::star::uno::Any OLEVariant::makeAny() const
+{
+ ::com::sun::star::uno::Any aValue;
+ switch (V_VT(this))
+ {
+ case VT_EMPTY:
+ case VT_NULL:
+ aValue.setValue(NULL, Type());
+ break;
+ case VT_I2:
+ aValue.setValue( & iVal, getCppuType( (sal_Int16*)0));
+ break;
+ case VT_I4:
+ aValue.setValue( & lVal, getCppuType( (sal_Int32*)0));
+ break;
+ case VT_R4:
+ aValue.setValue( & fltVal, getCppuType( (float*)0));
+ break;
+ case VT_R8:
+ aValue.setValue(& dblVal, getCppuType( (double*)0));
+ break;
+ case VT_CY:
+ {
+ Currency cy(cyVal.int64);
+ aValue <<= cy;
+ break;
+ }
+ case VT_DATE:
+ {
+ aValue <<= (::com::sun::star::util::Date)*this;
+ break;
+ }
+ case VT_BSTR:
+ {
+ OUString b(reinterpret_cast<const sal_Unicode*>(bstrVal));
+ aValue.setValue( &b, getCppuType( &b));
+ break;
+ }
+ case VT_BOOL:
+ {
+ sal_Bool b= boolVal == VARIANT_TRUE;
+ aValue.setValue( &b, getCppuType( &b));
+ break;
+ }
+ case VT_I1:
+ aValue.setValue( & cVal, getCppuType((sal_Int8*)0));
+ break;
+ case VT_UI1: // there is no unsigned char in UNO
+ aValue.setValue( & bVal, getCppuType( (sal_Int8*)0));
+ break;
+ case VT_UI2:
+ aValue.setValue( & uiVal, getCppuType( (sal_uInt16*)0));
+ break;
+ case VT_UI4:
+ aValue.setValue( & ulVal, getCppuType( (sal_uInt32*)0));
+ break;
+ case VT_INT:
+ aValue.setValue( & intVal, getCppuType( (sal_Int32*)0));
+ break;
+ case VT_UINT:
+ aValue.setValue( & uintVal, getCppuType( (sal_uInt32*)0));
+ break;
+ case VT_VOID:
+ aValue.setValue( NULL, Type());
+ break;
+ case VT_DECIMAL:
+ {
+ Decimal dec;
+ dec.Scale = decVal.scale;
+ dec.Sign = decVal.sign;
+ dec.LowValue = decVal.Lo32;
+ dec.MiddleValue = decVal.Mid32;
+ dec.HighValue = decVal.Hi32;
+ aValue <<= dec;
+ break;
+ }
+
+ default:
+ break;
+ }
+ return aValue;
+}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu
index 236d38bd7ff7..8a106c70283f 100755
--- a/connectivity/source/drivers/ado/ado.xcu
+++ b/connectivity/source/drivers/ado/ado.xcu
@@ -115,6 +115,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="PrimaryKeySupport" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">
diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx
index 188303a1ba50..e3412babfdf6 100644
--- a/connectivity/source/drivers/ado/adoimp.cxx
+++ b/connectivity/source/drivers/ado/adoimp.cxx
@@ -157,8 +157,10 @@ DataTypeEnum ADOS::MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine)
case DataType::BIT: return adBoolean; break;
case DataType::BINARY: return adBinary; break;
case DataType::VARCHAR: return adVarWChar; break;
+ case DataType::CLOB:
case DataType::LONGVARCHAR: return adLongVarWChar; break;
case DataType::VARBINARY: return adVarBinary; break;
+ case DataType::BLOB:
case DataType::LONGVARBINARY: return adLongVarBinary; break;
case DataType::CHAR: return adWChar; break;
case DataType::TINYINT: return isJetEngine(_nJetEngine) ? adUnsignedTinyInt : adTinyInt;break;
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index 07cdf95d7b44..6e583644e3b9 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -497,13 +497,16 @@ void OStatement_Base::construct(const ::rtl::OUString& sql) throw(SQLException,
// SELECT statement without columns -> error
m_pConnection->throwGenericSQLException(STR_QUERY_NO_COLUMN,*this);
- if ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_CREATE_TABLE )
- // CREATE TABLE is not supported at all
- m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
-
- if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_ODBC_CALL ) || ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_UNKNOWN ) )
- // ODBC call or unknown statement type -> error
- m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
+ switch(m_aSQLIterator.getStatementType())
+ {
+ case SQL_STATEMENT_CREATE_TABLE:
+ case SQL_STATEMENT_ODBC_CALL:
+ case SQL_STATEMENT_UNKNOWN:
+ m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
+ break;
+ default:
+ break;
+ }
// at this moment we support only one table per select statement
Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTabs.begin()->second,UNO_QUERY);
diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx
index cac868d4792f..d778487655d5 100644
--- a/connectivity/source/drivers/jdbc/Boolean.cxx
+++ b/connectivity/source/drivers/jdbc/Boolean.cxx
@@ -40,17 +40,19 @@ jclass java_lang_Boolean::theClass = 0;
java_lang_Boolean::~java_lang_Boolean()
{}
-
-jclass java_lang_Boolean::getMyClass() const
+jclass java_lang_Boolean::st_getMyClass()
{
// die Klasse muss nur einmal geholt werden, daher statisch
if( !theClass )
- {
theClass = findMyClass("java/lang/Boolean");
- }
return theClass;
}
+jclass java_lang_Boolean::getMyClass() const
+{
+ return st_getMyClass();
+}
+
java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL )
{
SDBThreadAttach t;
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 8cea582940d3..e6209a90f236 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -227,9 +227,8 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame
static jmethodID mID(NULL);
obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
// Parameter konvertieren
- jstring str = convertwchar_tToJavaString(t.pEnv,typeName);
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,str);
- t.pEnv->DeleteLocalRef(str);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,typeName));
+ t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,str.get());
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
}
}
@@ -336,23 +335,22 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/)
// Java-Call absetzen
jobject out = NULL;
// Parameter konvertieren
- jstring str = convertwchar_tToJavaString(t.pEnv,m_sSqlStatement);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,m_sSqlStatement));
static jmethodID mID(NULL);
if ( !mID )
mID = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
if( mID ){
- out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, str ,m_nResultSetType,m_nResultSetConcurrency);
+ out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, str.get() ,m_nResultSetType,m_nResultSetConcurrency);
} //mID
else
{
static const char * cSignature2 = "(Ljava/lang/String;)Ljava/sql/CallableStatement;";
static jmethodID mID2 = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
if( mID2 ){
- out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, str );
+ out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, str.get() );
} //mID
}
- t.pEnv->DeleteLocalRef(str);
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
if ( out )
diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx
index 632504448e06..ef64ca7b05e9 100644
--- a/connectivity/source/drivers/jdbc/Clob.cxx
+++ b/connectivity/source/drivers/jdbc/Clob.cxx
@@ -34,6 +34,8 @@
#include "java/tools.hxx"
#include "java/io/Reader.hxx"
#include <connectivity/dbexception.hxx>
+#include <rtl/logfile.hxx>
+
using namespace connectivity;
//**************************************************************
//************ Class: java.sql.Clob
@@ -61,6 +63,7 @@ jclass java_sql_Clob::getMyClass() const
sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::length" );
jlong out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
@@ -79,6 +82,7 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx
::rtl::OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 subStringLength ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::getSubString" );
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
::rtl::OUString aStr;
{
@@ -98,6 +102,7 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Clob::getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::getCharacterStream" );
SDBThreadAttach t;
static jmethodID mID(NULL);
jobject out = callObjectMethod(t.pEnv,"getCharacterStream","()Ljava/io/Reader;", mID);
@@ -108,6 +113,7 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx
sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::position" );
jlong out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
@@ -130,6 +136,7 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sa
sal_Int64 SAL_CALL java_sql_Clob::positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& /*pattern*/, sal_Int64 /*start*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::positionOfClob" );
::dbtools::throwFeatureNotImplementedException( "XClob::positionOfClob", *this );
// this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
// the pattern parameter. Since the effort for proper implementation is rather high - we would need
diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx
index 522c1f67973e..dd2b0566b33f 100644
--- a/connectivity/source/drivers/jdbc/InputStream.cxx
+++ b/connectivity/source/drivers/jdbc/InputStream.cxx
@@ -84,8 +84,9 @@ void SAL_CALL java_io_InputStream::closeInput( ) throw(::com::sun::star::io::No
// -----------------------------------------------------
sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
{
- if ( aData.getLength() < nBytesToRead )
- throw ::com::sun::star::io::BufferSizeExceededException();
+ if (nBytesToRead < 0)
+ throw ::com::sun::star::io::BufferSizeExceededException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), *this );
+
jint out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
@@ -102,7 +103,8 @@ sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequen
if(out > 0)
{
jboolean p = sal_False;
- memcpy(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out);
+ aData.realloc ( out );
+ rtl_copyMemory(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out);
}
t.pEnv->DeleteLocalRef((jbyteArray)pByteArray);
} //t.pEnv
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 96325511807f..9e967a65b85d 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -56,6 +56,7 @@
#include <rtl/ustrbuf.hxx>
#include <jni.h>
#include "resource/common_res.hrc"
+#include <unotools/confignode.hxx>
#include <list>
#include <memory>
@@ -553,10 +554,9 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
static jmethodID mID(NULL);
obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
// Parameter konvertieren
- jstring str = convertwchar_tToJavaString(t.pEnv,sql);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,sql));
- jobject out = t.pEnv->CallObjectMethod( object, mID, str );
- t.pEnv->DeleteLocalRef(str);
+ jobject out = t.pEnv->CallObjectMethod( object, mID, str.get() );
aStr = JavaString2String(t.pEnv, (jstring)out );
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
} //t.pEnv
@@ -767,7 +767,20 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri
enableAutoRetrievingEnabled( bAutoRetrievingEnabled );
setAutoRetrievingStatement( sGeneratedValueStatement );
}
-
+// -----------------------------------------------------------------------------
+::rtl::OUString java_sql_Connection::impl_getJavaDriverClassPath_nothrow(const ::rtl::OUString& _sDriverClass)
+{
+ static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"));
+ ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+ m_pDriver->getContext().getLegacyServiceFactory(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ ::rtl::OUString sURL;
+ if ( aNamesRoot.isValid() && aNamesRoot.hasByName( _sDriverClass ) )
+ {
+ ::utl::OConfigurationNode aRegisterObj = aNamesRoot.openNode( _sDriverClass );
+ OSL_VERIFY( aRegisterObj.getNodeValue( "Path" ) >>= sURL );
+ }
+ return sURL;
+}
// -----------------------------------------------------------------------------
sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
const Sequence< PropertyValue >& info)
@@ -790,6 +803,8 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
::comphelper::NamedValueCollection aSettings( info );
sDriverClass = aSettings.getOrDefault( "JavaDriverClass", sDriverClass );
sDriverClassPath = aSettings.getOrDefault( "JavaDriverClassPath", sDriverClassPath);
+ if ( !sDriverClassPath.getLength() )
+ sDriverClassPath = impl_getJavaDriverClassPath_nothrow(sDriverClass);
bAutoRetrievingEnabled = aSettings.getOrDefault( "IsAutoRetrievingEnabled", bAutoRetrievingEnabled );
sGeneratedValueStatement = aSettings.getOrDefault( "AutoRetrievingStatement", sGeneratedValueStatement );
m_bParameterSubstitution = aSettings.getOrDefault( "ParameterNameSubstitution", m_bParameterSubstitution );
@@ -810,8 +825,8 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
static const char * cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;";
static const char * cMethodName = "connect";
// Java-Call absetzen
- jmethodID mID = NULL;
- if ( !mID )
+ static jmethodID mID = NULL;
+ if ( !mID )
mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature );
if ( mID )
{
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 6f4e78550dc0..73829b46ec64 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -43,7 +43,7 @@
#include <vos/mutex.hxx>
#include <osl/thread.h>
#include <com/sun/star/uno/Sequence.hxx>
-
+#include "java/LocalRef.hxx"
#include "resource/jdbc_log.hrc"
#include <rtl/logfile.hxx>
#include <comphelper/logging.hxx>
@@ -395,10 +395,9 @@ void java_lang_Object::callVoidMethodWithStringArg( const char* _pMethodName, jm
OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
obtainMethodId(t.pEnv, _pMethodName,"(Ljava/lang/String;)V", _inout_MethodID);
- jstring str = convertwchar_tToJavaString(t.pEnv,_nArgument);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,_nArgument));
// call method
- t.pEnv->CallVoidMethod( object, _inout_MethodID , str);
- t.pEnv->DeleteLocalRef(str);
+ t.pEnv->CallVoidMethod( object, _inout_MethodID , str.get());
ThrowSQLException( t.pEnv, NULL );
}
// -------------------------------------------------------------------------
@@ -417,10 +416,9 @@ sal_Int32 java_lang_Object::callIntMethodWithStringArg( const char* _pMethodName
// *this
// );
- jstring str = convertwchar_tToJavaString(t.pEnv,_nArgument);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,_nArgument));
// call method
- jint out = t.pEnv->CallIntMethod( object, _inout_MethodID , str);
- t.pEnv->DeleteLocalRef(str);
+ jint out = t.pEnv->CallIntMethod( object, _inout_MethodID , str.get());
ThrowSQLException( t.pEnv, NULL );
return (sal_Int32)out;
}
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index dbf7241885da..ae43b40b3a0b 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -45,7 +45,7 @@
#include "resource/jdbc_log.hrc"
#include "resource/common_res.hrc"
#include "resource/sharedresources.hxx"
-
+#include "java/LocalRef.hxx"
#include <string.h>
using namespace connectivity;
@@ -138,10 +138,9 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c
// Java-Call absetzen
static jmethodID mID(NULL);
obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jstring str = convertwchar_tToJavaString(t.pEnv,x);
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,str);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x));
+ t.pEnv->CallVoidMethod( object, mID, parameterIndex,str.get());
// und aufraeumen
- t.pEnv->DeleteLocalRef(str);
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
} //t.pEnv
}
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 677985ac6a90..df90a68799bc 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -30,10 +30,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
+#include "java/lang/String.hxx"
+#include "java/lang/Boolean.hxx"
#include "java/sql/ResultSet.hxx"
#include "java/math/BigDecimal.hxx"
#include "java/sql/JStatement.hxx"
#include "java/sql/SQLWarning.hxx"
+#include "java/sql/Timestamp.hxx"
#include "java/sql/Array.hxx"
#include "java/sql/Ref.hxx"
#include "java/sql/Clob.hxx"
@@ -54,6 +57,7 @@
#include "connectivity/dbexception.hxx"
#include "resource/common_res.hrc"
#include "resource/sharedresources.hxx"
+#include "java/LocalRef.hxx"
#include <rtl/logfile.hxx>
#include <string.h>
@@ -324,6 +328,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" );
jobject out(0);
+ Any aRet;
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
jvalue args[2];
@@ -341,15 +346,43 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen
obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
}
- out = t.pEnv->CallObjectMethodA( object, mID, args);
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- // und aufraeumen
-
+ out = t.pEnv->CallObjectMethodA( object, mID, args);
+ t.pEnv->DeleteLocalRef((jstring)args[1].l);
+ ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+ // und aufraeumen
+ if ( out )
+ {
+ if ( t.pEnv->IsInstanceOf(out,java_lang_String::st_getMyClass()) )
+ {
+ java_lang_String aVal(t.pEnv,out);
+ aRet <<= (::rtl::OUString)aVal;
+ }
+ else if ( t.pEnv->IsInstanceOf(out,java_lang_Boolean::st_getMyClass()) )
+ {
+ java_lang_Boolean aVal(t.pEnv,out);
+ static jmethodID methodID = NULL;
+ aRet <<= aVal.callBooleanMethod("booleanValue",methodID);
+ }
+ else if ( t.pEnv->IsInstanceOf(out,java_sql_Date::st_getMyClass()) )
+ {
+ java_sql_Date aVal(t.pEnv,out);
+ aRet <<= (::com::sun::star::util::Date)aVal;
+ }
+ else if ( t.pEnv->IsInstanceOf(out,java_sql_Time::st_getMyClass()) )
+ {
+ java_sql_Time aVal(t.pEnv,out);
+ aRet <<= (::com::sun::star::util::Time)aVal;
+ }
+ else if ( t.pEnv->IsInstanceOf(out,java_sql_Timestamp::st_getMyClass()) )
+ {
+ java_sql_Timestamp aVal(t.pEnv,out);
+ aRet <<= (::com::sun::star::util::DateTime)aVal;
+ }
+ else
+ t.pEnv->DeleteLocalRef(out);
+ }
} //t.pEnv
- // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
- ::dbtools::throwFunctionNotSupportedException( "XRow::getObject", *this );
- return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out );
+ return aRet;
}
// -------------------------------------------------------------------------
@@ -689,9 +722,8 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r
{
// Parameter konvertieren
- jstring str = convertwchar_tToJavaString(t.pEnv,x);
- t.pEnv->CallVoidMethod( object, mID,columnIndex,str);
- t.pEnv->DeleteLocalRef(str);
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x));
+ t.pEnv->CallVoidMethod( object, mID,columnIndex,str.get());
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
}
}
@@ -754,16 +786,68 @@ void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const
}
// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 /*columnIndex*/, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBinaryStream" );
- ::dbtools::throwFeatureNotImplementedException( "XParameters::updateBinaryStream", *this );
+ try
+ {
+ SDBThreadAttach t;
+ {
+
+ // temporaere Variable initialisieren
+ // Java-Call absetzen
+ static jmethodID mID(NULL);
+ if ( !mID )
+ {
+ static const char * cSignature = "(ILjava/io/InputStream;I)V";
+ static const char * cMethodName = "updateBinaryStream";
+ obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
+ }
+
+ {
+ // Parameter konvertieren
+ jobject obj = createByteInputStream(x,length);
+ t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length);
+ ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+ }
+ }
+ }
+ catch(Exception)
+ {
+ ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateBinaryStream", *this );
+ }
}
// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 /*columnIndex*/, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateCharacterStream" );
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this );
+ try
+ {
+ SDBThreadAttach t;
+ {
+
+ // temporaere Variable initialisieren
+ // Java-Call absetzen
+ static jmethodID mID(NULL);
+ if ( !mID )
+ {
+ static const char * cSignature = "(ILjava/io/Reader;I)V";
+ static const char * cMethodName = "updateCharacterStream";
+ obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
+ }
+
+ {
+ // Parameter konvertieren
+ jobject obj = createCharArrayReader(x,length);
+ t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length);
+ ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+ }
+ }
+ }
+ catch(Exception)
+ {
+ ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this );
+ }
}
// -------------------------------------------------------------------------
void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx
index 8c30f7a14efc..065ffe11d3e7 100644
--- a/connectivity/source/drivers/jdbc/Timestamp.cxx
+++ b/connectivity/source/drivers/jdbc/Timestamp.cxx
@@ -71,6 +71,10 @@ java_sql_Date::~java_sql_Date()
jclass java_sql_Date::getMyClass() const
{
+ return st_getMyClass();
+}
+jclass java_sql_Date::st_getMyClass()
+{
// die Klasse muss nur einmal geholt werden, daher statisch
if( !theClass )
theClass = findMyClass("java/sql/Date");
@@ -94,12 +98,15 @@ java_sql_Time::~java_sql_Time()
jclass java_sql_Time::getMyClass() const
{
+ return st_getMyClass();
+}
+jclass java_sql_Time::st_getMyClass()
+{
// die Klasse muss nur einmal geholt werden, daher statisch
if( !theClass )
theClass = findMyClass("java/sql/Time");
return theClass;
}
-
java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_util_Date( NULL, (jobject)NULL )
{
SDBThreadAttach t;
@@ -140,12 +147,15 @@ java_sql_Timestamp::~java_sql_Timestamp()
jclass java_sql_Timestamp::getMyClass() const
{
+ return st_getMyClass();
+}
+jclass java_sql_Timestamp::st_getMyClass()
+{
// die Klasse muss nur einmal geholt werden, daher statisch
if( !theClass )
theClass = findMyClass("java/sql/Timestamp");
return theClass;
}
-
java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _rOut)
:java_util_Date( NULL, (jobject)NULL )
{
diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu
index ae1bbad227e7..f5ac8f20db5c 100755
--- a/connectivity/source/drivers/jdbc/jdbc.xcu
+++ b/connectivity/source/drivers/jdbc/jdbc.xcu
@@ -145,6 +145,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="PrimaryKeySupport" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">
diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk
index 831a6755af91..fb37a3077743 100644
--- a/connectivity/source/drivers/jdbc/makefile.mk
+++ b/connectivity/source/drivers/jdbc/makefile.mk
@@ -95,6 +95,7 @@ SHL1STDLIBS=\
$(SALLIB) \
$(JVMACCESSLIB) \
$(DBTOOLSLIB) \
+ $(UNOTOOLSLIB) \
$(JVMFWKLIB) \
$(COMPHELPERLIB)
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index daaed46acdd9..f77c45d66fc8 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -218,5 +218,58 @@ sal_Bool connectivity::isExceptionOccured(JNIEnv *pEnv,sal_Bool _bClear)
return bRet;
}
-
-
+// -----------------------------------------------------------------------------
+jobject connectivity::createByteInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length)
+{
+ SDBThreadAttach t;
+ if( !t.pEnv || !x.is() )
+ return NULL;
+ // Java-Call fuer den Konstruktor absetzen
+ // temporaere Variable initialisieren
+ jclass clazz = java_lang_Object::findMyClass("java/io/ByteArrayInputStream");
+ static jmethodID mID(NULL);
+ if ( !mID )
+ {
+ static const char * cSignature = "([B)V";
+ mID = t.pEnv->GetMethodID( clazz, "<init>", cSignature );
+ OSL_ENSURE( mID, cSignature );
+ if ( !mID )
+ throw SQLException();
+ } // if ( !_inout_MethodID )
+ jbyteArray pByteArray = t.pEnv->NewByteArray(length);
+ Sequence< sal_Int8 > aData;
+ x->readBytes(aData,length);
+ jboolean p = sal_False;
+ rtl_copyMemory(t.pEnv->GetByteArrayElements(pByteArray,&p),aData.getArray(),aData.getLength());
+ jobject out = t.pEnv->NewObject( clazz, mID,pByteArray);
+ t.pEnv->DeleteLocalRef((jbyteArray)pByteArray);
+ return out;
+}
+// -----------------------------------------------------------------------------
+jobject connectivity::createCharArrayReader(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length)
+{
+ SDBThreadAttach t;
+ if( !t.pEnv || !x.is() )
+ return NULL;
+ // Java-Call fuer den Konstruktor absetzen
+ // temporaere Variable initialisieren
+ jclass clazz = java_lang_Object::findMyClass("java/io/CharArrayReader");
+ static jmethodID mID(NULL);
+ if ( !mID )
+ {
+ static const char * cSignature = "([C)V";
+ mID = t.pEnv->GetMethodID( clazz, "<init>", cSignature );
+ OSL_ENSURE( mID, cSignature );
+ if ( !mID )
+ throw SQLException();
+ } // if ( !_inout_MethodID )
+ jcharArray pCharArray = t.pEnv->NewCharArray(length);
+ Sequence< sal_Int8 > aData;
+ x->readBytes(aData,length);
+ jboolean p = sal_False;
+ rtl_copyMemory(t.pEnv->GetCharArrayElements(pCharArray,&p),aData.getArray(),aData.getLength());
+ jobject out = t.pEnv->NewObject( clazz, mID,pCharArray);
+ t.pEnv->DeleteLocalRef((jcharArray)pCharArray);
+ return out;
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbc/odbc.xcu b/connectivity/source/drivers/odbc/odbc.xcu
index cf306f10d57f..b3a9d7149650 100755
--- a/connectivity/source/drivers/odbc/odbc.xcu
+++ b/connectivity/source/drivers/odbc/odbc.xcu
@@ -150,6 +150,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="PrimaryKeySupport" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
index b92206199c24..f923987cc04e 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
@@ -921,6 +921,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_In
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
break;
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
break;
case DataType::DATE:
@@ -939,6 +940,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_In
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
break;
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
break;
case DataType::SQLNULL:
@@ -959,12 +961,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_In
case DataType::ARRAY:
// OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
break;
- case DataType::BLOB:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::CLOB:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
case DataType::REF:
// OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
break;
@@ -1009,6 +1005,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_In
bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
break;
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
break;
case DataType::DATE:
@@ -1027,6 +1024,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_In
bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
break;
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
break;
}
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 77ecceeaacdf..d084561f9372 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -283,7 +283,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co
aDate.day = 0;
aDate.month = 0;
aDate.year = 0;
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,&aDate,sizeof aDate);
+ OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate);
return Date(aDate.day,aDate.month,aDate.year);
}
else
@@ -434,7 +434,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
::rtl::OUString aVal;
if(columnIndex <= m_nDriverColumnCount)
- aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,(SWORD)SQL_C_WCHAR,m_bWasNull,**this,m_nTextEncoding);
+ aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding);
else
m_bWasNull = sal_True;
@@ -454,7 +454,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
TIME_STRUCT aTime={0,0,0};
if(columnIndex <= m_nDriverColumnCount)
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,&aTime,sizeof aTime);
+ OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime);
else
m_bWasNull = sal_True;
return Time(0,aTime.second,aTime.minute,aTime.hour);
@@ -472,7 +472,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0};
if(columnIndex <= m_nDriverColumnCount)
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime);
+ OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime);
else
m_bWasNull = sal_True;
return DateTime((sal_uInt16)aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year);
@@ -1316,5 +1316,11 @@ void ODatabaseMetaDataResultSet::checkColumnCount()
}
// -----------------------------------------------------------------------------
-
+SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex)
+{
+ ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex);
+ if ( aFind == m_aODBCColumnTypes.end() )
+ aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection,m_aStatementHandle,*this,columnIndex))).first;
+ return aFind->second;
+}
diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
index 8d72c3271b82..03d9912e4e22 100644
--- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
@@ -321,16 +321,6 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
setInt (parameterIndex, value);
}
// -------------------------------------------------------------------------
-#define PREP_BIND_PARAM(_ty,_jt) \
- OTools::bindParameter(m_pConnection, \
- m_aStatementHandle, \
- parameterIndex, \
- bindBuf, \
- getLengthBuf(parameterIndex), \
- (SWORD)_jt, \
- sal_False,m_pConnection->useOldDateFormat(),_pData,(Reference <XInterface>)*this,getOwnConnection()->getTextEncoding())
-
-
void OPreparedStatement::setParameter(sal_Int32 parameterIndex,sal_Int32 _nType,sal_Int32 _nSize,void* _pData)
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -353,6 +343,10 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex,sal_Int32 _nType,
case SQL_NUMERIC:
++nRealSize;
break;
+ case SQL_BINARY:
+ case SQL_VARBINARY:
+ nRealSize=1; //dummy buffer, binary data isn't copied
+ break;
default:
break;
}
@@ -480,15 +474,17 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
}
// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
+void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException)
{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setClob", *this );
+ if ( x.is() )
+ setStream(parameterIndex, x->getCharacterStream(), (SQLLEN)x->length(), DataType::LONGVARCHAR);
}
// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
+void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException)
{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setBlob", *this );
+ if ( x.is() )
+ setStream(parameterIndex, x->getBinaryStream(), (SQLLEN)x->length(), DataType::LONGVARCHAR);
}
// -------------------------------------------------------------------------
@@ -503,7 +499,12 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Re
::dbtools::throwFunctionNotSupportedException( "XParameters::setRef", *this );
}
// -------------------------------------------------------------------------
-
+void OPreparedStatement::setDecimal( sal_Int32 parameterIndex, const ::rtl::OUString& x )
+{
+ ::rtl::OString aString(::rtl::OUStringToOString(x,getOwnConnection()->getTextEncoding()));
+ setParameter(parameterIndex,DataType::DECIMAL,aString.getLength(),(void*)&x);
+}
+// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
{
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -528,6 +529,12 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
setNull(parameterIndex,sqlType);
break;
case DataType::DECIMAL:
+ {
+ ORowSetValue aValue;
+ aValue.fill(x);
+ setDecimal(parameterIndex,aValue);
+ }
+ break;
case DataType::NUMERIC:
{
ORowSetValue aValue;
@@ -568,19 +575,20 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
{
setParameter(parameterIndex,DataType::BINARY,x.getLength(),(void*)&x);
+ boundParams[parameterIndex-1].setSequence(x); // this assures that the sequence stays alive
}
// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- setStream (parameterIndex, x, length, DataType::LONGVARCHAR);
+ setStream(parameterIndex, x, length, DataType::LONGVARCHAR);
}
// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- setStream (parameterIndex, x, length, DataType::LONGVARBINARY);
+ setStream(parameterIndex, x, length, DataType::LONGVARBINARY);
}
// -------------------------------------------------------------------------
@@ -839,10 +847,10 @@ sal_Int32 OPreparedStatement::getPrecision ( sal_Int32 sqlType)
// Sets an input stream as a parameter, using the given SQL type
//--------------------------------------------------------------------
-void OPreparedStatement::setStream (
+void OPreparedStatement::setStream(
sal_Int32 ParameterIndex,
const Reference< XInputStream>& x,
- sal_Int32 length,
+ SQLLEN length,
sal_Int32 SQLtype)
throw(SQLException)
{
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index 8c885f0924ad..fb1a08147338 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -223,9 +223,11 @@ SQLRETURN OResultSet::unbind(sal_Bool _bUnbindHandle)
delete static_cast< double* >(reinterpret_cast< void * >(pValue->first));
break;
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
delete [] static_cast< char* >(reinterpret_cast< void * >(pValue->first));
break;
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
delete [] static_cast< char* >(reinterpret_cast< void * >(pValue->first));
break;
case DataType::DATE:
@@ -284,9 +286,11 @@ TVoidPtr OResultSet::allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex)
aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new double(0.0)),_nType);
break;
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new char[2]),_nType); // dient nur zum auffinden
break;
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new char[2]),_nType); // dient nur zum auffinden
break;
case DataType::DATE:
@@ -1499,6 +1503,7 @@ void OResultSet::fillRow(sal_Int32 _nToColumn)
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
{
::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(nColumn);
if ( aFind == m_aODBCColumnTypes.end() )
@@ -1514,6 +1519,7 @@ void OResultSet::fillRow(sal_Int32 _nToColumn)
*pColumn = getDouble(nColumn);
break;
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
*pColumn = getBytes(nColumn);
break;
case DataType::DATE:
@@ -1719,6 +1725,7 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
+ case DataType::BLOB:
aSeq = m_aRow[nColumnIndex];
N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength());
break;
@@ -1730,6 +1737,7 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
break;
}
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
{
::rtl::OUString sRet;
sRet = m_aRow[nColumnIndex].getString();
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx
index 39c848f34eaf..daa6d28a0acf 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -135,6 +135,7 @@ void OTools::bindData( SQLSMALLINT _nOdbcType,
{
case SQL_CHAR:
case SQL_VARCHAR:
+ case SQL_DECIMAL:
if(_bUseWChar)
{
*pLen = SQL_NTS;
@@ -160,7 +161,7 @@ void OTools::bindData( SQLSMALLINT _nOdbcType,
*pLen = sizeof(sal_Int64);
_nColumnSize = *pLen;
break;
- case SQL_DECIMAL:
+
case SQL_NUMERIC:
if(_bUseWChar)
{
@@ -210,12 +211,9 @@ void OTools::bindData( SQLSMALLINT _nOdbcType,
if(pSeq)
{
- // memcpy(_pData,pSeq->getConstArray(),pSeq->getLength());
- _pData = (sal_Int8*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray();
+ _pData = (sal_Int8*)pSeq->getConstArray();
*pLen = pSeq->getLength();
}
- // _pData = (sal_Int8*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray();
- // *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
}
break;
case SQL_LONGVARBINARY:
diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx
index f15d78a37ed9..c9fd9807af41 100644
--- a/connectivity/source/inc/ado/Aolevariant.hxx
+++ b/connectivity/source/inc/ado/Aolevariant.hxx
@@ -161,6 +161,7 @@ namespace connectivity
double getDate() const;
CY getCurrency() const;
SAFEARRAY* getUI1SAFEARRAYPtr() const;
+ ::com::sun::star::uno::Any makeAny() const;
static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean);
diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx
index 2f33ea27bc11..7cfd1bbc4aa1 100644
--- a/connectivity/source/inc/java/lang/Boolean.hxx
+++ b/connectivity/source/inc/java/lang/Boolean.hxx
@@ -48,6 +48,7 @@ namespace connectivity
java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){}
java_lang_Boolean( sal_Bool _par0 );
+ static jclass st_getMyClass();
};
}
diff --git a/connectivity/source/inc/java/sql/Connection.hxx b/connectivity/source/inc/java/sql/Connection.hxx
index 74d76d32f35a..41c18848021f 100644
--- a/connectivity/source/inc/java/sql/Connection.hxx
+++ b/connectivity/source/inc/java/sql/Connection.hxx
@@ -80,6 +80,11 @@ namespace connectivity
const ::rtl::OUString& _sDriverClassPath,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSystemProperties
);
+ /** load driver class path from system configuration.
+ @param _sDriverClass
+ The driver class name to look for in the configuration.
+ */
+ ::rtl::OUString impl_getJavaDriverClassPath_nothrow(const ::rtl::OUString& _sDriverClass);
protected:
// statische Daten fuer die Klasse
diff --git a/connectivity/source/inc/java/sql/Timestamp.hxx b/connectivity/source/inc/java/sql/Timestamp.hxx
index ce6de39b5bb9..2d234e1b52a1 100644
--- a/connectivity/source/inc/java/sql/Timestamp.hxx
+++ b/connectivity/source/inc/java/sql/Timestamp.hxx
@@ -54,6 +54,7 @@ namespace connectivity
java_sql_Date( const ::com::sun::star::util::Date& _rOut );
operator ::com::sun::star::util::Date();
+ static jclass st_getMyClass();
};
@@ -73,6 +74,7 @@ namespace connectivity
java_sql_Time( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){}
java_sql_Time( const ::com::sun::star::util::Time& _rOut );
operator ::com::sun::star::util::Time();
+ static jclass st_getMyClass();
};
//**************************************************************
@@ -93,6 +95,7 @@ namespace connectivity
sal_Int32 getNanos();
void setNanos(sal_Int32 n);
+ static jclass st_getMyClass();
};
}
#endif // _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_
diff --git a/connectivity/source/inc/java/tools.hxx b/connectivity/source/inc/java/tools.hxx
index af061d5599b7..a74865817ddb 100644
--- a/connectivity/source/inc/java/tools.hxx
+++ b/connectivity/source/inc/java/tools.hxx
@@ -41,6 +41,7 @@
#include <comphelper/uno3.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/DateTime.hpp>
@@ -85,6 +86,9 @@ namespace connectivity
<TRUE/> if an exception is occured
*/
sal_Bool isExceptionOccured(JNIEnv *pEnv,sal_Bool _bClear);
+
+ jobject createByteInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length);
+ jobject createCharArrayReader(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length);
}
#endif // _CONNECTIVITY_JAVA_TOOLS_HXX_
diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx
index c71977a94910..bc896c2361d8 100644
--- a/connectivity/source/inc/odbc/OBoundParam.hxx
+++ b/connectivity/source/inc/odbc/OBoundParam.hxx
@@ -119,6 +119,11 @@ namespace connectivity
paramInputStreamLen = len;
}
+ void setSequence(const ::com::sun::star::uno::Sequence< sal_Int8 >& _aSequence)
+ {
+ aSequence = _aSequence;
+ }
+
//--------------------------------------------------------------------
// getInputStream
// Gets the input stream for the bound parameter
@@ -191,6 +196,7 @@ namespace connectivity
// data is in native format.
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> paramInputStream;
+ ::com::sun::star::uno::Sequence< sal_Int8 > aSequence;
// When an input stream is
// bound to a parameter, the
// input stream is saved
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
index 6248417828ba..46b5a020d1d0 100644
--- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
@@ -100,6 +100,7 @@ namespace connectivity
sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ SWORD impl_getColumnType_nothrow(sal_Int32 column);
sal_Int32 mapColumn (sal_Int32 column);
diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx
index 9e6f6ca8a61f..d167c9edb9a0 100644
--- a/connectivity/source/inc/odbc/OPreparedStatement.hxx
+++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx
@@ -89,7 +89,7 @@ namespace connectivity
void FreeParams();
void putParamData (sal_Int32 index) throw(::com::sun::star::sdbc::SQLException);
void setStream (sal_Int32 ParameterIndex,const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x,
- sal_Int32 length,sal_Int32 SQLtype) throw(::com::sun::star::sdbc::SQLException);
+ SQLLEN length,sal_Int32 SQLtype) throw(::com::sun::star::sdbc::SQLException);
sal_Int32 getParamLength ( sal_Int32 index);
sal_Int8* getLengthBuf (sal_Int32 index);
sal_Int8* getDataBuf (sal_Int32 index);
@@ -102,6 +102,7 @@ namespace connectivity
sal_Bool isPrepared() const { return m_bPrepared;}
void prepareStatement();
void checkParameterIndex(sal_Int32 _parameterIndex);
+ void setDecimal( sal_Int32 parameterIndex, const ::rtl::OUString& x );
/**
creates the driver specific resultset (factory)
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 97875dfd4de0..1680516e8dc0 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -107,7 +107,6 @@ static connectivity::OSQLInternalNode* newNode(const sal_Char* pNewValue,
const connectivity::SQLNodeType eNodeType,
const sal_uInt32 nNodeID = 0)
{
- OSL_TRACE("connectivity: Rule Number: %d,%d",eNodeType,nNodeID);
return new connectivity::OSQLInternalNode(pNewValue, eNodeType, nNodeID);
}
@@ -115,7 +114,6 @@ static connectivity::OSQLInternalNode* newNode(const ::rtl::OString& _NewValue,
const connectivity::SQLNodeType eNodeType,
const sal_uInt32 nNodeID = 0)
{
- OSL_TRACE("connectivity: Rule Number: %d,%d",eNodeType,nNodeID);
return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID);
}
@@ -123,7 +121,6 @@ static connectivity::OSQLInternalNode* newNode(const ::rtl::OUString& _NewValue,
const connectivity::SQLNodeType eNodeType,
const sal_uInt32 nNodeID = 0)
{
- OSL_TRACE("connectivity: Rule Number: %d,%d",eNodeType,nNodeID);
return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID);
}
@@ -2043,7 +2040,8 @@ join_spec:
| named_columns_join
;
join_type:
- SQL_TOKEN_INNER
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | SQL_TOKEN_INNER
{
$$ = SQL_NEW_RULE;
$$->append($1);
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 26086495be89..54ab874f70e1 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -952,21 +952,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
if ( pColumnRef->isRule() )
{
bFkt = sal_True;
- if ( SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term) || SQL_ISRULE(pColumnRef,factor) )
- {
- nType = DataType::DOUBLE;
- }
- else
- {
- ::rtl::OUString sFunctionName;
- if ( SQL_ISRULE(pColumnRef,length_exp) )
- pColumnRef->getChild(0)->getChild(0)->parseNodeToStr(
- sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
- else
- pColumnRef->getChild(0)->parseNodeToStr(
- sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
- nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
- }
+ nType = getFunctionReturnType(pColumnRef);
}
}
/*
@@ -1601,7 +1587,6 @@ void OSQLParseTreeIterator::impl_traverse( sal_uInt32 _nIncludeMask )
case SQL_STATEMENT_INSERT:
break;
default:
- OSL_ENSURE( false, "OSQLParseTreeIterator::traverseAll: not yet implemented for this statement type!" );
break;
}
}
@@ -2104,3 +2089,84 @@ void OSQLParseTreeIterator::impl_appendError( const SQLException& _rError )
m_aErrors = _rError;
}
// -----------------------------------------------------------------------------
+sal_Int32 OSQLParseTreeIterator::getFunctionReturnType(const OSQLParseNode* _pNode )
+{
+ sal_Int32 nType = DataType::OTHER;
+ ::rtl::OUString sFunctionName;
+ if ( SQL_ISRULE(_pNode,length_exp) )
+ {
+ _pNode->getChild(0)->getChild(0)->parseNodeToStr(sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+ nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
+ }
+ else if ( SQL_ISRULE(_pNode,num_value_exp) || SQL_ISRULE(_pNode,term) || SQL_ISRULE(_pNode,factor) )
+ {
+ nType = DataType::DOUBLE;
+ }
+ else
+ {
+ _pNode->getChild(0)->parseNodeToStr(sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+
+ // MIN and MAX have another return type, we have to check the expression itself.
+ // @see http://qa.openoffice.org/issues/show_bug.cgi?id=99566
+ if ( SQL_ISRULE(_pNode,general_set_fct) && (SQL_ISTOKEN(_pNode->getChild(0),MIN) || SQL_ISTOKEN(_pNode->getChild(0),MAX) ))
+ {
+ const OSQLParseNode* pValueExp = _pNode->getChild(3);
+ if (SQL_ISRULE(pValueExp,column_ref))
+ {
+ ::rtl::OUString sColumnName;
+ ::rtl::OUString aTableRange;
+ getColumnRange(pValueExp,sColumnName,aTableRange);
+ OSL_ENSURE(sColumnName.getLength(),"Columnname darf nicht leer sein");
+ Reference<XPropertySet> xColumn = findColumn( sColumnName, aTableRange, true );
+
+ if ( xColumn.is() )
+ {
+ xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_TYPE)) >>= nType;
+ }
+ }
+ else
+ {
+ if ( SQL_ISRULE(pValueExp,num_value_exp) || SQL_ISRULE(pValueExp,term) || SQL_ISRULE(pValueExp,factor) )
+ {
+ nType = DataType::DOUBLE;
+ }
+ else if ( SQL_ISRULE(pValueExp,datetime_primary) )
+ {
+ switch(pValueExp->getChild(0)->getTokenID() )
+ {
+ case SQL_TOKEN_CURRENT_DATE:
+ nType = DataType::DATE;
+ break;
+ case SQL_TOKEN_CURRENT_TIME:
+ nType = DataType::TIME;
+ break;
+ case SQL_TOKEN_CURRENT_TIMESTAMP:
+ nType = DataType::TIMESTAMP;
+ break;
+ }
+ }
+ else if ( SQL_ISRULE(pValueExp,value_exp_primary) )
+ {
+ nType = getFunctionReturnType(pValueExp->getChild(1));
+ }
+ else if ( SQL_ISRULE(pValueExp,concatenation)
+ || SQL_ISRULE(pValueExp,char_factor)
+ || SQL_ISRULE(pValueExp,bit_value_fct)
+ || SQL_ISRULE(pValueExp,char_value_fct)
+ || SQL_ISRULE(pValueExp,char_substring_fct)
+ || SQL_ISRULE(pValueExp,fold)
+ || SQL_ISTOKEN(pValueExp,STRING) )
+ {
+ nType = DataType::VARCHAR;
+ }
+ }
+ if ( nType == DataType::OTHER )
+ nType = DataType::DOUBLE;
+ }
+ else
+ nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
+ }
+
+ return nType;
+}
+
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 8d869c2dea0a..c76dd44e3d18 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -813,8 +813,9 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral)
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
- if ( !SQL_ISRULE(pReturn,char_value_exp) && !buildStringNodes(pReturn) )
- pReturn = NULL;
+ case DataType::CLOB:
+ if ( !SQL_ISRULE(pReturn,char_value_exp) && !buildStringNodes(pReturn) )
+ pReturn = NULL;
default:
break;
}
@@ -829,6 +830,7 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral)
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
break;
case DataType::DATE:
case DataType::TIME:
@@ -872,12 +874,13 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral)
case DataType::REAL:
case DataType::DOUBLE:
// kill thousand seperators if any
- killThousandSeparator(pReturn);
+ killThousandSeparator(pReturn);
break;
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
- pReturn = buildNode_STR_NUM(pReturn);
+ case DataType::CLOB:
+ pReturn = buildNode_STR_NUM(pReturn);
break;
default:
m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_INT_COMPARE);
@@ -893,12 +896,13 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral)
case DataType::REAL:
case DataType::DOUBLE:
// kill thousand seperators if any
- killThousandSeparator(pReturn);
+ killThousandSeparator(pReturn);
break;
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
- pReturn = buildNode_STR_NUM(pReturn);
+ case DataType::CLOB:
+ pReturn = buildNode_STR_NUM(pReturn);
break;
case DataType::INTEGER:
default:
@@ -967,6 +971,7 @@ sal_Int16 OSQLParser::buildLikeRule(OSQLParseNode*& pAppend, OSQLParseNode*& pLi
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
if(pLiteral->isRule())
{
pAppend->append(pLiteral);
@@ -1228,6 +1233,7 @@ OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const :
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
s_pScanner->SetRule(s_pScanner->GetSTRINGRule());
break;
default:
@@ -1415,7 +1421,11 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
{ OSQLParseNode::table_node, "table_node" },
{ OSQLParseNode::as, "as" },
{ OSQLParseNode::op_column_commalist, "op_column_commalist" },
- { OSQLParseNode::table_primary_as_range_column, "table_primary_as_range_column" }
+ { OSQLParseNode::table_primary_as_range_column, "table_primary_as_range_column" },
+ { OSQLParseNode::datetime_primary, "datetime_primary" },
+ { OSQLParseNode::concatenation, "concatenation" },
+ { OSQLParseNode::char_factor, "char_factor" },
+ { OSQLParseNode::bit_value_fct, "bit_value_fct" }
};
size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] );
OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" );
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index 00cf4cc911c2..84bc2fa4054c 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/dbregister.hxx
@@ -87,7 +87,7 @@ namespace svx
@param _sLocation
The location of the file.
*/
- void insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation);
+ void insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool bReadOnly );
/** opens the LinkDialog to create a register pair
@param _sOldName
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 23e8bf865626..91635d80f5f1 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -190,7 +190,7 @@ DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
pHeaderBar->Hide();
for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
- delete static_cast<String*>(pPathBox->GetEntry(i)->GetUserData());
+ delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() );
delete pPathBox;
delete pHeaderBar;
}
@@ -209,21 +209,22 @@ BOOL DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet )
{
// the settings for the single drivers
sal_Bool bModified = sal_False;
- TNameLocationMap aMap;
+ DatabaseRegistrations aRegistrations;
ULONG nCount = pPathBox->GetEntryCount();
for ( ULONG i = 0; i < nCount; ++i )
{
SvLBoxEntry* pEntry = pPathBox->GetEntry(i);
- String* pPath = static_cast<String*>(pEntry->GetUserData());
- if ( pPath && pPath->Len() )
+ DatabaseRegistration* pRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() );
+ if ( pRegistration && pRegistration->sLocation.getLength() )
{
- OFileNotation aTransformer(*pPath);
- aMap.insert(TNameLocationMap::value_type(::rtl::OUString(pPathBox->GetEntryText(pEntry,0)),aTransformer.get(OFileNotation::N_URL)));
+ ::rtl::OUString sName( pPathBox->GetEntryText( pEntry, 0 ) );
+ OFileNotation aTransformer( pRegistration->sLocation );
+ aRegistrations[ sName ] = DatabaseRegistration( aTransformer.get( OFileNotation::N_URL ), pRegistration->bReadOnly );
}
}
- if ( m_nOldCount != aMap.size() || m_bModified )
+ if ( m_nOldCount != aRegistrations.size() || m_bModified )
{
- rCoreSet.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aMap), SID_SB_DB_REGISTER);
+ rCoreSet.Put(DatabaseMapItem( SID_SB_DB_REGISTER, aRegistrations ), SID_SB_DB_REGISTER);
bModified = sal_True;
}
@@ -235,47 +236,44 @@ BOOL DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet )
void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet )
{
// the settings for the single drivers
- SFX_ITEMSET_GET( rSet, pSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+ SFX_ITEMSET_GET( rSet, pRegistrations, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+ if ( !pRegistrations )
+ return;
- if ( pSettings )
+ pPathBox->Clear();
+
+ const DatabaseRegistrations& rRegistrations = pRegistrations->getRegistrations();
+ m_nOldCount = rRegistrations.size();
+ DatabaseRegistrations::const_iterator aIter = rRegistrations.begin();
+ DatabaseRegistrations::const_iterator aEnd = rRegistrations.end();
+ for ( ; aIter != aEnd; ++aIter )
+ {
+ OFileNotation aTransformer( aIter->second.sLocation );
+ insertNewEntry( aIter->first, aTransformer.get( OFileNotation::N_SYSTEM ), aIter->second.bReadOnly );
+ }
+
+ String aUserData = GetUserData();
+ if ( aUserData.Len() )
{
- // TabListBox f"ullen
- pPathBox->Clear();
-
- const TNameLocationMap& rMap = pSettings->getSettings();
- m_nOldCount = rMap.size();
- TNameLocationMap::const_iterator aIter = rMap.begin();
- TNameLocationMap::const_iterator aEnd = rMap.end();
- for (; aIter != aEnd; ++aIter)
+ // Spaltenbreite restaurieren
+ pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
+ HeaderEndDrag_Impl( NULL );
+ // Sortierrichtung restaurieren
+ BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32();
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+
+ if ( bUp )
{
- OFileNotation aTransformer(aIter->second);
- insertNewEntry(aIter->first,aTransformer.get(OFileNotation::N_SYSTEM));
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
}
-
- String aUserData = GetUserData();
-
- if ( aUserData.Len() )
+ else
{
- // Spaltenbreite restaurieren
- pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
- HeaderEndDrag_Impl( NULL );
- // Sortierrichtung restaurieren
- BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32();
- HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
-
- if ( bUp )
- {
- nBits &= ~HIB_UPARROW;
- nBits |= HIB_DOWNARROW;
- }
- else
- {
- nBits &= ~HIB_DOWNARROW;
- nBits |= HIB_UPARROW;
- }
- pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
- HeaderSelect_Impl( NULL );
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
}
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ HeaderSelect_Impl( NULL );
}
}
@@ -316,16 +314,19 @@ IMPL_LINK( DbRegistrationOptionsPage, NewHdl, void *, EMPTYARG )
IMPL_LINK( DbRegistrationOptionsPage, EditHdl, void *, EMPTYARG )
{
SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
- if ( pEntry )
- {
- String* pOldLocation = static_cast<String*>(pEntry->GetUserData());
- String sOldName = pPathBox->GetEntryText(pEntry,0);
- m_pCurEntry = pEntry;
- openLinkDialog(sOldName,*pOldLocation,pEntry);
- m_pCurEntry = NULL;
- }
+ if ( !pEntry )
+ return 0L;
- return 0;
+ DatabaseRegistration* pOldRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() );
+ if ( !pOldRegistration || pOldRegistration->bReadOnly )
+ return 0L;
+
+ String sOldName = pPathBox->GetEntryText(pEntry,0);
+ m_pCurEntry = pEntry;
+ openLinkDialog( sOldName, pOldRegistration->sLocation, pEntry );
+ m_pCurEntry = NULL;
+
+ return 1L;
}
// -----------------------------------------------------------------------
@@ -390,28 +391,42 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
// -----------------------------------------------------------------------
IMPL_LINK( DbRegistrationOptionsPage, PathSelect_Impl, SvTabListBox *, EMPTYARG )
-
-/* [Beschreibung]
-
-*/
-
{
SvLBoxEntry* pEntry = pPathBox->FirstSelected();
- m_aEdit.Enable( pEntry != NULL);
- m_aDelete.Enable( pEntry != NULL);
+ bool bReadOnly = true;
+ if ( pEntry )
+ {
+ DatabaseRegistration* pRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() );
+ bReadOnly = pRegistration->bReadOnly;
+ }
+
+ m_aEdit.Enable( !bReadOnly );
+ m_aDelete.Enable( !bReadOnly );
return 0;
}
// -----------------------------------------------------------------------------
-void DbRegistrationOptionsPage::insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation)
+void DbRegistrationOptionsPage::insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool _bReadOnly )
{
String aStr( _sName );
aStr += '\t';
aStr += String(_sLocation);
- SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr );
- String* pLocation = new String( _sLocation );
- pEntry->SetUserData( pLocation );
+
+ SvLBoxEntry* pEntry = NULL;
+ if ( _bReadOnly )
+ {
+ sal_Bool bHighContrast = pPathBox->GetDisplayBackground().GetColor().IsDark();
+ Image aLocked( CUI_RES( bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK ) );
+ pEntry = pPathBox->InsertEntry( aStr, aLocked, aLocked );
+ }
+ else
+ {
+ pEntry = pPathBox->InsertEntry( aStr );
+ }
+
+ pEntry->SetUserData( new DatabaseRegistration( _sLocation, _bReadOnly ) );
}
+
// -----------------------------------------------------------------------------
String DbRegistrationOptionsPage::getFileLocation(const String& _sLocation)
{
@@ -482,10 +497,10 @@ void DbRegistrationOptionsPage::openLinkDialog(const String& _sOldName,const Str
{
if ( _pEntry )
{
- delete static_cast<String*>(_pEntry->GetUserData());
- pPathBox->GetModel()->Remove(_pEntry);
+ delete static_cast< DatabaseRegistration* >( _pEntry->GetUserData() );
+ pPathBox->GetModel()->Remove( _pEntry );
}
- insertNewEntry(sNewName,sNewLocation);
+ insertNewEntry( sNewName, sNewLocation, false );
m_bModified = sal_True;
}
}
diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
index 6fd7e34b2729..4ab867eaa44e 100644
--- a/cui/source/options/dbregisterednamesconfig.cxx
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -30,18 +30,19 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"
+#include "connpooloptions.hxx"
#include "dbregisterednamesconfig.hxx"
+#include "dbregistersettings.hxx"
+#include "svx/svxids.hrc"
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svl/eitem.hxx>
#include <svl/itemset.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/confignode.hxx>
-#include <comphelper/extract.hxx>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <svl/eitem.hxx>
-#include <comphelper/processfactory.hxx>
-#include <unotools/pathoptions.hxx>
-#include "dbregistersettings.hxx"
-#include "connpooloptions.hxx"
//........................................................................
namespace svx
@@ -50,136 +51,92 @@ namespace svx
using namespace ::utl;
using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::container;
- //--------------------------------------------------------------------
- static const ::rtl::OUString& getDbRegisteredNamesNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames");
- return s_sNodeName;
- }
-
- //--------------------------------------------------------------------
- static const ::rtl::OUString& getDbNameNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Name");
- return s_sNodeName;
- }
-
- //--------------------------------------------------------------------
- static const ::rtl::OUString& getDbLocationNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location");
- return s_sNodeName;
- }
-
//====================================================================
//= DbRegisteredNamesConfig
//====================================================================
//--------------------------------------------------------------------
- void DbRegisteredNamesConfig::GetOptions(SfxItemSet& _rFillItems)
+ void DbRegisteredNamesConfig::GetOptions( SfxItemSet& _rFillItems )
{
- // the config node where all pooling relevant info are stored under
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
-
- TNameLocationMap aSettings;
+ DatabaseRegistrations aSettings;
- // then look for which of them settings are stored in the configuration
- Sequence< ::rtl::OUString > aDriverKeys = aDbRegisteredNamesRoot.getNodeNames();
- const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
- const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
- for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ try
{
- // the name of the driver in this round
- OConfigurationNode aThisDriverSettings = aDbRegisteredNamesRoot.openNode(*pDriverKeys);
- ::rtl::OUString sName, sLocation;
- aThisDriverSettings.getNodeValue(getDbNameNodeName()) >>= sName;
- aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sLocation;
- sLocation = SvtPathOptions().SubstituteVariable(sLocation);
-
- aSettings.insert(TNameLocationMap::value_type(sName,sLocation));
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XDatabaseRegistrations > xRegistrations(
+ aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
+
+ Sequence< ::rtl::OUString > aRegistrationNames( xRegistrations->getRegistrationNames() );
+ const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray();
+ const ::rtl::OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
+ for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
+ {
+ ::rtl::OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) );
+ aSettings[ *pRegistrationName ] =
+ DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
- _rFillItems.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aSettings));
+ _rFillItems.Put( DatabaseMapItem( SID_SB_DB_REGISTER, aSettings ) );
}
//--------------------------------------------------------------------
void DbRegisteredNamesConfig::SetOptions(const SfxItemSet& _rSourceItems)
{
- // the config node where all pooling relevant info are stored under
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
-
- if (!aDbRegisteredNamesRoot.isValid())
- // already asserted by the OConfigurationTreeRoot
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSourceItems, pRegistrations, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+ if ( !pRegistrations )
return;
- sal_Bool bNeedCommit = sal_False;
-
-
- // the settings for the single drivers
- SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
- if (pDriverSettings)
+ try
{
- Reference< XNameAccess > xDatabaseContext = Reference< XNameAccess >(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseContext"))), UNO_QUERY);
- Reference< XNamingService> xNamingService(xDatabaseContext,UNO_QUERY);
- ::rtl::OUString sName, sLocation;
- OConfigurationNode aThisDriverSettings;
-
- const TNameLocationMap& rNewSettings = pDriverSettings->getSettings();
- TNameLocationMap::const_iterator aEnd = rNewSettings.end();
- for ( TNameLocationMap::const_iterator aLoop = rNewSettings.begin();
- aLoop != aEnd;
- ++aLoop
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XDatabaseRegistrations > xRegistrations(
+ aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
+
+ const DatabaseRegistrations& rNewRegistrations = pRegistrations->getRegistrations();
+ for ( DatabaseRegistrations::const_iterator reg = rNewRegistrations.begin();
+ reg != rNewRegistrations.end();
+ ++reg
)
{
- // need the name as ::rtl::OUString
- sName = aLoop->first;
+ const ::rtl::OUString sName = reg->first;
+ const ::rtl::OUString sLocation = reg->second.sLocation;
- // the sub-node for this driver
- if (aDbRegisteredNamesRoot.hasByName(sName))
+ if ( xRegistrations->hasRegisteredDatabase( sName ) )
{
- aThisDriverSettings = aDbRegisteredNamesRoot.openNode(sName);
- // set the values
- aThisDriverSettings.setNodeValue(getDbNameNodeName(), makeAny(sName));
- aThisDriverSettings.setNodeValue(getDbLocationNodeName(), makeAny(aLoop->second));
- bNeedCommit = sal_True;
- }
- else
- {
- try
- {
- xNamingService->registerObject(sName,Reference< ::com::sun::star::uno::XInterface >(xDatabaseContext->getByName(aLoop->second),UNO_QUERY));
- }
- catch( const Exception& )
+ if ( !xRegistrations->isDatabaseRegistrationReadOnly( sName ) )
+ xRegistrations->changeDatabaseLocation( sName, sLocation );
+ else
{
- DBG_UNHANDLED_EXCEPTION();
+ OSL_ENSURE( xRegistrations->getDatabaseLocation( sName ) == sLocation,
+ "DbRegisteredNamesConfig::SetOptions: somebody changed a read-only registration. How unrespectful." );
}
}
+ else
+ xRegistrations->registerDatabaseLocation( sName, sLocation );
}
- if (bNeedCommit)
- aDbRegisteredNamesRoot.commit();
- // delete unused entry
- Sequence< ::rtl::OUString > aDriverKeys = xDatabaseContext->getElementNames();
- const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
- const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
- for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ // delete unused entries
+ Sequence< ::rtl::OUString > aRegistrationNames = xRegistrations->getRegistrationNames();
+ const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray();
+ const ::rtl::OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
+ for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
{
- if ( rNewSettings.find(*pDriverKeys) == rNewSettings.end() )
- {
- try
- {
- xNamingService->revokeObject(*pDriverKeys);
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
+ if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() )
+ xRegistrations->revokeDatabaseLocation( *pRegistrationName );
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
//........................................................................
diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx
index c3d3b7e8c244..cdcb899c2567 100644
--- a/cui/source/options/dbregistersettings.cxx
+++ b/cui/source/options/dbregistersettings.cxx
@@ -33,6 +33,8 @@
#include "dbregistersettings.hxx"
+#include <rtl/ustring.hxx>
+
//........................................................................
namespace svx
{
@@ -43,9 +45,9 @@ namespace svx
//====================================================================
TYPEINIT1( DatabaseMapItem, SfxPoolItem )
//--------------------------------------------------------------------
- DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings )
- :SfxPoolItem(_nId)
- ,m_aSettings(_rSettings)
+ DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations )
+ :SfxPoolItem( _nId )
+ ,m_aRegistrations( _rRegistrations )
{
}
@@ -53,19 +55,19 @@ namespace svx
int DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const
{
const DatabaseMapItem* pItem = PTR_CAST(DatabaseMapItem, &_rCompare);
- if (!pItem)
+ if ( !pItem )
return sal_False;
- if (m_aSettings.size() != pItem->m_aSettings.size())
+ if ( m_aRegistrations.size() != pItem->m_aRegistrations.size() )
return sal_False;
- return m_aSettings != pItem->m_aSettings;
+ return m_aRegistrations == pItem->m_aRegistrations;
}
//--------------------------------------------------------------------
- SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool * ) const
+ SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool* ) const
{
- return new DatabaseMapItem(Which(), m_aSettings);
+ return new DatabaseMapItem( Which(), m_aRegistrations );
}
//--------------------------------------------------------------------
diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx
index 672d4bf63bcd..b78031f06786 100644
--- a/cui/source/options/dbregistersettings.hxx
+++ b/cui/source/options/dbregistersettings.hxx
@@ -39,24 +39,56 @@ namespace svx
{
//........................................................................
+ struct DatabaseRegistration
+ {
+ ::rtl::OUString sLocation;
+ bool bReadOnly;
+
+ DatabaseRegistration()
+ :sLocation()
+ ,bReadOnly( true )
+ {
+ }
+
+ DatabaseRegistration( const ::rtl::OUString& _rLocation, const sal_Bool _bReadOnly )
+ :sLocation( _rLocation )
+ ,bReadOnly( _bReadOnly )
+ {
+ }
+
+ bool operator==( const DatabaseRegistration& _rhs ) const
+ {
+ return ( sLocation == _rhs.sLocation );
+ // do not take the read-only-ness into account, this is not maintained everywhere, but only
+ // properly set when filling the struct from the XDatabaseRegistrations data
+ }
+
+ bool operator!=( const DatabaseRegistration& _rhs ) const
+ {
+ return !( this->operator==( _rhs ) );
+ }
+ };
+
+ typedef ::std::map< ::rtl::OUString, DatabaseRegistration, ::comphelper::UStringLess > DatabaseRegistrations;
+
//====================================================================
//= DatabaseMapItem
//====================================================================
- DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,TNameLocationMap);
class DatabaseMapItem : public SfxPoolItem
{
protected:
- TNameLocationMap m_aSettings;
+ DatabaseRegistrations m_aRegistrations;
public:
TYPEINFO();
- DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings );
+ DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations );
virtual int operator==( const SfxPoolItem& ) const;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- const TNameLocationMap& getSettings() const { return m_aSettings; }
+ const DatabaseRegistrations&
+ getRegistrations() const { return m_aRegistrations; }
};
//........................................................................
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 8016124f894d..ec30ff3d3d1d 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -441,8 +441,8 @@
#define HID_EXTENSION_NOT_PRESENT_DLG ( HID_DBACCESS_START + 381)
#define HID_DLG_QRY_JOIN_CONTROL ( HID_DBACCESS_START + 382)
#define HID_DSADMIN_IGNORECURRENCY ( HID_DBACCESS_START + 383)
-
#define HID_MACRO_MIGRATION_BACKUP_LOCATION ( HID_DBACCESS_START + 384)
+#define HID_DSADMIN_PRIMARY_KEY_SUPPORT ( HID_DBACCESS_START + 385)
// this one below have hid in number space HID_SBA_START
#define HID_DLG_ADABAS_NEWDB (HID_SBA_START + 0)
diff --git a/dbaccess/qa/complex/dbaccess/ApplicationController.java b/dbaccess/qa/complex/dbaccess/ApplicationController.java
index df4aaa2f5cf9..5b2dd1e0e613 100644
--- a/dbaccess/qa/complex/dbaccess/ApplicationController.java
+++ b/dbaccess/qa/complex/dbaccess/ApplicationController.java
@@ -107,16 +107,16 @@ public class ApplicationController extends TestCase
// load it into a frame
final Object object = getORB().createInstance("com.sun.star.frame.Desktop");
- final XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, object);
+ final XComponentLoader xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, object);
final XComponent loadedComponent = xComponentLoader.loadComponentFromURL(m_database.getDocumentURL(), "_blank", FrameSearchFlag.ALL, new PropertyValue[0]);
assure("too many document instances!",
UnoRuntime.areSame(loadedComponent, m_databaseDocument));
// get the controller, which provides access to various UI operations
- final XModel docModel = (XModel) UnoRuntime.queryInterface(XModel.class,
+ final XModel docModel = UnoRuntime.queryInterface(XModel.class,
loadedComponent);
- m_documentUI = (XDatabaseDocumentUI) UnoRuntime.queryInterface(XDatabaseDocumentUI.class,
+ m_documentUI = UnoRuntime.queryInterface(XDatabaseDocumentUI.class,
docModel.getCurrentController());
}
@@ -144,11 +144,8 @@ public class ApplicationController extends TestCase
final String newDocumentURL = createTempFileURL();
// store the doc in a new location
- final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
- m_databaseDocument);
- storeDoc.storeAsURL(newDocumentURL, new PropertyValue[]
- {
- });
+ final XStorable storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
+ storeDoc.storeAsURL( newDocumentURL, new PropertyValue[] { } );
// connect
m_documentUI.connect();
@@ -166,8 +163,7 @@ public class ApplicationController extends TestCase
impl_switchToDocument(oldDocumentURL);
m_documentUI.connect();
assure("could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected());
- XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class,
- m_documentUI.getActiveConnection());
+ XTablesSupplier suppTables = UnoRuntime.queryInterface( XTablesSupplier.class, m_documentUI.getActiveConnection() );
XNameAccess tables = suppTables.getTables();
assure("the table was created in the wrong database", !tables.hasByName("abc"));
@@ -176,8 +172,7 @@ public class ApplicationController extends TestCase
m_documentUI.connect();
assure("could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected());
- suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class,
- m_documentUI.getActiveConnection());
+ suppTables = UnoRuntime.queryInterface( XTablesSupplier.class, m_documentUI.getActiveConnection() );
tables = suppTables.getTables();
assure("the newly created table has not been written", tables.hasByName("abc"));
}
diff --git a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java
index eccb48647bae..b7c1ea987968 100644
--- a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java
+++ b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java
@@ -32,6 +32,7 @@ package complex.dbaccess;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdb.XSingleSelectQueryComposer;
import com.sun.star.uno.UnoRuntime;
+import connectivity.tools.CRMDatabase;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -44,7 +45,7 @@ public abstract class CRMBasedTestCase extends TestCase
{
try
{
- m_database = new CRMDatabase( getORB() );
+ m_database = new CRMDatabase( getORB(), false );
}
catch ( Exception e )
{
@@ -67,7 +68,7 @@ public abstract class CRMBasedTestCase extends TestCase
try
{
if ( m_database != null )
- m_database.close();
+ m_database.saveAndClose();
}
catch ( Exception ex )
{
@@ -80,9 +81,6 @@ public abstract class CRMBasedTestCase extends TestCase
*/
protected final XSingleSelectQueryComposer createQueryComposer() throws com.sun.star.uno.Exception
{
- final XMultiServiceFactory connectionFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
- XMultiServiceFactory.class, m_database.getConnection() );
- return (XSingleSelectQueryComposer)UnoRuntime.queryInterface(
- XSingleSelectQueryComposer.class, connectionFactory.createInstance( "com.sun.star.sdb.SingleSelectQueryComposer" ) );
+ return m_database.getConnection().createSingleSelectQueryComposer();
}
}
diff --git a/dbaccess/qa/complex/dbaccess/DataSource.java b/dbaccess/qa/complex/dbaccess/DataSource.java
index 29c9d2f2cdd7..6cb0b7ee4b17 100644
--- a/dbaccess/qa/complex/dbaccess/DataSource.java
+++ b/dbaccess/qa/complex/dbaccess/DataSource.java
@@ -34,6 +34,7 @@ import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XNamingService;
import complexlib.ComplexTestCase;
+import connectivity.tools.CRMDatabase;
import connectivity.tools.HsqlDatabase;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -66,7 +67,7 @@ public class DataSource extends ComplexTestCase
{
if (m_database == null)
{
- final CRMDatabase database = new CRMDatabase(getFactory());
+ final CRMDatabase database = new CRMDatabase( getFactory(), false );
m_database = database.getDatabase();
m_dataSource = m_database.getDataSource();
}
diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java
index 684df2b65a25..f39c37a8fbdb 100644
--- a/dbaccess/qa/complex/dbaccess/Query.java
+++ b/dbaccess/qa/complex/dbaccess/Query.java
@@ -37,6 +37,7 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdb.XQueriesSupplier;
import com.sun.star.sdbcx.XColumnsSupplier;
import com.sun.star.uno.UnoRuntime;
+import connectivity.tools.CRMDatabase;
public class Query extends complexlib.ComplexTestCase {
@@ -62,7 +63,7 @@ public class Query extends complexlib.ComplexTestCase {
{
if ( m_database == null )
{
- final CRMDatabase database = new CRMDatabase( getFactory() );
+ final CRMDatabase database = new CRMDatabase( getFactory(), false );
m_database = database.getDatabase();
}
}
@@ -87,8 +88,8 @@ public class Query extends complexlib.ComplexTestCase {
try
{
- final XQueriesSupplier suppQueries = (XQueriesSupplier)UnoRuntime.queryInterface(
- XQueriesSupplier.class, m_database.defaultConnection());
+ final XQueriesSupplier suppQueries = UnoRuntime.queryInterface(
+ XQueriesSupplier.class, m_database.defaultConnection().getXConnection() );
final XNameAccess queries = suppQueries.getQueries();
final String[] queryNames = new String[] { "parseable", "parseable native", "unparseable" };
@@ -100,12 +101,12 @@ public class Query extends complexlib.ComplexTestCase {
for ( int i = 0; i < queryNames.length; ++i )
{
- final XPropertySet query = (XPropertySet)UnoRuntime.queryInterface(
+ final XPropertySet query = UnoRuntime.queryInterface(
XPropertySet.class, queries.getByName( queryNames[i] ) );
- final XColumnsSupplier suppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+ final XColumnsSupplier suppCols = UnoRuntime.queryInterface(
XColumnsSupplier.class, query);
- final XIndexAccess columns = (XIndexAccess)UnoRuntime.queryInterface(
+ final XIndexAccess columns = UnoRuntime.queryInterface(
XIndexAccess.class, suppCols.getColumns());
// check whether the columns supplied by the query match what we expected
@@ -113,7 +114,7 @@ public class Query extends complexlib.ComplexTestCase {
columns.getCount() == expectedColumnNames[i].length );
for ( int col = 0; col < columns.getCount(); ++col )
{
- final XNamed columnName = (XNamed)UnoRuntime.queryInterface(
+ final XNamed columnName = UnoRuntime.queryInterface(
XNamed.class, columns.getByIndex(col) );
assure( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
columnName.getName().equals( expectedColumnNames[i][col] ) );
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index d9145d7aaee8..6a2b4e49c25a 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -41,7 +41,6 @@ import com.sun.star.sdb.XParametersSupplier;
import com.sun.star.sdb.XResultSetAccess;
import com.sun.star.sdb.XRowSetApproveBroadcaster;
import com.sun.star.sdbc.SQLException;
-import com.sun.star.sdbc.XConnection;
import com.sun.star.sdbc.XParameters;
import com.sun.star.sdbc.XPreparedStatement;
import com.sun.star.sdbc.XResultSet;
@@ -52,12 +51,12 @@ import com.sun.star.sdbc.XRowUpdate;
import com.sun.star.sdbcx.XColumnsSupplier;
import com.sun.star.sdbcx.XDeleteRows;
import com.sun.star.sdbcx.XRowLocate;
-import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XRefreshable;
import complexlib.ComplexTestCase;
+import connectivity.tools.CRMDatabase;
import connectivity.tools.DataSource;
import connectivity.tools.HsqlDatabase;
+import connectivity.tools.sdb.Connection;
import java.lang.reflect.Method;
import java.util.Random;
@@ -89,7 +88,7 @@ public class RowSet extends ComplexTestCase
public ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception
{
m_resultSet = _resultSet;
- m_row = (XRow) UnoRuntime.queryInterface(XRow.class, m_resultSet);
+ m_row = UnoRuntime.queryInterface( XRow.class, m_resultSet );
m_id = _id;
}
@@ -144,7 +143,7 @@ public class RowSet extends ComplexTestCase
{
try
{
- final CRMDatabase database = new CRMDatabase(getFactory());
+ final CRMDatabase database = new CRMDatabase( getFactory(), false );
m_database = database.getDatabase();
m_dataSource = m_database.getDataSource();
}
@@ -204,23 +203,22 @@ public class RowSet extends ComplexTestCase
{
try
{
- m_rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
- getFactory().createInstance("com.sun.star.sdb.RowSet"));
- final XPropertySet rowSetProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_rowSet);
+ m_rowSet = UnoRuntime.queryInterface( XRowSet.class, getFactory().createInstance( "com.sun.star.sdb.RowSet" ) );
+ final XPropertySet rowSetProperties = UnoRuntime.queryInterface( XPropertySet.class, m_rowSet );
rowSetProperties.setPropertyValue("Command", command);
rowSetProperties.setPropertyValue("CommandType", Integer.valueOf(commandType));
- rowSetProperties.setPropertyValue("ActiveConnection", m_database.defaultConnection());
+ rowSetProperties.setPropertyValue("ActiveConnection", m_database.defaultConnection().getXConnection());
if (limitFetchSize)
{
rowSetProperties.setPropertyValue("FetchSize", Integer.valueOf(MAX_FETCH_ROWS));
}
- m_resultSet = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, m_rowSet);
- m_resultSetUpdate = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_rowSet);
- m_row = (XRow) UnoRuntime.queryInterface(XRow.class, m_rowSet);
- m_rowLocate = (XRowLocate) UnoRuntime.queryInterface(XRowLocate.class, m_resultSet);
- m_rowSetProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_rowSet);
- m_paramsSupplier = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, m_rowSet);
+ m_resultSet = UnoRuntime.queryInterface( XResultSet.class, m_rowSet );
+ m_resultSetUpdate = UnoRuntime.queryInterface( XResultSetUpdate.class, m_rowSet );
+ m_row = UnoRuntime.queryInterface( XRow.class, m_rowSet );
+ m_rowLocate = UnoRuntime.queryInterface( XRowLocate.class, m_resultSet );
+ m_rowSetProperties = UnoRuntime.queryInterface( XPropertySet.class, m_rowSet );
+ m_paramsSupplier = UnoRuntime.queryInterface( XParametersSupplier.class, m_rowSet );
if (execute)
{
@@ -259,7 +257,7 @@ public class RowSet extends ComplexTestCase
// --------------------------------------------------------------------------------------------------------
XResultSet createClone() throws SQLException
{
- final XResultSetAccess rowAcc = (XResultSetAccess) UnoRuntime.queryInterface(XResultSetAccess.class, m_rowSet);
+ final XResultSetAccess rowAcc = UnoRuntime.queryInterface( XResultSetAccess.class, m_rowSet );
return rowAcc.createResultSet();
}
@@ -269,9 +267,9 @@ public class RowSet extends ComplexTestCase
m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS");
m_database.executeSQL("CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )");
- final XConnection connection = m_database.defaultConnection();
+ final Connection connection = m_database.defaultConnection();
final XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
- final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, prep);
+ final XParameters para = UnoRuntime.queryInterface( XParameters.class, prep );
for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
{
para.setInt(1, i);
@@ -279,9 +277,7 @@ public class RowSet extends ComplexTestCase
prep.executeUpdate();
}
- final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
- final XRefreshable refresh = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, suppTables.getTables());
- refresh.refresh();
+ connection.refreshTables();
}
// --------------------------------------------------------------------------------------------------------
@@ -335,8 +331,8 @@ public class RowSet extends ComplexTestCase
{
try
{
- final XRow _row = (XRow) UnoRuntime.queryInterface(XRow.class, _resultSet);
- final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ final XRow _row = UnoRuntime.queryInterface( XRow.class, _resultSet );
+ final XRow cloneRow = UnoRuntime.queryInterface( XRow.class, clone );
for (int i = 1; i <= MAX_FETCH_ROWS; ++i)
{
final int calcPos = (MAX_TABLE_ROWS % i) + 1;
@@ -359,14 +355,14 @@ public class RowSet extends ComplexTestCase
{
try
{
- final XRow _row = (XRow) UnoRuntime.queryInterface(XRow.class, _resultSet);
+ final XRow _row = UnoRuntime.queryInterface( XRow.class, _resultSet );
_resultSet.beforeFirst();
for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
{
_resultSet.next();
final XResultSet clone = createClone();
- final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ final XRow cloneRow = UnoRuntime.queryInterface( XRow.class, clone );
final int calcPos = MAX_TABLE_ROWS - 1;
if (calcPos != 0 && clone.absolute(calcPos))
{
@@ -420,15 +416,15 @@ public class RowSet extends ComplexTestCase
// first we create our RowSet object
final RowSetEventListener pRow = new RowSetEventListener();
- final XColumnsSupplier colSup = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, m_rowSet);
- final XPropertySet col = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, colSup.getColumns().getByName("ID"));
+ final XColumnsSupplier colSup = UnoRuntime.queryInterface( XColumnsSupplier.class, m_rowSet );
+ final XPropertySet col = UnoRuntime.queryInterface( XPropertySet.class, colSup.getColumns().getByName( "ID" ) );
col.addPropertyChangeListener("Value", pRow);
m_rowSetProperties.addPropertyChangeListener("IsModified", pRow);
m_rowSetProperties.addPropertyChangeListener("IsNew", pRow);
m_rowSetProperties.addPropertyChangeListener("IsRowCountFinal", pRow);
m_rowSetProperties.addPropertyChangeListener("RowCount", pRow);
- final XRowSetApproveBroadcaster xApBroad = (XRowSetApproveBroadcaster) UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class, m_resultSet);
+ final XRowSetApproveBroadcaster xApBroad = UnoRuntime.queryInterface( XRowSetApproveBroadcaster.class, m_resultSet );
xApBroad.addRowSetApproveListener(pRow);
m_rowSet.addRowSetListener(pRow);
@@ -458,13 +454,13 @@ public class RowSet extends ComplexTestCase
testCursorMove(m_resultSet, cResSet.getMethod("previous", (Class[]) null), pRow, moves, null);
testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = true;
- final XRowUpdate updRow = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
+ final XRowUpdate updRow = UnoRuntime.queryInterface( XRowUpdate.class, m_resultSet );
updRow.updateString(2, TEST21);
testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = false;
final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
- final XResultSetUpdate upd = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_resultSet);
+ final XResultSetUpdate upd = UnoRuntime.queryInterface( XResultSetUpdate.class, m_resultSet );
testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);
updRow.updateInt(1, MAX_TABLE_ROWS + 2);
@@ -536,7 +532,7 @@ public class RowSet extends ComplexTestCase
moves[RowSetEventListener.ROW_COUNT] = true;
final Class cdelRows = Class.forName("com.sun.star.sdbcx.XDeleteRows");
ctemp[0] = Object[].class;
- final XDeleteRows delRows = (XDeleteRows) UnoRuntime.queryInterface(XDeleteRows.class, m_resultSet);
+ final XDeleteRows delRows = UnoRuntime.queryInterface( XDeleteRows.class, m_resultSet );
final Object bookmarks[] = new Object[5];
m_resultSet.first();
for (int i = 0; i < bookmarks.length; ++i)
@@ -549,7 +545,7 @@ public class RowSet extends ComplexTestCase
testCursorMove(delRows, cdelRows.getMethod("deleteRows", ctemp), pRow, moves, temp);
// now destroy the RowSet
- final XComponent xComp = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_resultSet);
+ final XComponent xComp = UnoRuntime.queryInterface( XComponent.class, m_resultSet );
xComp.dispose();
}
@@ -715,7 +711,7 @@ public class RowSet extends ComplexTestCase
positionRandom();
final Object deleteBookmark = m_rowLocate.getBookmark();
m_resultSetUpdate.deleteRow();
- final XDeleteRows multiDelete = (XDeleteRows) UnoRuntime.queryInterface(XDeleteRows.class, m_resultSet);
+ final XDeleteRows multiDelete = UnoRuntime.queryInterface( XDeleteRows.class, m_resultSet );
final int[] deleteSuccess = multiDelete.deleteRows(new Object[]
{
firstBookmark, deleteBookmark
@@ -745,7 +741,7 @@ public class RowSet extends ComplexTestCase
// .....................................................................................................
// updating values in a deleted row should fail
deleteRandom();
- final XRowUpdate rowUpdated = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
+ final XRowUpdate rowUpdated = UnoRuntime.queryInterface( XRowUpdate.class, m_resultSet );
caughtException = false;
try
{
@@ -762,6 +758,7 @@ public class RowSet extends ComplexTestCase
/** checks whether deletions on the main RowSet properly interfere (or don't interfere) with the movement
* on a clone of the RowSet
*/
+ @SuppressWarnings("empty-statement")
public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException
{
createTestCase(true);
@@ -769,7 +766,7 @@ public class RowSet extends ComplexTestCase
m_resultSet.last();
final XResultSet clone = createClone();
- final XRowLocate cloneRowLocate = (XRowLocate) UnoRuntime.queryInterface(XRowLocate.class, clone);
+ final XRowLocate cloneRowLocate = UnoRuntime.queryInterface( XRowLocate.class, clone );
positionRandom();
@@ -837,7 +834,7 @@ public class RowSet extends ComplexTestCase
m_rowSetProperties.setPropertyValue("FetchSize", Integer.valueOf(10));
final XResultSet clone = createClone();
- final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ final XRow cloneRow = UnoRuntime.queryInterface( XRow.class, clone );
// .....................................................................................................
// first check the basic scenario without the |moveToInsertRow| |moveToCurrentRow|, to ensure that
@@ -893,8 +890,7 @@ public class RowSet extends ComplexTestCase
{
createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, true);
m_rowSetProperties.setPropertyValue("Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
- final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
- m_rowSet);
+ final XParameters rowsetParams = UnoRuntime.queryInterface( XParameters.class, m_rowSet );
rowsetParams.setString(1, "London");
m_rowSet.execute();
}
@@ -921,8 +917,7 @@ public class RowSet extends ComplexTestCase
for (int i = 0; i < expected; ++i)
{
- final XPropertySet parameter = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
- params.getByIndex(i));
+ final XPropertySet parameter = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( i ) );
final String expectedName = _paramNames[i];
final String foundName = (String) parameter.getPropertyValue("Name");
@@ -959,12 +954,11 @@ public class RowSet extends ComplexTestCase
createRowSet("products like", CommandType.QUERY, false);
// let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container
- final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
- m_rowSet);
+ final XParameters rowsetParams = UnoRuntime.queryInterface(XParameters.class, m_rowSet);
rowsetParams.setString(1, "Apples");
XIndexAccess params = m_paramsSupplier.getParameters();
- XPropertySet firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
+ XPropertySet firstParam = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( 0 ) );
Object firstParamValue = firstParam.getPropertyValue("Value");
assure("XParameters and the parameters container do not properly interact",
@@ -978,7 +972,7 @@ public class RowSet extends ComplexTestCase
// the execution of the row set. It currently doesn't (though the values it represents do).
// It would be nice, but not strictly necessary, if it would.
params = m_paramsSupplier.getParameters();
- firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
+ firstParam = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( 0 ) );
}
firstParamValue = firstParam.getPropertyValue("Value");
assure("XParameters and the parameters container do not properly interact, after the row set has been executed",
diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java
index 40370d9aeebd..e331ccc33e7c 100644
--- a/dbaccess/qa/complex/dbaccess/TestCase.java
+++ b/dbaccess/qa/complex/dbaccess/TestCase.java
@@ -29,8 +29,12 @@
************************************************************************/
package complex.dbaccess;
+import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XModel;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import helper.FileTools;
@@ -38,8 +42,6 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.net.URI;
-import java.net.URISyntaxException;
public abstract class TestCase extends complexlib.ComplexTestCase
{
@@ -55,8 +57,8 @@ public abstract class TestCase extends complexlib.ComplexTestCase
XComponentContext context = null;
try
{
- final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, getORB() );
- context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class,
+ final XPropertySet orbProps = UnoRuntime.queryInterface( XPropertySet.class, getORB() );
+ context = UnoRuntime.queryInterface( XComponentContext.class,
orbProps.getPropertyValue( "DefaultContext" ) );
}
catch ( Exception ex )
@@ -109,6 +111,15 @@ public abstract class TestCase extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
+ protected final XModel loadDocument( final String _docURL ) throws Exception
+ {
+ final XComponentLoader loader = UnoRuntime.queryInterface( XComponentLoader.class,
+ getORB().createInstance( "com.sun.star.frame.Desktop" ) );
+ return UnoRuntime.queryInterface( XModel.class,
+ loader.loadComponentFromURL( _docURL, "_blank", 0, new PropertyValue[] {} ) );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs,
Class _expectedExceptionClass )
{
diff --git a/dbaccess/qa/complex/dbaccess/UISettings.java b/dbaccess/qa/complex/dbaccess/UISettings.java
index 23fe10618810..92be58f28dd6 100644
--- a/dbaccess/qa/complex/dbaccess/UISettings.java
+++ b/dbaccess/qa/complex/dbaccess/UISettings.java
@@ -30,15 +30,17 @@
package complex.dbaccess;
import com.sun.star.awt.FontSlant;
-import com.sun.star.beans.PropertyValue;
+import com.sun.star.awt.TextAlign;
import com.sun.star.beans.XPropertySet;
-import com.sun.star.form.XFormController;
-import com.sun.star.frame.XComponentLoader;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.form.runtime.XFormController;
+import com.sun.star.frame.XController;
import com.sun.star.frame.XModel;
-import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.application.DatabaseObject;
import com.sun.star.sdb.application.XDatabaseDocumentUI;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XCloseable;
+import connectivity.tools.CRMDatabase;
public class UISettings extends TestCase
{
@@ -46,7 +48,8 @@ public class UISettings extends TestCase
public String[] getTestMethodNames()
{
return new String[] {
- "checkTableFormattingPersistence"
+ "checkTableFormattingPersistence",
+ "checkTransparentQueryColumnSettings"
};
}
@@ -61,25 +64,13 @@ public class UISettings extends TestCase
*/
public void checkTableFormattingPersistence() throws java.lang.Exception
{
- final CRMDatabase database = new CRMDatabase( getORB() );
-
- // load the document
- String docURL = database.getDatabase().getDocumentURL();
- final XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class,
- getORB().createInstance( "com.sun.star.frame.Desktop" ) );
- XModel doc = (XModel)UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( docURL, "_blank", 0, new PropertyValue[] {} ) );
-
- // establish the connection
- XDatabaseDocumentUI docUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface( XDatabaseDocumentUI.class,
- doc.getCurrentController() );
- docUI.connect();
-
- // display the table
- XComponent tableViewComp = docUI.loadComponent( com.sun.star.sdb.application.DatabaseObject.TABLE, "customers", false );
- XFormController tableViewController = (XFormController)UnoRuntime.queryInterface( XFormController.class,
- tableViewComp );
- XPropertySet tableControlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
+ // create, load, and connect a DB doc
+ CRMDatabase database = new CRMDatabase( getORB(), true );
+
+ // display a table
+ XFormController tableViewController = UnoRuntime.queryInterface( XFormController.class,
+ database.loadSubComponent( DatabaseObject.TABLE, "customers" ) );
+ XPropertySet tableControlModel = UnoRuntime.queryInterface( XPropertySet.class,
tableViewController.getCurrentControl().getModel() );
// change the table's formatting
@@ -87,12 +78,10 @@ public class UISettings extends TestCase
tableControlModel.setPropertyValue( "FontHeight", Float.valueOf( 20 ) );
tableControlModel.setPropertyValue( "FontSlant", FontSlant.ITALIC );
- // close the table
- docUI.closeSubComponents();
+ String docURL = database.getDatabase().getModel().getURL();
- // save and close the database document
- database.getDatabase().store();
- database.close();
+ // save close the database document
+ database.saveAndClose();
// load a copy of the document
// normally, it should be sufficient to load the same doc. However, there might be objects in the Java VM
@@ -102,18 +91,13 @@ public class UISettings extends TestCase
// not cleaned up, the "database model impl" - the structure holding all document data - will
// stay alive, and subsequent requests to load the doc will just reuse it, without really loading it.
docURL = copyToTempFile( docURL );
- doc = (XModel)UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( docURL, "_blank", 0, new PropertyValue[] {} ) );
-
- docUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface( XDatabaseDocumentUI.class,
- doc.getCurrentController() );
- docUI.connect();
+ loadDocument( docURL );
+ database = new CRMDatabase( getORB(), docURL );
// display the table, again
- tableViewComp = docUI.loadComponent( com.sun.star.sdb.application.DatabaseObject.TABLE, "customers", false );
- tableViewController = (XFormController)UnoRuntime.queryInterface( XFormController.class,
- tableViewComp );
- tableControlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
+ tableViewController = UnoRuntime.queryInterface( XFormController.class,
+ database.loadSubComponent( DatabaseObject.TABLE, "customers" ) );
+ tableControlModel = UnoRuntime.queryInterface( XPropertySet.class,
tableViewController.getCurrentControl().getModel() );
// verify the properties
@@ -122,9 +106,50 @@ public class UISettings extends TestCase
assureEquals( "wrong font slant", FontSlant.ITALIC, (FontSlant)tableControlModel.getPropertyValue( "FontSlant" ) );
// close the doc
- docUI.closeSubComponents();
- final XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- doc );
- closeDoc.close( true );
+ database.saveAndClose();
+ }
+
+ /**
+ * checks whether query columns use the settings of the underlying table column, if they do not (yet) have own
+ * settings
+ * @throws java.lang.Exception
+ */
+ public void checkTransparentQueryColumnSettings() throws java.lang.Exception
+ {
+ // create, load, and connect a DB doc
+ CRMDatabase database = new CRMDatabase( getORB(), true );
+
+ // display a table
+ XController tableView = database.loadSubComponent( DatabaseObject.TABLE, "customers" );
+ XFormController tableViewController = UnoRuntime.queryInterface( XFormController.class,
+ tableView );
+ XNameAccess tableControlModel = UnoRuntime.queryInterface( XNameAccess.class,
+ tableViewController.getCurrentControl().getModel() );
+
+ // change the formatting of a table column
+ XPropertySet idColumn = UnoRuntime.queryInterface( XPropertySet.class, tableControlModel.getByName( "ID" ) );
+ assure( "precondition not met: column already centered",
+ ((Short)idColumn.getPropertyValue( "Align" )).shortValue() != TextAlign.CENTER );
+ idColumn.setPropertyValue( "Align", TextAlign.CENTER );
+
+ // close the table data view
+ XCloseable closeSubComponent = UnoRuntime.queryInterface( XCloseable.class, tableView.getFrame() );
+ closeSubComponent.close( true );
+
+ // create a query based on that column
+ database.getDatabase().getDataSource().createQuery( "q_customers", "SELECT * FROM \"customers\"" );
+
+ // load this query, and verify the table column settings was propagated to the query column
+ XFormController queryViewController = UnoRuntime.queryInterface( XFormController.class,
+ database.loadSubComponent( DatabaseObject.QUERY, "q_customers" ) );
+ tableControlModel = UnoRuntime.queryInterface( XNameAccess.class,
+ queryViewController.getCurrentControl().getModel() );
+ idColumn = UnoRuntime.queryInterface( XPropertySet.class, tableControlModel.getByName( "ID" ) );
+
+ assure( "table column alignment was not propagated to the query column",
+ ((Short)idColumn.getPropertyValue( "Align" )).shortValue() == TextAlign.CENTER );
+
+ // save close the database document
+ database.saveAndClose();
}
}
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index 63d287df08bd..127ee83aaf2c 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -270,7 +270,10 @@ void OBookmarkSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xParamet
case DataType::LONGVARBINARY:
_xParameter->updateBytes(nPos,_rValue);
break;
-
+ case DataType::BLOB:
+ case DataType::CLOB:
+ _xParameter->updateObject(nPos,_rValue.getAny());
+ break;
}
}
}
diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx
index bc48a56ed3f0..0974963dfd72 100644
--- a/dbaccess/source/core/api/CRowSetColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetColumn.cxx
@@ -31,186 +31,84 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
#include "CRowSetColumn.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
+
#include <com/sun/star/sdb/XColumn.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
+#include <comphelper/types.hxx>
+#include <cppuhelper/typeprovider.hxx>
-using namespace dbaccess;
-// using namespace connectivity;
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::sdb;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-// using namespace ::com::sun::star::util;
-using namespace cppu;
-using namespace osl;
+using namespace ::com::sun::star::beans;
+//..............................................................................
+namespace dbaccess
+{
+//..............................................................................
-// -------------------------------------------------------------------------
-//ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData,
-// const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XRow >& _xRow,
-// sal_Int32 _nPos,
-// ORowSetMatrix::iterator& _rColumnValue,
-// ORowSetMatrix::iterator& _rEnd)
-// : ORowSetDataColumn(_xMetaData,_xRow,NULL,_nPos,_rColumnValue,_rEnd)
-//{
-//
-//}
//------------------------------------------------------------------------------
-Any SAL_CALL ORowSetColumn::queryInterface( const Type & _rType ) throw (RuntimeException)
+ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData, const Reference < XRow >& _xRow, sal_Int32 _nPos,
+ const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rDescription, ORowSetCacheIterator& _rColumnValue )
+ :ORowSetDataColumn( _xMetaData, _xRow, NULL, _nPos, _rxDBMeta, _rDescription, _rColumnValue )
{
- Any aReturn = OResultColumn::queryInterface(_rType);
- if (!aReturn.hasValue())
- aReturn = ::cppu::queryInterface(_rType,static_cast< XColumn* >(this));
- return aReturn;
}
-// -------------------------------------------------------------------------
-// comphelper::OPropertyArrayUsageHelper
+
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(30)
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP1(CATALOGNAME, ::rtl::OUString, READONLY);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- 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, ::rtl::OUString, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(SCHEMANAME, ::rtl::OUString, READONLY);
- DECL_PROP1(SERVICENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TABLENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP2(VALUE, Any, READONLY,BOUND);
- DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
- END_PROPERTY_HELPER();
+ const sal_Int32 nDerivedProperties = 21;
+ Sequence< Property> aDerivedProperties( nDerivedProperties );
+ Property* pDesc = aDerivedProperties.getArray();
+ sal_Int32 nPos = 0;
+
+ DECL_PROP1( CATALOGNAME, ::rtl::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, ::rtl::OUString, READONLY );
+ DECL_PROP1( PRECISION, sal_Int32, READONLY );
+ DECL_PROP1( SCALE, sal_Int32, READONLY );
+ DECL_PROP1( SCHEMANAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( SERVICENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TABLENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TYPE, sal_Int32, READONLY );
+ DECL_PROP1( TYPENAME, ::rtl::OUString, READONLY );
+ DECL_PROP2( VALUE, Any, READONLY, BOUND );
+ OSL_ENSURE( nPos == nDerivedProperties, "ORowSetColumn::createArrayHelper: inconsistency!" );
+
+ Sequence< Property > aRegisteredProperties;
+ describeProperties( aRegisteredProperties );
+
+ return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False );
}
-// cppu::OPropertySetHelper
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& ORowSetColumn::getInfoHelper()
{
return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >* >(this)->getArrayHelper();
}
-// -------------------------------------------------------------------------
-void SAL_CALL ORowSetColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- break;
- case PROPERTY_ID_VALUE:
- if ( !m_aColumnValue.isNull() && (*m_aColumnValue).isValid() )
- rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
- break;
- default:
- ORowSetDataColumn::getFastPropertyValue(rValue,nHandle);
- }
-}
-// -------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
{
- switch(nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- break;
- default:
- ORowSetDataColumn::setFastPropertyValue_NoBroadcast(nHandle,rValue );
- }
+ OSL_ENSURE( nHandle != PROPERTY_ID_VALUE, "ORowSetColumn::setFastPropertyValue_NoBroadcast: hmm? This property is marked as READONLY!" );
+ if ( nHandle != PROPERTY_ID_VALUE )
+ ORowSetDataColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ORowSetColumn::convertFastPropertyValue( Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue ) throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch(nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- rConvertedValue = rValue;
- getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
- bModified = !::comphelper::compare(rConvertedValue, rOldValue);
- break;
- default:
- bModified = ORowSetDataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
-
- }
- return bModified;
-}
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< Type > ORowSetColumn::getTypes() throw (RuntimeException)
-{
- OTypeCollection aTypes(::getCppuType( (const Reference< XColumn > *)0 ),OColumn::getTypes());
- return aTypes.getTypes();
-}
-//--------------------------------------------------------------------------
+//..............................................................................
+} // namespace dbaccess
+//..............................................................................
diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx
index 06b701f42601..45d71d8e513a 100644
--- a/dbaccess/source/core/api/CRowSetColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetColumn.hxx
@@ -46,11 +46,9 @@
namespace dbaccess
{
class ORowSetColumn;
- typedef ::comphelper::OPropertyArrayUsageHelper<ORowSetColumn> ORowSetColumn_PROP;
+ class ORowSetColumn :public ORowSetDataColumn
+ ,public ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >
- // -------------------------------------------------------------------------
- class ORowSetColumn : public ORowSetColumn_PROP,
- public ORowSetDataColumn
{
public:
ORowSetColumn( const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XResultSetMetaData >& _xMetaData,
@@ -58,34 +56,13 @@ namespace dbaccess
sal_Int32 _nPos,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
- ORowSetCacheIterator& _rColumnValue)
- : ORowSetDataColumn(_xMetaData,_xRow,NULL,_nPos,_rxDBMeta,_rDescription,_rColumnValue)
- {
- }
+ ORowSetCacheIterator& _rColumnValue);
- // com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
-
- // com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
-
- // comphelper::OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- // cppu::OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue )throw (::com::sun::star::uno::Exception);
-
- protected:
- using ORowSetDataColumn::getFastPropertyValue;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue )throw (::com::sun::star::uno::Exception );
};
}
-#endif // DBACCESS_CORE_API_CROWSETCOLUMN_HXX
+#endif // DBACCESS_CORE_API_CROWSETCOLUMN_HXX
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index 3205d343f83b..ae78b8af7817 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -75,11 +75,13 @@ ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >&
const Reference< XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
const ORowSetCacheIterator& _rColumnValue)
- : ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
+ :ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
,m_aColumnValue(_rColumnValue)
,m_aDescription(_rDescription)
{
DBG_CTOR(ORowSetDataColumn,NULL);
+ OColumnSettings::registerProperties( *this );
+ registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, PropertyAttribute::READONLY, &m_aDescription, ::getCppuType( &m_aDescription ) );
}
// -------------------------------------------------------------------------
ORowSetDataColumn::~ORowSetDataColumn()
@@ -91,39 +93,38 @@ ORowSetDataColumn::~ORowSetDataColumn()
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* ORowSetDataColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(31)
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP1(CATALOGNAME, ::rtl::OUString, READONLY);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- DECL_PROP1(DESCRIPTION, ::rtl::OUString, READONLY);
- DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- 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, ::rtl::OUString, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(SCHEMANAME, ::rtl::OUString, READONLY);
- DECL_PROP1(SERVICENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TABLENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(VALUE, Any, BOUND);
- DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
- END_PROPERTY_HELPER();
+ const sal_Int32 nDerivedProperties = 21;
+ Sequence< Property> aDerivedProperties( nDerivedProperties );
+ Property* pDesc = aDerivedProperties.getArray();
+ sal_Int32 nPos = 0;
+
+ DECL_PROP1( CATALOGNAME, ::rtl::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, ::rtl::OUString, READONLY );
+ DECL_PROP1( PRECISION, sal_Int32, READONLY );
+ DECL_PROP1( SCALE, sal_Int32, READONLY );
+ DECL_PROP1( SCHEMANAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( SERVICENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TABLENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TYPE, sal_Int32, READONLY );
+ DECL_PROP1( TYPENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( VALUE, Any, BOUND );
+ OSL_ENSURE( nPos == nDerivedProperties, "ORowSetDataColumn::createArrayHelper: inconsistency!" );
+
+ Sequence< Property > aRegisteredProperties;
+ describeProperties( aRegisteredProperties );
+
+ return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False );
}
// cppu::OPropertySetHelper
@@ -135,57 +136,33 @@ ORowSetDataColumn::~ORowSetDataColumn()
// -------------------------------------------------------------------------
void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
- switch(nHandle)
+ if ( PROPERTY_ID_VALUE == nHandle )
{
- case PROPERTY_ID_DESCRIPTION:
- rValue <<= m_aDescription;
- break;
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- break;
- case PROPERTY_ID_VALUE:
- if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() )
- {
- ::osl::Mutex* pMutex = m_aColumnValue.getMutex();
- ::osl::MutexGuard aGuard( *pMutex );
+ if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() )
+ {
+ ::osl::Mutex* pMutex = m_aColumnValue.getMutex();
+ ::osl::MutexGuard aGuard( *pMutex );
#if OSL_DEBUG_LEVEL > 0
- ORowSetRow aRow = *m_aColumnValue;
+ ORowSetRow aRow = *m_aColumnValue;
#endif
- OSL_ENSURE((sal_Int32)aRow->get().size() > m_nPos,"Pos is greater than size of vector");
- rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
- }
- break;
- default:
- ODataColumn::getFastPropertyValue(rValue,nHandle);
+ OSL_ENSURE((sal_Int32)aRow->get().size() > m_nPos,"Pos is greater than size of vector");
+ rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
+ }
}
+ else
+ ODataColumn::getFastPropertyValue( rValue, nHandle );
}
+
// -------------------------------------------------------------------------
void SAL_CALL ORowSetDataColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
{
- switch(nHandle)
+ if ( PROPERTY_ID_VALUE == nHandle )
+ {
+ updateObject(rValue);
+ }
+ else
{
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- updateObject(rValue);
- break;
- default:
- ODataColumn::setFastPropertyValue_NoBroadcast(nHandle,rValue );
+ ODataColumn::setFastPropertyValue_NoBroadcast( nHandle,rValue );
}
}
// -------------------------------------------------------------------------
@@ -195,27 +172,14 @@ sal_Bool SAL_CALL ORowSetDataColumn::convertFastPropertyValue( Any & rConvertedV
const Any& rValue ) throw (IllegalArgumentException)
{
sal_Bool bModified = sal_False;
- switch(nHandle)
+ if ( PROPERTY_ID_VALUE == nHandle )
{
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- rConvertedValue = rValue;
- getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
- bModified = !::comphelper::compare(rConvertedValue, rOldValue);
- break;
- default:
- bModified = ODataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
-
+ rConvertedValue = rValue;
+ getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
+ bModified = rConvertedValue != rOldValue;
}
+ else
+ bModified = ODataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
return bModified;
}
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx
index 93b812815676..ceec7344737c 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx
@@ -30,21 +30,13 @@
#ifndef DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX
#define DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX
-#ifndef _DBACORE_DATACOLUMN_HXX_
#include "datacolumn.hxx"
-#endif
-#ifndef DBACCESS_CORE_API_ROWSETROW_HXX
#include "RowSetRow.hxx"
-#endif
-#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "RowSetCacheIterator.hxx"
+#include "columnsettings.hxx"
+
#include <connectivity/CommonTools.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
-#endif
-#ifndef DBACCESS_ROWSETCACHEITERATOR_HXX
-#include "RowSetCacheIterator.hxx"
-#endif
namespace dbaccess
{
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index bbb080a52238..f7be322caa1a 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -515,88 +515,7 @@ void OCacheSet::setParameter(sal_Int32 nPos
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::setParameter" );
sal_Int32 nType = ( _nType != DataType::OTHER ) ? _nType : _rValue.getTypeKind();
- if(!_rValue.isNull())
- {
-
- switch(nType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- _xParameter->setObjectWithInfo(nPos,_rValue.makeAny(),nType,_nScale);
- break;
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- _xParameter->setString(nPos,_rValue);
- break;
- case DataType::BIGINT:
- if ( _rValue.isSigned() )
- _xParameter->setLong(nPos,_rValue);
- else
- _xParameter->setString(nPos,_rValue);
- break;
- case DataType::BIT:
- case DataType::BOOLEAN:
- _xParameter->setBoolean(nPos,_rValue);
- break;
- case DataType::TINYINT:
- if ( _rValue.isSigned() )
- _xParameter->setByte(nPos,_rValue);
- else
- _xParameter->setShort(nPos,_rValue);
- break;
- case DataType::SMALLINT:
- if ( _rValue.isSigned() )
- _xParameter->setShort(nPos,_rValue);
- else
- _xParameter->setInt(nPos,_rValue);
- break;
- case DataType::INTEGER:
- if ( _rValue.isSigned() )
- _xParameter->setInt(nPos,_rValue);
- else
- _xParameter->setLong(nPos,_rValue);
- break;
- case DataType::FLOAT:
- _xParameter->setFloat(nPos,_rValue);
- break;
- case DataType::DOUBLE:
- case DataType::REAL:
- _xParameter->setDouble(nPos,_rValue);
- break;
- case DataType::DATE:
- _xParameter->setDate(nPos,_rValue);
- break;
- case DataType::TIME:
- _xParameter->setTime(nPos,_rValue);
- break;
- case DataType::TIMESTAMP:
- _xParameter->setTimestamp(nPos,_rValue);
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- _xParameter->setBytes(nPos,_rValue);
- break;
- case DataType::CLOB:
- {
- Reference<XInputStream> xStream(_rValue.getAny(),UNO_QUERY);
- _xParameter->setCharacterStream(nPos,xStream,xStream.is() ? xStream->available() : sal_Int32(0));
- }
- break;
- case DataType::BLOB:
- {
- Reference<XInputStream> xStream(_rValue.getAny(),UNO_QUERY);
- _xParameter->setBinaryStream(nPos,xStream,xStream.is() ? xStream->available() : sal_Int32(0));
- }
- break;
- case DataType::SQLNULL:
- _xParameter->setNull(nPos,nType);
- break;
- }
- }
- else
- _xParameter->setNull(nPos,nType);
+ ::dbtools::setObjectWithInfo(_xParameter,nPos,_rValue,nType,_nScale);
}
// -------------------------------------------------------------------------
void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition)
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index b3e815928bff..f028dba66ae0 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -211,8 +211,33 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
Reference<XColumnsSupplier> xSup(m_xComposer,UNO_QUERY);
Reference<XNameAccess> xSourceColumns = m_xTable->getColumns();
- ::dbaccess::getColumnPositions(xSup->getColumns(),xKeyColumns,m_sUpdateTableName,(*m_pKeyColumnNames));
- ::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns,m_sUpdateTableName,(*m_pColumnNames));
+ ::rtl::OUString sCatalog,sSchema,sTable;
+
+ Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
+ Any aCatalog = xTableProp->getPropertyValue(PROPERTY_CATALOGNAME);
+ aCatalog >>= sCatalog;
+ xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
+ xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
+
+ ::std::vector< ::rtl::OUString> aBestRowColumnNames;
+ Reference<XResultSet> xBestRes(xMeta->getBestRowIdentifier(aCatalog,sSchema,sTable,0,sal_False));
+ Reference<XRow> xBestRow(xBestRes,uno::UNO_QUERY);
+ while ( xBestRes->next() )
+ {
+ aBestRowColumnNames.push_back(xBestRow->getString(2));
+ }
+
+ Sequence< ::rtl::OUString> aBestColumnNames;
+ if ( aBestRowColumnNames.empty() )
+ {
+ if ( xKeyColumns.is() )
+ aBestColumnNames = xKeyColumns->getElementNames();
+ }
+ else
+ aBestColumnNames = Sequence< ::rtl::OUString>(&aBestRowColumnNames[0],aBestRowColumnNames.size());
+
+ ::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
+ ::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames));
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
@@ -235,16 +260,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
- ::rtl::OUString aQuote = getIdentifierQuoteString();
-
- ::rtl::OUStringBuffer aFilter;
- ::rtl::OUString sCatalog,sSchema,sTable;
-
- Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
- xTableProp->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
- xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
-
+ const ::rtl::OUString aQuote = getIdentifierQuoteString();
m_aSelectComposedTableName = getComposedTableName(sCatalog,sSchema,sTable);
::rtl::OUString sComposedName;
@@ -252,6 +268,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
::dbtools::qualifiedNameComponents(xMetaData,m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
sComposedName = ::dbtools::composeTableName( xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation );
+ ::rtl::OUStringBuffer aFilter;
static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// create the where clause
@@ -286,21 +303,20 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
::rtl::OUString sSelectTableName = ::dbtools::composeTableName( xMetaData, xProp, ::dbtools::eInDataManipulation, false, false, false );
Reference<XNameAccess > xSelectColumns = xSup->getColumns();
- ::dbaccess::getColumnPositions(xSelectColumns,xSelColSup->getColumns(),sSelectTableName,(*m_pForeignColumnNames));
+ ::dbaccess::getColumnPositions(xSelectColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
- uno::Sequence< ::rtl::OUString> aSelectColumnNames = xSelectColumns->getElementNames();
- const ::rtl::OUString* pSelectColumnName = aSelectColumnNames.getConstArray();
- const ::rtl::OUString* pSelectColumnEnd = pSelectColumnName + aSelectColumnNames.getLength();
- for( ; pSelectColumnName != pSelectColumnEnd ; ++pSelectColumnName)
+ aPosEnd = (*m_pForeignColumnNames).end();
+ for(aPosIter = (*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
{
// look for columns not in the source columns to use them as filter as well
- if ( !xSourceColumns->hasByName(*pSelectColumnName) )
+ // if ( !xSourceColumns->hasByName(aPosIter->first) )
{
+ if ( aFilter.getLength() )
+ aFilter.append(aAnd);
+ aFilter.append(::dbtools::quoteName( aQuote,sSelectTableName));
aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,*pSelectColumnName));
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
aFilter.append(s_sParam);
- if ( (pSelectColumnName+1) != pSelectColumnEnd )
- aFilter.append(aAnd);
}
}
break;
@@ -311,8 +327,8 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
if ( sOldFilter.getLength() )
{
FilterCreator aFilterCreator;
- aFilterCreator.append( aFilter.makeStringAndClear() );
aFilterCreator.append( sOldFilter );
+ aFilterCreator.append( aFilter.makeStringAndClear() );
aFilter = aFilterCreator.getComposedAndClear();
}
xAnalyzer->setFilter(aFilter.makeStringAndClear());
@@ -502,7 +518,8 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
for(;aIter != aEnd;++aIter,++i)
{
- if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
+ //if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
+ if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
@@ -597,7 +614,8 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
j = 0;
- for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j)
+ aIter = m_pColumnNames->begin();
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
{
setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
}
@@ -829,7 +847,7 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
sal_Int32 i = 1;
for(i = 1;aIter != aEnd;++aIter,++i)
{
- if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
+ if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
aSql.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
@@ -882,7 +900,8 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
// now we have to set the index values
::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
- for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i)
+ aIter = m_pColumnNames->begin();
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++aIter)
{
setParameter(i,xParameter,(_rDeleteRow->get())[*aIdxColIter],(_rDeleteRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
}
@@ -1397,7 +1416,7 @@ sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException)
namespace dbaccess
{
void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
- const Reference<XNameAccess>& _rxColumns,
+ const Sequence< ::rtl::OUString>& _aColumnNames,
const ::rtl::OUString& _rsUpdateTableName,
SelectColumnsMetaData& _rColumnNames)
{
@@ -1406,9 +1425,8 @@ namespace dbaccess
const ::rtl::OUString* pSelBegin = aSelNames.getConstArray();
const ::rtl::OUString* pSelEnd = pSelBegin + aSelNames.getLength();
- Sequence< ::rtl::OUString> aColumnNames(_rxColumns->getElementNames());
- const ::rtl::OUString* pColumnIter = aColumnNames.getConstArray();
- const ::rtl::OUString* pColumnEnd = pColumnIter + aColumnNames.getLength();
+ const ::rtl::OUString* pColumnIter = _aColumnNames.getConstArray();
+ const ::rtl::OUString* pColumnEnd = pColumnIter + _aColumnNames.getLength();
::comphelper::UStringMixLess aTmp(_rColumnNames.key_comp());
::comphelper::UStringMixEqual bCase(static_cast< ::comphelper::UStringMixLess*>(&aTmp)->isCaseSensitive());
@@ -1442,7 +1460,7 @@ namespace dbaccess
break;
}
}
- pColumnIter = aColumnNames.getConstArray();
+ pColumnIter = _aColumnNames.getConstArray();
}
}
}
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 4193f60506d1..7a213d05b466 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -83,7 +83,7 @@ namespace dbaccess
// the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME
void getColumnPositions(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxQueryColumns,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aColumnNames,
const ::rtl::OUString& _rsUpdateTableName,
SelectColumnsMetaData& _rColumnNames /* out */);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index d3df4552126c..18d8398c8233 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -74,6 +74,7 @@
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <comphelper/uno3.hxx>
+#include <connectivity/BlobHelper.hxx>
#include <connectivity/dbconversion.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
@@ -713,7 +714,18 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
// XRowUpdate
void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- updateValue(columnIndex,ORowSetValue());
+ ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
+
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ checkUpdateConditions(columnIndex);
+ checkUpdateIterator();
+
+ ::connectivity::ORowSetValue aOldValue(((*m_aCurrentRow)->get())[columnIndex]);
+ m_pCache->updateNull(columnIndex);
+ // we have to notify all listeners
+ ((*m_aCurrentRow)->get())[columnIndex].setNull();
+ firePropertyChange(columnIndex-1 ,aOldValue);
+ fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False);
}
// -------------------------------------------------------------------------
void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
@@ -785,25 +797,23 @@ void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Referenc
checkUpdateConditions(columnIndex);
checkUpdateIterator();
- ::connectivity::ORowSetValue aOldValue;
- if(((*m_aCurrentRow)->get())[columnIndex].getTypeKind() == DataType::BLOB)
- {
- m_pCache->updateBinaryStream(columnIndex,x,length);
- aOldValue = ((*m_aCurrentRow)->get())[columnIndex];
- ((*m_aCurrentRow)->get())[columnIndex] = makeAny(x);
- }
- else
+
+ //if(((*m_aCurrentRow)->get())[columnIndex].getTypeKind() == DataType::BLOB)
+ //{
+ // ::connectivity::ORowSetValue aOldValue = ((*m_aCurrentRow)->get())[columnIndex];
+ // m_pCache->updateBinaryStream(columnIndex,x,length);
+ // ((*m_aCurrentRow)->get())[columnIndex] = makeAny(x);
+ // ((*m_aCurrentRow)->get())[columnIndex].setTypeKind(DataType::BLOB);
+ // firePropertyChange(columnIndex-1 ,aOldValue);
+ // fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False);
+ //}
+ //else
{
Sequence<sal_Int8> aSeq;
if(x.is())
x->readBytes(aSeq,length);
updateValue(columnIndex,aSeq);
- aOldValue = ((*m_aCurrentRow)->get())[columnIndex];
- ((*m_aCurrentRow)->get())[columnIndex] = aSeq;
}
-
- firePropertyChange(columnIndex-1 ,aOldValue);
- fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False);
}
// -------------------------------------------------------------------------
void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
@@ -1380,14 +1390,19 @@ Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQ
return Reference< XRef >();
}
// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return Reference< XBlob >();
+ if ( m_pCache && isInsertRow() )
+ {
+ checkCache();
+ return new ::connectivity::BlobHelper(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
+ }
+ return ORowSetBase::getBlob(columnIndex);
}
// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return Reference< XClob >();
+ return Reference< XClob >(getInsertValue(columnIndex).makeAny(),UNO_QUERY);
}
// -------------------------------------------------------------------------
Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
@@ -2737,7 +2752,8 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo
m_aDataColumns.push_back(pColumn);
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN));
- sal_Int32 nFormatKey = comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT));
+ 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));
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index a8894bcf5f1b..d8449094fa85 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -469,18 +469,16 @@ Reference< XRef > SAL_CALL ORowSetBase::getRef( sal_Int32 /*columnIndex*/ ) thro
return NULL;
}
// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBlob" );
- ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *m_pMySelf );
- return NULL;
+ return Reference< XBlob >(getValue(columnIndex).makeAny(),UNO_QUERY);
}
// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getClob" );
- ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *m_pMySelf );
- return NULL;
+ return Reference< XClob >(getValue(columnIndex).makeAny(),UNO_QUERY);
}
// -------------------------------------------------------------------------
Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index a96de4b9fbe1..4156c32635a2 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -168,6 +168,16 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference< XIndexAccess> xUpdateTableKeys;
::rtl::OUString aUpdateTableName = _rUpdateTableName;
Reference< XConnection> xConnection;
+ // first we need a connection
+ Reference< XStatement> xStmt(_xRs->getStatement(),UNO_QUERY);
+ if(xStmt.is())
+ xConnection = xStmt->getConnection();
+ else
+ {
+ Reference< XPreparedStatement> xPrepStmt(_xRs->getStatement(),UNO_QUERY);
+ xConnection = xPrepStmt->getConnection();
+ }
+ OSL_ENSURE(xConnection.is(),"No connection!");
if(_xAnalyzer.is())
{
try
@@ -215,16 +225,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if(xColumnsSupplier.is())
{
- // first we need a connection
- Reference< XStatement> xStmt(_xRs->getStatement(),UNO_QUERY);
- if(xStmt.is())
- xConnection = xStmt->getConnection();
- else
- {
- Reference< XPreparedStatement> xPrepStmt(_xRs->getStatement(),UNO_QUERY);
- xConnection = xPrepStmt->getConnection();
- }
- OSL_ENSURE(xConnection.is(),"No connection!");
+
Reference<XNameAccess> xColumns = xColumnsSupplier->getColumns();
Reference<XColumnsSupplier> xColSup(_xAnalyzer,UNO_QUERY);
@@ -233,7 +234,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false);
- ::dbaccess::getColumnPositions(xSelColumns,xColumns,aUpdateTableName,aColumnNames);
+ ::dbaccess::getColumnPositions(xSelColumns,xColumns->getElementNames(),aUpdateTableName,aColumnNames);
bAllKeysFound = !aColumnNames.empty() && sal_Int32(aColumnNames.size()) == xColumns->getElementNames().getLength();
}
}
@@ -303,7 +304,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference<XColumnsSupplier> xColSup(_xAnalyzer,UNO_QUERY);
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
Reference<XNameAccess> xColumns = m_aUpdateTable->getColumns();
- ::dbaccess::getColumnPositions(xSelColumns,xColumns,aUpdateTableName,aColumnNames);
+ ::dbaccess::getColumnPositions(xSelColumns,xColumns->getElementNames(),aUpdateTableName,aColumnNames);
// check privileges
m_nPrivileges = Privilege::SELECT;
@@ -560,10 +561,18 @@ sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
// -------------------------------------------------------------------------
// XRowUpdate
// -----------------------------------------------------------------------------
-void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
+void ORowSetCache::updateNull(sal_Int32 columnIndex)
{
checkUpdateConditions(columnIndex);
+ ((*m_aInsertRow)->get())[columnIndex].setBound(sal_True);
+ ((*m_aInsertRow)->get())[columnIndex].setNull();
+ ((*m_aInsertRow)->get())[columnIndex].setModified();
+}
+// -----------------------------------------------------------------------------
+void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
+{
+ checkUpdateConditions(columnIndex);
((*m_aInsertRow)->get())[columnIndex].setBound(sal_True);
((*m_aInsertRow)->get())[columnIndex] = x;
@@ -1342,11 +1351,12 @@ void ORowSetCache::moveToInsertRow( )
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1;
ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
- for(;aIter != aEnd;++aIter)
+ for(sal_Int32 i = 1;aIter != aEnd;++aIter,++i)
{
aIter->setBound(sal_False);
aIter->setModified(sal_False);
aIter->setNull();
+ aIter->setTypeKind(m_xMetaData->getColumnType(i));
}
}
// -------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 0576aa68ac02..1f5be3113f8b 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -225,6 +225,7 @@ namespace dbaccess
void updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length );
void updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x );
void updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale );
+ void updateNull(sal_Int32 columnIndex);
// ::com::sun::star::sdbc::XResultSet
sal_Bool next( );
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 10878f599c4f..9b8bae551cf1 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1530,6 +1530,27 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
aSQL.append( STR_LIKE );
aSQL.append( DBTypeConversion::toSQLString( nType, aValue, sal_True, m_xTypeConverter ) );
break;
+ case DataType::CLOB:
+ {
+ Reference< XClob > xClob(aValue,UNO_QUERY);
+ if ( xClob.is() )
+ {
+ const ::sal_Int64 nLength = xClob->length();
+ if ( sal_Int64(nLength + aSQL.getLength() + STR_LIKE.getLength() ) < sal_Int64(SAL_MAX_INT32) )
+ {
+ aSQL.append( STR_LIKE );
+ aSQL.appendAscii("'");
+ aSQL.append( xClob->getSubString(1,(sal_Int32)nLength) );
+ aSQL.appendAscii("'");
+ }
+ }
+ else
+ {
+ aSQL.append( STR_LIKE );
+ aSQL.append( DBTypeConversion::toSQLString( nType, aValue, sal_True, m_xTypeConverter ) );
+ }
+ }
+ break;
case DataType::VARBINARY:
case DataType::BINARY:
case DataType::LONGVARBINARY:
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index b0fa5b7492c6..c8225f1d7a28 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -706,7 +706,7 @@ OColumn* ODBTableDecorator::createColumn(const ::rtl::OUString& _rName) const
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName))
xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper(xProp,xColumnDefintion);
+ pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
}
}
return pReturn;
@@ -734,8 +734,8 @@ Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor()
if(m_xTable.is())
xNames.set(m_xTable->getColumns(),UNO_QUERY);
Reference< XPropertySet > xRet;
- if(xNames.is())
- xRet = new OTableColumnDescriptorWrapper(xNames->createDataDescriptor());
+ if ( xNames.is() )
+ xRet = new OTableColumnDescriptorWrapper( xNames->createDataDescriptor(), false, true );
return xRet;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx
index 0dde122faa1a..f789394d23f9 100644
--- a/dbaccess/source/core/api/column.cxx
+++ b/dbaccess/source/core/api/column.cxx
@@ -31,78 +31,31 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_COLUMN_HXX_
+#include "ContainerMediator.hxx"
+#include "apitools.hxx"
#include "column.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
-#ifndef _DBA_CORE_RESOURCE_HXX_
-#include "core_resource.hxx"
-#endif
-#ifndef _DBA_CORE_RESOURCE_HRC_
#include "core_resource.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include "core_resource.hxx"
+#include "dbastrings.hrc"
+#include "sdbcoretools.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
-#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_ENUMHELPER_HXX_
+
+#include <comphelper/basicio.hxx>
#include <comphelper/enumhelper.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
-#endif
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
-#ifndef _COMPHELPER_SEQSTREAM_HXX
+#include <comphelper/property.hxx>
#include <comphelper/seqstream.hxx>
-#endif
-#ifndef _COMPHELPER_BASIC_IO_HXX_
-#include <comphelper/basicio.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-#ifndef CONNECTIVITY_TABLEHELPER_HXX
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
#include <connectivity/TTableHelper.hxx>
-#endif
-#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_
-#include "definitioncolumn.hxx"
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
-#endif
-#ifndef DBA_CONTAINERMEDIATOR_HXX
-#include "ContainerMediator.hxx"
-#endif
-#ifndef DBACORE_SDBCORETOOLS_HXX
-#include "sdbcoretools.hxx"
-#endif
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/diagnose.h>
+#include <tools/debug.hxx>
#include <algorithm>
@@ -128,11 +81,14 @@ DBG_NAME(OColumn)
//= OColumn
//============================================================
//--------------------------------------------------------------------------
-OColumn::OColumn()
- :OColumnBase(m_aMutex)
- , OPropertySetHelper(OColumnBase::rBHelper)
+OColumn::OColumn( const bool _bNameIsReadOnly )
+ :OColumnBase( m_aMutex )
+ ,::comphelper::OPropertyContainer( OColumnBase::rBHelper )
{
DBG_CTOR(OColumn, NULL);
+
+ registerProperty( PROPERTY_NAME, PROPERTY_ID_NAME, _bNameIsReadOnly ? PropertyAttribute::READONLY : 0,
+ &m_sName, ::getCppuType( &m_sName ) );
}
//--------------------------------------------------------------------------
@@ -145,37 +101,14 @@ OColumn::~OColumn()
//--------------------------------------------------------------------------
Sequence< Type > OColumn::getTypes() throw (RuntimeException)
{
- OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
- ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- OColumnBase::getTypes());
- return aTypes.getTypes();
+ return ::comphelper::concatSequences(
+ OColumnBase::getTypes(),
+ ::comphelper::OPropertyContainer::getTypes()
+ );
}
// com::sun::star::uno::XInterface
-//--------------------------------------------------------------------------
-Any OColumn::queryInterface( const Type & rType ) throw (RuntimeException)
-{
- Any aIface = OColumnBase::queryInterface( rType );
- if (!aIface.hasValue())
- aIface = ::cppu::queryInterface(
- rType,
- static_cast< XPropertySet * >( this ),
- static_cast< XMultiPropertySet * >( this ));
-
- return aIface;
-}
-
-//--------------------------------------------------------------------------
-void OColumn::acquire() throw()
-{
- OColumnBase::acquire();
-}
-
-//--------------------------------------------------------------------------
-void OColumn::release() throw()
-{
- OColumnBase::release();
-}
+IMPLEMENT_FORWARD_XINTERFACE2( OColumn, OColumnBase, ::comphelper::OPropertyContainer )
// ::com::sun::star::lang::XServiceInfo
//------------------------------------------------------------------------------
@@ -202,7 +135,7 @@ Sequence< ::rtl::OUString > OColumn::getSupportedServiceNames( ) throw (Runtime
//------------------------------------------------------------------------------
void OColumn::disposing()
{
- OPropertySetHelper::disposing();
+ OPropertyContainer::disposing();
}
// com::sun::star::beans::XPropertySet
@@ -212,77 +145,6 @@ Reference< XPropertySetInfo > OColumn::getPropertySetInfo() throw (RuntimeExcept
return createPropertySetInfo( getInfoHelper() ) ;
}
-//------------------------------------------------------------------------------
-void OColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_sName;
- break;
- }
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OColumn::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch (nHandle)
- {
- case PROPERTY_ID_NAME:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sName);
- break;
- }
- return bModified;
-}
-
-//------------------------------------------------------------------------------
-void OColumn::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_NAME:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< ::rtl::OUString* >(NULL))),
- "OColumn::setFastPropertyValue_NoBroadcast(NAME) : invalid value !");
- rValue >>= m_sName;
- break;
- }
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OColumn::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OColumn::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL OColumn::getName( ) throw(::com::sun::star::uno::RuntimeException)
{
@@ -293,235 +155,31 @@ void SAL_CALL OColumn::setName( const ::rtl::OUString& _rName ) throw(::com::sun
{
m_sName = _rName;
}
+
// -----------------------------------------------------------------------------
void OColumn::fireValueChange(const ::connectivity::ORowSetValue& /*_rOldValue*/)
{
DBG_ERROR( "OColumn::fireValueChange: not implemented!" );
}
-// -----------------------------------------------------------------------------
-//============================================================
-//= OColumnSettings
-//============================================================
-DBG_NAME( OColumnSettings )
-//------------------------------------------------------------------------------
-OColumnSettings::OColumnSettings()
- :m_bHidden(sal_False)
-{
- DBG_CTOR( OColumnSettings, NULL );
-}
//------------------------------------------------------------------------------
-OColumnSettings::~OColumnSettings()
+void OColumn::registerProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void* _pPointerToMember, const Type& _rMemberType )
{
- DBG_DTOR( OColumnSettings, NULL );
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OColumnSettings::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- if ( ( rId.getLength() == 16 )
- && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- )
- return reinterpret_cast< sal_Int64 >( this );
-
- return 0;
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OColumnSettings::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
+ ::comphelper::OPropertyContainer::registerProperty( _rName, _nHandle, _nAttributes, _pPointerToMember, _rMemberType );
}
//------------------------------------------------------------------------------
-void OColumnSettings::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+void OColumn::registerMayBeVoidProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, Any* _pPointerToMember, const Type& _rExpectedType )
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- rValue = m_aAlignment;
- break;
- case PROPERTY_ID_NUMBERFORMAT:
- rValue = m_aFormatKey;
- break;
- case PROPERTY_ID_RELATIVEPOSITION:
- rValue = m_aRelativePosition;
- break;
- case PROPERTY_ID_WIDTH:
- rValue = m_aWidth;
- break;
- case PROPERTY_ID_HIDDEN:
- rValue.setValue(&m_bHidden, getBooleanCppuType());
- break;
- case PROPERTY_ID_CONTROLMODEL:
- rValue <<= m_xControlModel;
- break;
- case PROPERTY_ID_HELPTEXT:
- rValue = m_aHelpText;
- break;
- case PROPERTY_ID_CONTROLDEFAULT:
- rValue = m_aControlDefault;
- break;
- }
+ ::comphelper::OPropertyContainer::registerMayBeVoidProperty( _rName, _nHandle, _nAttributes, _pPointerToMember, _rExpectedType );
}
//------------------------------------------------------------------------------
-sal_Bool OColumnSettings::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- bModified = !uno_type_equalData(
- const_cast< void* >( m_aAlignment.getValue() ), m_aAlignment.getValueType().getTypeLibType(),
- const_cast< void* >( rValue.getValue() ), rValue.getValueType().getTypeLibType(),
- reinterpret_cast< uno_QueryInterfaceFunc >( cpp_queryInterface ),
- reinterpret_cast< uno_ReleaseFunc >( cpp_release )
- );
- if ( bModified )
- {
- rConvertedValue = rValue;
- rOldValue = m_aAlignment;
- }
- break;
- case PROPERTY_ID_WIDTH:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth,
- ::getCppuType(static_cast< sal_Int32* >(NULL)));
- break;
- case PROPERTY_ID_HIDDEN:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bHidden);
- break;
- case PROPERTY_ID_RELATIVEPOSITION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aRelativePosition,
- ::getCppuType(static_cast< sal_Int32* >(NULL)));
- break;
- case PROPERTY_ID_NUMBERFORMAT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFormatKey,
- ::getCppuType(static_cast< sal_Int32* >(NULL)));
- break;
- case PROPERTY_ID_CONTROLMODEL:
- {
- Reference< XPropertySet > xTest;
- if (!::cppu::extractInterface(xTest, rValue))
- throw IllegalArgumentException();
- if (xTest.get() != m_xControlModel.get())
- {
- bModified = sal_True;
- rOldValue <<= m_xControlModel;
- rConvertedValue <<= rValue;
- }
- }
- break;
- case PROPERTY_ID_HELPTEXT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aHelpText,
- ::getCppuType(static_cast< ::rtl::OUString* >(NULL)));
- break;
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = rValue != m_aControlDefault;
- if ( bModified )
- {
- rConvertedValue = rValue;
- rOldValue = m_aControlDefault;
- }
- break;
- }
- return bModified;
-}
-
-//------------------------------------------------------------------------------
-void OColumnSettings::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
+void OColumn::registerPropertyNoMember( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const Type& _rType, const void* _pInitialValue )
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- {
- if ( rValue.hasValue() )
- {
- sal_Int32 nAlign = 0;
- sal_Bool bSuccess =
- // copy the data from the to-be-set value
- uno_type_assignData(
- static_cast< void* >( &nAlign ), ::getCppuType(static_cast< sal_Int32* >(NULL)).getTypeLibType(),
- const_cast< void* >( rValue.getValue() ), rValue.getValueType().getTypeLibType(),
- reinterpret_cast< uno_QueryInterfaceFunc >( cpp_queryInterface ),
- reinterpret_cast< uno_AcquireFunc >( cpp_acquire ),
- reinterpret_cast< uno_ReleaseFunc >( cpp_release ) );
-
- OSL_ENSURE( bSuccess,
- "OPropertyStateContainer::setFastPropertyValue_NoBroadcast : ooops .... the value could not be assigned!");
- if ( bSuccess )
- m_aAlignment <<= nAlign;
- }
- else
- m_aAlignment = rValue;
- }
-
- break;
- case PROPERTY_ID_WIDTH:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(WIDTH) : invalid value !");
- m_aWidth = rValue;
- break;
- case PROPERTY_ID_NUMBERFORMAT:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(NUMBERFORMAT) : invalid value !");
- m_aFormatKey = rValue;
- break;
- case PROPERTY_ID_RELATIVEPOSITION:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(ID_RELATIVEPOSITION) : invalid value !");
- m_aRelativePosition = rValue;
- break;
- case PROPERTY_ID_HIDDEN:
- OSL_ENSURE(rValue.getValueType().equals(::getBooleanCppuType()),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(HIDDEN) : invalid value !");
- m_bHidden = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_HELPTEXT:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< ::rtl::OUString* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(ID_RELATIVEPOSITION) : invalid value !");
- m_aHelpText = rValue;
- break;
- case PROPERTY_ID_CONTROLDEFAULT:
- m_aControlDefault = rValue;
- break;
- }
+ ::comphelper::OPropertyContainer::registerPropertyNoMember( _rName, _nHandle, _nAttributes, _rType, _pInitialValue );
}
-
-//------------------------------------------------------------------------------
-sal_Bool OColumnSettings::isDefaulted() const
-{
- return !m_aAlignment.hasValue()
- && !m_aWidth.hasValue()
- && !m_aFormatKey.hasValue()
- && !m_aRelativePosition.hasValue()
- && !m_aHelpText.hasValue()
- && !m_aControlDefault.hasValue()
- && !m_bHidden;
-}
-
-
//============================================================
//= OColumns
//============================================================
@@ -547,6 +205,7 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent,
{
DBG_CTOR(OColumns, NULL);
}
+
// -------------------------------------------------------------------------
OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxDrvColumns,
diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx
new file mode 100644
index 000000000000..3aba07d88749
--- /dev/null
+++ b/dbaccess/source/core/api/columnsettings.cxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+
+#include "columnsettings.hxx"
+#include "dbastrings.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/property.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ /** === end UNO using === **/
+ namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+
+ //==============================================================================
+ //= OColumnSettings
+ //==============================================================================
+ DBG_NAME( OColumnSettings )
+ //------------------------------------------------------------------------------
+ OColumnSettings::OColumnSettings()
+ :m_bHidden(sal_False)
+ {
+ DBG_CTOR( OColumnSettings, NULL );
+ }
+
+ //------------------------------------------------------------------------------
+ OColumnSettings::~OColumnSettings()
+ {
+ DBG_DTOR( OColumnSettings, NULL );
+ }
+
+ //------------------------------------------------------------------------------
+ void OColumnSettings::registerProperties( IPropertyContainer& _rPropertyContainer )
+ {
+ const sal_Int32 nBoundAttr = PropertyAttribute::BOUND;
+ const sal_Int32 nMayBeVoidAttr = PropertyAttribute::MAYBEVOID | nBoundAttr;
+
+ const Type& rSalInt32Type = ::getCppuType( static_cast< sal_Int32* >( NULL ) );
+ const Type& rStringType = ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) );
+
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_ALIGN, PROPERTY_ID_ALIGN, nMayBeVoidAttr, &m_aAlignment, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_NUMBERFORMAT, PROPERTY_ID_NUMBERFORMAT, nMayBeVoidAttr, &m_aFormatKey, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_RELATIVEPOSITION, PROPERTY_ID_RELATIVEPOSITION, nMayBeVoidAttr, &m_aRelativePosition, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_WIDTH, PROPERTY_ID_WIDTH, nMayBeVoidAttr, &m_aWidth, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_HELPTEXT, PROPERTY_ID_HELPTEXT, nMayBeVoidAttr, &m_aHelpText, rStringType );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_CONTROLDEFAULT, PROPERTY_ID_CONTROLDEFAULT, nMayBeVoidAttr, &m_aControlDefault, rStringType );
+ _rPropertyContainer.registerProperty( PROPERTY_CONTROLMODEL, PROPERTY_ID_CONTROLMODEL, nBoundAttr, &m_xControlModel, ::getCppuType( &m_xControlModel ) );
+ _rPropertyContainer.registerProperty( PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN, nBoundAttr, &m_bHidden, ::getCppuType( &m_bHidden ) );
+ }
+
+ //------------------------------------------------------------------------------
+ bool OColumnSettings::isColumnSettingProperty( const sal_Int32 _nPropertyHandle )
+ {
+ return ( _nPropertyHandle == PROPERTY_ID_ALIGN )
+ || ( _nPropertyHandle == PROPERTY_ID_NUMBERFORMAT )
+ || ( _nPropertyHandle == PROPERTY_ID_RELATIVEPOSITION )
+ || ( _nPropertyHandle == PROPERTY_ID_WIDTH )
+ || ( _nPropertyHandle == PROPERTY_ID_HELPTEXT )
+ || ( _nPropertyHandle == PROPERTY_ID_CONTROLDEFAULT )
+ || ( _nPropertyHandle == PROPERTY_ID_CONTROLMODEL )
+ || ( _nPropertyHandle == PROPERTY_ID_HIDDEN );
+ }
+
+ //------------------------------------------------------------------------------
+ bool OColumnSettings::isDefaulted( const sal_Int32 _nPropertyHandle, const Any& _rPropertyValue )
+ {
+ switch ( _nPropertyHandle )
+ {
+ case PROPERTY_ID_ALIGN:
+ case PROPERTY_ID_NUMBERFORMAT:
+ case PROPERTY_ID_RELATIVEPOSITION:
+ case PROPERTY_ID_WIDTH:
+ case PROPERTY_ID_HELPTEXT:
+ case PROPERTY_ID_CONTROLDEFAULT:
+ return !_rPropertyValue.hasValue();
+
+ case PROPERTY_ID_CONTROLMODEL:
+ return !Reference< XPropertySet >( _rPropertyValue, UNO_QUERY ).is();
+
+ case PROPERTY_ID_HIDDEN:
+ {
+ sal_Bool bHidden = sal_False;
+ OSL_VERIFY( _rPropertyValue >>= bHidden );
+ return !bHidden;
+ }
+ }
+ OSL_ENSURE( false, "OColumnSettings::isDefaulted: illegal property handle!" );
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------
+ bool OColumnSettings::hasDefaultSettings( const Reference< XPropertySet >& _rxColumn )
+ {
+ ENSURE_OR_THROW( _rxColumn.is(), "illegal column" );
+ try
+ {
+ Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_SET_THROW );
+
+ struct PropertyDescriptor
+ {
+ ::rtl::OUString sName;
+ sal_Int32 nHandle;
+ };
+ PropertyDescriptor aProps[] =
+ {
+ { 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 ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i )
+ {
+ if ( xPSI->hasPropertyByName( aProps[i].sName ) )
+ if ( !isDefaulted( aProps[i].nHandle, _rxColumn->getPropertyValue( aProps[i].sName ) ) )
+ return false;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return true;
+ }
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
diff --git a/dbaccess/source/core/api/datasettings.cxx b/dbaccess/source/core/api/datasettings.cxx
index dcca2c34d694..6cbc702dae9e 100644
--- a/dbaccess/source/core/api/datasettings.cxx
+++ b/dbaccess/source/core/api/datasettings.cxx
@@ -69,6 +69,7 @@
#include <com/sun/star/awt/FontWidth.hpp>
#endif
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
@@ -157,19 +158,25 @@ ODataSettings_Base::ODataSettings_Base()
//--------------------------------------------------------------------------
ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource)
+ :m_sFilter( _rSource.m_sFilter )
+ ,m_sHavingClause( _rSource.m_sHavingClause )
+ ,m_sGroupBy( _rSource.m_sGroupBy )
+ ,m_sOrder( _rSource.m_sOrder )
+ ,m_bApplyFilter( _rSource.m_bApplyFilter )
+ ,m_aFont( _rSource.m_aFont )
+ ,m_aRowHeight( _rSource.m_aRowHeight )
+ ,m_aTextColor( _rSource.m_aTextColor )
+ ,m_aTextLineColor( _rSource.m_aTextLineColor )
+ ,m_nFontEmphasis( _rSource.m_nFontEmphasis )
+ ,m_nFontRelief( _rSource.m_nFontRelief )
+{
+}
+
+// -----------------------------------------------------------------------------
+ODataSettings_Base::~ODataSettings_Base()
{
- m_sFilter = _rSource.m_sFilter;
- m_sHavingClause = _rSource.m_sHavingClause;
- m_sGroupBy = _rSource.m_sGroupBy;
- m_sOrder = _rSource.m_sOrder;
- m_bApplyFilter = _rSource.m_bApplyFilter;
- m_aFont = _rSource.m_aFont;
- m_aRowHeight = _rSource.m_aRowHeight;
- m_aTextColor = _rSource.m_aTextColor;
- m_aTextLineColor= _rSource.m_aTextLineColor;
- m_nFontEmphasis = _rSource.m_nFontEmphasis;
- m_nFontRelief = _rSource.m_nFontRelief;
}
+
// -----------------------------------------------------------------------------
void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
{
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 8d0eb5e6b265..9f9e511fc9b4 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -31,39 +31,29 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_DEFINITIONSETTINGS_HXX_
+#include "apitools.hxx"
+#include "dbastrings.hrc"
#include "definitioncolumn.hxx"
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
+#include "sdbcoretools.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+/** === end UNO includes === **/
+
#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/typeprovider.hxx>
#include <tools/debug.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef DBACORE_SDBCORETOOLS_HXX
-#include "sdbcoretools.hxx"
-#endif
-
+#include <tools/diagnose_ex.h>
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;
using namespace ::osl;
@@ -79,23 +69,32 @@ using namespace dbaccess;
//============================================================
IMPLEMENT_FORWARD_XINTERFACE2(OTableColumnDescriptor,OColumn,TXChild)
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OTableColumnDescriptor::getImplementationId() throw (RuntimeException)
+//------------------------------------------------------------------------------
+void OTableColumnDescriptor::impl_registerProperties()
{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
+ sal_Int32 nDefaultAttr = m_bActAsDescriptor ? 0 : PropertyAttribute::READONLY;
+
+ registerProperty( PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, nDefaultAttr, &m_aTypeName, ::getCppuType( &m_aTypeName ) );
+ registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, nDefaultAttr, &m_aDescription, ::getCppuType( &m_aDescription ) );
+ registerProperty( PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, nDefaultAttr, &m_aDefaultValue, ::getCppuType( &m_aDefaultValue ) );
+
+ if ( m_bActAsDescriptor )
+ registerProperty( PROPERTY_AUTOINCREMENTCREATION, PROPERTY_ID_AUTOINCREMENTCREATION, nDefaultAttr, &m_aAutoIncrementValue, ::getCppuType( &m_aAutoIncrementValue ) );
+
+ registerProperty( PROPERTY_TYPE, PROPERTY_ID_TYPE, nDefaultAttr, &m_nType, ::getCppuType( &m_nType ) );
+ registerProperty( PROPERTY_PRECISION, PROPERTY_ID_PRECISION, nDefaultAttr, &m_nPrecision, ::getCppuType( &m_nPrecision ) );
+ registerProperty( PROPERTY_SCALE, PROPERTY_ID_SCALE, nDefaultAttr, &m_nScale, ::getCppuType( &m_nScale ) );
+ registerProperty( PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, nDefaultAttr, &m_nIsNullable, ::getCppuType( &m_nIsNullable ) );
+ registerProperty( PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, nDefaultAttr, &m_bAutoIncrement, ::getCppuType( &m_bAutoIncrement ) );
+ registerProperty( PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, nDefaultAttr, &m_bRowVersion, ::getCppuType( &m_bRowVersion ) );
+ registerProperty( PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, nDefaultAttr, &m_bCurrency, ::getCppuType( &m_bCurrency ) );
+
+ OColumnSettings::registerProperties( *this );
}
+//--------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptor )
+
// ::com::sun::star::lang::XServiceInfo
//------------------------------------------------------------------------------
rtl::OUString OTableColumnDescriptor::getImplementationName( ) throw (RuntimeException)
@@ -107,7 +106,7 @@ rtl::OUString OTableColumnDescriptor::getImplementationName( ) throw (RuntimeEx
Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( ) throw (RuntimeException)
{
Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBCX_COLUMNDESCRIPTOR;
+ aSNS[0] = m_bActAsDescriptor ? SERVICE_SDBCX_COLUMNDESCRIPTOR : SERVICE_SDBCX_COLUMN;
aSNS[1] = SERVICE_SDB_COLUMNSETTINGS;
return aSNS;
}
@@ -116,28 +115,9 @@ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( )
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumnDescriptor::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(20)
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP1(AUTOINCREMENTCREATION,::rtl::OUString, MAYBEVOID);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- DECL_PROP0(DEFAULTVALUE, ::rtl::OUString );
- DECL_PROP0(DESCRIPTION, ::rtl::OUString );
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP0_BOOL(ISAUTOINCREMENT );
- DECL_PROP0_BOOL(ISCURRENCY );
- DECL_PROP0(ISNULLABLE, sal_Int32 );
- DECL_PROP0_BOOL(ISROWVERSION );
- DECL_PROP0(NAME, ::rtl::OUString );
- DECL_PROP0(PRECISION, sal_Int32 );
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP0(SCALE, sal_Int32 );
- DECL_PROP0(TYPE, sal_Int32 );
- DECL_PROP0(TYPENAME, ::rtl::OUString );
- DECL_PROP2(WIDTH, sal_Int32, BOUND, MAYBEVOID);
- END_PROPERTY_HELPER();
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
}
// cppu::OPropertySetHelper
@@ -148,190 +128,10 @@ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( )
}
//------------------------------------------------------------------------------
-void OTableColumnDescriptor::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
{
- switch (nHandle)
- {
- case PROPERTY_ID_TYPE:
- rValue <<= m_nType;
- break;
- case PROPERTY_ID_PRECISION:
- rValue <<= m_nPrecision;
- break;
- case PROPERTY_ID_SCALE:
- rValue <<= m_nScale;
- break;
- case PROPERTY_ID_ISNULLABLE:
- rValue <<= m_nIsNullable;
- break;
- case PROPERTY_ID_TYPENAME:
- rValue <<= m_aTypeName;
- break;
- case PROPERTY_ID_DESCRIPTION:
- rValue <<= m_aDescription;
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- rValue <<= m_aDefaultValue;
- break;
- case PROPERTY_ID_AUTOINCREMENTCREATION:
- rValue <<= m_aAutoIncrementValue;
- break;
- case PROPERTY_ID_ISAUTOINCREMENT:
- {
- sal_Bool bVal = m_bAutoIncrement;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- case PROPERTY_ID_ISCURRENCY:
- {
- sal_Bool bVal = m_bCurrency;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- case PROPERTY_ID_ISROWVERSION:
- {
- sal_Bool bVal = m_bRowVersion;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- case PROPERTY_ID_NAME:
- OColumn::getFastPropertyValue( rValue, nHandle );
- break;
- default:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- }
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OTableColumnDescriptor::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch (nHandle)
- {
- case PROPERTY_ID_TYPE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nType);
- break;
- case PROPERTY_ID_PRECISION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nPrecision);
- break;
- case PROPERTY_ID_SCALE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nScale);
- break;
- case PROPERTY_ID_ISNULLABLE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nIsNullable);
- break;
- case PROPERTY_ID_TYPENAME:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTypeName);
- break;
- case PROPERTY_ID_DESCRIPTION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDescription);
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultValue);
- break;
- case PROPERTY_ID_AUTOINCREMENTCREATION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aAutoIncrementValue);
- break;
- case PROPERTY_ID_ISAUTOINCREMENT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAutoIncrement);
- break;
- case PROPERTY_ID_ISCURRENCY:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bCurrency);
- break;
- case PROPERTY_ID_ISROWVERSION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bRowVersion);
- break;
- case PROPERTY_ID_NAME:
- bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- default:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- }
- return bModified;
-}
-
-//------------------------------------------------------------------------------
-void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_TYPE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(TYPE) : invalid value !");
- rValue >>= m_nType;
- break;
- case PROPERTY_ID_PRECISION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(PRECISION) : invalid value !");
- rValue >>= m_nPrecision;
- break;
- case PROPERTY_ID_SCALE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(SCALE) : invalid value !");
- rValue >>= m_nScale;
- break;
- case PROPERTY_ID_ISNULLABLE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISNULLABLE) : invalid value !");
- rValue >>= m_nIsNullable;
- break;
- case PROPERTY_ID_TYPENAME:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(TYPENAME) : invalid value !");
- rValue >>= m_aTypeName;
- break;
- case PROPERTY_ID_DESCRIPTION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(DESCRIPTION) : invalid value !");
- rValue >>= m_aDescription;
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(DEFAULTVALUE) : invalid value !");
- rValue >>= m_aDefaultValue;
- break;
- case PROPERTY_ID_AUTOINCREMENTCREATION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(AUTOINCREMENTVALUE) : invalid value !");
- rValue >>= m_aAutoIncrementValue;
- break;
- case PROPERTY_ID_ISAUTOINCREMENT:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Bool* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISAUTOINCREMENT) : invalid value !");
- m_bAutoIncrement = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_ISCURRENCY:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Bool* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISCURRENCY) : invalid value !");
- m_bCurrency = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_ISROWVERSION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Bool* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISROWVERSION) : invalid value !");
- m_bRowVersion = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_NAME:
- OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- default:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- }
- ::dbaccess::notifyDataSourceModified(m_xParent,sal_True);
-}
-
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OTableColumnDescriptor::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw(RuntimeException)
-{
- sal_Int64 nReturn = OColumn::getSomething( aIdentifier );
- if ( !nReturn )
- nReturn = OColumnSettings::getSomething( aIdentifier );
- return nReturn;
+ OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ ::dbaccess::notifyDataSourceModified( m_xParent, sal_True );
}
// -----------------------------------------------------------------------------
@@ -350,51 +150,24 @@ void SAL_CALL OTableColumnDescriptor::setParent( const Reference< XInterface >&
//= OTableColumn
//============================================================
DBG_NAME(OTableColumn);
-OTableColumn::OTableColumn(const ::rtl::OUString& _rName)
+
+// -------------------------------------------------------------------------
+OTableColumn::OTableColumn( const ::rtl::OUString& _rName )
+ :OTableColumnDescriptor( false /* do not act as descriptor */ )
{
DBG_CTOR(OTableColumn,NULL);
m_sName = _rName;
}
-// -------------------------------------------------------------------------
-OTableColumn::OTableColumn(const Reference<XPropertySet>& _xColumn)
-{
- DBG_CTOR(OTableColumn,NULL);
- m_aTypeName = (::comphelper::getString(_xColumn->getPropertyValue(PROPERTY_TYPENAME)));
- if(_xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE))
- m_aDefaultValue = (::comphelper::getString(_xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)));
- m_nIsNullable = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_ISNULLABLE)));
- m_nPrecision = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_PRECISION)));
- m_nScale = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_SCALE)));
- m_nType = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_TYPE)));
- m_bAutoIncrement = (::comphelper::getBOOL(_xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
- m_bRowVersion = (sal_False);
- m_bCurrency = (::comphelper::getBOOL(_xColumn->getPropertyValue(PROPERTY_ISCURRENCY)));
- _xColumn->getPropertyValue(PROPERTY_NAME) >>= m_sName;
-}
// -----------------------------------------------------------------------------
OTableColumn::~OTableColumn()
{
DBG_DTOR(OTableColumn,NULL);
}
-// com::sun::star::lang::XTypeProvider
+
//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OTableColumn::getImplementationId() throw (RuntimeException)
-{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
+IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumn )
-// ::com::sun::star::lang::XServiceInfo
//------------------------------------------------------------------------------
rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException)
{
@@ -402,75 +175,203 @@ rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException)
}
//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OTableColumn::getSupportedServiceNames( ) throw (RuntimeException)
+::cppu::IPropertyArrayHelper& SAL_CALL OTableColumn::getInfoHelper()
{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBCX_COLUMN;
- aSNS[1] = SERVICE_SDB_COLUMNSETTINGS;
- return aSNS;
+ return *OTableColumn_PBase::getArrayHelper();
}
//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OTableColumn::getInfoHelper()
+::cppu::IPropertyArrayHelper* OTableColumn::createArrayHelper( ) const
{
- return *static_cast< ::comphelper::OPropertyArrayUsageHelper< OTableColumn >* >(this)->getArrayHelper();
+ return OTableColumnDescriptor::createArrayHelper();
+}
+
+// =========================================================================
+//= OQueryColumn
+// =========================================================================
+DBG_NAME( OQueryColumn );
+
+// -------------------------------------------------------------------------
+OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection )
+ :OTableColumnDescriptor( false /* do not act as descriptor */ )
+{
+ const sal_Int32 nPropAttr = PropertyAttribute::READONLY;
+ registerProperty( PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, nPropAttr, &m_sCatalogName, ::getCppuType( &m_sCatalogName ) );
+ registerProperty( PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nPropAttr, &m_sSchemaName, ::getCppuType( &m_sSchemaName ) );
+ registerProperty( PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, nPropAttr, &m_sTableName, ::getCppuType( &m_sTableName ) );
+ registerProperty( PROPERTY_REALNAME, PROPERTY_ID_REALNAME, nPropAttr, &m_sRealName, ::getCppuType( &m_sRealName ) );
+
+ DBG_CTOR( OQueryColumn, NULL );
+
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_TYPENAME ) >>= m_aTypeName );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= m_nIsNullable );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_PRECISION ) >>= m_nPrecision );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_SCALE ) >>= m_nScale );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency );
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName );
+ m_bRowVersion = sal_False;
+
+ Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW );
+ if ( xPSI->hasPropertyByName( PROPERTY_DEFAULTVALUE ) )
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_DEFAULTVALUE ) >>= m_aDefaultValue );
+
+ // copy some optional properties from the parser column
+ struct PropertyDescriptor
+ {
+ ::rtl::OUString sName;
+ sal_Int32 nHandle;
+ };
+ PropertyDescriptor aProps[] =
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME },
+ { PROPERTY_REALNAME, PROPERTY_ID_REALNAME }
+ };
+ for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i )
+ {
+ if ( xPSI->hasPropertyByName( aProps[i].sName ) )
+ setFastPropertyValue_NoBroadcast( aProps[i].nHandle, _rxParserColumn->getPropertyValue( aProps[i].sName ) );
+ }
+
+ // determine the table column we're based on
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ m_xOriginalTableColumn = impl_determineOriginalTableColumn( _rxConnection );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+//--------------------------------------------------------------------------
+OQueryColumn::~OQueryColumn()
+{
+ DBG_DTOR( OQueryColumn, NULL );
+}
+
+//--------------------------------------------------------------------------
+Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const Reference< XConnection >& _rxConnection )
+{
+ OSL_PRECOND( _rxConnection.is(), "OQueryColumn::impl_determineOriginalTableColumn: illegal connection!" );
+ if ( !_rxConnection.is() )
+ return NULL;
+
+ Reference< XPropertySet > xOriginalTableColumn;
+ try
+ {
+ // determine the composed table name, plus the column name, as indicated by the
+ // respective properties
+ ::rtl::OUString sCatalog, sSchema, sTable;
+ OSL_VERIFY( getPropertyValue( PROPERTY_CATALOGNAME ) >>= sCatalog );
+ OSL_VERIFY( getPropertyValue( PROPERTY_SCHEMANAME ) >>= sSchema );
+ OSL_VERIFY( getPropertyValue( PROPERTY_TABLENAME ) >>= sTable );
+ if ( !sCatalog.getLength() && !sSchema.getLength() && !sTable.getLength() )
+ return NULL;
+
+ ::rtl::OUString sComposedTableName = ::dbtools::composeTableName(
+ _rxConnection->getMetaData(), sCatalog, sSchema, sTable, sal_False, ::dbtools::eComplete );
+
+ // retrieve the table in question
+ Reference< XTablesSupplier > xSuppTables( _rxConnection, UNO_QUERY_THROW );
+ Reference< XNameAccess > xTables( xSuppTables->getTables(), UNO_QUERY_THROW );
+ if ( !xTables->hasByName( sComposedTableName ) )
+ return NULL;
+
+ Reference< XColumnsSupplier > xSuppCols( xTables->getByName( sComposedTableName ), UNO_QUERY_THROW );
+ Reference< XNameAccess > xColumns( xSuppCols->getColumns(), UNO_QUERY_THROW );
+
+ ::rtl::OUString sColumn;
+ OSL_VERIFY( getPropertyValue( PROPERTY_REALNAME ) >>= sColumn );
+ if ( !xColumns->hasByName( sColumn ) )
+ return NULL;
+
+ xOriginalTableColumn.set( xColumns->getByName( sColumn ), UNO_QUERY );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xOriginalTableColumn;
+}
+
+//--------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( OQueryColumn )
+
+//--------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OQueryColumn::getImplementationName( ) throw(RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.dbaccess.OQueryColumn" ) );
}
-// comphelper::OPropertyArrayUsageHelper
//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OTableColumn::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper& SAL_CALL OQueryColumn::getInfoHelper()
{
- BEGIN_PROPERTY_HELPER(19)
- DECL_PROP2(ALIGN, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet , BOUND);
- DECL_PROP1(DEFAULTVALUE, ::rtl::OUString, READONLY);
- DECL_PROP1(DESCRIPTION, ::rtl::OUString, READONLY);
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP2(WIDTH, sal_Int32, BOUND, MAYBEVOID);
- END_PROPERTY_HELPER();
+ return *OQueryColumn_PBase::getArrayHelper();
}
-//============================================================
+//--------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* OQueryColumn::createArrayHelper() const
+{
+ return OTableColumnDescriptor::createArrayHelper();
+}
+
+//--------------------------------------------------------------------------
+void SAL_CALL OQueryColumn::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
+{
+ OTableColumnDescriptor::getFastPropertyValue( _rValue, _nHandle );
+
+ // special treatment for column settings:
+ if ( !OColumnSettings::isColumnSettingProperty( _nHandle ) )
+ return;
+
+ // If the setting has its default value, then try to obtain the value from the table column which
+ // this query column is based on
+ if ( !OColumnSettings::isDefaulted( _nHandle, _rValue ) )
+ return;
+
+ if ( !m_xOriginalTableColumn.is() )
+ return;
+
+ try
+ {
+ // determine original property name
+ ::rtl::OUString sPropName;
+ sal_Int16 nAttributes( 0 );
+ const_cast< OQueryColumn* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
+ OSL_ENSURE( sPropName.getLength(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
+
+ _rValue = m_xOriginalTableColumn->getPropertyValue( sPropName );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//==========================================================================
//= OColumnWrapper
-//============================================================
+//==========================================================================
DBG_NAME(OColumnWrapper);
//--------------------------------------------------------------------------
-OColumnWrapper::OColumnWrapper(const Reference< XPropertySet > & rCol)
- :m_xAggregate(rCol)
- ,m_nColTypeID(-1)
+OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bool _bNameIsReadOnly )
+ :OColumn( _bNameIsReadOnly )
+ ,m_xAggregate(rCol)
+ ,m_nColTypeID(-1)
{
DBG_CTOR(OColumnWrapper,NULL);
- // which type of aggregate property do we have
- if (m_nColTypeID == -1)
+ // which type of aggregate property do we have?
+ // we distingish the properties by the containment of optional properties
+ m_nColTypeID = 0;
+ if ( m_xAggregate.is() )
{
- // we distingish the properties by the containment of optional properties, these are:
- // Description 0x0001
- // Hidden 0x0002
- // IsRowVersion 0x0004
- m_nColTypeID = 0;
- if ( m_xAggregate.is() )
- {
- Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
+ Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
- m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
- }
+ m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
}
}
// -----------------------------------------------------------------------------
@@ -480,91 +381,91 @@ OColumnWrapper::~OColumnWrapper()
}
//------------------------------------------------------------------------------
+::rtl::OUString OColumnWrapper::impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const
+{
+ ::rtl::OUString sPropName;
+ sal_Int16 nAttributes( 0 );
+ const_cast< OColumnWrapper* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
+ OSL_ENSURE( sPropName.getLength(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
+ return sPropName;
+}
+
+//------------------------------------------------------------------------------
void OColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
- switch (nHandle)
+ // derived classes are free to either use the OPropertyContainer(Helper) mechanisms for properties,
+ // or to declare additional properties which are to be forwarded to the wrapped object. So we need
+ // to distinguish those cases.
+ if ( OColumn::isRegisteredProperty( nHandle ) )
{
- case PROPERTY_ID_NAME:
- rValue <<= m_sName;
- break;
- default:
- {
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OColumnWrapper*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = m_xAggregate->getPropertyValue(aPropName);
- }
+ OColumn::getFastPropertyValue( rValue, nHandle );
+ }
+ else
+ {
+ rValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
}
}
//------------------------------------------------------------------------------
-sal_Bool OColumnWrapper::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
+sal_Bool OColumnWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle,
+ const Any& rValue ) throw (IllegalArgumentException)
{
- // used for the name
- sal_Bool bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
-
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- getInfoHelper().fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- m_xAggregate->setPropertyValue(aPropName, rValue);
+ sal_Bool bModified( sal_False );
+ if ( OColumn::isRegisteredProperty( nHandle ) )
+ {
+ bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
+ }
+ else
+ {
+ getFastPropertyValue( rOldValue, nHandle );
+ if ( rOldValue != rValue )
+ {
+ rConvertedValue = rValue;
+ bModified = sal_True;
+ }
+ }
return bModified;
}
//------------------------------------------------------------------------------
-void OColumnWrapper::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
+void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
{
- OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ if ( OColumn::isRegisteredProperty( nHandle ) )
+ {
+ OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ }
+ else
+ {
+ m_xAggregate->setPropertyValue( impl_getPropertyNameFromHandle( nHandle ), rValue );
+ }
}
+
// -----------------------------------------------------------------------------
sal_Int64 SAL_CALL OColumnWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw(RuntimeException)
{
- sal_Int64 nRet = OColumn::getSomething(aIdentifier);
- if(!nRet)
- {
- Reference<XUnoTunnel> xTunnel(m_xAggregate,UNO_QUERY);
- if(xTunnel.is())
- nRet = xTunnel->getSomething(aIdentifier);
- }
- return nRet;
+ Reference< XUnoTunnel > xTunnel( m_xAggregate, UNO_QUERY);
+ if ( xTunnel.is() )
+ return xTunnel->getSomething( aIdentifier );
+ return 0;
}
+
//============================================================
//= OTableColumnDescriptorWrapper
//============================================================
-// com::sun::star::lang::XTypeProvider
//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OTableColumnDescriptorWrapper::getImplementationId() throw (RuntimeException)
+OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference< XPropertySet >& _rCol, const bool _bPureWrap, const bool _bIsDescriptor )
+ :OColumnWrapper( _rCol, !_bIsDescriptor )
+ ,m_bPureWrap( _bPureWrap )
+ ,m_bIsDescriptor( _bIsDescriptor )
{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
+ // let the ColumnSettings register its properties
+ OColumnSettings::registerProperties( *this );
}
+// com::sun::star::lang::XTypeProvider
+//--------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptorWrapper )
+
// ::com::sun::star::lang::XServiceInfo
//------------------------------------------------------------------------------
rtl::OUString OTableColumnDescriptorWrapper::getImplementationName( ) throw (RuntimeException)
@@ -581,74 +482,72 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa
return aSNS;
}
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OTableColumnDescriptorWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw(RuntimeException)
-{
- sal_Int64 nReturn = OColumnWrapper::getSomething( aIdentifier );
- if ( !nReturn )
- nReturn = OColumnSettings::getSomething( aIdentifier );
- return nReturn;
-}
-
// comphelper::OPropertyArrayUsageHelper
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumnDescriptorWrapper::createArrayHelper( sal_Int32 nId ) const
{
- // BEGIN_PROPERTY_HELPER(17)
- sal_Int32 nPropertyCount = 16;
- // How many properties do we have?
+ const sal_Int32 nHaveAlways = 7;
+
// Which optional properties are contained?
+ sal_Int32 nHaveOptionally = 0;
if (nId & HAS_DESCRIPTION)
- ++nPropertyCount;
+ ++nHaveOptionally;
if (nId & HAS_DEFAULTVALUE)
- ++nPropertyCount;
+ ++nHaveOptionally;
if (nId & HAS_ROWVERSION)
- ++nPropertyCount;
+ ++nHaveOptionally;
if ( nId & HAS_AUTOINCREMENT_CREATION )
- ++nPropertyCount;
+ ++nHaveOptionally;
- Sequence< Property> aDescriptor(nPropertyCount);
- Property* pDesc = aDescriptor.getArray();
+ const sal_Int32 nPropertyCount( nHaveAlways + nHaveOptionally );
+ Sequence< Property > aTableDescProperties( nPropertyCount );
+ Property* pDesc = aTableDescProperties.getArray();
sal_Int32 nPos = 0;
- // Description, Defaultvalue, IsRowVersion
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- {
- DECL_PROP1(AUTOINCREMENTCREATION,::rtl::OUString, MAYBEVOID);
- }
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- if (nId & HAS_DEFAULTVALUE)
- {
- DECL_PROP0(DEFAULTVALUE, ::rtl::OUString );
- }
+ 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, ::rtl::OUString );
- if (nId & HAS_DESCRIPTION)
- {
- DECL_PROP0(DESCRIPTION, ::rtl::OUString );
- }
+ if ( nId & HAS_AUTOINCREMENT_CREATION )
+ {
+ DECL_PROP1( AUTOINCREMENTCREATION, ::rtl::OUString, MAYBEVOID );
+ }
+ if ( nId & HAS_DEFAULTVALUE )
+ {
+ DECL_PROP0( DEFAULTVALUE, ::rtl::OUString );
+ }
+ if ( nId & HAS_DESCRIPTION )
+ {
+ DECL_PROP0( DESCRIPTION, ::rtl::OUString );
+ }
+ if ( nId & HAS_ROWVERSION )
+ {
+ DECL_PROP0_BOOL( ISROWVERSION );
+ }
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP0_BOOL(ISAUTOINCREMENT );
- DECL_PROP0_BOOL(ISCURRENCY );
- DECL_PROP0(ISNULLABLE, sal_Int32 );
+ OSL_ENSURE( nPos == nPropertyCount, "OTableColumnDescriptorWrapper::createArrayHelper: something went wrong!" );
- if (nId & HAS_ROWVERSION)
+ if ( !m_bIsDescriptor )
+ {
+ for ( Property* prop = aTableDescProperties.getArray();
+ prop != aTableDescProperties.getArray() + aTableDescProperties.getLength();
+ ++prop
+ )
{
- DECL_PROP0_BOOL(ISROWVERSION );
+ prop->Attributes |= PropertyAttribute::READONLY;
}
+ }
- DECL_PROP0(NAME, ::rtl::OUString );
- DECL_PROP0(PRECISION, sal_Int32 );
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP0(SCALE, sal_Int32 );
- DECL_PROP0(TYPE, sal_Int32 );
- DECL_PROP0(TYPENAME, ::rtl::OUString );
- DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
- END_PROPERTY_HELPER();
+ // finally also describe the properties which are maintained by our base class, in particular the OPropertyContainerHelper
+ Sequence< Property > aBaseProperties;
+ describeProperties( aBaseProperties );
+
+ Sequence< Property > aAllProperties( ::comphelper::concatSequences( aTableDescProperties, aBaseProperties ) );
+ return new ::cppu::OPropertyArrayHelper( aAllProperties, sal_False );
}
// cppu::OPropertySetHelper
@@ -663,75 +562,36 @@ void OTableColumnDescriptorWrapper::getFastPropertyValue( Any& rValue, sal_Int32
{
if ( m_bPureWrap )
{
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OTableColumnDescriptorWrapper*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = m_xAggregate->getPropertyValue(aPropName);
+ rValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
}
else
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- break;
- default:
- {
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OTableColumnDescriptorWrapper*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = m_xAggregate->getPropertyValue(aPropName);
- }
- }
+ OColumnWrapper::getFastPropertyValue( rValue, nHandle );
}
}
//------------------------------------------------------------------------------
-sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
+sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw (IllegalArgumentException)
{
sal_Bool bModified(sal_False);
if ( m_bPureWrap )
- bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- else
{
- switch (nHandle)
+ // do not delegate to OColumnWrapper: It would, for the properties which were registered with registerProperty,
+ // ask the OPropertyContainer base class, which is not what we want here.
+ // TODO: the whole "m_bPureWrap"-thingie is strange. We should have a dedicated class doing this wrapping,
+ // not a class which normally serves other purposes, and only sometimes does a "pure wrap". It makes the
+ // code unnecessarily hard to maintain, and error prone.
+ rOldValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
+ if ( rOldValue != rValue )
{
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- default:
- bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
+ rConvertedValue = rValue;
+ bModified = sal_True;
}
}
+ else
+ {
+ bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
+ }
return bModified;
}
@@ -743,24 +603,12 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
throw (Exception)
{
if ( m_bPureWrap )
- OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ {
+ m_xAggregate->setPropertyValue( impl_getPropertyNameFromHandle( nHandle ), rValue );
+ }
else
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- default:
- OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- }
+ OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
}
}
@@ -768,24 +616,23 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
//= OTableColumnWrapper
//============================================================
//--------------------------------------------------------------------------
-OTableColumnWrapper::OTableColumnWrapper(const Reference< XPropertySet >& rCol
- ,const Reference< XPropertySet >& _xColDefintion
- ,sal_Bool _bPureWrap)
- :OTableColumnDescriptorWrapper(rCol,_bPureWrap)
+OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefintion,
+ const bool _bPureWrap )
+ :OTableColumnDescriptorWrapper( rCol, _bPureWrap, false )
{
- osl_incrementInterlockedCount(&m_refCount);
+ osl_incrementInterlockedCount( &m_refCount );
if ( _xColDefintion.is() )
{
try
{
- ::comphelper::copyProperties(_xColDefintion,this);
+ ::comphelper::copyProperties( _xColDefintion, this );
}
- catch(Exception&)
+ catch( const Exception& )
{
- OSL_ENSURE(sal_False, "OTableColumnWrapper::OTableColumnWrapper: caught an exception!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
- osl_decrementInterlockedCount(&m_refCount);
+ osl_decrementInterlockedCount( &m_refCount );
}
//--------------------------------------------------------------------------
@@ -793,27 +640,13 @@ OTableColumnWrapper::~OTableColumnWrapper()
{
}
-// com::sun::star::lang::XTypeProvider
//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OTableColumnWrapper::getImplementationId() throw (RuntimeException)
-{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// ::com::sun::star::lang::XServiceInfo
+IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnWrapper )
+
//------------------------------------------------------------------------------
rtl::OUString OTableColumnWrapper::getImplementationName( ) throw (RuntimeException)
{
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnWrapper");
+ return rtl::OUString::createFromAscii( "com.sun.star.sdb.OTableColumnWrapper" );
}
//------------------------------------------------------------------------------
@@ -835,206 +668,6 @@ Sequence< ::rtl::OUString > OTableColumnWrapper::getSupportedServiceNames( ) th
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumnWrapper::createArrayHelper( sal_Int32 nId ) const
{
- // BEGIN_PROPERTY_HELPER(17)
- sal_Int32 nPropertyCount = 16;
- // How many properties do we have?
- // Which optional properties are contained?
- if (nId & HAS_DESCRIPTION)
- nPropertyCount++;
- if (nId & HAS_DEFAULTVALUE)
- nPropertyCount++;
- if (nId & HAS_ROWVERSION)
- nPropertyCount++;
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- ++nPropertyCount;
-
- Sequence< Property> aDescriptor(nPropertyCount);
- Property* pDesc = aDescriptor.getArray();
- sal_Int32 nPos = 0;
-
- // Description, Defaultvalue, IsRowVersion
- DECL_PROP2(ALIGN, sal_Int32, BOUND, MAYBEVOID);
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- {
- DECL_PROP1(AUTOINCREMENTCREATION,::rtl::OUString, MAYBEVOID);
- }
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet , BOUND);
- if (nId & HAS_DEFAULTVALUE)
- {
- DECL_PROP1(DEFAULTVALUE, ::rtl::OUString, READONLY);
- }
-
- if (nId & HAS_DESCRIPTION)
- {
- DECL_PROP1(DESCRIPTION, ::rtl::OUString, READONLY);
- }
-
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
-
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
-
- if (nId & HAS_ROWVERSION)
- {
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- }
-
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP2(WIDTH, sal_Int32, BOUND, MAYBEVOID);
- END_PROPERTY_HELPER();
-}
-
-//============================================================
-//= OIndexColumnWrapper
-//============================================================
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OIndexColumnWrapper::getImplementationId() throw (RuntimeException)
-{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// ::com::sun::star::lang::XServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OIndexColumnWrapper::getImplementationName( ) throw (RuntimeException)
-{
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OIndexColumnWrapper");
-}
-
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OIndexColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBCX_COLUMN;
- aSNS[1] = SERVICE_SDBCX_INDEXCOLUMN;
- return aSNS;
-}
-
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OIndexColumnWrapper::getInfoHelper()
-{
- return *static_cast< OPropertyArrayUsageHelper< OIndexColumnWrapper >* >(this)->getArrayHelper();
-}
-
-// comphelper::OPropertyArrayUsageHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OIndexColumnWrapper::createArrayHelper() const
-{
- BEGIN_PROPERTY_HELPER(9)
- DECL_PROP1_BOOL(ISASCENDING, READONLY);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- END_PROPERTY_HELPER();
-}
-
-//------------------------------------------------------------------------------
-void OIndexColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISASCENDING:
- {
- sal_Bool bVal = m_bAscending;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- default:
- OColumnWrapper::getFastPropertyValue( rValue, nHandle );
- }
+ return OTableColumnDescriptorWrapper::createArrayHelper( nId );
}
-//============================================================
-//= OKeyColumnWrapper
-//============================================================
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OKeyColumnWrapper::getImplementationId() throw (RuntimeException)
-{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// ::com::sun::star::lang::XServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OKeyColumnWrapper::getImplementationName( ) throw (RuntimeException)
-{
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OIndexColumnWrapper");
-}
-
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OKeyColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBCX_COLUMN;
- aSNS[1] = SERVICE_SDBCX_KEYCOLUMN;
- return aSNS;
-}
-
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OKeyColumnWrapper::getInfoHelper()
-{
- return *static_cast< OPropertyArrayUsageHelper< OKeyColumnWrapper >* >(this)->getArrayHelper();
-}
-
-// comphelper::OPropertyArrayUsageHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OKeyColumnWrapper::createArrayHelper() const
-{
- BEGIN_PROPERTY_HELPER(9)
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP1(RELATEDCOLUMN, ::rtl::OUString, READONLY);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- END_PROPERTY_HELPER();
-}
-
-//------------------------------------------------------------------------------
-void OKeyColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_RELATEDCOLUMN:
- rValue <<= m_aRelatedColumn;
- break;
- default:
- OColumnWrapper::getFastPropertyValue( rValue, nHandle );
- }
-}
-
-
diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk
index 59d89fb9036f..f983db38b640 100644
--- a/dbaccess/source/core/api/makefile.mk
+++ b/dbaccess/source/core/api/makefile.mk
@@ -73,7 +73,8 @@ SLOFILES= \
$(SLO)$/tablecontainer.obj \
$(SLO)$/SingleSelectQueryComposer.obj \
$(SLO)$/HelperCollections.obj \
- $(SLO)$/datasettings.obj
+ $(SLO)$/datasettings.obj \
+ $(SLO)$/columnsettings.obj
# --- Targets ----------------------------------
diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx
index 761b27fc94ed..f2fd05cdf12c 100644
--- a/dbaccess/source/core/api/preparedstatement.cxx
+++ b/dbaccess/source/core/api/preparedstatement.cxx
@@ -30,39 +30,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_PREPAREDSTATEMENT_HXX_
-#include <preparedstatement.hxx>
-#endif
-#ifndef _DBA_COREAPI_RESULTSET_HXX_
-#include <resultset.hxx>
-#endif
-#ifndef _DBA_COREAPI_RESULTCOLUMN_HXX_
-#include <resultcolumn.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
+
#include "dbastrings.hrc"
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+
#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
+
+#include <comphelper/property.hxx>
#include <comphelper/sequence.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <preparedstatement.hxx>
+#include <resultcolumn.hxx>
+#include <resultset.hxx>
#include <tools/debug.hxx>
-#endif
+#include <tools/diagnose_ex.h>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
@@ -203,27 +185,23 @@ Reference< ::com::sun::star::container::XNameAccess > OPreparedStatement::getCol
{
try
{
- // get the metadata
- Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xAggregateAsSet, UNO_QUERY)->getMetaData();
- // do we have columns
- if ( xMetaData.is() )
+ Reference< XResultSetMetaDataSupplier > xSuppMeta( m_xAggregateAsSet, UNO_QUERY_THROW );
+ Reference< XResultSetMetaData > xMetaData( xSuppMeta->getMetaData(), UNO_SET_THROW );
+
+ Reference< XConnection > xConn( getConnection(), UNO_SET_THROW );
+ Reference< XDatabaseMetaData > xDBMeta( xConn->getMetaData(), UNO_SET_THROW );
+
+ for (sal_Int32 i = 0, nCount = xMetaData->getColumnCount(); i < nCount; ++i)
{
- Reference< XDatabaseMetaData > xDBMeta;
- Reference< XConnection > xConn( getConnection() );
- if ( xConn.is() )
- xDBMeta = xConn->getMetaData();
-
- for (sal_Int32 i = 0, nCount = xMetaData->getColumnCount(); i < nCount; ++i)
- {
- // retrieve the name of the column
- rtl::OUString aName = xMetaData->getColumnName(i + 1);
- OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
- m_pColumns->append(aName, pColumn);
- }
+ // retrieve the name of the column
+ rtl::OUString aName = xMetaData->getColumnName(i + 1);
+ OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
+ m_pColumns->append(aName, pColumn);
}
}
- catch (SQLException)
+ catch (const SQLException& )
{
+ DBG_UNHANDLED_EXCEPTION();
}
m_pColumns->setInitialized();
}
@@ -236,7 +214,7 @@ Reference< XResultSetMetaData > OPreparedStatement::getMetaData(void) throw( SQL
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
- return Reference< XResultSetMetaDataSupplier >(m_xAggregateAsSet, UNO_QUERY)->getMetaData();
+ return Reference< XResultSetMetaDataSupplier >( m_xAggregateAsSet, UNO_QUERY_THROW )->getMetaData();
}
// XPreparedStatement
@@ -249,7 +227,7 @@ Reference< XResultSet > OPreparedStatement::executeQuery() throw( SQLException,
disposeResultSet();
Reference< XResultSet > xResultSet;
- Reference< XResultSet > xDrvResultSet = Reference< XPreparedStatement >(m_xAggregateAsSet, UNO_QUERY)->executeQuery();
+ Reference< XResultSet > xDrvResultSet = Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeQuery();
if (xDrvResultSet.is())
{
xResultSet = new OResultSet(xDrvResultSet, *this, m_pColumns->isCaseSensitive());
@@ -268,7 +246,7 @@ sal_Int32 OPreparedStatement::executeUpdate() throw( SQLException, RuntimeExcept
disposeResultSet();
- return Reference< XPreparedStatement >(m_xAggregateAsSet, UNO_QUERY)->executeUpdate();
+ return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeUpdate();
}
//------------------------------------------------------------------------------
@@ -278,7 +256,8 @@ sal_Bool OPreparedStatement::execute() throw( SQLException, RuntimeException )
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
disposeResultSet();
- return Reference< XPreparedStatement >(m_xAggregateAsSet, UNO_QUERY)->execute();
+
+ return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->execute();
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index 489ca625c5d7..7468e88f4fff 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -241,13 +241,12 @@ void OQuery::rebuildColumns()
for ( ;pBegin != pEnd; ++pBegin)
{
Reference<XPropertySet> xSource(xColumns->getByName( *pBegin ),UNO_QUERY);
- OTableColumn* pColumn = new OTableColumn( xSource );
- Reference<XChild> xChild(*pColumn,UNO_QUERY);
- if ( xChild.is() )
- xChild->setParent(*this);
+ OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection );
+ Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW );
+ xChild->setParent( *this );
implAppendColumn( *pBegin, pColumn );
- Reference<XPropertySet> xDest(*pColumn,UNO_QUERY);
+ Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW );
if ( m_pColumnMediator.is() )
m_pColumnMediator->notifyElementCreated( *pBegin, xDest );
}
diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx
index f86a1a8bf6e5..2d75ce3bf8bd 100644
--- a/dbaccess/source/core/api/querycontainer.cxx
+++ b/dbaccess/source/core/api/querycontainer.cxx
@@ -163,6 +163,10 @@ OQueryContainer::~OQueryContainer()
}
// -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2( OQueryContainer,ODefinitionContainer,OQueryContainer_Base)
+
+//------------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( OQueryContainer,ODefinitionContainer,OQueryContainer_Base)
+
//------------------------------------------------------------------------------
void OQueryContainer::disposing()
{
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index 5f8c265e36df..2dfb6714ee63 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -242,7 +242,7 @@ Reference< XNameAccess > SAL_CALL OQueryDescriptor_Base::getColumns( ) throw (Ru
{
rebuildColumns();
}
- catch(...)
+ catch ( const Exception& )
{
setColumnsOutOfDate( sal_True );
throw;
@@ -313,9 +313,10 @@ void OQueryDescriptor_Base::refreshColumns()
}
//------------------------------------------------------------------------------
-OColumn* OQueryDescriptor_Base::createColumn(const ::rtl::OUString& _rName) const
+OColumn* OQueryDescriptor_Base::createColumn( const ::rtl::OUString& /*_rName*/ ) const
{
- return new OTableColumn(_rName);
+ // creating a column/descriptor for a query/descriptor does not make sense at all
+ return NULL;
}
// -----------------------------------------------------------------------------
//........................................................................
diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx
index 4fb765148df9..33cc93b02994 100644
--- a/dbaccess/source/core/api/resultcolumn.cxx
+++ b/dbaccess/source/core/api/resultcolumn.cxx
@@ -82,13 +82,12 @@ using namespace dbaccess;
DBG_NAME(OResultColumn)
//--------------------------------------------------------------------------
-OResultColumn::OResultColumn(
- const Reference < XResultSetMetaData >& _xMetaData,
- sal_Int32 _nPos,
- const Reference< XDatabaseMetaData >& _rxDBMeta )
- :m_xMetaData(_xMetaData)
- ,m_xDBMetaData(_rxDBMeta)
- ,m_nPos(_nPos)
+OResultColumn::OResultColumn( const Reference < XResultSetMetaData >& _xMetaData, sal_Int32 _nPos,
+ const Reference< XDatabaseMetaData >& _rxDBMeta )
+ :OColumn( true )
+ ,m_xMetaData( _xMetaData )
+ ,m_xDBMetaData( _rxDBMeta )
+ ,m_nPos( _nPos )
{
DBG_CTOR(OResultColumn,NULL);
}
@@ -216,112 +215,95 @@ void OResultColumn::disposing()
}
//------------------------------------------------------------------------------
+namespace
+{
+ template< typename TYPE >
+ void obtain( Any& _out_rValue, ::boost::optional< TYPE > _rCache, const sal_Int32 _nPos, const Reference < XResultSetMetaData >& _rxResultMeta, TYPE (SAL_CALL XResultSetMetaData::*Getter)( sal_Int32 ) )
+ {
+ if ( !_rCache )
+ _rCache.reset( (_rxResultMeta.get()->*Getter)( _nPos ) );
+ _out_rValue <<= *_rCache;
+ }
+}
+
+//------------------------------------------------------------------------------
void OResultColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
try
{
- switch (nHandle)
+ if ( OColumn::isRegisteredProperty( nHandle ) )
{
- case PROPERTY_ID_ISROWVERSION:
- const_cast< OResultColumn* >( this )->impl_determineIsRowVersion_nothrow();
- rValue = m_aIsRowVersion;
- break;
- case PROPERTY_ID_TABLENAME:
- rValue <<= m_xMetaData->getTableName(m_nPos);
- break;
- case PROPERTY_ID_SCHEMANAME:
- rValue <<= m_xMetaData->getSchemaName(m_nPos);
- break;
- case PROPERTY_ID_CATALOGNAME:
- rValue <<= m_xMetaData->getCatalogName(m_nPos);
- break;
- case PROPERTY_ID_ISSIGNED:
- {
- if ( !m_isSigned )
- m_isSigned.reset( m_xMetaData->isSigned(m_nPos));
- rValue <<= *m_isSigned;
- } break;
- case PROPERTY_ID_ISCURRENCY:
- {
- if ( !m_isCurrency )
- m_isCurrency.reset( m_xMetaData->isCurrency(m_nPos));
- rValue <<= *m_isCurrency;
- } break;
- case PROPERTY_ID_ISSEARCHABLE:
- {
- if ( !m_bSearchable )
- m_bSearchable.reset( m_xMetaData->isSearchable(m_nPos));
- rValue <<= *m_bSearchable;
- } break;
- case PROPERTY_ID_ISCASESENSITIVE:
- {
- if ( !m_isCaseSensitive )
- m_isCaseSensitive.reset( m_xMetaData->isCaseSensitive(m_nPos));
- rValue <<= *m_isCaseSensitive;
- } break;
- case PROPERTY_ID_ISREADONLY:
- {
- if ( !m_isReadOnly )
- m_isReadOnly.reset( m_xMetaData->isReadOnly(m_nPos));
- rValue <<= *m_isReadOnly;
- } break;
- case PROPERTY_ID_ISWRITABLE:
- {
- if ( !m_isWritable )
- m_isWritable.reset( m_xMetaData->isWritable(m_nPos));
- rValue <<= *m_isWritable;
- } break;
- case PROPERTY_ID_ISDEFINITELYWRITABLE:
- {
- if ( !m_isDefinitelyWritable )
- m_isDefinitelyWritable.reset( m_xMetaData->isDefinitelyWritable(m_nPos));
- rValue <<= *m_isDefinitelyWritable;
- } break;
- case PROPERTY_ID_ISAUTOINCREMENT:
+ OColumn::getFastPropertyValue( rValue, nHandle );
+ }
+ else
+ {
+ switch (nHandle)
{
- if ( !m_isAutoIncrement )
- m_isAutoIncrement.reset( m_xMetaData->isAutoIncrement(m_nPos));
- rValue <<= *m_isAutoIncrement;
- } break;
- case PROPERTY_ID_SERVICENAME:
- rValue <<= m_xMetaData->getColumnServiceName(m_nPos);
- break;
- case PROPERTY_ID_LABEL:
- if ( !m_sColumnLabel )
- m_sColumnLabel.reset( m_xMetaData->getColumnLabel(m_nPos));
- rValue <<= *m_sColumnLabel;
- break;
- case PROPERTY_ID_DISPLAYSIZE:
- if ( !m_nColumnDisplaySize )
- m_nColumnDisplaySize.reset( m_xMetaData->getColumnDisplaySize(m_nPos));
- rValue <<= *m_nColumnDisplaySize;
- break;
- case PROPERTY_ID_TYPE:
- if ( !m_nColumnType )
- m_nColumnType.reset( m_xMetaData->getColumnType(m_nPos));
- rValue <<= *m_nColumnType;
- break;
- case PROPERTY_ID_PRECISION:
- if ( !m_nPrecision )
- m_nPrecision.reset( m_xMetaData->getPrecision(m_nPos));
- rValue <<= *m_nPrecision;
- break;
- case PROPERTY_ID_SCALE:
- if ( !m_nScale )
- m_nScale.reset( m_xMetaData->getScale(m_nPos));
- rValue <<= *m_nScale;
- break;
- case PROPERTY_ID_ISNULLABLE:
- if ( !m_isNullable )
- m_isNullable.reset( m_xMetaData->isNullable(m_nPos));
- rValue <<= *m_isNullable;
- break;
- case PROPERTY_ID_TYPENAME:
- rValue <<= m_xMetaData->getColumnTypeName(m_nPos);
- break;
- case PROPERTY_ID_NAME:
- OColumn::getFastPropertyValue( rValue, nHandle );
- break;
+ case PROPERTY_ID_ISROWVERSION:
+ const_cast< OResultColumn* >( this )->impl_determineIsRowVersion_nothrow();
+ rValue = m_aIsRowVersion;
+ break;
+ case PROPERTY_ID_TABLENAME:
+ rValue <<= m_xMetaData->getTableName(m_nPos);
+ break;
+ case PROPERTY_ID_SCHEMANAME:
+ rValue <<= m_xMetaData->getSchemaName(m_nPos);
+ break;
+ case PROPERTY_ID_CATALOGNAME:
+ rValue <<= m_xMetaData->getCatalogName(m_nPos);
+ break;
+ case PROPERTY_ID_ISSIGNED:
+ obtain( rValue, m_isSigned, m_nPos, m_xMetaData, &XResultSetMetaData::isSigned );
+ break;
+ case PROPERTY_ID_ISCURRENCY:
+ obtain( rValue, m_isCurrency, m_nPos, m_xMetaData, &XResultSetMetaData::isCurrency );
+ break;
+ case PROPERTY_ID_ISSEARCHABLE:
+ obtain( rValue, m_bSearchable, m_nPos, m_xMetaData, &XResultSetMetaData::isSearchable );
+ break;
+ case PROPERTY_ID_ISCASESENSITIVE:
+ obtain( rValue, m_isCaseSensitive, m_nPos, m_xMetaData, &XResultSetMetaData::isCaseSensitive );
+ break;
+ case PROPERTY_ID_ISREADONLY:
+ obtain( rValue, m_isReadOnly, m_nPos, m_xMetaData, &XResultSetMetaData::isReadOnly );
+ break;
+ case PROPERTY_ID_ISWRITABLE:
+ obtain( rValue, m_isWritable, m_nPos, m_xMetaData, &XResultSetMetaData::isWritable );
+ break;
+ case PROPERTY_ID_ISDEFINITELYWRITABLE:
+ obtain( rValue, m_isDefinitelyWritable, m_nPos, m_xMetaData, &XResultSetMetaData::isDefinitelyWritable );
+ break;
+ case PROPERTY_ID_ISAUTOINCREMENT:
+ obtain( rValue, m_isAutoIncrement, m_nPos, m_xMetaData, &XResultSetMetaData::isAutoIncrement );
+ break;
+ case PROPERTY_ID_SERVICENAME:
+ rValue <<= m_xMetaData->getColumnServiceName(m_nPos);
+ break;
+ case PROPERTY_ID_LABEL:
+ obtain( rValue, m_sColumnLabel, m_nPos, m_xMetaData, &XResultSetMetaData::getColumnLabel );
+ break;
+ case PROPERTY_ID_DISPLAYSIZE:
+ obtain( rValue, m_nColumnDisplaySize, m_nPos, m_xMetaData, &XResultSetMetaData::getColumnDisplaySize );
+ break;
+ case PROPERTY_ID_TYPE:
+ obtain( rValue, m_nColumnType, m_nPos, m_xMetaData, &XResultSetMetaData::getColumnType );
+ break;
+ case PROPERTY_ID_PRECISION:
+ obtain( rValue, m_nPrecision, m_nPos, m_xMetaData, &XResultSetMetaData::getPrecision );
+ break;
+ case PROPERTY_ID_SCALE:
+ obtain( rValue, m_nScale, m_nPos, m_xMetaData, &XResultSetMetaData::getScale );
+ break;
+ case PROPERTY_ID_ISNULLABLE:
+ obtain( rValue, m_isNullable, m_nPos, m_xMetaData, &XResultSetMetaData::isNullable );
+ break;
+ case PROPERTY_ID_TYPENAME:
+ rValue <<= m_xMetaData->getColumnTypeName(m_nPos);
+ break;
+ default:
+ OSL_ENSURE( false, "OResultColumn::getFastPropertyValue: unknown property handle!" );
+ break;
+ }
}
}
catch (SQLException& )
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index 9d2772a5f3ef..301038903b97 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -182,7 +182,7 @@ OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const
Reference<XPropertySet> xColumnDefintion;
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper(xProp,xColumnDefintion);
+ pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
return pReturn;
}
@@ -468,7 +468,7 @@ Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId()
Reference< XPropertySet > ODBTable::createColumnDescriptor()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" );
- return new OTableColumnDescriptor();
+ return new OTableColumnDescriptor( true );
}
// -----------------------------------------------------------------------------
sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames)
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index 2d8ce453fb2c..8c1abc1f0048 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -364,15 +364,11 @@ ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, cons
if ( !xColumnDefinitions->hasByName(*pIter) )
{
Reference<XPropertySet> xColumn(xNames->getByName(*pIter),UNO_QUERY);
- OColumnSettings* pColumnSettings = NULL;
- if ( ::comphelper::getImplementation( pColumnSettings, xColumn ) )
+ if ( !OColumnSettings::hasDefaultSettings( xColumn ) )
{
- if ( ( pColumnSettings && !pColumnSettings->isDefaulted() ) )
- {
- ::comphelper::copyProperties(xColumn,xProp);
- xAppend->appendByDescriptor(xProp);
- bModified = sal_True;
- }
+ ::comphelper::copyProperties( xColumn, xProp );
+ xAppend->appendByDescriptor( xProp );
+ bModified = sal_True;
}
}
}
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index 452931848e5c..678ed2ce612e 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
@@ -280,14 +280,16 @@ OColumn* OComponentDefinition::createColumn(const ::rtl::OUString& _rName) const
if ( aFind != rDefinition.end() )
{
aFind->second->addPropertyChangeListener(::rtl::OUString(),m_xColumnPropertyListener.getRef());
- return new OTableColumnWrapper( aFind->second, aFind->second, sal_True );
+ return new OTableColumnWrapper( aFind->second, aFind->second, true );
}
+ OSL_ENSURE( false, "OComponentDefinition::createColumn: is this a valid case?" );
+ // This here is the last place creating a OTableColumn, and somehow /me thinks it is not needed ...
return new OTableColumn( _rName );
}
// -----------------------------------------------------------------------------
Reference< XPropertySet > OComponentDefinition::createColumnDescriptor()
{
- return new OTableColumnDescriptor();
+ return new OTableColumnDescriptor( true );
}
// -----------------------------------------------------------------------------
void OComponentDefinition::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
@@ -307,7 +309,7 @@ void OComponentDefinition::columnAppended( const Reference< XPropertySet >& _rxS
::rtl::OUString sName;
_rxSourceDescriptor->getPropertyValue( PROPERTY_NAME ) >>= sName;
- Reference<XPropertySet> xColDesc = new OTableColumnDescriptor();
+ Reference<XPropertySet> xColDesc = new OTableColumnDescriptor( true );
::comphelper::copyProperties( _rxSourceDescriptor, xColDesc );
getDefinition().insert( sName, xColDesc );
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 755f8f717d25..fef47f68145a 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -546,7 +546,7 @@ void ODatabaseModelImpl::impl_construct_nothrow()
Property aProperty(
::rtl::OUString::createFromAscii( pSettings->AsciiName ),
-1,
- ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ),
+ pSettings->ValueType,
PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID
);
xSettingsSet->insert( makeAny( aProperty ) );
@@ -1164,8 +1164,9 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "ParameterNameSubstitution", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AddIndexAppendix", makeAny( (sal_Bool)sal_True ) ),
AsciiPropertyValue( "IgnoreDriverPrivileges", makeAny( (sal_Bool)sal_True ) ),
- AsciiPropertyValue( "ImplicitCatalogRestriction", Any( ) ),
- AsciiPropertyValue( "ImplicitSchemaRestriction", Any( ) ),
+ AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
+ AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
+ AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
// known SDB level settings
AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ),
@@ -1182,7 +1183,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( (sal_Bool)sal_True ) ),
AsciiPropertyValue( "EscapeDateTime", makeAny( (sal_Bool)sal_True ) ),
- AsciiPropertyValue( NULL, Any() )
+ AsciiPropertyValue()
};
return aKnownSettings;
}
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index f9b38be569af..4dd72cf5b319 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -104,13 +104,32 @@ struct AsciiPropertyValue
// 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.
- ::com::sun::star::uno::Any DefaultValue;
- const sal_Char* AsciiName;
+ ::com::sun::star::uno::Any DefaultValue;
+ const sal_Char* AsciiName;
+ const ::com::sun::star::uno::Type& ValueType;
+
+ AsciiPropertyValue()
+ :DefaultValue( )
+ ,AsciiName( NULL )
+ ,ValueType( ::cppu::UnoType< ::cppu::UnoVoidType >::get() )
+ {
+ }
AsciiPropertyValue( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rDefaultValue )
:DefaultValue( _rDefaultValue )
,AsciiName( _pAsciiName )
+ ,ValueType( _rDefaultValue.getValueType() )
+ {
+ OSL_ENSURE( ValueType.getTypeClass() != ::com::sun::star::uno::TypeClass_VOID,
+ "AsciiPropertyValue::AsciiPropertyValue: NULL values not allowed here, use the other CTOR for this!" );
+ }
+ AsciiPropertyValue( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Type& _rValeType )
+ :DefaultValue()
+ ,AsciiName( _pAsciiName )
+ ,ValueType( _rValeType )
{
+ OSL_ENSURE( ValueType.getTypeClass() != ::com::sun::star::uno::TypeClass_VOID,
+ "AsciiPropertyValue::AsciiPropertyValue: VOID property values not supported!" );
}
};
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 84dbdff17d13..8a7ff1b1595c 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -36,6 +36,7 @@
#include "core_resource.hxx"
#include "databasecontext.hxx"
#include "databasedocument.hxx"
+#include "databaseregistrations.hxx"
#include "datasource.hxx"
#include "dbastrings.hrc"
#include "module_dba.hxx"
@@ -70,7 +71,6 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <svl/filenotation.hxx>
-#include <unotools/pathoptions.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/fsys.hxx>
@@ -114,30 +114,6 @@ namespace dbaccess
{
//........................................................................
- namespace
- {
- //--------------------------------------------------------------------
- const ::rtl::OUString& getDbRegisteredNamesNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames");
- return s_sNodeName;
- }
-
- //--------------------------------------------------------------------
- const ::rtl::OUString& getDbNameNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Name");
- return s_sNodeName;
- }
-
- //--------------------------------------------------------------------
- const ::rtl::OUString& getDbLocationNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location");
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- }
// .............................................................................
typedef ::cppu::WeakImplHelper1 < XTerminateListener
> DatabaseDocumentLoader_Base;
@@ -224,6 +200,15 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon
{
m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( m_aContext );
::basic::BasicManagerRepository::registerCreationListener( *this );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ m_xDBRegistrationAggregate.set( createDataSourceRegistrations( m_aContext ), UNO_SET_THROW );
+ m_xDatabaseRegistrations.set( m_xDBRegistrationAggregate, UNO_QUERY_THROW );
+
+ m_xDBRegistrationAggregate->setDelegator( *this );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
}
//--------------------------------------------------------------------------
@@ -232,6 +217,10 @@ ODatabaseContext::~ODatabaseContext()
::basic::BasicManagerRepository::revokeCreationListener( *this );
if ( m_pDatabaseDocumentLoader )
m_pDatabaseDocumentLoader->release();
+
+ m_xDBRegistrationAggregate->setDelegator( NULL );
+ m_xDBRegistrationAggregate.clear();
+ m_xDatabaseRegistrations.clear();
}
// Helper
@@ -327,25 +316,6 @@ void ODatabaseContext::disposing()
m_aDatabaseObjects.clear();
}
-//------------------------------------------------------------------------------
-bool ODatabaseContext::getURLForRegisteredObject( const ::rtl::OUString& _rRegisteredName, ::rtl::OUString& _rURL )
-{
- if ( !_rRegisteredName.getLength() )
- throw IllegalArgumentException();
-
- // the config node where all pooling relevant info ar