diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-22 11:01:27 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-22 11:01:27 +0000 |
commit | 7599f68cee9141cd16ca7697872b5f83c6ae9ad9 (patch) | |
tree | 7b6af2b3e3e2afad6302a623743ae5077acf3d9f /dbaccess | |
parent | 213aa2c95aa520cac3b5bcc68f373bec8d4ebf42 (diff) |
CWS-TOOLING: integrate CWS dba32a
2009-04-16 13:08:19 +0200 oj r270882 : #i14538# set property at control
2009-04-16 13:04:28 +0200 oj r270881 : #i98557# remove binary string for SRB
2009-04-15 13:19:10 +0200 oj r270838 : #i96782# use type set at view
2009-04-14 14:53:20 +0200 oj r270778 : #i96782# set initialize size for custom shape
2009-04-06 14:19:14 +0200 oj r270546 : #i88432# correct pos when < 0 while resizing
2009-04-06 13:36:13 +0200 oj r270541 : #i96782# handle toolbar and menubar differently
2009-04-06 13:33:54 +0200 oj r270540 : #i96782# handle toolbar and menubar differently
2009-04-06 12:28:23 +0200 oj r270534 : #i96782# handle toolbar and menubar differently
2009-04-06 12:27:44 +0200 oj r270533 : #i96782# handle toolbar and menubar differently
2009-04-06 12:24:32 +0200 oj r270532 : #i96782# handle toolbar and menubar differently
2009-04-06 12:15:15 +0200 oj r270531 : do not initialze when field is empty
2009-04-06 10:06:08 +0200 oj r270528 : #i96782# clean up of menubar and remove duplicates
2009-04-06 09:47:49 +0200 oj r270527 : #i96519# adjust help text dynamic
2009-04-03 13:43:20 +0200 oj r270482 : do not need to remove section from observer they are already disposed
2009-04-03 13:27:28 +0200 fs r270479 : #i97356#
2009-04-02 11:30:39 +0200 fs r270386 : UNX line ends
2009-04-02 10:54:51 +0200 fs r270379 : UNX line ends
2009-04-02 10:39:57 +0200 fs r270378 : UNX line ends
2009-04-02 10:37:24 +0200 fs r270377 : why did this survive the rebase? was removed on trunk ...
2009-03-31 13:31:12 +0200 fs r270277 : component_foo should be public
2009-03-28 00:21:01 +0100 fs r270176 : manuallly merged the changes which happened in CWS before resync to m45, where the directory had been moved from reportdesign/registry to reportbuilder/registry
2009-03-27 23:01:20 +0100 fs r270174 : CWS-TOOLING: rebase CWS dba32a to trunk@270033 (milestone: DEV300:m45)
2009-03-11 12:23:35 +0100 fs r269310 : #i99958# ensure the ControlModelLock doesn't release twice
2009-03-06 09:07:32 +0100 fs r268970 : ignore output paths in SVN's status
2009-03-06 09:07:08 +0100 fs r268969 : ignore output paths in SVN's status
2009-03-04 11:28:02 +0100 oj r268800 : copy and paste error, check correct end now
2009-03-03 15:49:11 +0100 fs r268736 : #i10000# those merges were lost during the rebase (m38->m42)
2009-03-03 13:25:27 +0100 lla r268720 : #i99652# fix wrong refactoring
2009-02-27 11:12:56 +0100 fs r268566 : beautified
2009-02-27 10:53:47 +0100 fs r268561 : doFormListening(false) only when actually isFormListening() (found during complex test case XMLFormSettings with assertions)
2009-02-26 20:55:31 +0100 fs r268546 : #i96530# set the Label property of the bound control, if we didn't create a dedicated label control
2009-02-26 11:53:09 +0100 fs r268494 : #i10000#
2009-02-26 11:27:50 +0100 fs r268493 : #i10000#
2009-02-26 11:17:08 +0100 fs r268490 : reportdesign depends on REPORTBUILDER, not REPORTDESIGN
2009-02-25 11:39:48 +0100 fs r268422 : #i10000# post-resync: INFO_ESCAPE_DATETIME got lost during rebase
2009-02-24 23:24:10 +0100 fs r268411 : CWS-TOOLING: rebase CWS dba32a to trunk@268395 (milestone: DEV300:m42)
2009-02-20 15:09:48 +0100 fs r268324 : respect ImplicitCatalog/SchemaRestriction in all necessary places
2009-02-20 13:48:10 +0100 oj r268318 : order of initialize corrected
2009-02-14 15:07:52 +0100 fs r267759 : #i98975# when an image does not have a bitmap, but a text, draw this (as placeholder)
2009-02-14 15:02:40 +0100 fs r267758 : consolidated and removed some duplicate code
2009-02-14 13:52:23 +0100 fs r267756 : #i10000#
2009-02-13 22:08:34 +0100 fs r267750 : #i100000#
2009-02-13 22:07:25 +0100 fs r267749 : #i10000#
2009-02-13 21:55:36 +0100 fs r267747 : #i10000#
2009-02-13 21:54:27 +0100 fs r267746 : use const_cast
2009-02-13 21:29:10 +0100 fs r267745 : #i10000#
2009-02-13 21:27:39 +0100 fs r267744 : #i10000#
2009-02-13 20:59:13 +0100 fs r267742 : #i10000#
2009-02-13 13:21:30 +0100 fs r267717 : better diagnostics
2009-02-13 13:17:24 +0100 fs r267715 : #i58313# support Catalog/SchemaRestriction settings, which are applied in getTables when 'all catalogs/schemas' are to be retrieved
2009-02-13 13:16:14 +0100 fs r267714 : filter out some more known global settings
2009-02-13 12:39:43 +0100 fs r267713 : #i58313# ImplicitCatalog/SchemaRestriction
2009-02-13 12:36:50 +0100 fs r267712 : when exporting data source settings, allow for properties which have a VOID default value, but are currently not VOID
2009-02-13 12:35:57 +0100 fs r267711 : implement XSet, to allow inserting properties which have a default value of VOID
2009-02-13 12:35:03 +0100 fs r267710 : +addVoidProperty
2009-02-13 10:20:08 +0100 fs r267697 : removed unused variable
2009-02-13 09:46:46 +0100 fs r267695 : refactored the table filtering code, to have a better base for introducing additional low level filters
2009-02-10 09:23:07 +0100 lla r267537 : #i10000# wrong line feed, double named variable
2009-02-09 12:13:08 +0100 oj r267508 : #i98605# notify hanlder
2009-02-09 11:50:34 +0100 oj r267507 : #i98926# solve refcount problem
2009-02-09 11:50:05 +0100 oj r267506 : #i98971# fix for simple html
2009-02-09 11:49:24 +0100 oj r267505 : #i98971# fix for simple html
2009-02-09 11:47:27 +0100 oj r267504 : invoke on copy
2009-02-09 09:51:00 +0100 fs r267500 : #i98316#
2009-02-09 09:46:10 +0100 fs r267499 : setCurrentSelection: don't reset the current form when we de-select everything
2009-02-09 09:43:45 +0100 fs r267498 : #i98316#
2009-02-08 21:25:18 +0100 fs r267496 : #i98272# introduce late ctor for cloning
2009-02-07 21:08:39 +0100 fs r267485 : #i98272# when copy-constructing a FmFormPageImpl, use the XCloneable of the forms collection, instead of XPersistObject (which is incompletely implemented)
2009-02-07 21:07:26 +0100 fs r267484 : removed obsolete include guards
2009-02-07 21:05:22 +0100 fs r267483 : #i98272# implement XCloneable
2009-02-06 15:02:48 +0100 lla r267467 : #i96523# add XImageControl
2009-02-06 14:41:38 +0100 oj r267463 : #i98926# late init when connection disposed but only when asked for
2009-02-06 13:49:57 +0100 lla r267457 : #i92860# bigint in forms doesn't allow input of values > 1, fixed
2009-02-06 13:03:55 +0100 oj r267455 : ImageScaleMode
2009-02-05 14:48:19 +0100 lla r267424 : #i89335# dropdown listboxes are 14 instead of 7 lines high
2009-02-05 13:40:00 +0100 oj r267423 : #i96945# insert new prop Opaque
2009-02-05 13:39:19 +0100 oj r267422 : #i96945# insert layer handling for hell and heaven
2009-02-05 13:29:32 +0100 lla r267420 : #i89335# add is null, is not null, is not like filter condition
2009-02-04 12:23:02 +0100 oj r267364 : #i98821# load table font settings
2009-02-04 10:05:27 +0100 oj r267351 : #i98821# load table font settings
2009-02-04 09:23:22 +0100 fs r267350 : checking persistency of UI settings in database documents - for the moment, capture table formattings (which is issue 98821)
2009-02-04 09:22:15 +0100 fs r267349 : moved some methods which are of wider interest from DatabaseDocument to FileHelper resp. TestCase
2009-02-04 08:56:27 +0100 oj r267347 : #i97586# UcbStreamHelper::CreateStream doesn't check all streamModes use different method
2009-02-04 08:23:26 +0100 oj r267346 : #i98701# check key size is >= 3 and some redesign
2009-02-03 23:29:24 +0100 fs r267345 : return the component (controller), not the frame
2009-02-03 23:28:53 +0100 fs r267344 : openExisting returns a controller now, not the frame (this was a bug)
2009-02-03 23:28:25 +0100 fs r267343 : openElement: properly return the component in the table/query case
2009-02-02 12:48:17 +0100 oj r267261 : #i96013# fix for relative path
2009-02-02 10:33:28 +0100 lla r267253 : #i98557# cleanups and consolidation
2009-02-02 09:37:23 +0100 lla r267250 : #i88432# resize will no longer move components to other sections
2009-02-02 09:08:24 +0100 oj r267245 : #i97475# write 0x1A at the end of the file
2009-01-30 19:39:20 +0100 lla r267230 : #i10000# unused parameters
2009-01-30 09:51:09 +0100 fs r267181 : onsolete
2009-01-30 09:49:27 +0100 fs r267180 : onsolete
2009-01-29 14:28:22 +0100 oj r267139 : #i96825# import cell style
2009-01-29 14:23:12 +0100 oj r267137 : #i98601# export imagescalehandler
2009-01-29 14:19:57 +0100 lla r267135 : #i98601# add ImageScaleMode
2009-01-29 13:21:08 +0100 oj r267124 : #i98601# impl ScaleMode
2009-01-29 13:20:56 +0100 oj r267123 : #i98601# impl ScaleMode
2009-01-29 08:46:40 +0100 oj r267095 : new property: ScaleMode
2009-01-29 08:45:23 +0100 oj r267094 : new ScaleMode from UnControlImageModel
2009-01-29 08:28:12 +0100 oj r267093 : #i87930# close all sub forms/reports when the desktop is going to be terminated and no db frame exists
2009-01-28 19:54:34 +0100 lla r267082 : #i98557# pictures in report wizard
2009-01-28 15:06:25 +0100 oj r267060 : #i87930# close all sub forms/reports when the desktop is going to be terminated and no db frame exists
2009-01-28 11:38:41 +0100 lla r267046 : #i76783# handle binary fields in forms
2009-01-28 09:24:43 +0100 lla r267025 : #i10000#
2009-01-28 08:40:04 +0100 fs r267024 : #i10000#
2009-01-28 08:04:43 +0100 oj r267023 : #i93456# use resource strings for function names
2009-01-27 13:26:05 +0100 oj r266988 : check data field is type field or expression
2009-01-27 13:07:17 +0100 oj r266985 : check data field length
2009-01-27 11:48:19 +0100 oj r266974 : #i96823# return dll string as column name when no alias exists
2009-01-27 09:53:11 +0100 fs r266958 : display the message of a caught exception
2009-01-27 09:44:13 +0100 fs r266957 : #i58313# when retrieving all tables, just set an empty table type filter - the connection will care for translating this, by respecting the TableTypeFilterMode setting
2009-01-27 09:36:09 +0100 fs r266956 : #i58313# getTables: per JDBC spec, is not a valid table type filter. Translate it to 'null'.
2009-01-26 11:24:49 +0100 lla r266912 : #i97865# cleanups (AddField viewable in remote mode)
2009-01-26 07:49:27 +0100 lla r266897 : #i97865# AddField opens in remote case
2009-01-26 07:48:58 +0100 lla r266896 : #i97865# AddField opens in remote case
2009-01-26 07:48:42 +0100 lla r266895 : #i97865# AddField opens in remote case
2009-01-23 15:04:40 +0100 fs r266825 : consolidate the usage of OSQLMessageBox with MessageType==Warning into OSQLWarningBox
2009-01-23 10:47:33 +0100 fs r266787 : +supportsUserAdministration
2009-01-23 10:47:11 +0100 fs r266784 : use DatabaseMetaData.supportsUserAdministration
2009-01-23 07:55:59 +0100 lla r266767 : #i10000# fix gcc compiler failures
2009-01-21 15:08:55 +0100 lla r266673 : #i97265# Labels in HC (IsDark) with other color (viewable)
2009-01-19 14:58:54 +0100 lla r266504 : #i96523# last problems with FormatKey and '0' values fixed
2009-01-19 14:58:00 +0100 lla r266503 : #i96519# AddField help text
2009-01-19 11:59:02 +0100 fs r266485 : #i96523# for formatted field models, init them with TreatAsNumber = false
2009-01-16 10:31:49 +0100 lla r266405 : #i96793# add shrink to popup menu
2009-01-16 09:21:44 +0100 lla r266401 : #i96519# AddField contains a help text
2009-01-15 11:21:49 +0100 lla r266357 : #i96523# problem with XVclWindowPeer not fixed now
2009-01-15 09:19:20 +0100 lla r266335 : #i96523# more crashes fixed.
2009-01-14 13:08:34 +0100 lla r266291 : #i96523# problems with crashes fixed
2009-01-13 10:54:24 +0100 lla r266199 : #i96523# show datasource in formattedfields new files
2009-01-13 10:52:39 +0100 lla r266198 : #i96523# show datasource in formattedfields
2009-01-13 09:41:50 +0100 lla r266197 : #i96526# handling none existance default.otr
2009-01-12 12:55:49 +0100 fs r266151 : don't expect the control model to be a BoundComponent before adding as modify listener
2009-01-12 12:51:33 +0100 fs r266149 : #i88458# let the ImageControl be an XModifyBroadcaster, so the forms runtime can notice when the user changes the control content while it does not have the focus
2009-01-09 13:41:22 +0100 fs r266080 : doc
2009-01-09 13:14:14 +0100 fs r266077 : #i97377# SetModified when order is changed via DnD
2009-01-07 09:55:40 +0100 oj r265951 : merge from master
2009-01-07 09:55:24 +0100 oj r265950 : removed observer
2009-01-07 09:55:06 +0100 oj r265949 : merge from master
2009-01-07 07:29:11 +0100 oj r265945 : shadow var changed
2009-01-06 07:25:57 +0100 oj r265893 : CWS-TOOLING: rebase CWS dba32a to trunk@265758 (milestone: DEV300:m38)
2009-01-05 13:18:22 +0100 oj r265865 : convert to unix le
2009-01-05 09:13:52 +0100 lla r265857 : #i79423# lc_ sc_ permutation fix
2009-01-02 19:40:59 +0100 lla r265847 : #i79423# section shrink icons
2008-12-22 11:37:57 +0100 lla r265749 : #i97484# move component to negative Y-position
2008-12-22 11:37:05 +0100 lla r265748 : #i97484# move component to negative Y-position
2008-12-22 11:35:33 +0100 lla r265747 : #i97484# move component to negative Y-position
2008-12-22 11:25:07 +0100 lla r265745 : #i96757# changes via property browser was not undoable
2008-12-18 15:10:38 +0100 fs r265694 : corrected an condition in doFormListening, which otherwise leads to uncommitable grid columns in documents which are loaded from disc (not in documents which are newly created)
2008-12-18 14:54:39 +0100 fs r265692 : Hide Columns text slightly changed
2008-12-18 13:44:15 +0100 fs r265683 : #i94068# properly display erros happening during a form operation - at least once, and at most once
2008-12-18 11:28:29 +0100 fs r265677 : document the new InputRequired property
2008-12-18 11:04:15 +0100 fs r265676 : #i96530# createControlLabelPair: don't actually create a label for a checkbox
2008-12-18 10:35:53 +0100 fs r265674 : #i95226# when a column is replaced, and it's the selected column, update the selection
2008-12-18 10:34:42 +0100 fs r265673 : #i95226# refactoring of the implReplaced method
2008-12-18 10:34:28 +0100 fs r265672 : #i95226# when replacing a grid column, update the property browser
2008-12-18 10:33:17 +0100 fs r265671 : when an element is removed, remove it from m_aCurrentSelection, too (if necessary)
2008-12-18 10:31:57 +0100 fs r265670 : Hide Columns text slightly changed
2008-12-18 10:15:56 +0100 lla r265669 : #i14538# do not allow to press finish button twice
2008-12-18 08:56:33 +0100 lla r265665 : #i10000# build depend=t problem hacked.
2008-12-17 20:59:10 +0100 fs r265656 : #i89821# don't let a MultiLineEdit select all text when it receives the focus
2008-12-17 12:10:54 +0100 fs r265594 : #i97356#
2008-12-17 12:06:29 +0100 fs r265593 : #i97355# Print -> Printable
2008-12-17 11:59:31 +0100 fs r265591 : #i97350# combo boxes comment on list selection (as list boxes already do)
2008-12-16 09:53:57 +0100 lla r265527 : #i96526# handling none existance default.otr
2008-12-15 14:48:39 +0100 lla r265500 : #i79423# reparing, was wrong implemented
2008-12-12 15:08:33 +0100 lla r265424 : #i10000# remove wrong carridge returns
2008-12-12 15:07:55 +0100 lla r265423 : #i10000# remove wrong carridge returns
2008-12-12 15:06:41 +0100 lla r265422 : #i10000# remove wrong carridge returns
2008-12-12 10:23:13 +0100 lla r265395 : #i95234# reset DragDelta
2008-12-12 10:11:02 +0100 lla r265393 : #i79423# pre versions of shrink buttons
2008-12-11 15:32:13 +0100 fs r265318 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:30:06 +0100 fs r265316 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:07:05 +0100 fs r265307 : removed superfluous text
2008-12-11 12:29:54 +0100 lla r265282 : #i96757# cleanup second try
2008-12-11 12:09:15 +0100 lla r265278 : #i96757# cleanup
2008-12-11 12:07:56 +0100 lla r265277 : #i95234#
2008-12-10 14:04:39 +0100 lla r265183 : #i93472# D&D fixes
2008-12-10 12:29:33 +0100 lla r265168 : #i94067# add (APP|SYS)FONT to XUnitConversion
2008-12-10 12:15:02 +0100 lla r265166 : #i94067# add APPFONT, SYSFONT to MeasureUnit
2008-12-10 11:52:10 +0100 lla r265163 : #i94067# add comments
2008-12-06 20:33:05 +0100 fs r264935 : #i10000# precompiled header
2008-12-05 09:29:26 +0100 fs r264889 : #i10000#
2008-12-05 09:07:31 +0100 fs r264888 : #i10000#
2008-12-04 13:25:46 +0100 fs r264838 : CWS-TOOLING: rebase CWS dba32a to trunk@264807 (milestone: DEV300:m37)
2008-12-03 23:49:13 +0100 fs r264808 : merge changes from trunk, to be able to do a rebase
2008-12-03 17:13:09 +0100 lla r264801 : #i91041# update documentation
2008-12-03 16:57:04 +0100 lla r264799 : #i94067# allow convert(Point|Size)ToLogic as pixel also
2008-12-02 12:36:32 +0100 lla r264687 : #i96782# bring toolbar objects to menu structure
2008-12-02 10:32:44 +0100 lla r264667 : #i86255# make property work
2008-12-02 09:22:47 +0100 lla r264659 : #i79423# add section shrink toolbar
2008-12-02 07:41:22 +0100 lla r264657 : #i86255# add check box for Escape DateTime property
2008-12-02 07:37:17 +0100 lla r264656 : #i79423# new shrink buttons
2008-11-26 11:55:28 +0100 fs r264362 : #i96541#
FillPropertySet: do not only catch UnknownPropertyException when setting the Char/ParaAutoStyleName,
but also care for the other exceptions which can be thrown by XPropertySet::setPropertyValue.
This is actually not the real fix for #i96541#, but only a follow-up. The root cause of the issue
was fixed in CWS dba301b, but this here was another (potential) bug which popped up during investigations.
2008-11-25 09:04:40 +0100 lla r264273 : #i82083# new toolbox in GroupsSorting dialog
2008-11-25 08:56:08 +0100 lla r264272 : #i94729# change token strings into string list, move class out of function
2008-11-24 15:52:22 +0100 fs r264251 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:51:45 +0100 fs r264249 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:45:21 +0100 fs r264244 : #i96532# the API default for ParamNameSubst is false
2008-11-24 15:45:04 +0100 fs r264243 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:44:14 +0100 fs r264241 : #i96532# slight refactoring of exporting properties which have a XML default different from the API default
2008-11-24 10:50:01 +0100 lla r264216 : #i82083# icons for new toolbox
2008-11-24 09:38:45 +0100 lla r264205 : #i82083# new toolbox in GroupsSorting dialog
2008-11-24 09:32:20 +0100 lla r264201 : #i96501# cleanup assertions
2008-11-24 09:12:55 +0100 lla r264198 : #i83082# enhancement for toolboxes, better HC comfort
2008-11-24 08:46:43 +0100 lla r264197 : #i96501# fix problem with negative positions
2008-11-21 11:44:47 +0100 fs r264118 : #i57042# introduce a counter for suspending change notifications of a given property, so recursive calls are possible
2008-11-21 11:02:17 +0100 fs r264116 : #i96388# don't call ExecuteContextMenuAction when no action was chosen by the user
2008-11-21 10:36:53 +0100 fs r264114 : #i47384# assertion was wrong
2008-11-14 12:33:15 +0100 fs r263673 : #i47318# XRowSetChangeBroadcaster/Listener, to be able to listen for changes in an XRowSetSupplier's RowSet
2008-11-14 12:30:29 +0100 fs r263672 : #i47318# more refactoring
- BoundControlModels now listen at the XRowSetSupplier for changes in the supplied
RowSet, to properly revoke/register old/new listeners at the RowSet
- replaced ::osl::Mutex in various places with a ControlModelLock
2008-11-14 12:20:55 +0100 fs r263671 : when BUILD_TYPE includes QADEVOOO, the BUILD_QADEVOOO needs to bet set, too
2008-11-14 12:19:21 +0100 fs r263670 : oops, this was not intended to be committed
2008-11-12 11:08:10 +0100 fs r263579 : #i96096# new ctors taking UNO_QUERY_THROW
2008-11-12 09:15:54 +0100 fs r263576 : no need to load the complete dialog just to get a string which the dialog itself loads from resource
2008-11-10 17:55:45 +0100 fs r263535 : spelling in comment
2008-11-10 15:51:14 +0100 fs r263523 : #i47318# various refactorings
1. don't forward syntetic XLoadListener events from the grid control to
the grid columns. Instead, forward GridColumn::XChild::setParent to
the base class, which then can add itself as load listener
2. removed various occurances of XMultiServiceFactory, instead use the
::comphelper::ComponentContext
3. in O(Bound)ControlModel, have a mechanism to lock the instance (using
ControlModelLock) and fire property changes when the last lock dies.
2008-11-10 12:49:24 +0100 oj r263513 : #i94729# change token strings into string list
2008-11-10 12:13:15 +0100 oj r263512 : #i95222# export chart:title style as well
2008-11-10 08:55:25 +0100 oj r263507 : #i93471# show the correct tabpage when selecting a different object
2008-11-07 23:38:29 +0100 fs r263490 : #i95977# for the event input controls, add a component extending their functionality so they're reset when the users presses DEL
2008-11-07 23:35:39 +0100 fs r263489 : during #i95977#: When a VCL Window is deleted from within VCL code, the respective WindowPeer was never disposed. Corrected this.
2008-11-07 14:57:07 +0100 fs r263420 : #i95963# human-readable display names for event bindings
2008-11-06 10:34:52 +0100 fs r263366 : #i95865# don't use library names containing InvalidZipEntryFileNames - workaround until i95409 is fixed
2008-11-06 10:33:28 +0100 fs r263365 : #i95865#
copied the following change from CWS odfmetadata2 (not yet integrated) into CWS dba31d
- comphelper/inc/comphelper/storagehelper.hxx,
comphelper/source/misc/storagehelper.cxx:
+ add function IsValidZipEntryFileName (moved from module package)
Diffstat (limited to 'dbaccess')
76 files changed, 1405 insertions, 925 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index 746f79da53d2..28771fad05b1 100644 --- a/dbaccess/inc/dbaccess_helpid.hrc +++ b/dbaccess/inc/dbaccess_helpid.hrc @@ -355,6 +355,7 @@ #define HID_DSADMIN_AS_BEFORE_CORRELATION_NAME (HID_DBACCESS_START + 297) #define HID_DSADMIN_CHECK_REQUIRED_FIELDS (HID_DBACCESS_START + 298) +#define HID_DSADMIN_ESCAPE_DATETIME (HID_DBACCESS_START + 299) #define HID_PAGE_DBWIZARD_GENERALPAGE (HID_DBACCESS_START + 300) #define HID_PAGE_DBWIZARD_GENERAL_RB_CREATEDBDATABASE (HID_DBACCESS_START + 301) diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index 82e7c8dc8a80..a46dda02e285 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -30,7 +30,6 @@ package complex.dbaccess; import com.sun.star.awt.XTopWindow; -import com.sun.star.awt.XTopWindow; import com.sun.star.beans.PropertyState; import com.sun.star.document.DocumentEvent; import com.sun.star.lang.XEventListener; @@ -81,11 +80,7 @@ import com.sun.star.util.XCloseable; import com.sun.star.util.XModifiable; import com.sun.star.util.XURLTransformer; import connectivity.tools.*; -import helper.FileTools; -import java.io.File; import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; import java.util.Iterator; import java.util.Vector; import java.util.logging.Level; @@ -350,32 +345,6 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - private String impl_correctFileURL( String _URL ) - { - String returnURL = _URL; - if ( ( returnURL.indexOf( "file:/" ) == 0 ) && ( returnURL.indexOf( "file:///" ) == -1 ) ) - { - // for some reason, the URLs here in Java start with "file:/" only, instead of "file:///" - // Some of the office code doesn't like this ... - returnURL = "file:///" + returnURL.substring( 6 ); - } - return returnURL; - } - - // -------------------------------------------------------------------------------------------------------- - private String impl_copyTempFile( String _sourceURL ) throws IOException - { - String targetURL = createTempFileURL(); - try - { - FileTools.copyFile( new File( new URI( _sourceURL ) ), new File( new URI( targetURL ) ) ); - } - catch ( URISyntaxException e ) { } - - return impl_correctFileURL( targetURL ); - } - - // -------------------------------------------------------------------------------------------------------- private XModel impl_createDocument( ) throws Exception { XModel databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class, @@ -450,7 +419,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. // 2. XLoadable::load databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class, getORB().createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) ); - documentURL = impl_copyTempFile( documentURL ); + documentURL = copyToTempFile( documentURL ); // load the doc, and verify it's initialized then, and has the proper URL XLoadable loadDoc = (XLoadable)UnoRuntime.queryInterface( XLoadable.class, databaseDoc ); loadDoc.load( new PropertyValue[] { new PropertyValue( "URL", 0, documentURL, PropertyState.DIRECT_VALUE ) } ); @@ -560,7 +529,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. // store the document, and close it String documentURL = databaseDoc.getURL(); - documentURL = impl_correctFileURL( documentURL ); + documentURL = FileHelper.getOOoCompatibleFileURL( documentURL ); XStorable storeDoc = (XStorable) UnoRuntime.queryInterface( XStorable.class, databaseDoc ); storeDoc.store(); @@ -647,7 +616,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_stopObservingEvents( m_globalEvents, new String[] { "OnSave", "OnSaveDone", "OnModifyChanged" }, context ); // XComponentLoader.loadComponentFromURL - newURL = impl_copyTempFile( databaseDoc.getURL() ); + newURL = copyToTempFile( databaseDoc.getURL() ); XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, getORB().createInstance( "com.sun.star.frame.Desktop" ) ); context = "loadComponentFromURL"; @@ -704,7 +673,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. loader.loadComponentFromURL( newURL, "_blank", 0, impl_getDefaultLoadArgs() ) ); int previousOnLoadEventPos = impl_waitForEvent( m_globalEvents, "OnLoad", 5000 ); // ... and another document ... - String otherURL = impl_copyTempFile( databaseDoc.getURL() ); + String otherURL = copyToTempFile( databaseDoc.getURL() ); XModel otherDoc = (XModel)UnoRuntime.queryInterface( XModel.class, loader.loadComponentFromURL( otherURL, "_blank", 0, impl_getDefaultLoadArgs() ) ); impl_waitForEvent( m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1 ); diff --git a/dbaccess/qa/complex/dbaccess/FileHelper.java b/dbaccess/qa/complex/dbaccess/FileHelper.java new file mode 100644 index 000000000000..fbe5f330b24d --- /dev/null +++ b/dbaccess/qa/complex/dbaccess/FileHelper.java @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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: Parser.java,v $ + * $Revision: 1.1.6.2 $ + * + * 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. + * + ************************************************************************/ + +package complex.dbaccess; + +public class FileHelper +{ + static public String getOOoCompatibleFileURL( String _javaFileURL ) + { + String returnURL = _javaFileURL; + if ( ( returnURL.indexOf( "file:/" ) == 0 ) && ( returnURL.indexOf( "file:///" ) == -1 ) ) + { + // for some reason, the URLs here in Java start with "file:/" only, instead of "file:///" + // Some of the office code doesn't like this ... + returnURL = "file:///" + returnURL.substring( 6 ); + } + return returnURL; + } +} diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index 65774e108247..7fdc2c3d886b 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -33,10 +33,13 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; +import helper.FileTools; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.net.URI; +import java.net.URISyntaxException; public abstract class TestCase extends complexlib.ComplexTestCase { @@ -87,6 +90,24 @@ public abstract class TestCase extends complexlib.ComplexTestCase } // -------------------------------------------------------------------------------------------------------- + /** + * copies the file given by URL to a temporary file + * @return + * the URL of the new file + */ + protected final String copyToTempFile( String _sourceURL ) throws IOException + { + String targetURL = createTempFileURL(); + try + { + FileTools.copyFile( new File( new URI( _sourceURL ) ), new File( new URI( targetURL ) ) ); + } + catch ( URISyntaxException e ) { } + + return FileHelper.getOOoCompatibleFileURL( targetURL ); + } + + // -------------------------------------------------------------------------------------------------------- protected void verifyExpectedException( 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 new file mode 100644 index 000000000000..a755b39aa63c --- /dev/null +++ b/dbaccess/qa/complex/dbaccess/UISettings.java @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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: Parser.java,v $ + * $Revision: 1.1.6.2 $ + * + * 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. + * + ************************************************************************/ +package complex.dbaccess; + +import com.sun.star.awt.FontSlant; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; +import com.sun.star.form.XFormController; +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.sdb.application.XDatabaseDocumentUI; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.XCloseable; +import helper.URLHelper; +import java.io.File; +import java.net.URI; + +public class UISettings extends TestCase +{ + // -------------------------------------------------------------------------------------------------------- + public String[] getTestMethodNames() + { + return new String[] { + "checkTableFormattingPersistence" + }; + } + + // -------------------------------------------------------------------------------------------------------- + public String getTestObjectName() + { + return "UISettings"; + } + + // -------------------------------------------------------------------------------------------------------- + /** verifies that aliases for inner queries work as expected + */ + public void checkTableFormattingPersistence() throws java.lang.Exception + { + CRMDatabase database = new CRMDatabase( getORB() ); + + // load the document + String docURL = database.getDatabase().getDocumentURL(); + 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, + tableViewController.getCurrentControl().getModel() ); + + // change the table's formatting + tableControlModel.setPropertyValue( "FontName", "Andale Sans UI" ); + tableControlModel.setPropertyValue( "FontHeight", new Float( 20 ) ); + tableControlModel.setPropertyValue( "FontSlant", FontSlant.ITALIC ); + + // close the table + docUI.closeSubComponents(); + + // save and close the database document + database.getDatabase().store(); + database.close(); + + // 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 + // which are not yet freed, and which effectively hold the document alive. More precise: The document (|doc|) + // is certainly disposed, but other objects might hold a reference to one of the many other components + // around the database document, the data source, the connection, etc. As long as those objects are + // 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(); + + // 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.getCurrentControl().getModel() ); + + // verify the properties + assureEquals( "wrong font name", "Andale Sans UI", (String)tableControlModel.getPropertyValue( "FontName" ) ); + assureEquals( "wrong font height", (float)20, ((Float)tableControlModel.getPropertyValue( "FontHeight" )).floatValue() ); + assureEquals( "wrong font slant", FontSlant.ITALIC, (FontSlant)tableControlModel.getPropertyValue( "FontSlant" ) ); + + // close the doc + docUI.closeSubComponents(); + XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, + doc ); + closeDoc.close( true ); + } +} diff --git a/dbaccess/qa/complex/dbaccess/dbaccess.sce b/dbaccess/qa/complex/dbaccess/dbaccess.sce index b546f6ee7496..9b17f0cd9f84 100644 --- a/dbaccess/qa/complex/dbaccess/dbaccess.sce +++ b/dbaccess/qa/complex/dbaccess/dbaccess.sce @@ -7,3 +7,4 @@ -o complex.dbaccess.DataSource -o complex.dbaccess.Parser -o complex.dbaccess.ApplicationController +-o complex.dbaccess.UISettings diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index adf9e1b587be..ff93b1fd9e8f 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -29,22 +29,21 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove + #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_CORE_FILTERED_CONTAINER_HXX + +#include "dbastrings.hrc" #include "FilteredContainer.hxx" -#endif -#ifndef DBA_CORE_REFRESHLISTENER_HXX #include "RefreshListener.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include "sdbcoretools.hxx" + #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ -#include "connectivity/dbtools.hxx" -#endif -#ifndef _WLDCRD_HXX + +#include <connectivity/dbtools.hxx> #include <tools/wldcrd.hxx> -#endif +#include <tools/diagnose_ex.h> + +#include <boost/optional.hpp> namespace dbaccess { @@ -92,6 +91,171 @@ namespace dbaccess return nShiftPos; } + // ------------------------------------------------------------------------- + bool lcl_isElementAllowed( const ::rtl::OUString& _rName, + const Sequence< ::rtl::OUString >& _rTableFilter, + const ::std::vector< WildCard >& _rWCSearch ) + { + sal_Int32 nTableFilterLen = _rTableFilter.getLength(); + + const ::rtl::OUString* tableFilter = _rTableFilter.getConstArray(); + const ::rtl::OUString* tableFilterEnd = _rTableFilter.getConstArray() + nTableFilterLen; + bool bFilterMatch = ::std::find( tableFilter, tableFilterEnd, _rName ) != tableFilterEnd; + // the table is allowed to "pass" if we had no filters at all or any of the non-wildcard filters matches + if (!bFilterMatch && !_rWCSearch.empty()) + { // or if one of the wildcrad expression matches + for ( ::std::vector< WildCard >::const_iterator aLoop = _rWCSearch.begin(); + aLoop != _rWCSearch.end() && !bFilterMatch; + ++aLoop + ) + bFilterMatch = aLoop->Matches( _rName ); + } + + return bFilterMatch; + } + + //-------------------------------------------------------------------------- + typedef ::boost::optional< ::rtl::OUString > OptionalString; + struct TableInfo + { + OptionalString sComposedName; + OptionalString sType; + OptionalString sCatalog; + OptionalString sSchema; + OptionalString sName; + + TableInfo( const ::rtl::OUString& _composedName ) + :sComposedName( _composedName ) + { + } + + TableInfo( const ::rtl::OUString& _catalog, const ::rtl::OUString& _schema, const ::rtl::OUString& _name, + const ::rtl::OUString& _type ) + :sComposedName() + ,sType( _type ) + ,sCatalog( _catalog ) + ,sSchema( _schema ) + ,sName( _name ) + { + } + }; + typedef ::std::vector< TableInfo > TableInfos; + + //-------------------------------------------------------------------------- + void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData ) + { + if ( !_metaData.is() ) + throw RuntimeException(); + + if ( !_io_tableInfo.sComposedName ) + { + OSL_ENSURE( !!_io_tableInfo.sCatalog && !!_io_tableInfo.sSchema && !!_io_tableInfo.sName, "lcl_ensureComposedName: How should I composed the name from nothing!?" ); + + _io_tableInfo.sComposedName = OptionalString( + composeTableName( _metaData, *_io_tableInfo.sCatalog, *_io_tableInfo.sSchema, *_io_tableInfo.sName, + sal_False, ::dbtools::eInDataManipulation ) + ); + } + } + + //-------------------------------------------------------------------------- + void lcl_ensureType( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer ) + { + if ( !!_io_tableInfo.sType ) + return; + + lcl_ensureComposedName( _io_tableInfo, _metaData ); + + if ( !_masterContainer.is() ) + throw RuntimeException(); + + ::rtl::OUString sTypeName; + try + { + Reference< XPropertySet > xTable( _masterContainer->getByName( *_io_tableInfo.sComposedName ), UNO_QUERY_THROW ); + OSL_VERIFY( xTable->getPropertyValue( PROPERTY_TYPE ) >>= sTypeName ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + _io_tableInfo.sType = OptionalString( sTypeName ); + } + + //-------------------------------------------------------------------------- + connectivity::TStringVector lcl_filter( const TableInfos& _unfilteredTables, + const Sequence< ::rtl::OUString >& _tableFilter, const Sequence< ::rtl::OUString >& _tableTypeFilter, + const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer ) + { + TableInfos aFilteredTables; + + // first, filter for the table names + sal_Int32 nTableFilterCount = _tableFilter.getLength(); + sal_Bool dontFilterTableNames = ( ( nTableFilterCount == 1 ) && _tableFilter[0].equalsAsciiL( "%", 1 ) ); + if( dontFilterTableNames ) + { + aFilteredTables = _unfilteredTables; + } + else + { + // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard + // for them + ::std::vector< WildCard > aWildCardTableFilter; + Sequence< ::rtl::OUString > aNonWildCardTableFilter = _tableFilter; + nTableFilterCount = createWildCardVector( aNonWildCardTableFilter, aWildCardTableFilter ); + + TableInfos aUnfilteredTables( _unfilteredTables ); + aUnfilteredTables.reserve( nTableFilterCount + ( aWildCardTableFilter.size() * 10 ) ); + + for ( TableInfos::iterator table = aUnfilteredTables.begin(); + table != aUnfilteredTables.end(); + ++table + ) + { + lcl_ensureComposedName( *table, _metaData ); + + if ( lcl_isElementAllowed( *table->sComposedName, aNonWildCardTableFilter, aWildCardTableFilter ) ) + aFilteredTables.push_back( *table ); + } + } + + // second, filter for the table types + sal_Int32 nTableTypeFilterCount = _tableTypeFilter.getLength(); + sal_Bool dontFilterTableTypes = ( ( nTableTypeFilterCount == 1 ) && _tableTypeFilter[0].equalsAsciiL( "%", 1 ) ); + dontFilterTableTypes = dontFilterTableTypes || ( nTableTypeFilterCount == 0 ); + // (for TableTypeFilter, unlike TableFilter, "empty" means "do not filter at all") + if ( !dontFilterTableTypes ) + { + TableInfos aUnfilteredTables; + aUnfilteredTables.swap( aFilteredTables ); + + const ::rtl::OUString* pTableTypeFilterBegin = _tableTypeFilter.getConstArray(); + const ::rtl::OUString* pTableTypeFilterEnd = pTableTypeFilterBegin + _tableTypeFilter.getLength(); + + for ( TableInfos::iterator table = aUnfilteredTables.begin(); + table != aUnfilteredTables.end(); + ++table + ) + { + // ensure that we know the table type + lcl_ensureType( *table, _metaData, _masterContainer ); + + if ( ::std::find( pTableTypeFilterBegin, pTableTypeFilterEnd, *table->sType ) != pTableTypeFilterEnd ) + aFilteredTables.push_back( *table ); + } + } + + connectivity::TStringVector aReturn; + for ( TableInfos::iterator table = aFilteredTables.begin(); + table != aFilteredTables.end(); + ++table + ) + { + lcl_ensureComposedName( *table, _metaData ); + aReturn.push_back( *table->sComposedName ); + } + return aReturn; + } //========================================================================== //= OViewContainer @@ -104,14 +268,15 @@ namespace dbaccess IWarningsContainer* _pWarningsContainer ,oslInterlockedCount& _nInAppend) :OCollection(_rParent,_bCase,_rMutex,::std::vector< ::rtl::OUString>()) + ,m_bConstructed(sal_False) ,m_pWarningsContainer(_pWarningsContainer) ,m_pRefreshListener(_pRefreshListener) ,m_nInAppend(_nInAppend) ,m_xConnection(_xCon) - ,m_bConstructed(sal_False) { } + // ------------------------------------------------------------------------- void OFilteredContainer::construct(const Reference< XNameAccess >& _rxMasterContainer, const Sequence< ::rtl::OUString >& _rTableFilter, @@ -125,81 +290,40 @@ namespace dbaccess } catch(SQLException&) { + DBG_UNHANDLED_EXCEPTION(); } m_xMasterContainer = _rxMasterContainer; - if(m_xMasterContainer.is()) + if ( m_xMasterContainer.is() ) { addMasterContainerListener(); - sal_Int32 nTableFilterLen = _rTableFilter.getLength(); - - connectivity::TStringVector aTableNames; - sal_Bool bNoTableFilters = ((nTableFilterLen == 1) && _rTableFilter[0].equalsAsciiL("%", 1)); - if(!bNoTableFilters) - { - Sequence< ::rtl::OUString > aTableFilter = _rTableFilter; - Sequence< ::rtl::OUString > aTableTypeFilter = _rTableTypeFilter; - - // build sorted versions of the filter sequences, so the visibility decision is faster - ::std::sort( aTableFilter.getArray(), aTableFilter.getArray() + nTableFilterLen ); - // as we want to modify nTableFilterLen, remember this + TableInfos aUnfilteredTables; - // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard - // for them - ::std::vector< WildCard > aWCSearch; // contains the wildcards for the table filter - nTableFilterLen = createWildCardVector(aTableFilter,aWCSearch); + Sequence< ::rtl::OUString > aNames = m_xMasterContainer->getElementNames(); + const ::rtl::OUString* name = aNames.getConstArray(); + const ::rtl::OUString* nameEnd = name + aNames.getLength(); + for ( ; name != nameEnd; ++name ) + aUnfilteredTables.push_back( TableInfo( *name ) ); - aTableNames.reserve(nTableFilterLen + (aWCSearch.size() * 10)); + reFill( lcl_filter( aUnfilteredTables, + _rTableFilter, _rTableTypeFilter, m_xMetaData, m_xMasterContainer ) ); - Sequence< ::rtl::OUString> aNames = m_xMasterContainer->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - for(;pBegin != pEnd;++pBegin) - { - if(isNameValid(*pBegin,aTableFilter,aTableTypeFilter,aWCSearch)) - aTableNames.push_back(*pBegin); - } - } - else - { - // no filter so insert all names - Sequence< ::rtl::OUString> aNames = m_xMasterContainer->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - aTableNames = connectivity::TStringVector(pBegin,pEnd); - } - reFill(aTableNames); m_bConstructed = sal_True; } else { - construct(_rTableFilter,_rTableTypeFilter); + construct( _rTableFilter, _rTableTypeFilter ); } } //------------------------------------------------------------------------------ void OFilteredContainer::construct(const Sequence< ::rtl::OUString >& _rTableFilter, const Sequence< ::rtl::OUString >& _rTableTypeFilter) { - try - { - Reference<XConnection> xCon = m_xConnection; - if ( xCon.is() ) - m_xMetaData = xCon->getMetaData(); - } - catch(SQLException&) - { - } // build sorted versions of the filter sequences, so the visibility decision is faster Sequence< ::rtl::OUString > aTableFilter(_rTableFilter); sal_Int32 nTableFilterLen = aTableFilter.getLength(); - if (nTableFilterLen) - ::std::sort( aTableFilter.getArray(), aTableFilter.getArray() + nTableFilterLen ); - - sal_Bool bNoTableFilters = ((nTableFilterLen == 1) && _rTableFilter[0].equalsAsciiL("%", 1)); - // as we want to modify nTableFilterLen, remember this - // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard // for them ::std::vector< WildCard > aWCSearch; @@ -207,90 +331,87 @@ namespace dbaccess try { - if (m_xMetaData.is()) + Reference< XConnection > xCon( m_xConnection, UNO_SET_THROW ); + m_xMetaData.set( xCon->getMetaData(), UNO_SET_THROW ); + + // create a table table filter suitable for the XDatabaseMetaData::getTables call, + // taking into account both the externally-provided table type filter, and any + // table type restriction which is inherent to the container + Sequence< ::rtl::OUString > aTableTypeFilter; + ::rtl::OUString sInherentTableTypeRestriction( getTableTypeRestriction() ); + if ( sInherentTableTypeRestriction.getLength() ) { - static const ::rtl::OUString sAll = ::rtl::OUString::createFromAscii("%"); - Sequence< ::rtl::OUString > sTableTypes = getTableTypeFilter(_rTableTypeFilter); - if ( m_bConstructed && sTableTypes.getLength() == 0 ) - return; - - Reference< XResultSet > xTables = m_xMetaData->getTables(Any(), sAll, sAll, sTableTypes); - Reference< XRow > xCurrentRow(xTables, UNO_QUERY); - if (xCurrentRow.is()) + if ( _rTableTypeFilter.getLength() != 0 ) { - - // after creation the set is positioned before the first record, per definitionem - - ::rtl::OUString sCatalog, sSchema, sName, sType; - ::rtl::OUString sComposedName; - - // we first collect the names and construct the OTable objects later, as the ctor of the table may need - // another result set from the connection, and some drivers support only one statement per connection - - sal_Bool bFilterMatch; - while (xTables->next()) + const ::rtl::OUString* tableType = _rTableTypeFilter.getConstArray(); + const ::rtl::OUString* tableTypeEnd = tableType + _rTableTypeFilter.getLength(); + for ( ; tableType != tableTypeEnd; ++tableType ) { - sCatalog = xCurrentRow->getString(1); - sSchema = xCurrentRow->getString(2); - sName = xCurrentRow->getString(3); -#if OSL_DEBUG_LEVEL > 0 - ::rtl::OUString sTableType = xCurrentRow->getString(4); -#endif - // we're not interested in the "wasNull", as the getStrings would return an empty string in - // that case, which is sufficient here - - sComposedName = composeTableName( m_xMetaData, sCatalog, sSchema, sName, sal_False, ::dbtools::eInDataManipulation ); - - const ::rtl::OUString* tableFilter = aTableFilter.getConstArray(); - const ::rtl::OUString* tableFilterEnd = aTableFilter.getConstArray() + nTableFilterLen; - bool composedNameInFilter = ::std::find( tableFilter, tableFilterEnd, sComposedName ) != tableFilterEnd; - - bFilterMatch = bNoTableFilters - || ( ( nTableFilterLen != 0 ) - && composedNameInFilter - ); - - // the table is allowed to "pass" if we had no filters at all or any of the non-wildcard filters matches - - if (!bFilterMatch && aWCSearch.size()) - { // or if one of the wildcrad expression matches - for ( ::std::vector< WildCard >::const_iterator aLoop = aWCSearch.begin(); - aLoop != aWCSearch.end() && !bFilterMatch; - ++aLoop - ) - bFilterMatch = aLoop->Matches(sComposedName); - } - - if (bFilterMatch) - { // the table name is allowed (not filtered out) - insertElement(sComposedName,NULL); - } + if ( *tableType == sInherentTableTypeRestriction ) + break; + } + if ( tableType == tableTypeEnd ) + { // the only table type which can be part of this container is not allowed + // by the externally provided table type filter. + m_bConstructed = sal_True; + return; } - - // dispose the tables result set, in case the connection can handle only one concurrent statement - // (the table object creation will need it's own statements) - disposeComponent(xTables); } - else - OSL_ENSURE(0,"OFilteredContainer::construct : did not get a XRow from the tables result set !"); + aTableTypeFilter.realloc( 1 ); + aTableTypeFilter[0] = sInherentTableTypeRestriction; } else - OSL_ENSURE(0,"OFilteredContainer::construct : no connection meta data !"); + { + // no container-inherent restriction for the table types + if ( _rTableTypeFilter.getLength() == 0 ) + { // no externally-provided table type filter => use the default filter + getAllTableTypeFilter( aTableTypeFilter ); + } + else + { + aTableTypeFilter = _rTableTypeFilter; + } + } + + static const ::rtl::OUString sAll = ::rtl::OUString::createFromAscii("%"); + Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter ); + Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW ); + + TableInfos aUnfilteredTables; + + ::rtl::OUString sCatalog, sSchema, sName, sType; + while ( xTables->next() ) + { + sCatalog = xCurrentRow->getString(1); + sSchema = xCurrentRow->getString(2); + sName = xCurrentRow->getString(3); + sType = xCurrentRow->getString(4); + + aUnfilteredTables.push_back( TableInfo( sCatalog, sSchema, sName, sType ) ); + } + + reFill( lcl_filter( aUnfilteredTables, + _rTableFilter, aTableTypeFilter, m_xMetaData, NULL ) ); + + disposeComponent( xTables ); } - catch (SQLException&) + catch (const Exception&) { - OSL_ENSURE(0,"OFilteredContainer::construct: caught an SQL-Exception !"); + DBG_UNHANDLED_EXCEPTION(); disposing(); return; } m_bConstructed = sal_True; } + //------------------------------------------------------------------------------ void OFilteredContainer::disposing() { OCollection::disposing(); - removeMasterContainerListener(); + + if ( m_xMasterContainer.is() ) + removeMasterContainerListener(); m_xMasterContainer = NULL; m_xMetaData = NULL; @@ -310,36 +431,70 @@ namespace dbaccess m_pRefreshListener->refresh(this); } } - // ------------------------------------------------------------------------- - sal_Bool OFilteredContainer::isNameValid( const ::rtl::OUString& _rName, - const Sequence< ::rtl::OUString >& _rTableFilter, - const Sequence< ::rtl::OUString >& /*_rTableTypeFilter*/, - const ::std::vector< WildCard >& _rWCSearch) const - { - sal_Int32 nTableFilterLen = _rTableFilter.getLength(); - const ::rtl::OUString* tableFilter = _rTableFilter.getConstArray(); - const ::rtl::OUString* tableFilterEnd = _rTableFilter.getConstArray() + nTableFilterLen; - bool bFilterMatch = ::std::find( tableFilter, tableFilterEnd, _rName ) != tableFilterEnd; - // the table is allowed to "pass" if we had no filters at all or any of the non-wildcard filters matches - if (!bFilterMatch && !_rWCSearch.empty()) - { // or if one of the wildcrad expression matches - String sWCCompare = (const sal_Unicode*)_rName; - for ( ::std::vector< WildCard >::const_iterator aLoop = _rWCSearch.begin(); - aLoop != _rWCSearch.end() && !bFilterMatch; - ++aLoop - ) - bFilterMatch = aLoop->Matches(sWCCompare); - } - - return bFilterMatch; - } // ----------------------------------------------------------------------------- ::rtl::OUString OFilteredContainer::getNameForObject(const ObjectType& _xObject) { - OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!"); + OSL_ENSURE( _xObject.is(), "OFilteredContainer::getNameForObject: Object is NULL!" ); return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::eInDataManipulation, false, false, false ); } + + // ----------------------------------------------------------------------------- + // multiple to obtain all tables from XDatabaseMetaData::getTables, via passing a particular + // table type filter: + // adhere to the standard, which requests to pass a NULL table type filter, if + // you want to retrieve all tables + #define FILTER_MODE_STANDARD 0 + // only pass %, which is not allowed by the standard, but understood by some drivers + #define FILTER_MODE_WILDCARD 1 + // only pass TABLE and VIEW + #define FILTER_MODE_FIXED 2 + // do the thing which showed to be the safest way, understood by nearly all + // drivers, even the ones which do not understand the standard + #define FILTER_MODE_MIX_ALL 3 + + void OFilteredContainer::getAllTableTypeFilter( Sequence< ::rtl::OUString >& /* [out] */ _rFilter ) const + { + sal_Int32 nFilterMode = FILTER_MODE_MIX_ALL; + // for compatibility reasons, this is the default: we used this way before we + // introduced the TableTypeFilterMode setting + + // obtain the data source we belong to, and the TableTypeFilterMode setting + Any aFilterModeSetting; + if ( getDataSourceSetting( getDataSource( (Reference< XInterface >)m_rParent ), "TableTypeFilterMode", aFilterModeSetting ) ) + { + OSL_VERIFY( aFilterModeSetting >>= nFilterMode ); + } + + const ::rtl::OUString sAll( RTL_CONSTASCII_USTRINGPARAM( "%" ) ); + const ::rtl::OUString sView( RTL_CONSTASCII_USTRINGPARAM( "VIEW" ) ); + const ::rtl::OUString sTable( RTL_CONSTASCII_USTRINGPARAM( "TABLE" ) ); + + switch ( nFilterMode ) + { + default: + OSL_ENSURE( sal_False, "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" ); + case FILTER_MODE_MIX_ALL: + _rFilter.realloc( 3 ); + _rFilter[0] = sView; + _rFilter[1] = sTable; + _rFilter[2] = sAll; + break; + case FILTER_MODE_FIXED: + _rFilter.realloc( 2 ); + _rFilter[0] = sView; + _rFilter[1] = sTable; + break; + case FILTER_MODE_WILDCARD: + _rFilter.realloc( 1 ); + _rFilter[0] = sAll; + break; + case FILTER_MODE_STANDARD: + _rFilter.realloc( 0 ); + break; + } + } + // .............................................................................. } // namespace // .............................................................................. diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 96c20e00584b..269a5aca69ba 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -124,6 +124,9 @@ #ifndef _STRING_HXX #include <tools/string.hxx> #endif +#ifndef TOOLS_DIAGNOSE_EX_H +#include <tools/diagnose_ex.h> +#endif using namespace dbaccess; using namespace dbtools; @@ -162,12 +165,6 @@ namespace OSL_ENSURE( 0, "lcl_isPropertySetDefaulted: Exception caught!" ); } } - // the code below doesn't function -> I don't kow why -// Sequence<PropertyState> aStates = xState->getPropertyStates(_aNames); -// const PropertyState* pIter = aStates.getConstArray(); -// const PropertyState* pEnd = pIter + aStates.getLength(); -// for( ; pIter != pEnd && *pIter == PropertyState_DEFAULT_VALUE; ++pIter) -// ; return ( pIter == pEnd ); } return sal_False; @@ -204,45 +201,29 @@ OTableContainer::~OTableContainer() // ----------------------------------------------------------------------------- void OTableContainer::removeMasterContainerListener() { - Reference<XContainer> xCont(m_xMasterContainer,UNO_QUERY); - if(xCont.is()) - xCont->removeContainerListener(this); + try + { + Reference<XContainer> xCont( m_xMasterContainer, UNO_QUERY_THROW ); + xCont->removeContainerListener( this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } + +// ----------------------------------------------------------------------------- +::rtl::OUString OTableContainer::getTableTypeRestriction() const +{ + // no restriction at all (other than the ones provided externally) + return ::rtl::OUString(); +} + // ----------------------------------------------------------------------------- // XServiceInfo //------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) -// ------------------------------------------------------------------------- -sal_Bool OTableContainer::isNameValid( const ::rtl::OUString& _rName, - const Sequence< ::rtl::OUString >& _rTableFilter, - const Sequence< ::rtl::OUString >& _rTableTypeFilter, - const ::std::vector< WildCard >& _rWCSearch) const -{ - if ( OFilteredContainer::isNameValid(_rName,_rTableFilter,_rTableTypeFilter,_rWCSearch) ) - {// the table name is allowed (not filtered out) - // no type filter - - sal_Int32 nTableTypeFilterLen = _rTableTypeFilter.getLength(); - sal_Bool bNoTableFilters = ((nTableTypeFilterLen == 1) && _rTableTypeFilter[0].equalsAsciiL("%", 1)); - - if ( bNoTableFilters || !nTableTypeFilterLen ) - return sal_True; - // this is expensive but there is no other way to get the type of the table - Reference<XPropertySet> xTable; - ::cppu::extractInterface(xTable,m_xMasterContainer->getByName(_rName)); - ::rtl::OUString aTypeName; - xTable->getPropertyValue(PROPERTY_TYPE) >>= aTypeName; - const ::rtl::OUString* pTypeBegin = _rTableTypeFilter.getConstArray(); - const ::rtl::OUString* pTypeEnd = pTypeBegin + _rTableTypeFilter.getLength(); - for(;pTypeBegin != pTypeEnd;++pTypeBegin) - { - if(*pTypeBegin == aTypeName) - return sal_True; // same as break and then checking - } - } - return sal_False; -} // ----------------------------------------------------------------------------- namespace { @@ -572,84 +553,18 @@ void SAL_CALL OTableContainer::disposing() void SAL_CALL OTableContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException) { } -// ----------------------------------------------------------------------------- -Sequence< ::rtl::OUString > OTableContainer::getTableTypeFilter(const Sequence< ::rtl::OUString >& _rTableTypeFilter) const -{ - Sequence< ::rtl::OUString > sTableTypes; - if ( _rTableTypeFilter.getLength() == 0 ) - { - getAllTableTypeFilter( sTableTypes ); - } - else - { - sTableTypes = _rTableTypeFilter; - } - return sTableTypes; -} // ----------------------------------------------------------------------------- void OTableContainer::addMasterContainerListener() { - // we have to listen at the mastertables because it could happen that another inserts new tables - Reference<XContainer> xCont(m_xMasterContainer,UNO_QUERY); - if(xCont.is()) - xCont->addContainerListener(this); -} -// ----------------------------------------------------------------------------- -// two ways to obtain all tables from XDatabaseMetaData::getTables, via passing a particular -// table type filter: -// adhere to the standard, which requests to pass a NULL table type filter, if -// you want to retrieve all tables -#define FILTER_MODE_STANDARD 0 -// only pass %, which is not allowed by the standard, but understood by some drivers -#define FILTER_MODE_WILDCARD 1 -// only pass TABLE and VIEW -#define FILTER_MODE_FIXED 2 -// do the thing which showed to be the safest way, understood by nearly all -// drivers, even the ones which do not understand the standard -#define FILTER_MODE_MIX_ALL 3 - -void OTableContainer::getAllTableTypeFilter( Sequence< ::rtl::OUString >& /* [out] */ _rFilter ) const -{ - sal_Int32 nFilterMode = FILTER_MODE_MIX_ALL; - // for compatibility reasons, this is the default: we used this way before we - // introduced the TableTypeFilterMode setting - - // obtain the data source we belong to, and the TableTypeFilterMode setting - Any aFilterModeSetting; - if ( getDataSourceSetting( getDataSource( (Reference< XInterface >)m_rParent ), "TableTypeFilterMode", aFilterModeSetting ) ) + try { - OSL_VERIFY( aFilterModeSetting >>= nFilterMode ); + Reference< XContainer > xCont( m_xMasterContainer, UNO_QUERY_THROW ); + xCont->addContainerListener( this ); } - - const ::rtl::OUString sAll( RTL_CONSTASCII_USTRINGPARAM( "%" ) ); - const ::rtl::OUString sView( RTL_CONSTASCII_USTRINGPARAM( "VIEW" ) ); - const ::rtl::OUString sTable( RTL_CONSTASCII_USTRINGPARAM( "TABLE" ) ); - - switch ( nFilterMode ) + catch( const Exception& ) { - default: - OSL_ENSURE( sal_False, "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" ); - case FILTER_MODE_MIX_ALL: - _rFilter.realloc( 3 ); - _rFilter[0] = sView; - _rFilter[1] = sTable; - _rFilter[2] = sAll; - break; - case FILTER_MODE_FIXED: - _rFilter.realloc( 2 ); - _rFilter[0] = sView; - _rFilter[1] = sTable; - break; - case FILTER_MODE_WILDCARD: - _rFilter.realloc( 1 ); - _rFilter[0] = sAll; - break; - case FILTER_MODE_STANDARD: - _rFilter.realloc( 0 ); - break; + DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- - diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx index 58641966bb7d..2783c0586f64 100644 --- a/dbaccess/source/core/api/viewcontainer.cxx +++ b/dbaccess/source/core/api/viewcontainer.cxx @@ -316,30 +316,8 @@ void SAL_CALL OViewContainer::elementReplaced( const ContainerEvent& /*Event*/ ) { } // ----------------------------------------------------------------------------- -Sequence< ::rtl::OUString > OViewContainer::getTableTypeFilter(const Sequence< ::rtl::OUString >& _rTableTypeFilter) const +::rtl::OUString OViewContainer::getTableTypeRestriction() const { - static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW")); - - if(_rTableTypeFilter.getLength() != 0) - { - const ::rtl::OUString* pBegin = _rTableTypeFilter.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + _rTableTypeFilter.getLength(); - for(;pBegin != pEnd;++pBegin) - { - if ( *pBegin == s_sTableTypeView ) - break; - } - if ( pBegin != pEnd ) - { // view are filtered out - m_bConstructed = sal_True; - return Sequence< ::rtl::OUString >(); - } - } - // we want all catalogues, all schemas, all tables - Sequence< ::rtl::OUString > sTableTypes(1); - sTableTypes[0] = s_sTableTypeView; - return sTableTypes; + // no restriction at all (other than the ones provided externally) + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VIEW" ) ); } -// ----------------------------------------------------------------------------- - - diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 0ccdbf8191e5..d78acc83712a 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -417,20 +417,35 @@ void ODatabaseModelImpl::impl_construct_nothrow() // insert the default settings Reference< XPropertyContainer > xContainer( m_xSettings, UNO_QUERY_THROW ); + Reference< XSet > xSettingsSet( m_xSettings, UNO_QUERY_THROW ); const AsciiPropertyValue* pSettings = getDefaultDataSourceSettings(); for ( ; pSettings->AsciiName; ++pSettings ) { - xContainer->addProperty( - ::rtl::OUString::createFromAscii( pSettings->AsciiName ), - PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT, - pSettings->DefaultValue - ); + if ( !pSettings->DefaultValue.hasValue() ) + { + Property aProperty( + ::rtl::OUString::createFromAscii( pSettings->AsciiName ), + -1, + ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ), + PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID + ); + xSettingsSet->insert( makeAny( aProperty ) ); + } + else + { + xContainer->addProperty( + ::rtl::OUString::createFromAscii( pSettings->AsciiName ), + PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT, + pSettings->DefaultValue + ); + } } } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + m_pDBContext->appendAtTerminateListener(*this); } // ----------------------------------------------------------------------------- @@ -1031,6 +1046,7 @@ oslInterlockedCount SAL_CALL ODatabaseModelImpl::release() if ( osl_decrementInterlockedCount(&m_refCount) == 0 ) { acquire(); // prevent multiple releases + m_pDBContext->removeFromTerminateListener(*this); dispose(); m_pDBContext->storeTransientProperties(*this); revokeDataSource(); @@ -1063,6 +1079,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() { // known JDBC settings AsciiPropertyValue( "JavaDriverClass", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "IgnoreCurrency", makeAny( (sal_Bool)sal_False ) ), // known settings for file-based drivers AsciiPropertyValue( "Extension", makeAny( ::rtl::OUString() ) ), AsciiPropertyValue( "CharSet", makeAny( ::rtl::OUString() ) ), @@ -1075,6 +1092,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() // known ODBC settings AsciiPropertyValue( "SystemDriverSettings", makeAny( ::rtl::OUString() ) ), AsciiPropertyValue( "UseCatalog", makeAny( (sal_Bool)sal_False ) ), + AsciiPropertyValue( "TypeInfoSettings", makeAny( Sequence< Any >()) ), // settings related to auto increment handling AsciiPropertyValue( "AutoIncrementCreation", makeAny( ::rtl::OUString() ) ), AsciiPropertyValue( "AutoRetrievingStatement", makeAny( ::rtl::OUString() ) ), @@ -1090,11 +1108,15 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() AsciiPropertyValue( "PortNumber", makeAny( (sal_Int32)389 ) ), AsciiPropertyValue( "BaseDN", makeAny( ::rtl::OUString() ) ), AsciiPropertyValue( "MaxRowCount", makeAny( (sal_Int32)100 ) ), + // known MySQLNative driver settings + AsciiPropertyValue( "LocalSocket", makeAny( ::rtl::OUString() ) ), // misc known driver settings AsciiPropertyValue( "ParameterNameSubstitution", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "AddIndexAppendix", makeAny( (sal_Bool)sal_True ) ), - // known SDB level settings AsciiPropertyValue( "IgnoreDriverPrivileges", makeAny( (sal_Bool)sal_True ) ), + AsciiPropertyValue( "ImplicitCatalogRestriction", Any( ) ), + AsciiPropertyValue( "ImplicitSchemaRestriction", Any( ) ), + // known SDB level settings AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "GenerateASBeforeCorrelationName", makeAny( (sal_Bool)sal_True ) ), @@ -1109,9 +1131,6 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() AsciiPropertyValue( "PreferDosLikeLineEnds", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( (sal_Bool)sal_True ) ), AsciiPropertyValue( "EscapeDateTime", makeAny( (sal_Bool)sal_True ) ), - AsciiPropertyValue( "IgnoreCurrency", makeAny( (sal_Bool)sal_False ) ), - AsciiPropertyValue( "TypeInfoSettings", makeAny( Sequence< Any >()) ), - AsciiPropertyValue( "LocalSocket", makeAny( ::rtl::OUString() ) ), AsciiPropertyValue( NULL, Any() ) }; diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index f39f601d148f..4eab4145bd9c 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -434,8 +434,9 @@ OConnection::OConnection(ODatabaseSource& _rDB impl_checkTableQueryNames_nothrow(); } } - catch(Exception&) + catch(const Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } osl_decrementInterlockedCount( &m_refCount ); } @@ -621,6 +622,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) { if (!m_pTables->isInitialized()) { + // check if our "master connection" can supply tables getMasterTables(); if (m_xMasterTables.is() && m_xMasterTables->getTables().is()) diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index 0d5bcb3e7081..9bc92a003c9a 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -44,16 +44,20 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/registry/InvalidRegistryException.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/ucb/InteractiveIOException.hpp> #include <com/sun/star/ucb/IOErrorCode.hpp> -#include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/util/XCloseable.hpp> /** === end UNO includes === **/ #include <basic/basmgr.hxx> @@ -74,6 +78,8 @@ #include <ucbhelper/content.hxx> #include <unotools/confignode.hxx> #include <unotools/sharedunocomponent.hxx> +#include <list> +#include <boost/bind.hpp> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; @@ -85,6 +91,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::util; using namespace ::com::sun::star::registry; +using namespace ::com::sun::star; using namespace ::cppu; using namespace ::osl; using namespace ::utl; @@ -129,7 +136,83 @@ namespace dbaccess static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location"); return s_sNodeName; } + // ----------------------------------------------------------------------------- } + // ............................................................................. + typedef ::cppu::WeakImplHelper1 < XTerminateListener + > DatabaseDocumentLoader_Base; + class DatabaseDocumentLoader : public DatabaseDocumentLoader_Base + { + private: + Reference< XDesktop > m_xDesktop; + ::std::list< const ODatabaseModelImpl* > m_aDatabaseDocuments; + + public: + DatabaseDocumentLoader( const comphelper::ComponentContext& _aContext); + + inline void append(const ODatabaseModelImpl& _rModelImpl ) + { + m_aDatabaseDocuments.push_back(&_rModelImpl); + } + inline void remove(const ODatabaseModelImpl& _rModelImpl) { m_aDatabaseDocuments.remove(&_rModelImpl); } + + private: + // XTerminateListener + virtual void SAL_CALL queryTermination( const lang::EventObject& Event ) throw (TerminationVetoException, RuntimeException); + virtual void SAL_CALL notifyTermination( const lang::EventObject& Event ) throw (RuntimeException); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + }; + + // ............................................................................. + DatabaseDocumentLoader::DatabaseDocumentLoader( const comphelper::ComponentContext& _aContext ) + { + acquire(); + try + { + m_xDesktop.set( _aContext.createComponent( (rtl::OUString)SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); + m_xDesktop->addTerminateListener( this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + struct TerminateFunctor : ::std::unary_function<ODatabaseModelImpl* , void> + { + void operator()( const ODatabaseModelImpl* _pModelImpl ) const + { + try + { + const Reference< XModel2> xModel( _pModelImpl ->getModel_noCreate(),UNO_QUERY_THROW ); + if ( !xModel->getControllers()->hasMoreElements() ) + { + Reference<util::XCloseable> xCloseable(xModel,UNO_QUERY_THROW); + xCloseable->close(sal_False); + } // if ( !xModel->getControllers()->hasMoreElements() ) + } + catch(const CloseVetoException&) + { + throw TerminationVetoException(); + } + } + }; + // ............................................................................. + void SAL_CALL DatabaseDocumentLoader::queryTermination( const lang::EventObject& /*Event*/ ) throw (TerminationVetoException, RuntimeException) + { + ::std::list< const ODatabaseModelImpl* > aCopy(m_aDatabaseDocuments); + ::std::for_each(aCopy.begin(),aCopy.end(),TerminateFunctor()); + } + + // ............................................................................. + void SAL_CALL DatabaseDocumentLoader::notifyTermination( const lang::EventObject& /*Event*/ ) throw (RuntimeException) + { + } + // ............................................................................. + void SAL_CALL DatabaseDocumentLoader::disposing( const lang::EventObject& /*Source*/ ) throw (RuntimeException) + { + } //= ODatabaseContext //========================================================================== @@ -139,6 +222,7 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon ,m_aContext( _rxContext ) ,m_aContainerListeners(m_aMutex) { + m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( m_aContext ); ::basic::BasicManagerRepository::registerCreationListener( *this ); } @@ -146,6 +230,8 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon ODatabaseContext::~ODatabaseContext() { ::basic::BasicManagerRepository::revokeCreationListener( *this ); + if ( m_pDatabaseDocumentLoader ) + m_pDatabaseDocumentLoader->release(); } // Helper @@ -348,13 +434,23 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin xModel->attachResource( _sURL, aResource ); ::utl::CloseableComponent aEnsureClose( xModel ); - } + } // if ( !pExistent.get() ) setTransientProperties( _sURL, *pExistent ); return pExistent->getOrCreateDataSource().get(); } // ----------------------------------------------------------------------------- +void ODatabaseContext::appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel) +{ + m_pDatabaseDocumentLoader->append(_rDataSourceModel); +} +// ----------------------------------------------------------------------------- +void ODatabaseContext::removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel) +{ + m_pDatabaseDocumentLoader->remove(_rDataSourceModel); +} +// ----------------------------------------------------------------------------- void ODatabaseContext::setTransientProperties(const ::rtl::OUString& _sURL, ODatabaseModelImpl& _rDataSourceModel ) { if ( m_aDatasourceProperties.end() == m_aDatasourceProperties.find(_sURL) ) diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx index b164dd644671..f09d54daf3f3 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.hxx +++ b/dbaccess/source/core/dataaccess/databasecontext.hxx @@ -98,7 +98,7 @@ namespace com { namespace sun { namespace star { namespace dbaccess { //........................................................................ - +class DatabaseDocumentLoader; //============================================================ //= ODatabaseContext //============================================================ @@ -159,6 +159,7 @@ protected: // properties. ::cppu::OInterfaceContainerHelper m_aContainerListeners; + DatabaseDocumentLoader* m_pDatabaseDocumentLoader; public: ODatabaseContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); @@ -213,6 +214,8 @@ public: void deregisterPrivate(const ::rtl::OUString& _sName); void nameChangePrivate(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName); void storeTransientProperties( ODatabaseModelImpl& _rModelImpl); + void appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel); + void removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel); private: // BasicManagerCreationListener diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 6ccbb4d03a03..c5b176478ecd 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -162,6 +162,7 @@ ODocumentContainer::ODocumentContainer(const Reference< XMultiServiceFactory >& ODocumentContainer::~ODocumentContainer() { DBG_DTOR(ODocumentContainer, NULL); + if ( !OContentHelper::rBHelper.bInDispose && !OContentHelper::rBHelper.bDisposed ) { acquire(); @@ -262,6 +263,10 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments { aValue.Value >>= bAsTemplate; } + else + { + // DBG_ASSERT("unknown property exception"); + } } const ODefinitionContainer_Impl& rDefinitions( getDefinitions() ); diff --git a/dbaccess/source/core/dataaccess/documentcontainer.hxx b/dbaccess/source/core/dataaccess/documentcontainer.hxx index b5c5a16e0383..c4f4aa24642c 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.hxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.hxx @@ -77,6 +77,7 @@ class ODocumentContainer : public ODefinitionContainer , public ::comphelper::OPropertyArrayUsageHelper< ODocumentContainer > { sal_Bool m_bFormsContainer; + public: /** constructs the container.<BR> */ diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 80096ebe427d..c14197110b48 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -254,31 +254,31 @@ #include <com/sun/star/sdb/application/DatabaseObject.hpp> using namespace ::com::sun::star; -using namespace ::com::sun::star::view; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::embed; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::document; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::datatransfer; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::drawing; +using namespace view; +using namespace uno; +using namespace util; +using namespace ucb; +using namespace beans; +using namespace lang; +using namespace awt; +using namespace embed; +using namespace frame; +using namespace document; +using namespace sdbc; +using namespace sdb; +using namespace io; +using namespace container; +using namespace datatransfer; +using namespace task; +using namespace form; +using namespace drawing; using namespace ::osl; using namespace ::comphelper; using namespace ::cppu; namespace css = ::com::sun::star; -using ::com::sun::star::sdb::application::XDatabaseDocumentUI; -namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; +using sdb::application::XDatabaseDocumentUI; +namespace DatabaseObject = sdb::application::DatabaseObject; #define DEFAULT_WIDTH 10000 @@ -318,7 +318,7 @@ namespace dbaccess //================================================================== // OEmbedObjectHolder //================================================================== - typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::embed::XStateChangeListener > TEmbedObjectHolder; + typedef ::cppu::WeakComponentImplHelper1< embed::XStateChangeListener > TEmbedObjectHolder; class OEmbedObjectHolder : public ::comphelper::OBaseMutex ,public TEmbedObjectHolder { @@ -344,9 +344,9 @@ namespace dbaccess osl_decrementInterlockedCount( &m_refCount ); } - virtual void SAL_CALL changingState( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL stateChanged( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL changingState( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (embed::WrongStateException, uno::RuntimeException); + virtual void SAL_CALL stateChanged( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (uno::RuntimeException); + virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException); }; //------------------------------------------------------------------ void SAL_CALL OEmbedObjectHolder::disposing() @@ -357,7 +357,7 @@ namespace dbaccess m_pDefinition = NULL; } //------------------------------------------------------------------ - void SAL_CALL OEmbedObjectHolder::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException) + void SAL_CALL OEmbedObjectHolder::changingState( const lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (embed::WrongStateException, uno::RuntimeException) { if ( !m_bInChangingState && nNewState == EmbedStates::RUNNING && nOldState == EmbedStates::ACTIVE && m_pDefinition ) { @@ -367,7 +367,7 @@ namespace dbaccess } } //------------------------------------------------------------------ - void SAL_CALL OEmbedObjectHolder::stateChanged( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException) + void SAL_CALL OEmbedObjectHolder::stateChanged( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (uno::RuntimeException) { if ( !m_bInStateChange && nNewState == EmbedStates::RUNNING && nOldState == EmbedStates::ACTIVE && m_pDefinition ) { @@ -382,7 +382,7 @@ namespace dbaccess } } //------------------------------------------------------------------ - void SAL_CALL OEmbedObjectHolder::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException) + void SAL_CALL OEmbedObjectHolder::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) { m_xBroadCaster = NULL; } @@ -405,7 +405,7 @@ namespace dbaccess { } // XComponentSupplier - virtual Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent( ) throw (RuntimeException) + virtual Reference< util::XCloseable > SAL_CALL getComponent( ) throw (RuntimeException) { return Reference< css::util::XCloseable >(); } @@ -561,6 +561,7 @@ ODocumentDefinition::ODocumentDefinition(const Reference< XInterface >& _rxConta ,m_bForm(_bForm) ,m_bOpenInDesign(sal_False) ,m_bInExecute(sal_False) + ,m_bRemoveListener(sal_False) ,m_pClientHelper(NULL) { DBG_CTOR(ODocumentDefinition, NULL); @@ -568,7 +569,6 @@ ODocumentDefinition::ODocumentDefinition(const Reference< XInterface >& _rxConta if ( _aClassID.getLength() ) loadEmbeddedObject( _xConnection, _aClassID, Sequence< PropertyValue >(), false, false ); } - //-------------------------------------------------------------------------- ODocumentDefinition::~ODocumentDefinition() { @@ -617,6 +617,12 @@ void SAL_CALL ODocumentDefinition::disposing() ::osl::MutexGuard aGuard(m_aMutex); closeObject(); ::comphelper::disposeComponent(m_xListener); + if ( m_bRemoveListener && m_xDesktop.is() ) + { + Reference<util::XCloseable> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate(),UNO_QUERY); + if ( xCloseable.is() ) + xCloseable->removeCloseListener(this); + } m_xDesktop = NULL; } // ----------------------------------------------------------------------------- @@ -745,7 +751,7 @@ namespace { private: Reference< XVisualObject > m_xVisObject; - ::com::sun::star::awt::Size m_aOriginalSize; + awt::Size m_aOriginalSize; public: inline PreserveVisualAreaSize( const Reference< XModel >& _rxModel ) @@ -1603,6 +1609,15 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC if ( !m_xDesktop.is() ) m_xDesktop.set( m_aContext.createComponent( (::rtl::OUString)SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); xParentFrame.set(m_xDesktop,uno::UNO_QUERY); + if ( xParentFrame.is() ) + { + Reference<util::XCloseable> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate(),UNO_QUERY); + if ( xCloseable.is() ) + { + xCloseable->addCloseListener(this); + m_bRemoveListener = sal_True; + } + } } OSL_ENSURE( xParentFrame.is(), "ODocumentDefinition::fillLoadArgs: no parent frame!" ); if ( xParentFrame.is() ) @@ -1633,6 +1648,8 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC if ( m_pImpl->m_aProps.aTitle.getLength() ) aMediaDesc.put( "DocumentTitle", m_pImpl->m_aProps.aTitle ); + aMediaDesc.put( "DocumentBaseURL", m_pImpl->m_pDataSource->getURL() ); + // ......................................................................... // put the common load arguments into the document's media descriptor lcl_putLoadArgs( aMediaDesc, optional_bool( _bSuppressMacros ), optional_bool( _bReadOnly ) ); @@ -1716,7 +1733,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x m_xEmbeddedObject->changeState(EmbedStates::RUNNING); if ( bSetSize ) { - ::com::sun::star::awt::Size aSize( DEFAULT_WIDTH, DEFAULT_HEIGHT ); + awt::Size aSize( DEFAULT_WIDTH, DEFAULT_HEIGHT ); m_xEmbeddedObject->setVisualAreaSize(Aspects::MSOLE_CONTENT,aSize); } @@ -1760,6 +1777,9 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x Sequence< PropertyValue > aArgs = xModel->getArgs(); ::comphelper::NamedValueCollection aMediaDesc( aArgs ); + ::comphelper::NamedValueCollection aArguments( _rAdditionalArgs ); + aMediaDesc.merge( aArguments, sal_False ); + lcl_putLoadArgs( aMediaDesc, optional_bool(), optional_bool() ); // don't put _bSuppressMacros and _bReadOnly here - if the document was already // loaded, we should not tamper with its settings. @@ -1844,10 +1864,10 @@ void ODocumentDefinition::onCommandGetDocumentProperties( Any& _rProps ) } } // ----------------------------------------------------------------------------- -Reference< ::com::sun::star::util::XCloseable> ODocumentDefinition::getComponent() throw (RuntimeException) +Reference< util::XCloseable> ODocumentDefinition::getComponent() throw (RuntimeException) { OSL_ENSURE(m_xEmbeddedObject.is(),"Illegal call for embeddedObject"); - Reference< ::com::sun::star::util::XCloseable> xComp; + Reference< util::XCloseable> xComp; if ( m_xEmbeddedObject.is() ) { int nOldState = m_xEmbeddedObject->getCurrentState(); @@ -2147,6 +2167,29 @@ void ODocumentDefinition::updateDocumentTitle() if ( xTitle.is() ) xTitle->setTitle(sName); } +// ----------------------------------------------------------------------------- +void SAL_CALL ODocumentDefinition::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException) +{ + (void) Source; + (void) GetsOwnership; + try + { + if ( !close() ) + throw util::CloseVetoException(); + } + catch(const lang::WrappedTargetException&) + { + throw util::CloseVetoException(); + } +} +// ----------------------------------------------------------------------------- +void SAL_CALL ODocumentDefinition::notifyClosing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) +{ +} +// ----------------------------------------------------------------------------- +void SAL_CALL ODocumentDefinition::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) +{ +} //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 510d9f30153c..2d8d5f6df343 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -34,8 +34,8 @@ #ifndef _CPPUHELPER_PROPSHLP_HXX #include <cppuhelper/propshlp.hxx> #endif -#ifndef _CPPUHELPER_IMPLBASE2_HXX_ -#include <cppuhelper/implbase2.hxx> +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> #endif #ifndef DBA_CONTENTHELPER_HXX #include "ContentHelper.hxx" @@ -65,6 +65,7 @@ #include <com/sun/star/embed/XStateChangeListener.hpp> #endif #include <com/sun/star/sdb/XSubDocument.hpp> +#include <com/sun/star/util/XCloseListener.hpp> //........................................................................ namespace dbaccess @@ -78,8 +79,9 @@ namespace dbaccess //= document //========================================================================== -typedef ::cppu::ImplHelper2 < ::com::sun::star::embed::XComponentSupplier +typedef ::cppu::ImplHelper3 < ::com::sun::star::embed::XComponentSupplier , ::com::sun::star::sdb::XSubDocument + , ::com::sun::star::util::XCloseListener > ODocumentDefinition_Base; class ODocumentDefinition @@ -97,6 +99,7 @@ class ODocumentDefinition sal_Bool m_bForm; // <TRUE/> if it is a form sal_Bool m_bOpenInDesign; sal_Bool m_bInExecute; + sal_Bool m_bRemoveListener; OEmbeddedClientHelper* m_pClientHelper; protected: @@ -143,6 +146,13 @@ public: // XRename virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XCloseListener + virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + /** returns the forms/reports container storage, depending on m_bForm. Our own storage inside this container storage is the one with the name as indicated by m_pImpl->m_aProps.sPersistentName. */ diff --git a/dbaccess/source/core/inc/FilteredContainer.hxx b/dbaccess/source/core/inc/FilteredContainer.hxx index d86277eae596..0fc0974c29eb 100644 --- a/dbaccess/source/core/inc/FilteredContainer.hxx +++ b/dbaccess/source/core/inc/FilteredContainer.hxx @@ -30,17 +30,11 @@ #ifndef DBACCESS_CORE_FILTERED_CONTAINER_HXX #define DBACCESS_CORE_FILTERED_CONTAINER_HXX -#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ -#include <connectivity/sdbcx/VCollection.hxx> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -class WildCard; +#include <connectivity/sdbcx/VCollection.hxx> + namespace dbaccess { class IWarningsContainer; @@ -48,6 +42,9 @@ namespace dbaccess class OFilteredContainer : public ::connectivity::sdbcx::OCollection { + private: + mutable sal_Bool m_bConstructed; // late ctor called + protected: IWarningsContainer* m_pWarningsContainer; IRefreshListener* m_pRefreshListener; @@ -58,14 +55,10 @@ namespace dbaccess ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > m_xConnection; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; - mutable sal_Bool m_bConstructed; // late ctor called - - virtual sal_Bool isNameValid(const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableFilter, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableTypeFilter, - const ::std::vector< WildCard >& _rWCSearch) const; - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getTableTypeFilter(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableTypeFilter) const = 0; + /** returns a string denoting the only type of tables allowed in this container, or an empty string + if there is no such restriction + */ + virtual ::rtl::OUString getTableTypeRestriction() const = 0; inline virtual void addMasterContainerListener(){} inline virtual void removeMasterContainerListener(){} @@ -97,6 +90,12 @@ namespace dbaccess private: oslInterlockedCount& m_rValue; }; + + /** retrieve a table type filter to pass to <member scope="com::sun::star::sdbc">XDatabaseMetaData::getTables</member>, + according to the current data source settings + */ + void getAllTableTypeFilter( ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rFilter ) const; + public: /** ctor of the container. The parent has to support the <type scope="com::sun::star::sdbc">XConnection</type> interface.<BR> @@ -108,12 +107,12 @@ namespace dbaccess @see construct */ OFilteredContainer( ::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xCon, - sal_Bool _bCase, - IRefreshListener* _pRefreshListener, - IWarningsContainer* _pWarningsContainer, - oslInterlockedCount& _nInAppend + ::osl::Mutex& _rMutex, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xCon, + sal_Bool _bCase, + IRefreshListener* _pRefreshListener, + IWarningsContainer* _pWarningsContainer, + oslInterlockedCount& _nInAppend ); inline void dispose() { disposing(); } diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx index 3c96a0947cea..1644fc70bec6 100644 --- a/dbaccess/source/core/inc/tablecontainer.hxx +++ b/dbaccess/source/core/inc/tablecontainer.hxx @@ -102,7 +102,7 @@ namespace dbaccess // OFilteredContainer virtual void addMasterContainerListener(); virtual void removeMasterContainerListener(); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getTableTypeFilter(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableTypeFilter) const; + virtual ::rtl::OUString getTableTypeRestriction() const; // ::connectivity::sdbcx::OCollection virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); @@ -110,17 +110,8 @@ namespace dbaccess virtual connectivity::sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); - virtual sal_Bool isNameValid(const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableFilter, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableTypeFilter, - const ::std::vector< WildCard >& _rWCSearch) const; virtual void SAL_CALL disposing(); - /** retrieve a table type filter to pass to <member scope="com::sun::star::sdbc">XDatabaseMetaData::getTables</member>, - according to the current data source settings - */ - void getAllTableTypeFilter( ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rFilter ) const; - inline virtual void SAL_CALL acquire() throw(){ OFilteredContainer::acquire();} inline virtual void SAL_CALL release() throw(){ OFilteredContainer::release();} // ::com::sun::star::lang::XServiceInfo diff --git a/dbaccess/source/core/inc/viewcontainer.hxx b/dbaccess/source/core/inc/viewcontainer.hxx index 4ae1dc040ae6..4d339de34837 100644 --- a/dbaccess/source/core/inc/viewcontainer.hxx +++ b/dbaccess/source/core/inc/viewcontainer.hxx @@ -108,6 +108,10 @@ namespace dbaccess virtual ~OViewContainer(); + protected: + // OFilteredContainer overridables + virtual ::rtl::OUString getTableTypeRestriction() const; + private: inline virtual void SAL_CALL acquire() throw(){ OFilteredContainer::acquire();} inline virtual void SAL_CALL release() throw(){ OFilteredContainer::release();} @@ -121,7 +125,6 @@ namespace dbaccess virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getTableTypeFilter(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableTypeFilter) const; // ::connectivity::sdbcx::OCollection virtual ::connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); diff --git a/dbaccess/source/ext/macromigration/macromigration.src b/dbaccess/source/ext/macromigration/macromigration.src index e92afa82f978..bb49ac7ad287 100644 --- a/dbaccess/source/ext/macromigration/macromigration.src +++ b/dbaccess/source/ext/macromigration/macromigration.src @@ -162,8 +162,6 @@ TabPage TP_SAVE_DBDOC_AS Border = TRUE; DropDown = TRUE ; - - Text = "/home/user/databases/database.backup.odb"; }; PushButton PB_BROWSE_SAVE_AS_LOCATION diff --git a/dbaccess/source/filter/xml/xmlColumn.cxx b/dbaccess/source/filter/xml/xmlColumn.cxx index 3405f137a28d..c9670d98317a 100644 --- a/dbaccess/source/filter/xml/xmlColumn.cxx +++ b/dbaccess/source/filter/xml/xmlColumn.cxx @@ -66,6 +66,7 @@ #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include <com/sun/star/container/XNameContainer.hpp> #endif +#include <com/sun/star/container/XChild.hpp> #ifndef DBA_XMLSTYLEIMPORT_HXX #include "xmlStyleImport.hxx" #endif @@ -87,9 +88,11 @@ OXMLColumn::OXMLColumn( ODBFilter& rImport ,const ::rtl::OUString& _sLocalName ,const Reference< XAttributeList > & _xAttrList ,const Reference< XNameAccess >& _xParentContainer + ,const Reference< XPropertySet >& _xTable ) : SvXMLImportContext( rImport, nPrfx, _sLocalName ) ,m_xParentContainer(_xParentContainer) + ,m_xTable(_xTable) ,m_bHidden(sal_False) { DBG_CTOR(OXMLColumn,NULL); @@ -132,9 +135,11 @@ OXMLColumn::OXMLColumn( ODBFilter& rImport case XML_TOK_COLUMN_VISIBLE: m_bHidden = sValue.equalsAscii("false"); break; + case XML_TOK_DEFAULT_CELL_STYLE_NAME: + m_sCellStyleName = sValue; + break; } } - OSL_ENSURE(m_sName.getLength(),"Invalid column name of length: ZERO"); } // ----------------------------------------------------------------------------- @@ -160,6 +165,11 @@ void OXMLColumn::EndElement() if ( m_aDefaultValue.hasValue() ) xProp->setPropertyValue(PROPERTY_CONTROLDEFAULT,m_aDefaultValue); + Reference<XAppend> xAppend(m_xParentContainer,UNO_QUERY); + if ( xAppend.is() ) + xAppend->appendByDescriptor(xProp); + m_xParentContainer->getByName(m_sName) >>= xProp; + if ( m_sStyleName.getLength() ) { const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles(); @@ -171,10 +181,35 @@ void OXMLColumn::EndElement() pAutoStyle->FillPropertySet(xProp); } } + } // if ( m_sStyleName.getLength() ) + if ( m_sCellStyleName.getLength() ) + { + const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles(); + if ( pAutoStyles ) + { + OTableStyleContext* pAutoStyle = PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName)); + if ( pAutoStyle ) + { + pAutoStyle->FillPropertySet(xProp); + // we also have to do this on the table to import text-properties + pAutoStyle->FillPropertySet(m_xTable); + } + } + } + + } + } // if ( xFac.is() && m_sName.getLength() ) + else if ( m_sCellStyleName.getLength() ) + { + const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles(); + if ( pAutoStyles ) + { + OTableStyleContext* pAutoStyle = PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName)); + if ( pAutoStyle ) + { + // we also have to do this on the table to import text-properties + pAutoStyle->FillPropertySet(m_xTable); } - Reference<XAppend> xAppend(m_xParentContainer,UNO_QUERY); - if ( xAppend.is() ) - xAppend->appendByDescriptor(xProp); } } } diff --git a/dbaccess/source/filter/xml/xmlColumn.hxx b/dbaccess/source/filter/xml/xmlColumn.hxx index af436a3cc54e..bab8d7660120 100644 --- a/dbaccess/source/filter/xml/xmlColumn.hxx +++ b/dbaccess/source/filter/xml/xmlColumn.hxx @@ -30,13 +30,9 @@ #ifndef DBA_XMLCOLUMN_HXX #define DBA_XMLCOLUMN_HXX -#ifndef _XMLOFF_XMLICTXT_HXX #include <xmloff/xmlictxt.hxx> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif - +#include <com/sun/star/beans/XPropertySet.hpp> namespace dbaxml { @@ -44,8 +40,11 @@ namespace dbaxml class OXMLColumn : public SvXMLImportContext { ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xParentContainer; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable; + ::rtl::OUString m_sName; ::rtl::OUString m_sStyleName; + ::rtl::OUString m_sCellStyleName; ::rtl::OUString m_sHelpMessage; ::com::sun::star::uno::Any m_aDefaultValue; sal_Bool m_bHidden; @@ -58,6 +57,7 @@ namespace dbaxml ,const ::rtl::OUString& rLName ,const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xParentContainer + ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xTable ); virtual ~OXMLColumn(); virtual void EndElement(); diff --git a/dbaccess/source/filter/xml/xmlDataSource.cxx b/dbaccess/source/filter/xml/xmlDataSource.cxx index 169ebdb2ab65..5ec715764073 100644 --- a/dbaccess/source/filter/xml/xmlDataSource.cxx +++ b/dbaccess/source/filter/xml/xmlDataSource.cxx @@ -82,9 +82,8 @@ DBG_NAME(OXMLDataSource) OXMLDataSource::OXMLDataSource( ODBFilter& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName, - const Reference< XAttributeList > & _xAttrList,bool _bAsDataSource ) : + const Reference< XAttributeList > & _xAttrList, const UsedFor _eUsedFor ) : SvXMLImportContext( rImport, nPrfx, _sLocalName ) - ,m_bAsDataSource(_bAsDataSource) { DBG_CTOR(OXMLDataSource,NULL); @@ -95,7 +94,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport, Reference<XPropertySet> xDataSource = rImport.getDataSource(); PropertyValue aProperty; - bool bParameter_name_substitution = false; + bool bFoundParamNameSubstitution = false; bool bFoundTableNameLengthLimited = false; bool bFoundAppendTableAliasName = false; bool bFoundSuppressVersionColumns = false; @@ -169,7 +168,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport, case XML_TOK_PARAMETER_NAME_SUBSTITUTION: aProperty.Name = INFO_PARAMETERNAMESUBST; aProperty.Value <<= (sValue == s_sTRUE ? sal_True : sal_False); - bParameter_name_substitution = true; + bFoundParamNameSubstitution = true; break; case XML_TOK_IGNORE_DRIVER_PRIVILEGES: aProperty.Name = INFO_IGNOREDRIVER_PRIV; @@ -207,25 +206,25 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport, } if ( rImport.isNewFormat() ) { - if ( !bFoundTableNameLengthLimited ) + if ( !bFoundTableNameLengthLimited && ( _eUsedFor == eAppSettings ) ) { aProperty.Name = INFO_ALLOWLONGTABLENAMES; aProperty.Value <<= sal_True; rImport.addInfo(aProperty); } - if ( !bParameter_name_substitution ) + if ( !bFoundParamNameSubstitution && ( _eUsedFor == eDriverSettings ) ) { aProperty.Name = INFO_PARAMETERNAMESUBST; aProperty.Value <<= sal_True; rImport.addInfo(aProperty); } - if ( !bFoundAppendTableAliasName ) + if ( !bFoundAppendTableAliasName && ( _eUsedFor == eAppSettings ) ) { aProperty.Name = INFO_APPEND_TABLE_ALIAS; aProperty.Value <<= sal_True; rImport.addInfo(aProperty); } - if ( !bFoundSuppressVersionColumns ) + if ( !bFoundSuppressVersionColumns && ( _eUsedFor == eAppSettings ) ) { try { @@ -285,7 +284,7 @@ SvXMLImportContext* OXMLDataSource::CreateChildContext( break; case XML_TOK_DRIVER_SETTINGS: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList,false); + pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList, OXMLDataSource::eDriverSettings ); break; case XML_TOK_JAVA_CLASSPATH: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); @@ -293,7 +292,7 @@ SvXMLImportContext* OXMLDataSource::CreateChildContext( break; case XML_TOK_APPLICATION_CONNECTION_SETTINGS: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList,false); + pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList, OXMLDataSource::eAppSettings ); break; } diff --git a/dbaccess/source/filter/xml/xmlDataSource.hxx b/dbaccess/source/filter/xml/xmlDataSource.hxx index e5b73a8c3056..5475efc67b07 100644 --- a/dbaccess/source/filter/xml/xmlDataSource.hxx +++ b/dbaccess/source/filter/xml/xmlDataSource.hxx @@ -43,15 +43,19 @@ namespace dbaxml class ODBFilter; class OXMLDataSource : public SvXMLImportContext { - bool m_bAsDataSource; - ODBFilter& GetOwnImport(); public: + enum UsedFor + { + eDataSource, + eDriverSettings, + eAppSettings + }; OXMLDataSource( ODBFilter& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, - bool _bAsDataSource = true); + const UsedFor _eUsedFor = eDataSource ); virtual ~OXMLDataSource(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, diff --git a/dbaccess/source/filter/xml/xmlDatabase.cxx b/dbaccess/source/filter/xml/xmlDatabase.cxx index c75625fcfbe9..3f3f183ba038 100644 --- a/dbaccess/source/filter/xml/xmlDatabase.cxx +++ b/dbaccess/source/filter/xml/xmlDatabase.cxx @@ -106,7 +106,7 @@ SvXMLImportContext* OXMLDatabase::CreateChildContext( { case XML_TOK_DATASOURCE: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName,xAttrList ); + pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList, OXMLDataSource::eDataSource ); break; case XML_TOK_FORMS: { diff --git a/dbaccess/source/filter/xml/xmlEnums.hxx b/dbaccess/source/filter/xml/xmlEnums.hxx index 7e4321e9f7cf..0bb680eca477 100644 --- a/dbaccess/source/filter/xml/xmlEnums.hxx +++ b/dbaccess/source/filter/xml/xmlEnums.hxx @@ -166,7 +166,8 @@ namespace dbaxml XML_TOK_COLUMN_VISIBILITY, XML_TOK_COLUMN_DEFAULT_VALUE, XML_TOK_COLUMN_TYPE_NAME, - XML_TOK_COLUMN_VISIBLE + XML_TOK_COLUMN_VISIBLE, + XML_TOK_DEFAULT_CELL_STYLE_NAME }; // ----------------------------------------------------------------------------- } // namespace dbaxml diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index decfe6ac1b4e..efd744df1428 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -88,9 +88,9 @@ #ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> + #ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ #include <com/sun/star/awt/TextAlign.hpp> #endif @@ -107,6 +107,8 @@ #include <svtools/pathoptions.hxx> #include <tools/diagnose_ex.h> +#include <boost/optional.hpp> + namespace dbaxml { using namespace comphelper; @@ -222,6 +224,7 @@ namespace dbaxml return s_sTypeInteger; default: + OSL_ENSURE( false, "lcl_implGetPropertyXMLType: unsupported value type!" ); return s_sTypeDouble; } } @@ -318,19 +321,17 @@ IMPLEMENT_SERVICE_INFO1_STATIC( ODBExport, "com.sun.star.comp.sdb.DBExportFilter // ----------------------------------------------------------------------------- void ODBExport::exportDataSource() { - Reference<XPropertySet> xProp(getDataSource()); - if ( xProp.is() ) + try { + Reference<XPropertySet> xProp( getDataSource(), UNO_SET_THROW ); + sal_Bool bAutoIncrementEnabled = sal_True; TStringPair aAutoIncrement; Reference< XPropertySet > xDataSourceSettings; OSL_VERIFY( xProp->getPropertyValue( PROPERTY_SETTINGS ) >>= xDataSourceSettings ); - Reference< XPropertyState > xSettingsState( xDataSourceSettings, UNO_QUERY ); - Reference< XPropertySetInfo > xSettingsInfo; - if ( xDataSourceSettings.is() ) - xSettingsInfo = xDataSourceSettings->getPropertySetInfo(); - OSL_ENSURE( xSettingsState.is() && xSettingsInfo.is(), "ODBExport::exportDataSource: invalid Setting property of the data source!" ); + Reference< XPropertyState > xSettingsState( xDataSourceSettings, UNO_QUERY_THROW ); + Reference< XPropertySetInfo > xSettingsInfo( xDataSourceSettings->getPropertySetInfo(), UNO_SET_THROW ); TDelimiter aDelimiter; xSettingsState->getPropertyDefault( INFO_TEXTDELIMITER ) >>= aDelimiter.sText; @@ -339,6 +340,7 @@ void ODBExport::exportDataSource() xSettingsState->getPropertyDefault( INFO_THOUSANDSDELIMITER ) >>= aDelimiter.sThousand; static ::rtl::OUString s_sTrue(::xmloff::token::GetXMLToken( XML_TRUE )); + static ::rtl::OUString s_sFalse(::xmloff::token::GetXMLToken( XML_FALSE )); // loop through the properties, and export only those which are not defaulted TSettingsMap aSettingsMap; Sequence< Property > aProperties = xSettingsInfo->getProperties(); @@ -346,14 +348,6 @@ void ODBExport::exportDataSource() const Property* pPropertiesEnd = pProperties + aProperties.getLength(); for ( ; pProperties != pPropertiesEnd; ++pProperties ) { - // for properties which are not REMOVEABLE, we care for their state, and - // only export them if they're not DEFAULTed - if ( ( pProperties->Attributes & PropertyAttribute::REMOVEABLE ) == 0 ) - { - PropertyState ePropertyState = xSettingsState->getPropertyState( pProperties->Name ); - if ( PropertyState_DEFAULT_VALUE == ePropertyState ) - continue; - } ::rtl::OUString sValue; Any aValue = xDataSourceSettings->getPropertyValue( pProperties->Name ); switch ( aValue.getValueTypeClass() ) @@ -379,146 +373,144 @@ void ODBExport::exportDataSource() } ::xmloff::token::XMLTokenEnum eToken = XML_TOKEN_INVALID; - if ( pProperties->Name == INFO_JDBCDRIVERCLASS ) - eToken = XML_JAVA_DRIVER_CLASS; - else if ( pProperties->Name == INFO_TEXTFILEHEADER ) + + struct PropertyMap { - if ( sValue == s_sTrue ) - continue; - eToken = XML_IS_FIRST_ROW_HEADER_LINE; - } - else if ( pProperties->Name == INFO_SHOWDELETEDROWS ) + const ::rtl::OUString sPropertyName; + const XMLTokenEnum eAttributeToken; + const ::boost::optional< ::rtl::OUString > aXMLDefault; + + PropertyMap( const ::rtl::OUString& _rPropertyName, const XMLTokenEnum _eToken ) + :sPropertyName( _rPropertyName ) + ,eAttributeToken( _eToken ) + ,aXMLDefault() + { + } + + PropertyMap( const ::rtl::OUString& _rPropertyName, const XMLTokenEnum _eToken, const ::rtl::OUString& _rDefault ) + :sPropertyName( _rPropertyName ) + ,eAttributeToken( _eToken ) + ,aXMLDefault( _rDefault ) + { + } + }; + + PropertyMap aTokens[] = { - if ( sValue != s_sTrue ) - continue; - eToken = XML_SHOW_DELETED; - } - else if ( pProperties->Name == INFO_ALLOWLONGTABLENAMES ) + PropertyMap( INFO_JDBCDRIVERCLASS, XML_JAVA_DRIVER_CLASS ), + PropertyMap( INFO_TEXTFILEHEADER, XML_IS_FIRST_ROW_HEADER_LINE, s_sTrue ), + PropertyMap( INFO_SHOWDELETEDROWS, XML_SHOW_DELETED, s_sFalse ), + PropertyMap( INFO_ALLOWLONGTABLENAMES, XML_IS_TABLE_NAME_LENGTH_LIMITED, s_sTrue ), + PropertyMap( INFO_ADDITIONALOPTIONS, XML_SYSTEM_DRIVER_SETTINGS ), + PropertyMap( PROPERTY_ENABLESQL92CHECK, XML_ENABLE_SQL92_CHECK, s_sFalse ), + PropertyMap( INFO_APPEND_TABLE_ALIAS, XML_APPEND_TABLE_ALIAS_NAME, s_sTrue ), + PropertyMap( INFO_PARAMETERNAMESUBST, XML_PARAMETER_NAME_SUBSTITUTION, s_sTrue ), + PropertyMap( INFO_IGNOREDRIVER_PRIV, XML_IGNORE_DRIVER_PRIVILEGES, s_sTrue ), + PropertyMap( INFO_USECATALOG, XML_USE_CATALOG, s_sFalse ), + PropertyMap( PROPERTY_SUPPRESSVERSIONCL,XML_SUPPRESS_VERSION_COLUMNS, s_sTrue ), + PropertyMap( INFO_CONN_LDAP_BASEDN, XML_BASE_DN ), + PropertyMap( INFO_CONN_LDAP_ROWCOUNT, XML_MAX_ROW_COUNT ) + }; + + bool bIsXMLDefault = false; + for ( size_t i=0; i < sizeof( aTokens ) / sizeof( aTokens[0] ); ++i ) { - if ( sValue == s_sTrue ) - continue; - eToken = XML_IS_TABLE_NAME_LENGTH_LIMITED; + if ( pProperties->Name == aTokens[i].sPropertyName ) + { + eToken = aTokens[i].eAttributeToken; + + if ( !!aTokens[i].aXMLDefault + && ( sValue == *aTokens[i].aXMLDefault ) + ) + { + bIsXMLDefault = true; + } + break; + } } - else if ( pProperties->Name == INFO_ADDITIONALOPTIONS ) - eToken = XML_SYSTEM_DRIVER_SETTINGS; - else if ( pProperties->Name == PROPERTY_ENABLESQL92CHECK ) + + if ( bIsXMLDefault ) + // the property has the value which is specified as default in the XML schema -> no need to write it + continue; + + if ( eToken == XML_TOKEN_INVALID ) { - if ( sValue != s_sTrue ) + // for properties which are not REMOVEABLE, we care for their state, and + // only export them if they're not DEFAULTed + if ( ( pProperties->Attributes & PropertyAttribute::REMOVEABLE ) == 0 ) + { + PropertyState ePropertyState = xSettingsState->getPropertyState( pProperties->Name ); + if ( PropertyState_DEFAULT_VALUE == ePropertyState ) + continue; + } + + // special handlings + if ( pProperties->Name == PROPERTY_BOOLEANCOMPARISONMODE ) + { + sal_Int32 nValue = 0; + aValue >>= nValue; + if ( sValue.equalsAscii("0") ) + sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("equal-integer")); + else if ( sValue.equalsAscii("1") ) + sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("is-boolean")); + else if ( sValue.equalsAscii("2") ) + sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("equal-boolean")); + else if ( sValue.equalsAscii("3") ) + sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("equal-use-only-zero")); + if ( sValue.equalsAscii("equal-integer") ) + continue; + eToken = XML_BOOLEAN_COMPARISON_MODE; + } + else if ( pProperties->Name == INFO_AUTORETRIEVEENABLED ) + { + aValue >>= bAutoIncrementEnabled; continue; - eToken = XML_ENABLE_SQL92_CHECK; - } - else if ( pProperties->Name == INFO_APPEND_TABLE_ALIAS ) - { - if ( sValue == s_sTrue ) + } + else if ( pProperties->Name == INFO_AUTORETRIEVEVALUE ) + { + aAutoIncrement.first = sValue; continue; - eToken = XML_APPEND_TABLE_ALIAS_NAME; - } - else if ( pProperties->Name == INFO_PARAMETERNAMESUBST ) - { - if ( sValue == s_sTrue ) + } + else if ( pProperties->Name == PROPERTY_AUTOINCREMENTCREATION ) + { + aAutoIncrement.second = sValue; continue; - eToken = XML_PARAMETER_NAME_SUBSTITUTION; - } - else if ( pProperties->Name == INFO_IGNOREDRIVER_PRIV ) - { - if ( sValue == s_sTrue ) + } + else if ( pProperties->Name == INFO_TEXTDELIMITER ) + { + aDelimiter.sText = sValue; + aDelimiter.bUsed = true; continue; - eToken = XML_IGNORE_DRIVER_PRIVILEGES; - } - else if ( pProperties->Name == PROPERTY_BOOLEANCOMPARISONMODE ) - { - sal_Int32 nValue = 0; - aValue >>= nValue; - if ( sValue.equalsAscii("0") ) - sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("equal-integer")); - else if ( sValue.equalsAscii("1") ) - sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("is-boolean")); - else if ( sValue.equalsAscii("2") ) - sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("equal-boolean")); - else if ( sValue.equalsAscii("3") ) - sValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("equal-use-only-zero")); - if ( sValue.equalsAscii("equal-integer") ) + } + else if ( pProperties->Name == INFO_FIELDDELIMITER ) + { + aDelimiter.sField = sValue; + aDelimiter.bUsed = true; continue; - eToken = XML_BOOLEAN_COMPARISON_MODE; - } - else if ( pProperties->Name == INFO_USECATALOG ) - { - if ( sValue != s_sTrue ) + } + else if ( pProperties->Name == INFO_DECIMALDELIMITER ) + { + aDelimiter.sDecimal = sValue; + aDelimiter.bUsed = true; continue; - eToken = XML_USE_CATALOG; - } - else if ( pProperties->Name == PROPERTY_SUPPRESSVERSIONCL ) - { - if ( sValue == s_sTrue ) + } + else if ( pProperties->Name == INFO_THOUSANDSDELIMITER ) + { + aDelimiter.sThousand = sValue; + aDelimiter.bUsed = true; continue; - eToken = XML_SUPPRESS_VERSION_COLUMNS; - } - else if ( pProperties->Name == INFO_CONN_LDAP_BASEDN ) - eToken = XML_BASE_DN; - else if ( pProperties->Name == INFO_CONN_LDAP_ROWCOUNT ) - eToken = XML_MAX_ROW_COUNT; - else if ( pProperties->Name == INFO_AUTORETRIEVEENABLED ) - { - aValue >>= bAutoIncrementEnabled; - // special handling - continue; - } - else if ( pProperties->Name == INFO_AUTORETRIEVEVALUE ) - { - aAutoIncrement.first = sValue; - // special handling - continue; - } - else if ( pProperties->Name == PROPERTY_AUTOINCREMENTCREATION ) - { - aAutoIncrement.second = sValue; - // special handling - continue; - } - else if ( pProperties->Name == INFO_TEXTDELIMITER ) - { - aDelimiter.sText = sValue; - aDelimiter.bUsed = true; - // special handling - continue; - } - else if ( pProperties->Name == INFO_FIELDDELIMITER ) - { - aDelimiter.sField = sValue; - aDelimiter.bUsed = true; - // special handling - continue; - } - else if ( pProperties->Name == INFO_DECIMALDELIMITER ) - { - aDelimiter.sDecimal = sValue; - aDelimiter.bUsed = true; - // special handling - continue; - } - else if ( pProperties->Name == INFO_THOUSANDSDELIMITER ) - { - aDelimiter.sThousand = sValue; - aDelimiter.bUsed = true; - // special handling - continue; - } - else if ( pProperties->Name == INFO_CHARSET ) - { - m_sCharSet = sValue; - // special handling - continue; - } - else - { - m_aDataSourceSettings.push_back( makeAny( PropertyValue( - pProperties->Name, - -1, - aValue, - PropertyState_DIRECT_VALUE - ) ) ); - // special handling - continue; + } + else if ( pProperties->Name == INFO_CHARSET ) + { + m_sCharSet = sValue; + continue; + } + else + { + m_aDataSourceSettings.push_back( TypedPropertyValue( + pProperties->Name, pProperties->Type, aValue ) ); + continue; + } } aSettingsMap.insert(TSettingsMap::value_type(eToken,sValue)); @@ -534,6 +526,10 @@ void ODBExport::exportDataSource() exportDriverSettings(aSettingsMap); exportApplicationConnectionSettings(aSettingsMap); } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } // ----------------------------------------------------------------------------- void ODBExport::exportApplicationConnectionSettings(const TSettingsMap& _aSettings) @@ -700,84 +696,83 @@ void ODBExport::exportConnectionData() // ----------------------------------------------------------------------------- void ODBExport::exportDataSourceSettings() { - if ( !m_aDataSourceSettings.empty() ) + if ( m_aDataSourceSettings.empty() ) + return; + + SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTINGS, sal_True, sal_True); + ::std::vector< TypedPropertyValue >::iterator aIter = m_aDataSourceSettings.begin(); + ::std::vector< TypedPropertyValue >::iterator aEnd = m_aDataSourceSettings.end(); + for ( ; aIter != aEnd; ++aIter ) { - SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTINGS, sal_True, sal_True); - PropertyValue aValue; - ::std::vector< Any>::iterator aIter = m_aDataSourceSettings.begin(); - ::std::vector< Any>::iterator aEnd = m_aDataSourceSettings.end(); - for (; aIter != aEnd; ++aIter) - { - *aIter >>= aValue; - sal_Bool bIsSequence = TypeClass_SEQUENCE == aValue.Value.getValueTypeClass(); + sal_Bool bIsSequence = TypeClass_SEQUENCE == aIter->Type.getTypeClass(); - Type aSimpleType; - if ( bIsSequence ) - aSimpleType = ::comphelper::getSequenceElementType(aValue.Value.getValueType()); - else - aSimpleType = aValue.Value.getValueType(); + Type aSimpleType; + if ( bIsSequence ) + aSimpleType = ::comphelper::getSequenceElementType( aIter->Value.getValueType() ); + else + aSimpleType = aIter->Type; - AddAttribute(XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_IS_LIST,bIsSequence ? XML_TRUE : XML_FALSE); - AddAttribute(XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_NAME,aValue.Name); - ::rtl::OUString sTypeName = lcl_implGetPropertyXMLType(aSimpleType); - if ( bIsSequence && aSimpleType.getTypeClass() == TypeClass_ANY ) - { - Sequence<Any> aSeq; - aValue.Value >>= aSeq; - if ( aSeq.getLength() ) - sTypeName = lcl_implGetPropertyXMLType(aSeq[0].getValueType()); - } + AddAttribute( XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_IS_LIST,bIsSequence ? XML_TRUE : XML_FALSE ); + AddAttribute( XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_NAME, aIter->Name ); - AddAttribute(XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_TYPE,sTypeName); + ::rtl::OUString sTypeName = lcl_implGetPropertyXMLType( aSimpleType ); + if ( bIsSequence && aSimpleType.getTypeClass() == TypeClass_ANY ) + { + Sequence<Any> aSeq; + aIter->Value >>= aSeq; + if ( aSeq.getLength() ) + sTypeName = lcl_implGetPropertyXMLType(aSeq[0].getValueType()); + } - SvXMLElementExport aDataSourceSetting(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING, sal_True, sal_True); + AddAttribute( XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_TYPE, sTypeName ); - if ( !bIsSequence ) + SvXMLElementExport aDataSourceSetting( *this, XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING, sal_True, sal_True ); + + if ( !bIsSequence ) + { + SvXMLElementExport aDataValue( *this, XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, sal_True, sal_False ); + // (no whitespace inside the tag) + Characters( implConvertAny( aIter->Value ) ); + } + else + { + // the not-that-simple case, we need to iterate through the sequence elements + ::std::auto_ptr<IIterator> pSequenceIterator; + switch (aSimpleType.getTypeClass()) { - SvXMLElementExport aDataValue(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, sal_True, sal_False); - // (no whitespace inside the tag) - Characters(implConvertAny(aValue.Value)); + case TypeClass_STRING: + pSequenceIterator.reset( new OSequenceIterator< ::rtl::OUString >( aIter->Value ) ); + break; + case TypeClass_DOUBLE: + pSequenceIterator.reset( new OSequenceIterator< double >( aIter->Value ) ); + break; + case TypeClass_BOOLEAN: + pSequenceIterator.reset( new OSequenceIterator< sal_Bool >( aIter->Value ) ); + break; + case TypeClass_BYTE: + pSequenceIterator.reset( new OSequenceIterator< sal_Int8 >( aIter->Value ) ); + break; + case TypeClass_SHORT: + pSequenceIterator.reset( new OSequenceIterator< sal_Int16 >( aIter->Value ) ); + break; + case TypeClass_LONG: + pSequenceIterator.reset( new OSequenceIterator< sal_Int32 >( aIter->Value ) ); + break; + case TypeClass_ANY: + pSequenceIterator.reset( new OSequenceIterator< Any >( aIter->Value ) ); + break; + default: + OSL_ENSURE(sal_False, "unsupported sequence type !"); + break; } - else + if ( pSequenceIterator.get() ) { - // the not-that-simple case, we need to iterate through the sequence elements - ::std::auto_ptr<IIterator> pSequenceIterator; - switch (aSimpleType.getTypeClass()) + ::rtl::OUString sCurrent; + while (pSequenceIterator->hasMoreElements()) { - case TypeClass_STRING: - pSequenceIterator.reset(new OSequenceIterator< ::rtl::OUString >(aValue.Value)); - break; - case TypeClass_DOUBLE: - pSequenceIterator.reset(new OSequenceIterator< double >(aValue.Value)); - break; - case TypeClass_BOOLEAN: - pSequenceIterator.reset(new OSequenceIterator< sal_Bool >(aValue.Value)); - break; - case TypeClass_BYTE: - pSequenceIterator.reset(new OSequenceIterator< sal_Int8 >(aValue.Value)); - break; - case TypeClass_SHORT: - pSequenceIterator.reset(new OSequenceIterator< sal_Int16 >(aValue.Value)); - break; - case TypeClass_LONG: - pSequenceIterator.reset(new OSequenceIterator< sal_Int32 >(aValue.Value)); - break; - case TypeClass_ANY: - pSequenceIterator.reset(new OSequenceIterator< Any >(aValue.Value)); - break; - default: - OSL_ENSURE(sal_False, "unsupported sequence type !"); - break; - } - if ( pSequenceIterator.get() ) - { - ::rtl::OUString sCurrent; - while (pSequenceIterator->hasMoreElements()) - { - SvXMLElementExport aDataValue(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, sal_True, sal_False); - // (no whitespace inside the tag) - Characters(implConvertAny(pSequenceIterator->nextElement())); - } + SvXMLElementExport aDataValue(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, sal_True, sal_False); + // (no whitespace inside the tag) + Characters(implConvertAny(pSequenceIterator->nextElement())); } } } @@ -1015,7 +1010,21 @@ void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup) { Reference<XNameAccess> xNameAccess( _xColSup->getColumns(), UNO_SET_THROW ); if ( !xNameAccess->hasElements() ) + { + Reference< XPropertySet > xComponent(_xColSup,UNO_QUERY); + TTableColumnMap::iterator aFind = m_aTableDummyColumns.find(xComponent); + if ( aFind != m_aTableDummyColumns.end() ) + { + SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, sal_True, sal_True); + SvXMLAttributeList* pAtt = new SvXMLAttributeList; + Reference<XAttributeList> xAtt = pAtt; + exportStyleName(aFind->second.get(),*pAtt); + AddAttributeList(xAtt); + SvXMLElementExport aColumn(*this,XML_NAMESPACE_DB, XML_COLUMN, sal_True, sal_True); + + } return; + } SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, sal_True, sal_True); Sequence< ::rtl::OUString> aSeq = xNameAccess->getElementNames(); @@ -1166,8 +1175,21 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,aFont.Family,aFont.Pitch,aFont.CharSet ); m_aCurrentPropertyStates = m_xCellExportHelper->Filter(_xProp); - ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportAutoStyle); - exportCollection(xCollection,XML_TOKEN_INVALID,XML_TOKEN_INVALID,sal_False,aMemFunc); + if ( !m_aCurrentPropertyStates.empty() && !xCollection->hasElements() ) + { + Reference< XDataDescriptorFactory> xFac(xCollection,UNO_QUERY); + if ( xFac.is() ) + { + Reference< XPropertySet> xColumn = xFac->createDataDescriptor(); + m_aTableDummyColumns.insert(TTableColumnMap::value_type(Reference< XPropertySet>(_xProp),xColumn)); + exportAutoStyle(xColumn.get()); + } + } + else + { + ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportAutoStyle); + exportCollection(xCollection,XML_TOKEN_INVALID,XML_TOKEN_INVALID,sal_False,aMemFunc); + } } catch(Exception&) { diff --git a/dbaccess/source/filter/xml/xmlExport.hxx b/dbaccess/source/filter/xml/xmlExport.hxx index e11f9b244cfd..ae10a9a20709 100644 --- a/dbaccess/source/filter/xml/xmlExport.hxx +++ b/dbaccess/source/filter/xml/xmlExport.hxx @@ -130,15 +130,31 @@ class ODBExport : public SvXMLExport TDelimiter() : bUsed( false ) { } }; - typedef ::std::map< Reference<XPropertySet> ,::rtl::OUString > TPropertyStyleMap; + typedef ::std::map< Reference<XPropertySet> ,::rtl::OUString > TPropertyStyleMap; + typedef ::std::map< Reference<XPropertySet> ,Reference<XPropertySet> > TTableColumnMap; + + struct TypedPropertyValue + { + ::rtl::OUString Name; + ::com::sun::star::uno::Type Type; + ::com::sun::star::uno::Any Value; + + TypedPropertyValue( const ::rtl::OUString& _name, const ::com::sun::star::uno::Type& _type, const ::com::sun::star::uno::Any& _value ) + :Name( _name ) + ,Type( _type ) + ,Value( _value ) + { + } + }; ::std::auto_ptr< TStringPair > m_aAutoIncrement; ::std::auto_ptr< TDelimiter > m_aDelimiter; - ::std::vector< Any> m_aDataSourceSettings; + ::std::vector< TypedPropertyValue > m_aDataSourceSettings; ::std::vector< XMLPropertyState > m_aCurrentPropertyStates; TPropertyStyleMap m_aAutoStyleNames; TPropertyStyleMap m_aCellAutoStyleNames; TPropertyStyleMap m_aRowAutoStyleNames; + TTableColumnMap m_aTableDummyColumns; ::rtl::OUString m_sCharSet; UniReference < SvXMLExportPropertyMapper> m_xExportHelper; UniReference < SvXMLExportPropertyMapper> m_xColumnExportHelper; diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx index 03487a1d9060..892b50bd610f 100644 --- a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx +++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx @@ -146,9 +146,11 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport ,sal_uInt16 nPrfx ,const ::rtl::OUString& _sLocalName ,const Reference< XNameAccess >& _xContainer + ,const Reference< XPropertySet >& _xTable ) : SvXMLImportContext( rImport, nPrfx, _sLocalName ) ,m_xContainer(_xContainer) + ,m_xTable(_xTable) { DBG_CTOR(OXMLHierarchyCollection,NULL); } @@ -179,7 +181,7 @@ SvXMLImportContext* OXMLHierarchyCollection::CreateChildContext( break; case XML_TOK_COLUMN: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLColumn( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer); + pContext = new OXMLColumn( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_xTable); break; // case XML_TOK_QUERY_COLLECTION: case XML_TOK_COMPONENT_COLLECTION: diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx index 35c93809a67d..23eb19d1a57c 100644 --- a/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx +++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.hxx @@ -30,15 +30,10 @@ #ifndef DBA_XMLHIERARCHYCOLLECTION_HXX #define DBA_XMLHIERARCHYCOLLECTION_HXX -#ifndef _XMLOFF_XMLICTXT_HXX #include <xmloff/xmlictxt.hxx> -#endif -#ifndef DBA_XMLENUMS_HXX #include "xmlEnums.hxx" -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif +#include <com/sun/star/beans/XPropertySet.hpp> namespace dbaxml @@ -48,6 +43,7 @@ namespace dbaxml { ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xParentContainer; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xContainer; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable; ::rtl::OUString m_sName; ::rtl::OUString m_sCollectionServiceName; ::rtl::OUString m_sComponentServiceName; @@ -67,6 +63,7 @@ namespace dbaxml ,sal_uInt16 nPrfx ,const ::rtl::OUString& rLName ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xContainer + ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xTable ); virtual ~OXMLHierarchyCollection(); diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx b/dbaccess/source/filter/xml/xmlStyleImport.cxx index 35bf7934cc44..a373bb4c79c8 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.cxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx @@ -214,8 +214,9 @@ OTableStylesContext::OTableStylesContext( SvXMLImport& rImport, const Reference< XAttributeList > & xAttrList, const sal_Bool bTempAutoStyles ) : SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ), - sColumnStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ))), sTableStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ))), + sColumnStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ))), + sCellStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME ))), m_nNumberFormatIndex(-1), bAutoStyles(bTempAutoStyles) { @@ -251,6 +252,13 @@ UniReference < SvXMLImportPropertyMapper > { switch( nFamily ) { + case XML_STYLE_FAMILY_TABLE_TABLE: + { + if ( !m_xTableImpPropMapper.is() ) + m_xTableImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + xMapper = m_xTableImpPropMapper; + } + break; case XML_STYLE_FAMILY_TABLE_COLUMN: { if ( !m_xColumnImpPropMapper.is() ) @@ -258,11 +266,11 @@ UniReference < SvXMLImportPropertyMapper > xMapper = m_xColumnImpPropMapper; } break; - case XML_STYLE_FAMILY_TABLE_TABLE: + case XML_STYLE_FAMILY_TABLE_CELL: { - if ( !m_xTableImpPropMapper.is() ) - m_xTableImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); - xMapper = m_xTableImpPropMapper; + if ( !m_xCellImpPropMapper.is() ) + m_xCellImpPropMapper = new SvXMLImportPropertyMapper( const_cast<OTableStylesContext*>(this)->GetOwnImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); + xMapper = m_xCellImpPropMapper; } break; } @@ -282,8 +290,9 @@ SvXMLStyleContext *OTableStylesContext::CreateStyleStyleChildContext( { switch( nFamily ) { - case XML_STYLE_FAMILY_TABLE_COLUMN: case XML_STYLE_FAMILY_TABLE_TABLE: + case XML_STYLE_FAMILY_TABLE_COLUMN: + case XML_STYLE_FAMILY_TABLE_CELL: pStyle = new OTableStyleContext( GetOwnImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); break; @@ -308,12 +317,16 @@ Reference < XNameContainer > { switch( nFamily ) { + case XML_STYLE_FAMILY_TABLE_TABLE: + sServiceName = sTableStyleServiceName; + break; case XML_STYLE_FAMILY_TABLE_COLUMN: sServiceName = sColumnStyleServiceName; break; - case XML_STYLE_FAMILY_TABLE_TABLE: - sServiceName = sTableStyleServiceName; + case XML_STYLE_FAMILY_TABLE_CELL: + sServiceName = sCellStyleServiceName; break; + } } return sServiceName; diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx index e8dfe4eedac6..95be65774e6d 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.hxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx @@ -111,14 +111,16 @@ namespace dbaxml class OTableStylesContext : public SvXMLStylesContext { - const ::rtl::OUString sColumnStyleServiceName; const ::rtl::OUString sTableStyleServiceName; + const ::rtl::OUString sColumnStyleServiceName; + const ::rtl::OUString sCellStyleServiceName; sal_Int32 m_nNumberFormatIndex; sal_Int32 nMasterPageNameIndex; sal_Bool bAutoStyles : 1; - mutable UniReference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper; mutable UniReference < SvXMLImportPropertyMapper > m_xTableImpPropMapper; + mutable UniReference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper; + mutable UniReference < SvXMLImportPropertyMapper > m_xCellImpPropMapper; ODBFilter& GetOwnImport(); diff --git a/dbaccess/source/filter/xml/xmlTable.cxx b/dbaccess/source/filter/xml/xmlTable.cxx index fb85eecbb91a..86f4304b6eb5 100644 --- a/dbaccess/source/filter/xml/xmlTable.cxx +++ b/dbaccess/source/filter/xml/xmlTable.cxx @@ -184,7 +184,7 @@ SvXMLImportContext* OXMLTable::CreateChildContext( { xColumns = xColumnsSup->getColumns(); } - pContext = new OXMLHierarchyCollection( GetOwnImport(), nPrefix, rLocalName ,xColumns); + pContext = new OXMLHierarchyCollection( GetOwnImport(), nPrefix, rLocalName ,xColumns,m_xTable); } break; } diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 128ad71ffc21..5e9374dcce77 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -753,13 +753,14 @@ const SvXMLTokenMap& ODBFilter::GetColumnElemTokenMap() const { static __FAR_DATA SvXMLTokenMapEntry aElemTokenMap[]= { - { XML_NAMESPACE_DB, XML_NAME, XML_TOK_COLUMN_NAME }, - { XML_NAMESPACE_DB, XML_STYLE_NAME, XML_TOK_COLUMN_STYLE_NAME }, - { XML_NAMESPACE_DB, XML_HELP_MESSAGE, XML_TOK_COLUMN_HELP_MESSAGE }, - { XML_NAMESPACE_DB, XML_VISIBILITY, XML_TOK_COLUMN_VISIBILITY }, - { XML_NAMESPACE_DB, XML_DEFAULT_VALUE, XML_TOK_COLUMN_DEFAULT_VALUE}, - { XML_NAMESPACE_DB, XML_TYPE_NAME, XML_TOK_COLUMN_TYPE_NAME }, - { XML_NAMESPACE_DB, XML_VISIBLE, XML_TOK_COLUMN_VISIBLE }, + { XML_NAMESPACE_DB, XML_NAME, XML_TOK_COLUMN_NAME }, + { XML_NAMESPACE_DB, XML_STYLE_NAME, XML_TOK_COLUMN_STYLE_NAME }, + { XML_NAMESPACE_DB, XML_HELP_MESSAGE, XML_TOK_COLUMN_HELP_MESSAGE }, + { XML_NAMESPACE_DB, XML_VISIBILITY, XML_TOK_COLUMN_VISIBILITY }, + { XML_NAMESPACE_DB, XML_DEFAULT_VALUE, XML_TOK_COLUMN_DEFAULT_VALUE }, + { XML_NAMESPACE_DB, XML_TYPE_NAME, XML_TOK_COLUMN_TYPE_NAME }, + { XML_NAMESPACE_DB, XML_VISIBLE, XML_TOK_COLUMN_VISIBLE }, + { XML_NAMESPACE_DB, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_DEFAULT_CELL_STYLE_NAME }, XML_TOKEN_MAP_END }; m_pColumnElemTokenMap.reset(new SvXMLTokenMap( aElemTokenMap )); @@ -807,6 +808,15 @@ UniReference < XMLPropertySetMapper > ODBFilter::GetColumnStylesPropertySetMappe return m_xColumnStylesPropertySetMapper; } // ----------------------------------------------------------------------------- +UniReference < XMLPropertySetMapper > ODBFilter::GetCellStylesPropertySetMapper() const +{ + if ( !m_xCellStylesPropertySetMapper.is() ) + { + m_xCellStylesPropertySetMapper = OXMLHelper::GetCellStylesPropertySetMapper(); + } + return m_xCellStylesPropertySetMapper; +} +// ----------------------------------------------------------------------------- void ODBFilter::setPropertyInfo() { Reference<XPropertySet> xDataSource(getDataSource()); diff --git a/dbaccess/source/filter/xml/xmlfilter.hxx b/dbaccess/source/filter/xml/xmlfilter.hxx index 4805e242055d..744770305469 100644 --- a/dbaccess/source/filter/xml/xmlfilter.hxx +++ b/dbaccess/source/filter/xml/xmlfilter.hxx @@ -129,6 +129,7 @@ private: mutable UniReference < XMLPropertySetMapper > m_xTableStylesPropertySetMapper; mutable UniReference < XMLPropertySetMapper > m_xColumnStylesPropertySetMapper; + mutable UniReference < XMLPropertySetMapper > m_xCellStylesPropertySetMapper; Reference<XPropertySet> m_xDataSource; sal_Int32 m_nPreviewMode; bool m_bNewFormat; @@ -188,6 +189,7 @@ public: UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper() const; UniReference < XMLPropertySetMapper > GetColumnStylesPropertySetMapper() const; + UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper() const; /** add a Info to the sequence which will be appened to the data source @param _rInfo The property to append. diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc index af9b3e879d74..6a58ba1ddd0d 100644 --- a/dbaccess/source/inc/stringconstants.hrc +++ b/dbaccess/source/inc/stringconstants.hrc @@ -421,6 +421,7 @@ DECLARE_CONSTASCII_USTRING(INFO_CONN_LDAP_BASEDN); DECLARE_CONSTASCII_USTRING(INFO_CONN_LDAP_ROWCOUNT); DECLARE_CONSTASCII_USTRING(INFO_PREVIEW); DECLARE_CONSTASCII_USTRING(INFO_MEDIATYPE); +DECLARE_CONSTASCII_USTRING(INFO_ESCAPE_DATETIME); // other DECLARE_CONSTASCII_USTRING(INFO_POOLURL); diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc index b8ede15d1d55..8803d0e0edc7 100644 --- a/dbaccess/source/inc/stringconstants.inc +++ b/dbaccess/source/inc/stringconstants.inc @@ -265,6 +265,7 @@ IMPLEMENT_CONSTASCII_USTRING(INFO_CONN_LDAP_BASEDN,"BaseDN"); IMPLEMENT_CONSTASCII_USTRING(INFO_CONN_LDAP_ROWCOUNT,"MaxRowCount"); IMPLEMENT_CONSTASCII_USTRING(INFO_PREVIEW,"Preview"); IMPLEMENT_CONSTASCII_USTRING(INFO_MEDIATYPE,"MediaType"); +IMPLEMENT_CONSTASCII_USTRING(INFO_ESCAPE_DATETIME,"EscapeDateTime"); // other IMPLEMENT_CONSTASCII_USTRING(INFO_POOLURL,"PoolURL"); diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 1f6be558f551..21716791864d 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2000,11 +2000,11 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const if ( !aArguments.has( (::rtl::OUString)PROPERTY_SHOWMENU ) ) aArguments.put( (::rtl::OUString)PROPERTY_SHOWMENU, makeAny( (sal_Bool)sal_True ) ); - aDataSource <<= getDatabaseName(); + aDataSource <<= getDatabaseName(); } - Reference< XComponent > xComponent( pDesigner->openExisting( aDataSource, _sName, aArguments.getPropertyValues() ), UNO_QUERY ); - onDocumentOpened( _sName, _eType, _eOpenMode, xComponent, NULL ); + xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments.getPropertyValues() ) ); + onDocumentOpened( _sName, _eType, _eOpenMode, xRet, NULL ); } } break; diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 989ceacdc1f0..c532c0d45fe7 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -876,7 +876,6 @@ void OApplicationController::getSupportedFormats(ElementType _eType,::std::vecto _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_TABLE); _rFormatIds.push_back(SOT_FORMAT_RTF); _rFormatIds.push_back(SOT_FORMATSTR_ID_HTML); - _rFormatIds.push_back(SOT_FORMATSTR_ID_HTML_SIMPLE); // run through case E_QUERY: _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_QUERY); diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index f4c7a4eca31d..50e357b687b8 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -181,6 +181,7 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::beans; using namespace ::com::sun::star; +using ::com::sun::star::awt::XTabController; namespace dbaui { @@ -1299,18 +1300,18 @@ void OAppDetailPageHelper::showPreview( const ::rtl::OUString& _sDataSourceName, aArgs[3].Name = PROPERTY_SHOWMENU; aArgs[3].Value <<= sal_False; - Reference<XFrame> xFrame( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY ); - sal_Bool bClearPreview = !xFrame.is(); + Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY ); + sal_Bool bClearPreview = !xPreview.is(); // clear the preview when the query or table could not be loaded if ( !bClearPreview ) { - Reference<awt::XTabController> xController(xFrame->getController(),UNO_QUERY); - bClearPreview = !xController.is(); + Reference< XTabController > xTabController( xPreview, UNO_QUERY ); + bClearPreview = !xTabController.is(); if ( !bClearPreview ) { - Reference<XLoadable> xLoadable(xController->getModel(),UNO_QUERY); - bClearPreview = !(xLoadable.is() && xLoadable->isLoaded()); + Reference< XLoadable > xLoadable( xTabController->getModel(), UNO_QUERY ); + bClearPreview = !( xLoadable.is() && xLoadable->isLoaded() ); } } if ( bClearPreview ) diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx index 513cb9485f4c..5a6f11ebf840 100644 --- a/dbaccess/source/ui/browser/dbexchange.cxx +++ b/dbaccess/source/ui/browser/dbexchange.cxx @@ -164,7 +164,7 @@ namespace dbaui // ----------------------------------------------------------------------------- sal_Bool ODataClipboard::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& /*rFlavor*/ ) { - if (nUserObjectId == SOT_FORMAT_RTF || nUserObjectId == SOT_FORMATSTR_ID_HTML || nUserObjectId == SOT_FORMATSTR_ID_HTML_SIMPLE) + if (nUserObjectId == SOT_FORMAT_RTF || nUserObjectId == SOT_FORMATSTR_ID_HTML ) { ODatabaseImportExport* pExport = reinterpret_cast<ODatabaseImportExport*>(pUserObject); if ( pExport && rxOStm.Is() ) @@ -185,10 +185,7 @@ namespace dbaui // HTML? if (m_pHtml) - { AddFormat(SOT_FORMATSTR_ID_HTML); - AddFormat(SOT_FORMATSTR_ID_HTML_SIMPLE); - } ODataAccessObjectTransferable::AddSupportedFormats(); } @@ -196,8 +193,7 @@ namespace dbaui // ----------------------------------------------------------------------------- sal_Bool ODataClipboard::GetData( const DataFlavor& rFlavor ) { - ULONG nFormat = SotExchange::GetFormat(rFlavor); - sal_uInt32 nHtml = SOT_FORMATSTR_ID_HTML_SIMPLE; + const ULONG nFormat = SotExchange::GetFormat(rFlavor); switch (nFormat) { case SOT_FORMAT_RTF: @@ -205,12 +201,9 @@ namespace dbaui m_pRtf->initialize(getDescriptor()); return m_pRtf && SetObject(m_pRtf, SOT_FORMAT_RTF, rFlavor); case SOT_FORMATSTR_ID_HTML: - nHtml = SOT_FORMATSTR_ID_HTML; - // run through - case SOT_FORMATSTR_ID_HTML_SIMPLE: if ( m_pHtml ) m_pHtml->initialize(getDescriptor()); - return m_pHtml && SetObject(m_pHtml, nHtml, rFlavor); + return m_pHtml && SetObject(m_pHtml, SOT_FORMATSTR_ID_HTML, rFlavor); } return ODataAccessObjectTransferable::GetData( rFlavor ); @@ -219,8 +212,16 @@ namespace dbaui // ----------------------------------------------------------------------------- void ODataClipboard::ObjectReleased() { - m_pHtml = NULL; - m_pRtf = NULL; + if ( m_pHtml ) + { + m_pHtml->dispose(); + m_pHtml = NULL; + } // if ( m_pHtml ) + if ( m_pRtf ) + { + m_pRtf->dispose(); + m_pRtf = NULL; + } m_aEventListeners.clear(); Reference<XConnection> xConnection; Reference<XResultSet> xProp; @@ -237,16 +238,30 @@ namespace dbaui Reference<XConnection> xConnection; Reference<XResultSet> xProp; if ( getDescriptor().has(daConnection) && (getDescriptor()[daConnection] >>= xConnection) ) + { lcl_removeListener(xConnection,this); + getDescriptor().erase(daConnection); + } // if ( getDescriptor().has(daConnection) && (getDescriptor()[daConnection] >>= xConnection) ) if ( getDescriptor().has(daCursor) && (getDescriptor()[daCursor] >>= xProp) ) + { lcl_removeListener(xProp,this); + getDescriptor().erase(daCursor); + } // if ( getDescriptor().has(daCursor) && (getDescriptor()[daCursor] >>= xProp) ) + + if ( getDescriptor().has(daColumnObject) ) + getDescriptor().erase(daColumnObject); + + if ( getDescriptor().has(daComponent) ) + getDescriptor().erase(daComponent); + ClearFormats(); - getDescriptor().clear(); + //getDescriptor().clear(); + AddSupportedFormats(); - m_pHtml = NULL; + /*m_pHtml = NULL; m_pRtf = NULL; - m_aEventListeners.clear(); + m_aEventListeners.clear();*/ } // ----------------------------------------------------------------------------- IMPLEMENT_FORWARD_XINTERFACE2( ODataClipboard, ODataAccessObjectTransferable, TDataClipboard_BASE ) diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index dfda4b4f119b..0251b6f653b8 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1503,7 +1503,6 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos) { // case SOT_FORMAT_RTF: // RTF data descriptions // case SOT_FORMATSTR_ID_HTML: // HTML data descriptions -// case SOT_FORMATSTR_ID_HTML_SIMPLE: // HTML data descriptions case SOT_FORMATSTR_ID_DBACCESS_TABLE: // table descriptor case SOT_FORMATSTR_ID_DBACCESS_QUERY: // query descriptor case SOT_FORMATSTR_ID_DBACCESS_COMMAND: // SQL command diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index f9a01133b215..58335c5cd230 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -952,7 +952,7 @@ DBG_NAME(OConnectionHelper) { String sFile = String( ModuleRes( STR_FILE_DOES_NOT_EXIST ) ); sFile.SearchAndReplaceAscii("$file$", aTransformer.get(OFileNotation::N_SYSTEM)); - OSQLMessageBox(this,String(ModuleRes(STR_STAT_WARNING)),sFile).Execute(); + OSQLWarningBox( this, sFile ).Execute(); setURLNoPrefix(sOldPath); SetRoadmapStateValue(sal_False); callModifiedHdl(); diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 533ff93d5820..8018b424ee95 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -229,6 +229,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_APPEND_TABLE_ALIAS, INFO_APPEND_TABLE_ALIAS)); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_AS_BEFORE_CORRNAME, INFO_AS_BEFORE_CORRELATION_NAME ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CHECK_REQUIRED_FIELDS, INFO_FORMS_CHECK_REQUIRED_FIELDS ) ); + m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_ESCAPE_DATETIME, INFO_ESCAPE_DATETIME ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_PARAMETERNAMESUBST, INFO_PARAMETERNAMESUBST)); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_IGNOREDRIVER_PRIV, INFO_IGNOREDRIVER_PRIV)); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_BOOLEANCOMPARISON, PROPERTY_BOOLEANCOMPARISONMODE)); diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx index d9ae183a0c7a..15c40b3e40c5 100644 --- a/dbaccess/source/ui/dlg/DriverSettings.cxx +++ b/dbaccess/source/ui/dlg/DriverSettings.cxx @@ -59,6 +59,7 @@ void ODriversSettings::getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE DSID_AUTOINCREMENTVALUE, DSID_AUTORETRIEVEVALUE, DSID_BOOLEANCOMPARISON, + DSID_ESCAPE_DATETIME, 0 }; for ( const USHORT* pGenericKnowSetting = nGenericKnownSettings; *pGenericKnowSetting; ++pGenericKnowSetting ) diff --git a/dbaccess/source/ui/dlg/ExtensionNotPresent.src b/dbaccess/source/ui/dlg/ExtensionNotPresent.src index e3adfea5c0ad..e2d599befef9 100644 --- a/dbaccess/source/ui/dlg/ExtensionNotPresent.src +++ b/dbaccess/source/ui/dlg/ExtensionNotPresent.src @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -89,3 +89,4 @@ ModalDialog RID_EXTENSION_NOT_PRESENT_DLG TabStop = TRUE ; }; }; + diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx index bc070485fea2..63312762c7b8 100644 --- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx +++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx @@ -31,60 +31,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBAUI_USERADMINDLG_HXX -#include "UserAdminDlg.hxx" -#endif -#ifndef DBAUI_USERADMINDLG_HRC -#include "UserAdminDlg.hrc" -#endif -#ifndef _DBU_DLG_HRC_ +#include "adminpages.hxx" +#include "DbAdminImpl.hxx" #include "dbu_dlg.hrc" -#endif -#ifndef _DBAUI_DATASOURCEITEMS_HXX_ +#include "DriverSettings.hxx" #include "dsitems.hxx" -#endif -#ifndef _SFXSTRITEM_HXX -#include <svtools/stritem.hxx> -#endif -#ifndef _SFXENUMITEM_HXX +#include "propertysetitem.hxx" +#include "UITools.hxx" +#include "UserAdmin.hxx" +#include "UserAdminDlg.hrc" +#include "UserAdminDlg.hxx" + +#include <comphelper/componentcontext.hxx> +#include <connectivity/dbmetadata.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <svtools/eitem.hxx> -#endif -#ifndef _SFXINTITEM_HXX #include <svtools/intitem.hxx> -#endif -#ifndef _VCL_STDTEXT_HXX -#include <vcl/stdtext.hxx> -#endif -#ifndef _SV_MSGBOX_HXX +#include <svtools/stritem.hxx> +#include <tools/diagnose_ex.h> #include <vcl/msgbox.hxx> -#endif -#ifndef _DBAUI_DATASOURCEITEMS_HXX_ -#include "dsitems.hxx" -#endif -#ifndef DBAUI_DRIVERSETTINGS_HXX -#include "DriverSettings.hxx" -#endif -#ifndef _DBAUI_DBADMINIMPL_HXX_ -#include "DbAdminImpl.hxx" -#endif -#ifndef _DBAUI_PROPERTYSETITEM_HXX_ -#include "propertysetitem.hxx" -#endif -#ifndef _DBAUI_ADMINPAGES_HXX_ -#include "adminpages.hxx" -#endif -#ifndef DBAUI_USERADMIN_HXX -#include "UserAdmin.hxx" -#endif -#ifndef DBAUI_TOOLS_HXX -#include "UITools.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XUSERSSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XUsersSupplier.hpp> -#endif +#include <vcl/stdtext.hxx> + //......................................................................... namespace dbaui { @@ -147,37 +114,22 @@ DBG_NAME(OUserAdminDlg) { try { - Reference<XUsersSupplier> xUsersSup(m_xConnection,UNO_QUERY); - sal_Bool bError = sal_False; - if ( !xUsersSup.is() ) - { - Reference< XDataDefinitionSupplier > xDriver(getDriver(),UNO_QUERY); - bError = !xDriver.is(); - if ( !bError ) - { - m_xConnection = createConnection().first; - bError = !m_xConnection.is(); - - if ( !bError ) - { - // now set the tables supplier at the table control - xUsersSup.set(xDriver->getDataDefinitionByConnection(m_xConnection),UNO_QUERY); - } - } - } - bError = ! ( xUsersSup.is() && xUsersSup->getUsers().is()); - - if ( bError ) + ::dbtools::DatabaseMetaData aMetaData( createConnection().first ); + if ( !aMetaData.supportsUserAdministration( ::comphelper::ComponentContext( getORB() ) ) ) { String sError(ModuleRes(STR_USERADMIN_NOT_AVAILABLE)); throw SQLException(sError,NULL,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")) ,0,Any()); } } - catch(SQLException& e) + catch(const SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),getORB()); + ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), GetParent(), getORB() ); return RET_CANCEL; } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } short nRet = SfxTabDialog::Execute(); if ( nRet == RET_OK ) m_pImpl->saveChanges(*GetOutputItemSet()); diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index ffc6e1cb8080..7b930b81e4ab 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -97,6 +97,7 @@ namespace dbaui ,m_pDosLineEnds( NULL ) ,m_pCheckRequiredFields( NULL ) ,m_pIgnoreCurrency(NULL) + ,m_pEscapeDateTime(NULL) ,m_pBooleanComparisonModeLabel( NULL ) ,m_pBooleanComparisonMode( NULL ) ,m_aControlDependencies() @@ -112,9 +113,11 @@ namespace dbaui ++setting ) { - if ( aDSUI.hasSetting( setting->nItemId ) ) + USHORT nItemId = setting->nItemId; + if ( aDSUI.hasSetting( nItemId ) ) { - (*setting->ppControl) = new CheckBox( this, ModuleRes( setting->nControlResId ) ); + USHORT nID = setting->nControlResId; + (*setting->ppControl) = new CheckBox( this, ModuleRes( nID ) ); (*setting->ppControl)->SetClickHdl( getControlModifiedLink() ); } } @@ -181,6 +184,7 @@ namespace dbaui DELETEZ( m_pDosLineEnds ); DELETEZ( m_pCheckRequiredFields ); DELETEZ( m_pIgnoreCurrency ); + DELETEZ( m_pEscapeDateTime ); DELETEZ( m_pBooleanComparisonModeLabel ); DELETEZ( m_pBooleanComparisonMode ); } @@ -205,11 +209,16 @@ namespace dbaui { &m_pDosLineEnds, CB_DOSLINEENDS, DSID_DOSLINEENDS, false }, { &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false }, { &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false }, + { &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false }, { NULL, 0, 0, false } }; for ( const BooleanSettingDesc* pCopy = aSettings; pCopy->nItemId != 0; ++pCopy ) + { + USHORT nID = pCopy->nItemId; + (void) nID; m_aBooleanSettings.push_back( *pCopy ); + } } // ----------------------------------------------------------------------- diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc index f1f6cd5bcde6..8bd0063fc4d6 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hrc +++ b/dbaccess/source/ui/dlg/advancedsettings.hrc @@ -63,6 +63,7 @@ #define CB_AS_BEFORE_CORR_NAME 12 #define CB_CHECK_REQUIRED 13 #define CB_IGNORECURRENCY 14 +#define CB_ESCAPE_DATETIME 15 #define ET_AUTOINCREMENTVALUE 1 #define ET_RETRIEVE_AUTO 2 diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 6349f87ff2d1..78a572d7fb0f 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -73,6 +73,7 @@ namespace dbaui CheckBox* m_pDosLineEnds; CheckBox* m_pCheckRequiredFields; CheckBox* m_pIgnoreCurrency; + CheckBox* m_pEscapeDateTime; FixedText* m_pBooleanComparisonModeLabel; ListBox* m_pBooleanComparisonMode; diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src index be6a97bd1ce4..acb5fbb81656 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.src +++ b/dbaccess/source/ui/dlg/advancedsettings.src @@ -199,6 +199,17 @@ Text [ en-US ] = "Form data input checks for required fields"; \ }; +#define AUTO_ESCAPE_DATETIME(AUTO_Y) \ + CheckBox CB_ESCAPE_DATETIME \ + { \ + Pos = MAP_APPFONT ( 6 , AUTO_Y ) ; \ + Size = MAP_APPFONT ( ADVANCED_PAGE_X -12 , CHECKBOX_HEIGHT ) ; \ + TabStop = TRUE ; \ + HelpId = HID_DSADMIN_ESCAPE_DATETIME; \ + Text [ en-US ] = "Use ODBC conformant date/time literals"; \ + }; + + //------------------------------------------------------------------------- #define WORKAROUND \ @@ -310,7 +321,8 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL AUTO_DOSLINEENDS( 11*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 10*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_CHECKREQUIRED( 12*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 11*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_IGNORECURRENCY( 13*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 12*CHECKBOX_HEIGHT + RELATED_CONTROLS ) - AUTO_BOOLEANCOMPARISON( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 13*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) + AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS ) + AUTO_BOOLEANCOMPARISON( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 13*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) }; //------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/dlg/datasourceui.cxx b/dbaccess/source/ui/dlg/datasourceui.cxx index a255222c13b3..aa4c0e7f8444 100644 --- a/dbaccess/source/ui/dlg/datasourceui.cxx +++ b/dbaccess/source/ui/dlg/datasourceui.cxx @@ -92,6 +92,7 @@ namespace dbaui case DSID_AUTOINCREMENTVALUE: return rAdvancedSupport.bGeneratedValues; case DSID_AUTORETRIEVEVALUE: return rAdvancedSupport.bGeneratedValues; case DSID_IGNORECURRENCY: return rAdvancedSupport.bIgnoreCurrency; + case DSID_ESCAPE_DATETIME: return rAdvancedSupport.bEscapeDateTime; } OSL_ENSURE( false, "DataSourceUI::hasSetting: this item id is currently not supported!" ); diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index d025641477d6..a28567c6b0af 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -410,7 +410,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxStringItem(DSID_THOUSANDSDELIMITER, String()); *pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, String::CreateFromAscii("txt")); *pCounter++ = new SfxBoolItem(DSID_TEXTFILEHEADER, sal_True); - *pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, sal_True); + *pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, sal_False); *pCounter++ = new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100); *pCounter++ = new SfxBoolItem(DSID_SUPPRESSVERSIONCL, sal_False); *pCounter++ = new OPropertySetItem(DSID_DATASOURCE_UNO); @@ -445,6 +445,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, sal_True); *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, sal_False); *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, String()); + *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True); // must be the same as in ModelImpl.cxx // create the pool static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = @@ -504,10 +505,11 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0}, {0,0}, {0,0}, + {0,0}, /* for Escape DateTime*/ {0,0} }; - OSL_ENSURE(sizeof(aItemInfos)/sizeof(aItemInfos[0]) == DSID_LAST_ITEM_ID,"Invlaid Ids!"); + OSL_ENSURE(sizeof(aItemInfos)/sizeof(aItemInfos[0]) == DSID_LAST_ITEM_ID,"Invalid Ids!"); _rpPool = new SfxItemPool(String::CreateFromAscii("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, aItemInfos, _rppDefaults); _rpPool->FreezeIdRanges(); diff --git a/dbaccess/source/ui/dlg/dsitems.hxx b/dbaccess/source/ui/dlg/dsitems.hxx index ad0ca3ce780f..75316232684b 100644 --- a/dbaccess/source/ui/dlg/dsitems.hxx +++ b/dbaccess/source/ui/dlg/dsitems.hxx @@ -90,6 +90,7 @@ #define DSID_CHECK_REQUIRED_FIELDS 54 #define DSID_IGNORECURRENCY 55 #define DSID_CONN_SOCKET 56 +#define DSID_ESCAPE_DATETIME 57 // don't forget to adjust DSID_LAST_ITEM_ID below! @@ -97,7 +98,7 @@ //= item range. Adjust this if you introduce new items above #define DSID_FIRST_ITEM_ID DSID_NAME -#define DSID_LAST_ITEM_ID DSID_CONN_SOCKET +#define DSID_LAST_ITEM_ID DSID_ESCAPE_DATETIME #endif // _DBAUI_DATASOURCEITEMS_HXX_ diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 0130a44e2ab0..bd5a4c1e6392 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -768,6 +768,15 @@ IMPL_LINK( OSQLMessageBox, ButtonClickHdl, Button *, /*pButton*/ ) return 0; } +//================================================================== +// OSQLWarningBox +//================================================================== +OSQLWarningBox::OSQLWarningBox( Window* _pParent, const UniString& _rMessage, WinBits _nStyle, + const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo ) + :OSQLMessageBox( _pParent, String( ModuleRes( STR_STAT_WARNING ) ), _rMessage, _nStyle, OSQLMessageBox::Warning, _pAdditionalErrorInfo ) +{ +} + //......................................................................... } // namespace dbaui //......................................................................... diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 0f3bb3f73c0a..bbcd265c5f34 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -379,16 +379,11 @@ DBG_NAME(OTableSubscriptionPage) Reference<XModifiable> xModi(getDataSourceOrModel(xProp),UNO_QUERY); sal_Bool bModified = ( xModi.is() && xModi->isModified() ); - Sequence< ::rtl::OUString> aNewTableFilter(1),aEmpty(3); + Sequence< ::rtl::OUString > aNewTableFilter(1); aNewTableFilter[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")); xProp->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(aNewTableFilter)); - static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW")); - static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); - aEmpty[0] = s_sTableTypeView; - aEmpty[1] = s_sTableTypeTable; - aEmpty[2] = aNewTableFilter[0]; - xProp->setPropertyValue(PROPERTY_TABLETYPEFILTER,makeAny(aEmpty)); + xProp->setPropertyValue( PROPERTY_TABLETYPEFILTER, makeAny( Sequence< ::rtl::OUString >() ) ); Reference< ::com::sun::star::lang::XEventListener> xEvt; aErrorInfo = ::dbaui::createConnection(xProp,m_xORB,xEvt,m_xCurrentConnection); diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx index bf60736df901..c0b5e77cc403 100644 --- a/dbaccess/source/ui/inc/TableCopyHelper.hxx +++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx @@ -76,7 +76,6 @@ namespace dbaui { case SOT_FORMAT_RTF: // RTF data descriptions case SOT_FORMATSTR_ID_HTML: // HTML data descriptions - case SOT_FORMATSTR_ID_HTML_SIMPLE: // HTML data descriptions case SOT_FORMATSTR_ID_DBACCESS_TABLE: // table descriptor return (E_TABLE == eEntryType); case SOT_FORMATSTR_ID_DBACCESS_QUERY: // query descriptor diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx index c373cc835b40..2eb162a05020 100644 --- a/dbaccess/source/ui/inc/TokenWriter.hxx +++ b/dbaccess/source/ui/inc/TokenWriter.hxx @@ -93,15 +93,9 @@ namespace dbaui class ODatabaseImportExport : public ODatabaseImportExport_BASE { private: - void disposing(); void impl_initializeRowMember_throw(); protected: - typedef ::utl::SharedUNOComponent < ::com::sun::star::frame::XModel - , ::utl::CloseableComponent - > SharedModel; - - protected: ::com::sun::star::lang::Locale m_aLocale; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aSelection; SvStream* m_pStream; @@ -114,7 +108,6 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xRowSetColumns; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xFactory; - SharedModel m_aKeepModelAlive; ::rtl::OUString m_sName; //dyf add 20070601 @@ -123,6 +116,7 @@ namespace dbaui //dyf add end ::rtl::OUString m_sDataSourceName; sal_Int32 m_nCommandType; + bool m_bNeedToReInitialize; #if defined UNX static const char __FAR_DATA sNewLine; @@ -158,17 +152,18 @@ namespace dbaui void setSTableName(const ::rtl::OUString &_sTableName){ m_sDefaultTableName = _sTableName; } //dyf add end - virtual BOOL Write() = 0; // Export - virtual BOOL Read() = 0; // Import + virtual BOOL Write(); // Export + virtual BOOL Read(); // Import void initialize(const ::svx::ODataAccessDescriptor& _aDataDescriptor); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + void dispose(); void enableCheckOnly() { m_bCheckOnly = sal_True; } sal_Bool isCheckEnabled() const { return m_bCheckOnly; } + private: + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); void impl_initFromDescriptor( const ::svx::ODataAccessDescriptor& _aDataDescriptor, bool _bPlusDefaultInit ); }; diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx index 174d42803086..88053668a4ed 100644 --- a/dbaccess/source/ui/inc/dsmeta.hxx +++ b/dbaccess/source/ui/inc/dsmeta.hxx @@ -109,6 +109,8 @@ namespace dbaui bool bFormsCheckRequiredFields; bool bIgnoreCurrency; bool bAutoIncrementIsPrimaryKey; + bool bEscapeDateTime; + // Note: If you extend this list, you need to adjust the ctor (of course) // and (maybe) the implementation of supportsAnySpecialSetting @@ -129,6 +131,7 @@ namespace dbaui ,bFormsCheckRequiredFields ( true ) ,bIgnoreCurrency ( false ) ,bAutoIncrementIsPrimaryKey ( false ) + ,bEscapeDateTime ( false ) { } @@ -156,6 +159,7 @@ namespace dbaui || ( bFormsCheckRequiredFields == true ) || ( bIgnoreCurrency == true ) || ( bAutoIncrementIsPrimaryKey == true ) + || ( bEscapeDateTime == true ) ; } diff --git a/dbaccess/source/ui/inc/sqlmessage.hxx b/dbaccess/source/ui/inc/sqlmessage.hxx index 190cbbfe1d67..088ea8a1ac42 100644 --- a/dbaccess/source/ui/inc/sqlmessage.hxx +++ b/dbaccess/source/ui/inc/sqlmessage.hxx @@ -100,7 +100,7 @@ public: ); /** display a database related error message - <p/> + @param rTitle the title to display @param rMessage the detailed message to display @param _eType determines the image to use. AUTO is disallowed in this constructor version @@ -126,6 +126,18 @@ private: void impl_addDetailsButton(); }; +//================================================================== +// OSQLWarningBox +//================================================================== +class OSQLWarningBox : public OSQLMessageBox +{ +public: + OSQLWarningBox( Window* _pParent, + const UniString& _rMessage, + WinBits _nStyle = WB_OK | WB_DEF_OK, + const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL ); +}; + //......................................................................... } // namespace dbaui //......................................................................... diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index fe31c60abc3b..b366695301a0 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -857,8 +857,7 @@ void ODatabaseExport::showErrorDialog(const ::com::sun::star::sdbc::SQLException String aMsg(e.Message); aMsg += '\n'; aMsg += String( ModuleRes( STR_QRY_CONTINUE ) ); - OSQLMessageBox aBox(NULL, String(ModuleRes(STR_STAT_WARNING)), - aMsg, WB_YES_NO | WB_DEF_NO, OSQLMessageBox::Warning); + OSQLWarningBox aBox( NULL, aMsg, WB_YES_NO | WB_DEF_NO ); if (aBox.Execute() == RET_YES) m_bDontAskAgain = TRUE; diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx index 444af3fba2a7..3098e4b88eb6 100644 --- a/dbaccess/source/ui/misc/RowSetDrop.cxx +++ b/dbaccess/source/ui/misc/RowSetDrop.cxx @@ -264,8 +264,7 @@ sal_Bool ORowSetImportExport::insertNewRow() if(!m_bAlreadyAsked) { String sAskIfContinue = String(ModuleRes(STR_ERROR_OCCURED_WHILE_COPYING)); - String sTitle = String(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aDlg(m_pParent,sTitle,sAskIfContinue,WB_YES_NO|WB_DEF_YES,OSQLMessageBox::Warning); + OSQLWarningBox aDlg( m_pParent, sAskIfContinue, WB_YES_NO | WB_DEF_YES ); if(aDlg.Execute() == RET_YES) m_bAlreadyAsked = sal_True; else diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index 299926f222b8..b2760e4d2e51 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -299,12 +299,12 @@ void OTableCopyHelper::pasteTable( SotFormatStringId _nFormatId { DropDescriptor aTrans; if ( _nFormatId != SOT_FORMAT_RTF ) - const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(_rTransData.HasFormat(SOT_FORMATSTR_ID_HTML) ? SOT_FORMATSTR_ID_HTML : SOT_FORMATSTR_ID_HTML_SIMPLE,aTrans.aHtmlRtfStorage); + const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SOT_FORMATSTR_ID_HTML ,aTrans.aHtmlRtfStorage); else const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SOT_FORMAT_RTF,aTrans.aHtmlRtfStorage); aTrans.nType = E_TABLE; - aTrans.bHtml = SOT_FORMATSTR_ID_HTML == _nFormatId || SOT_FORMATSTR_ID_HTML_SIMPLE == _nFormatId; + aTrans.bHtml = SOT_FORMATSTR_ID_HTML == _nFormatId; aTrans.sDefaultTableName = GetTableNameForAppend(); if ( !copyTagTable(aTrans,sal_False,_xConnection) ) m_pController->showError(SQLException(String(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*m_pController,::rtl::OUString::createFromAscii("S1000") ,0,Any())); @@ -331,8 +331,6 @@ void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData pasteTable( SOT_FORMATSTR_ID_DBACCESS_TABLE,_rTransData,_sDestDataSourceName,_xConnection); else if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_HTML) ) pasteTable( SOT_FORMATSTR_ID_HTML,_rTransData,_sDestDataSourceName,_xConnection); - else if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_HTML_SIMPLE) ) - pasteTable( SOT_FORMATSTR_ID_HTML_SIMPLE,_rTransData,_sDestDataSourceName,_xConnection); else if ( _rTransData.HasFormat(SOT_FORMAT_RTF) ) pasteTable( SOT_FORMAT_RTF,_rTransData,_sDestDataSourceName,_xConnection); } @@ -365,8 +363,7 @@ sal_Bool OTableCopyHelper::isTableFormat(const TransferableDataHelper& _rClipboa sal_Bool bTableFormat = _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE) || _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) || _rClipboard.HasFormat(SOT_FORMAT_RTF) - || _rClipboard.HasFormat(SOT_FORMATSTR_ID_HTML) - || _rClipboard.HasFormat(SOT_FORMATSTR_ID_HTML_SIMPLE); + || _rClipboard.HasFormat(SOT_FORMATSTR_ID_HTML); return bTableFormat; } @@ -376,11 +373,11 @@ sal_Bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedD ,const SharedConnection& _xConnection) { sal_Bool bRet = sal_False; - sal_Bool bHtml = _aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML) || _aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML_SIMPLE); + sal_Bool bHtml = _aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML); if ( bHtml || _aDroppedData.HasFormat(SOT_FORMAT_RTF) ) { if ( bHtml ) - const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(_aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML) ? SOT_FORMATSTR_ID_HTML : SOT_FORMATSTR_ID_HTML_SIMPLE,_rAsyncDrop.aHtmlRtfStorage); + const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SOT_FORMATSTR_ID_HTML ,_rAsyncDrop.aHtmlRtfStorage); else const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SOT_FORMAT_RTF,_rAsyncDrop.aHtmlRtfStorage); diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index db8bd6e5e21f..0910808a5f9d 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -135,6 +135,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; +using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::awt; @@ -163,6 +164,7 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor& :m_xFormatter(_rxNumberF) ,m_xFactory(_rM) ,m_nCommandType(CommandType::TABLE) + ,m_bNeedToReInitialize(sal_False) ,m_pReader(NULL) ,m_pRowMarker(NULL) ,m_bInInitialize(sal_False) @@ -192,6 +194,7 @@ ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& ,m_xFormatter(_rxNumberF) ,m_xFactory(_rM) ,m_nCommandType(::com::sun::star::sdb::CommandType::TABLE) + ,m_bNeedToReInitialize(sal_False) ,m_pReader(NULL) ,m_pRowMarker(NULL) ,m_bInInitialize(sal_False) @@ -214,14 +217,14 @@ ODatabaseImportExport::~ODatabaseImportExport() DBG_DTOR(ODatabaseImportExport,NULL); acquire(); - disposing(); + dispose(); if(m_pReader) m_pReader->release(); delete m_pRowMarker; } // ----------------------------------------------------------------------------- -void ODatabaseImportExport::disposing() +void ODatabaseImportExport::dispose() { DBG_CHKTHIS(ODatabaseImportExport,NULL); // remove me as listener @@ -240,8 +243,6 @@ void ODatabaseImportExport::disposing() m_xResultSet.clear(); m_xRow.clear(); m_xFormatter.clear(); - - m_aKeepModelAlive.clear(); } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) @@ -251,9 +252,10 @@ void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source ) thro if(m_xConnection.is() && m_xConnection == xCon) { m_xConnection.clear(); - disposing(); - if(!m_bInInitialize) - initialize(); + dispose(); + m_bNeedToReInitialize = true; + //if(!m_bInInitialize) + // initialize(); } } // ----------------------------------------------------------------------------- @@ -266,30 +268,36 @@ void ODatabaseImportExport::initialize( const ODataAccessDescriptor& _aDataDescr void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor& _aDataDescriptor, bool _bPlusDefaultInit) { DBG_CHKTHIS(ODatabaseImportExport,NULL); - m_sDataSourceName = _aDataDescriptor.getDataSource(); - _aDataDescriptor[daCommandType] >>= m_nCommandType; - _aDataDescriptor[daCommand] >>= m_sName; - // some additonal information - if(_aDataDescriptor.has(daConnection)) - { - Reference< XConnection > xPureConn( _aDataDescriptor[daConnection], UNO_QUERY ); - m_xConnection.reset( xPureConn, SharedConnection::NoTakeOwnership ); - } - if(_aDataDescriptor.has(daSelection)) - _aDataDescriptor[daSelection] >>= m_aSelection; - - sal_Bool bBookmarkSelection = sal_True; // the default if not present - if ( _aDataDescriptor.has( daBookmarkSelection ) ) + if ( !_bPlusDefaultInit ) { - _aDataDescriptor[ daBookmarkSelection ] >>= bBookmarkSelection; - DBG_ASSERT( !bBookmarkSelection, "ODatabaseImportExport::ODatabaseImportExport: bookmarked selection not yet supported!" ); - } + m_sDataSourceName = _aDataDescriptor.getDataSource(); + _aDataDescriptor[daCommandType] >>= m_nCommandType; + _aDataDescriptor[daCommand] >>= m_sName; + // some additonal information + if(_aDataDescriptor.has(daConnection)) + { + Reference< XConnection > xPureConn( _aDataDescriptor[daConnection], UNO_QUERY ); + m_xConnection.reset( xPureConn, SharedConnection::NoTakeOwnership ); + Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY); + Reference< XComponent > xComponent(m_xConnection, UNO_QUERY); + if (xComponent.is() && xEvt.is()) + xComponent->addEventListener(xEvt); + } + if(_aDataDescriptor.has(daSelection)) + _aDataDescriptor[daSelection] >>= m_aSelection; + sal_Bool bBookmarkSelection = sal_True; // the default if not present + if ( _aDataDescriptor.has( daBookmarkSelection ) ) + { + _aDataDescriptor[ daBookmarkSelection ] >>= bBookmarkSelection; + DBG_ASSERT( !bBookmarkSelection, "ODatabaseImportExport::ODatabaseImportExport: bookmarked selection not yet supported!" ); + } - if(_aDataDescriptor.has(daCursor)) - _aDataDescriptor[daCursor] >>= m_xResultSet; - if ( _bPlusDefaultInit ) + if(_aDataDescriptor.has(daCursor)) + _aDataDescriptor[daCursor] >>= m_xResultSet; + } // if ( !_bPlusDefaultInit ) + else initialize(); try @@ -306,23 +314,12 @@ void ODatabaseImportExport::initialize() { DBG_CHKTHIS(ODatabaseImportExport,NULL); m_bInInitialize = sal_True; + m_bNeedToReInitialize = false; if ( !m_xConnection.is() ) { // we need a connection OSL_ENSURE(m_sDataSourceName.getLength(),"There must be a datsource name!"); Reference<XNameAccess> xDatabaseContext = Reference< XNameAccess >(m_xFactory->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY); - - try - { - Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_sDataSourceName ), UNO_QUERY_THROW ); - Reference< XModel > xDocument( getDataSourceOrModel( xDataSource ), UNO_QUERY_THROW ); - m_aKeepModelAlive = SharedModel( xDocument ); - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "ODatabaseImportExport::initialize: could not obtaine the document model!" ); - } - Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY); Reference< XConnection > xConnection; @@ -332,13 +329,6 @@ void ODatabaseImportExport::initialize() if(aInfo.isValid() && aInfo.getType() == SQLExceptionInfo::SQL_EXCEPTION) throw *static_cast<const SQLException*>(aInfo); } - else - { - Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY); - Reference< XComponent > xComponent(m_xConnection, UNO_QUERY); - if (xComponent.is() && xEvt.is()) - xComponent->addEventListener(xEvt); - } Reference<XNameAccess> xNameAccess; switch(m_nCommandType) @@ -411,6 +401,26 @@ void ODatabaseImportExport::initialize() m_bInInitialize = sal_False; } // ----------------------------------------------------------------------------- +BOOL ODatabaseImportExport::Write() +{ + if ( m_bNeedToReInitialize ) + { + if ( !m_bInInitialize ) + initialize(); + } // if ( m_bNeedToReInitialize ) + return TRUE; +} +// ----------------------------------------------------------------------------- +BOOL ODatabaseImportExport::Read() +{ + if ( m_bNeedToReInitialize ) + { + if ( !m_bInInitialize ) + initialize(); + } // if ( m_bNeedToReInitialize ) + return TRUE; +} +// ----------------------------------------------------------------------------- void ODatabaseImportExport::impl_initializeRowMember_throw() { if ( !m_xRow.is() && m_xResultSet.is() ) @@ -424,6 +434,7 @@ void ODatabaseImportExport::impl_initializeRowMember_throw() //====================================================================== BOOL ORTFImportExport::Write() { + ODatabaseImportExport::Write(); (*m_pStream) << '{' << sRTF_RTF; (*m_pStream) << sRTF_ANSI << ODatabaseImportExport::sNewLine; rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252; @@ -680,6 +691,7 @@ BOOL ORTFImportExport::Write() //------------------------------------------------------------------- BOOL ORTFImportExport::Read() { + ODatabaseImportExport::Read(); SvParserState eState = SVPAR_ERROR; if ( m_pStream ) { @@ -742,6 +754,7 @@ OHTMLImportExport::OHTMLImportExport(const ::svx::ODataAccessDescriptor& _aDataD //------------------------------------------------------------------- BOOL OHTMLImportExport::Write() { + ODatabaseImportExport::Write(); if(m_xObject.is()) { (*m_pStream) << '<' << sHTML_doctype << ' ' << sHTML_doctype32 << '>' << ODatabaseImportExport::sNewLine << ODatabaseImportExport::sNewLine; @@ -759,6 +772,7 @@ BOOL OHTMLImportExport::Write() //------------------------------------------------------------------- BOOL OHTMLImportExport::Read() { + ODatabaseImportExport::Read(); SvParserState eState = SVPAR_ERROR; if ( m_pStream ) { @@ -1132,4 +1146,3 @@ void OHTMLImportExport::IncIndent( sal_Int16 nVal ) sIndent[m_nIndent] = 0; } // ----------------------------------------------------------------------------- - diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index e25258097e72..c5bfe2470b49 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1263,9 +1263,7 @@ sal_Bool appendToFilter(const Reference<XConnection>& _xConnection, if(! ::dbaui::checkDataSourceAvailable(::comphelper::getString(xProp->getPropertyValue(PROPERTY_NAME)),_xFactory)) { String aMessage(ModuleRes(STR_TABLEDESIGN_DATASOURCE_DELETED)); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(_pParent,sTitle,aMessage); - aMsg.Execute(); + OSQLWarningBox( _pParent, aMessage ).Execute(); bRet = sal_False; } else diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 08946d8660c5..ca3408bd0285 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -1598,12 +1598,9 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& // ----------------------------------------------------------------------------- void OCopyTableWizard::showColumnTypeNotSupported(const ::rtl::OUString& _rColumnName) { - UniString sTitle(ModuleRes(STR_STAT_WARNING)); - UniString sMessage(ModuleRes(STR_UNKNOWN_TYPE_FOUND)); - + String sMessage( ModuleRes( STR_UNKNOWN_TYPE_FOUND ) ); sMessage.SearchAndReplaceAscii("#1",_rColumnName); - OSQLMessageBox aMsg(this,sTitle,sMessage); - aMsg.Execute(); + OSQLWarningBox( this, sMessage ).Execute(); } //------------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index cdfefb5b673d..fa6e91142fc9 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -178,9 +178,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId ) { String strMessage = String(ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME)); strMessage.SearchAndReplaceAscii("$column$", sNewName); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(this,sTitle,strMessage,WB_OK | WB_DEF_OK,OSQLMessageBox::Error); - aMsg.Execute(); + OSQLWarningBox( this, strMessage ).Execute(); pCurFieldDescr->SetName(sName); DisplayData(pCurFieldDescr); static_cast<OWizTypeSelect*>(GetParent())->setDuplicateName(sal_True); diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 21a247c73c9f..259834be1724 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -166,7 +166,7 @@ namespace dbaui { try { - // get the desktop object + // if we have no externally provided frame, create one if ( !m_xFrameLoader.is() ) { Reference< XSingleServiceFactory > xFact(m_xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.TaskCreator")), UNO_QUERY_THROW); @@ -185,7 +185,7 @@ namespace dbaui m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW); } - Reference< XComponentLoader > xFrameLoader(m_xFrameLoader, UNO_QUERY_THROW); + Reference< XComponentLoader > xFrameLoader( m_xFrameLoader, UNO_QUERY_THROW ); xReturn = xFrameLoader->loadComponentFromURL( m_sComponentURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), @@ -193,8 +193,8 @@ namespace dbaui _rArgs ); - if ( xReturn.is() ) - xReturn.set(m_xFrameLoader,UNO_QUERY); + if ( !xReturn.is() ) + xReturn.set( m_xFrameLoader, UNO_QUERY ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index 26e9bfd1e953..aa50736ba6b7 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -47,7 +47,7 @@ namespace dbaui { // strange ctor, but makes instantiating this class more readable (see below) InitAdvanced( short _Generated, short _SQL, short _Append, short _As, short _Outer, short _Priv, short _Param, - short _Version, short _Catalog, short _Schema, short _Index, short _DOS, short _Required, short _Bool,short _IgnoreCur,short _AutoPKey ) + short _Version, short _Catalog, short _Schema, short _Index, short _DOS, short _Required, short _Bool,short _IgnoreCur,short _AutoPKey, short _EscapeDT ) :AdvancedSettingsSupport() { bGeneratedValues = ( _Generated != 0 ); @@ -66,6 +66,7 @@ namespace dbaui bFormsCheckRequiredFields = ( _Required != 0 ); bIgnoreCurrency = ( _IgnoreCur != 0 ); bAutoIncrementIsPrimaryKey = ( _AutoPKey != 0 ); + bEscapeDateTime = ( _EscapeDT != 0 ); } enum Special { All, AllButIgnoreCurrency, None }; @@ -89,6 +90,7 @@ namespace dbaui bFormsCheckRequiredFields = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); bIgnoreCurrency = ( _eType == All ); bAutoIncrementIsPrimaryKey = false; // hsqldb special + bEscapeDateTime = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); } }; @@ -119,18 +121,18 @@ namespace dbaui static AdvancedSupport s_aSupport; if ( s_aSupport.empty() ) { - s_aSupport[ ::dbaccess::DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ); - s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); - s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); - s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1 ); + s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 ); s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ ::dbaccess::DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 ); s_aSupport[ ::dbaccess::DST_CALC ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ ::dbaccess::DST_DBASE ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); - s_aSupport[ ::dbaccess::DST_FLAT ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_DBASE ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_FLAT ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); s_aSupport[ ::dbaccess::DST_JDBC ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency ); s_aSupport[ ::dbaccess::DST_ODBC ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency ); - s_aSupport[ ::dbaccess::DST_ADO ] = InitAdvanced( 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_ADO ] = InitAdvanced( 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ); s_aSupport[ ::dbaccess::DST_MOZILLA ] = InitAdvanced( InitAdvanced::None ); s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = InitAdvanced( InitAdvanced::None ); s_aSupport[ ::dbaccess::DST_LDAP ] = InitAdvanced( InitAdvanced::None ); @@ -141,8 +143,8 @@ namespace dbaui s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = InitAdvanced( InitAdvanced::None ); s_aSupport[ ::dbaccess::DST_KAB ] = InitAdvanced( InitAdvanced::None ); s_aSupport[ ::dbaccess::DST_MACAB ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ); - s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = InitAdvanced( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1 ); + s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = InitAdvanced( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 ); s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency ); s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency ); s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency ); diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index e84927a15690..d1c056b6e4a3 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -454,17 +454,13 @@ namespace dbaui aInfo = dbtools::SQLExceptionInfo(aSQLException); // more like a hack, insert an empty message - OExtensionNotPresentDialog aDlg(m_pDialogParent, m_xORB); - - String sText = aDlg.getText(); + String sText( ModuleRes( RID_STR_EXTENSION_NOT_PRESENT ) ); sText = sText.GetToken(0,'\n'); aInfo.prepend(sText); String sMessage = String(ModuleRes(STR_COULDNOTOPEN_LINKEDDOC)); sMessage.SearchAndReplaceAscii("$file$",_rLinkName); aInfo.prepend(sMessage); - // OExtensionNotPresentDialog aDlg(m_pDialogParent, m_xORB); - // aDlg.Execute(); } catch(Exception& e) { diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 56f52c986253..2ae24b6f6423 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -692,11 +692,9 @@ sal_Bool OSelectionBrowseBox::fillColumnRef(const ::rtl::OUString& _sColumnName, sal_uInt16 nTabCount = 0; if ( !static_cast<OQueryTableView*>(getDesignView()->getTableView())->FindTableFromField(_sColumnName,_pEntry,nTabCount) ) // error occured: column not in table window { - String sTitle(ModuleRes(STR_STAT_WARNING)); String sErrorMsg(ModuleRes(RID_STR_FIELD_DOESNT_EXIST)); sErrorMsg.SearchAndReplaceAscii("$name$",_sColumnName); - OSQLMessageBox aDlg(this,sTitle,sErrorMsg,WB_OK | WB_DEF_OK,OSQLMessageBox::Warning); - aDlg.Execute(); + OSQLWarningBox( this, sErrorMsg ).Execute(); bError = sal_True; } else @@ -772,10 +770,7 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes // something different which we have to check (may be a select statement) String sErrorMessage( ModuleRes( STR_QRY_COLUMN_NOT_FOUND ) ); sErrorMessage.SearchAndReplaceAscii("$name$",_sFieldName); - OSQLMessageBox aDlg( this, - String( ModuleRes( STR_STAT_WARNING ) ), sErrorMessage, - WB_OK | WB_DEF_OK, OSQLMessageBox::Warning ); - aDlg.Execute(); + OSQLWarningBox( this, sErrorMessage ).Execute(); return sal_True; } @@ -964,10 +959,7 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes { // the field could not be isnerted String sErrorMessage( ModuleRes( RID_STR_FIELD_DOESNT_EXIST ) ); sErrorMessage.SearchAndReplaceAscii("$name$",aSelEntry->GetField()); - OSQLMessageBox aDlg( this, - String( ModuleRes( STR_STAT_WARNING ) ), sErrorMessage, - WB_OK | WB_DEF_OK, OSQLMessageBox::Warning ); - aDlg.Execute(); + OSQLWarningBox( this, sErrorMessage ).Execute(); bError = sal_True; } } @@ -1238,9 +1230,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() { if ( !m_bDisableErrorBox ) { - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aDlg(this,sTitle,aErrorMsg,WB_OK | WB_DEF_OK,OSQLMessageBox::Warning); - aDlg.Execute(); + OSQLWarningBox( this, aErrorMsg ).Execute(); } bError = sal_True; } @@ -1249,9 +1239,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() { if ( !m_bDisableErrorBox ) { - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aDlg(this,sTitle,aErrorMsg,WB_OK | WB_DEF_OK,OSQLMessageBox::Warning); - aDlg.Execute(); + OSQLWarningBox( this, aErrorMsg ).Execute(); } bError = sal_True; } diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 48f51b31d5fd..5b6be38be4a9 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -1337,9 +1337,7 @@ bool OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) if ( !editingCommand() && !haveDataSource() ) { String aMessage(ModuleRes(STR_DATASOURCE_DELETED)); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(getView(),sTitle,aMessage); - aMsg.Execute(); + OSQLWarningBox( getView(), aMessage ).Execute(); return false; } diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index 8572ff867f41..b9b599c1c8cc 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -255,9 +255,7 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue if(!::dbaui::checkDataSourceAvailable(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_NAME)),getORB())) { String aMessage(ModuleRes(STR_DATASOURCE_DELETED)); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(getView(),sTitle,aMessage); - aMsg.Execute(); + OSQLWarningBox( getView(), aMessage ).Execute(); } else { diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx index 633a7ed45b52..82d42ccc87de 100644 --- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx +++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx @@ -375,7 +375,7 @@ void ORelationTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const // ----------------------------------------------------------------------------- void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin ) { - OSQLMessageBox aDlg(this,ModuleRes(STR_QUERY_REL_DELETE_WINDOW),String(),WB_YES_NO|WB_DEF_YES,OSQLMessageBox::Warning); + OSQLWarningBox aDlg( this, ModuleRes( STR_QUERY_REL_DELETE_WINDOW ), WB_YES_NO | WB_DEF_YES ); if ( m_bInRemove || aDlg.Execute() == RET_YES ) { m_pView->getController().getUndoMgr()->Clear(); diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 33990f5f296a..d81cf5f9a5cf 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -398,9 +398,7 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) if (!xTablesSup.is()) { String aMessage(ModuleRes(STR_TABLEDESIGN_CONNECTION_MISSING)); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(getView(),sTitle,aMessage); - aMsg.Execute(); + OSQLWarningBox( getView(), aMessage ).Execute(); return sal_False; } @@ -642,8 +640,7 @@ void OTableController::impl_initialize() } catch(const SQLException&) { - OSQLMessageBox aErr(getView(),ModuleRes(STR_STAT_WARNING),ModuleRes(STR_NO_TYPE_INFO_AVAILABLE)); - aErr.Execute(); + OSQLWarningBox( getView(), ModuleRes( STR_NO_TYPE_INFO_AVAILABLE ) ).Execute(); throw; } try @@ -1109,9 +1106,7 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star:: { String strMessage = String(ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME)); strMessage.SearchAndReplaceAscii("$column$", pFieldDesc->GetName()); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(getView(),sTitle,strMessage,WB_OK | WB_DEF_OK,OSQLMessageBox::Error); - aMsg.Execute(); + OSQLWarningBox( getView(), strMessage ).Execute(); return sal_False; } } @@ -1257,10 +1252,9 @@ void OTableController::alterColumns() { String aMessage( ModuleRes( STR_TABLEDESIGN_ALTER_ERROR ) ); aMessage.SearchAndReplaceAscii( "$column$", pField->GetName() ); - String sTitle( ModuleRes( STR_STAT_WARNING ) ); SQLExceptionInfo aError( ::cppu::getCaughtException() ); - OSQLMessageBox aMsg( getView(), sTitle, aMessage, WB_YES_NO | WB_DEF_YES , OSQLMessageBox::Warning, &aError ); + OSQLWarningBox aMsg( getView(), aMessage, WB_YES_NO | WB_DEF_YES , &aError ); bNotOk = aMsg.Execute() == RET_YES; } else @@ -1336,8 +1330,7 @@ void OTableController::alterColumns() { String aMessage(ModuleRes(STR_TABLEDESIGN_ALTER_ERROR)); aMessage.SearchAndReplaceAscii("$column$",pField->GetName()); - String sTitle(ModuleRes(STR_STAT_WARNING)); - OSQLMessageBox aMsg(getView(),sTitle,aMessage,WB_YES_NO|WB_DEF_YES,OSQLMessageBox::Warning); + OSQLWarningBox aMsg( getView(), aMessage, WB_YES_NO | WB_DEF_YES ); if ( aMsg.Execute() != RET_YES ) { Reference<XPropertySet> xNewColumn(xIdxColumns->getByIndex(nPos),UNO_QUERY_THROW); |