diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-06-05 09:47:55 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-06-05 09:47:55 +0000 |
commit | f69c97860cc62e2aad46e9cfb68a643817e8ad4a (patch) | |
tree | 28dd9434276da5b6d415359de4676f3d89b5f824 | |
parent | 62cd9aa9be35282c94bd140998b182bfdac7c325 (diff) |
CWS-TOOLING: integrate CWS dba32b
2009-06-03 14:58:08 +0200 fs r272581 : #i102439#
2009-05-29 13:56:18 +0200 fs r272456 : remove the sub form when the 'add subform' setting changes from <true/> to <false/>, not only its controls
2009-05-29 13:19:27 +0200 fs r272454 : display '(Default)' instead of an empty string when a control has the default font
2009-05-28 20:49:18 +0200 fs r272428 : #i98162# getFirstSelectedValue: do not return reference to a temporary
2009-05-27 15:30:22 +0200 msc r272353 : #102303#
2009-05-26 13:03:06 +0200 fs r272295 : spelling
2009-05-26 12:59:54 +0200 fs r272294 : merge m48 version to get latest cygwin related fixes
2009-05-25 14:02:06 +0200 fs r272239 : remove references to local files, needed for debugging sessions only
2009-05-25 14:01:16 +0200 fs r272238 : #i102021# ensure members such as bNumberFormat are initialized before actually returning them
2009-05-25 13:10:20 +0200 fs r272236 : #i10000# reset ENABLE_EVOAB2
2009-05-22 06:44:45 +0200 oj r272167 : #i99104# add import handler for calc-sett
2009-05-22 06:42:27 +0200 oj r272166 : #i99104# impl NullDate as member
2009-05-22 06:36:22 +0200 oj r272165 : #i99104# handle nulldate from parent model
2009-05-22 06:33:13 +0200 oj r272164 : #i99104# export and import calculation-settings and nulldate
2009-05-22 06:27:50 +0200 oj r272163 : #i99104# export and import calculation-settings and nulldate
2009-05-20 13:29:58 +0200 oj r272118 : #i99911# handle invalid name
2009-05-20 13:28:49 +0200 oj r272117 : #i101261# handle different rowsets
2009-05-20 11:29:55 +0200 msc r272111 : #i100000#
2009-05-20 11:28:27 +0200 msc r272110 : merge in change from dba32a
2009-05-20 11:27:38 +0200 msc r272109 : #102082# CTRL + C does not work
2009-05-20 09:43:36 +0200 oj r272106 : clean up includes
2009-05-20 09:32:15 +0200 oj r272105 : #i99060# merge error resovled now VERTICAL_ALIGN is in both stmt
2009-05-20 08:37:21 +0200 msc r272104 : add workaround for issue #102010#
2009-05-20 08:10:12 +0200 oj r272103 : #i99104# use numberformatkey
2009-05-20 08:07:02 +0200 oj r272102 : #i99104# use column info from rowset
2009-05-20 08:04:43 +0200 oj r272101 : #i102032# use a special column type where prec and scale are the values currently set at the column
2009-05-20 08:03:04 +0200 oj r272100 : #i102032# correct type info, we have to use SQL defined type names
2009-05-19 10:27:02 +0200 oj r272061 : #i99104# export null-date
2009-05-19 08:26:53 +0200 oj r272056 : #i99104# export null-date
2009-05-18 13:15:10 +0200 msc r272014 : add issue #102019#
2009-05-18 11:33:07 +0200 msc r272005 : add issue #102019#
2009-05-18 08:59:45 +0200 msc r271996 : add workaroud for issue #102010#
2009-05-15 10:21:24 +0200 msc r271929 : #101944#
2009-05-11 21:18:30 +0200 fs r271792 : #i99914#
2009-05-08 13:52:06 +0200 oj r271715 : #i96423# remember column span
2009-05-08 11:26:19 +0200 oj r271708 : #i98605# impl new scale mode
2009-05-08 10:33:35 +0200 fs r271706 : SendUserCall: only call into the shape notification routine for UserCall types where this is necessary (performance issue)
2009-05-07 20:52:44 +0200 fs r271698 : outsource ShapeProperty from shapepropertynotifier.hxx
2009-05-07 20:43:33 +0200 fs r271697 : #i99056# use notifyShapePropertyChange, instead of getShapePropertyChangeNotifier - the latter throws if no shape exists, yet
2009-05-07 20:33:58 +0200 fs r271696 : #i99056# +notifyShapePropertyChange: allow notifying chages without checking whether there actually already exists an SvxShape
2009-05-07 16:22:15 +0200 fs r271679 : #i10000# cygwin needs quotes around the classpath
2009-05-07 16:21:37 +0200 fs r271678 : #i10000# cygwin needs quotes around the classpath
2009-05-07 16:01:11 +0200 oj r271677 : #i99914# notify parent handler
2009-05-07 15:54:54 +0200 fs r271676 : #i10000# cygwin needs some quoting
2009-05-07 14:49:48 +0200 oj r271672 : #i99277# quote alias name
2009-05-07 14:48:12 +0200 oj r271671 : #i92538# add ~ in front of type
2009-05-07 14:37:13 +0200 oj r271667 : #i99118# change type from char to varchar
2009-05-07 14:36:23 +0200 oj r271666 : #i99118# clear dest columns when changing to create new table
2009-05-07 13:35:32 +0200 oj r271657 : #i94467# handle type 0 as double as well
2009-05-07 13:20:49 +0200 oj r271655 : i99743# setNull when varchar is no text
2009-05-07 12:58:06 +0200 fs r271651 : initialize the SdrObject's property change notifier after the ctor, if necessary
2009-05-07 11:47:18 +0200 fs r271647 : #i10000#
2009-05-07 10:57:16 +0200 fs r271639 : OPropertyBrowserController::propertyChange: care for the current property state, too, and properly forward it to the UI
2009-05-07 10:18:14 +0200 fs r271636 : onNewComponent: do not ask the map for grid columns, it will throw
2009-05-07 10:09:55 +0200 fs r271634 : #i101623#
2009-05-07 09:53:44 +0200 fs r271631 : #i101622#
2009-05-06 21:55:53 +0200 fs r271615 : #i10000#
2009-05-06 21:10:42 +0200 fs r271611 : #i10000#
2009-05-06 13:11:48 +0200 fs r271583 : #i10000#
2009-05-05 22:29:31 +0200 fs r271559 : proper assertion message
2009-05-05 22:29:03 +0200 fs r271558 : diagnostics
2009-05-05 22:16:16 +0200 fs r271557 : #i10000#
2009-05-05 13:50:32 +0200 fs r271513 : #i10000#
2009-05-05 10:21:50 +0200 fs r271503 : #i10000#
2009-05-05 09:30:26 +0200 fs r271501 : why did those survive the rebase -C step?
2009-05-05 09:18:12 +0200 fs r271500 : #i10000#
2009-05-04 17:08:17 +0200 fs r271475 : CWS-TOOLING: rebase CWS dba32b to trunk@271427 (milestone: DEV300:m47)
2009-05-04 14:51:26 +0200 fs r271456 : line ends
2009-04-30 15:55:27 +0200 fs r271418 : NewURL -> PublicConnectionURL
2009-04-22 21:18:34 +0200 fs r271141 : #i100944#
2009-04-22 09:12:26 +0200 oj r271071 : #i101261# little code change
2009-04-22 09:11:43 +0200 oj r271070 : #i101261# only ask for parameters which aren't set before
2009-04-22 09:11:25 +0200 oj r271069 : #i101261# new grabage container for nodes
2009-04-22 09:11:02 +0200 oj r271068 : #i101261# new grabage container for nodes
2009-04-22 09:10:44 +0200 oj r271067 : #i101261# new grabage container for nodes
2009-04-22 09:10:21 +0200 oj r271066 : #i101261# only ask for parameters which aren't set before
2009-04-22 09:08:24 +0200 oj r271065 : #i101261# only ask for parameters which aren't set before
2009-04-22 09:07:25 +0200 oj r271064 : #i101261# only ask for parameters which aren't set before
2009-04-22 08:49:07 +0200 oj r271062 : #i77501# preview only when needed
2009-04-22 08:45:44 +0200 oj r271061 : #i101261# new prop max rows
2009-04-22 08:44:18 +0200 oj r271060 : #i101261# create dataprovider earlier to avoid the wrong legend in chart
2009-04-22 08:42:48 +0200 oj r271059 : #i101261# handle parameter
2009-04-17 21:00:23 +0200 fs r270954 : #i98350#
2009-04-17 13:54:19 +0200 fs r270942 : #i99565#
2009-04-17 13:51:34 +0200 fs r270940 : #i101153# only localize the (potentially) localizable properties when there really is support at the control model
2009-04-17 11:43:14 +0200 fs r270932 : removed superfluous include
2009-04-17 10:10:15 +0200 fs r270926 : #i10000#
2009-04-17 10:02:36 +0200 fs r270925 : #i10000#
2009-04-17 09:15:13 +0200 fs r270918 : #i99056# some more refactoring of the recently introduced property change notification mechanism for UNO shapes
2009-04-17 09:14:56 +0200 fs r270917 : #i99056# some more refactoring of the recently introduced property change notification mechanism for UNO shapes
2009-04-17 09:13:25 +0200 fs r270915 : #i99056# some more refactoring of the recently introduced property change notification mechanism for UNO shapes
2009-04-17 08:30:34 +0200 fs r270914 : removed unotools/servicehelper.hxx in favour of the (duplicated) comphelper/servicehelper.hxx
2009-04-16 21:05:25 +0200 fs r270903 : #i10000#
2009-04-16 20:43:43 +0200 fs r270902 : #i99056# shape notification outsourced to the SdrObject, this is what all other shape implementations (which only aggregate an SvxShape) have access to, too
2009-04-16 15:57:36 +0200 fs r270891 : #i99056# make SetUnoControlModel virtual
2009-04-16 15:44:02 +0200 fs r270890 : #i99056# let the ScShapeObj notify changes in its Anchor property
2009-04-16 15:36:47 +0200 fs r270889 : #i99056# enable the sheet anchor type property, too
2009-04-16 15:33:45 +0200 fs r270887 : #i99056# shape notification outsourced to the SdrObject, this is what all other shape implementations (which only aggregate an SvxShape) have access to, too
2009-04-15 14:53:13 +0200 fs r270844 : #i10000#
2009-04-15 13:08:29 +0200 fs r270836 : #i10000#
2009-04-15 12:28:14 +0200 fs r270832 : #i10000#
2009-04-15 10:59:14 +0200 fs r270827 : #i10000#
2009-04-15 09:41:08 +0200 oj r270823 : fix issues found with findbugs and pmd
2009-04-14 21:08:04 +0200 fs r270808 : #i99056# implement SheetAnchorType - now the only thing missing to enable it is the proper notification when it is modified
2009-04-14 17:09:00 +0200 fs r270799 : #i99056# implement XServiceInfo for the ScShapeObj
2009-04-14 17:07:55 +0200 fs r270798 : #i99056# implement TextAnchorType, partially implement SheetAnchorType
2009-04-14 15:54:05 +0200 fs r270786 : #i99056# SwXShape: notify changes of the AnchorType property
2009-04-14 15:47:32 +0200 fs r270785 : #i99056# deliver shapepropertynotifier.hxx
2009-04-14 15:46:54 +0200 fs r270784 : diagnostics
2009-04-14 15:08:28 +0200 fs r270781 : #i99056# outsourced the SvxShape's property change notification code into a dedicated class
2009-04-14 14:41:09 +0200 fs r270773 : #i99056# outsourced the SvxShape's property change notification code into a dedicated class
2009-04-14 14:37:23 +0200 fs r270772 : in dtor, remove the properties from the temporary component context
2009-04-14 14:36:34 +0200 fs r270771 : getWeakUnoShape made const
2009-04-14 12:23:08 +0200 oj r270757 : #i101064# add missing braces
2009-04-14 12:21:25 +0200 oj r270756 : #i101065# add braces for gcc 4.3.2
2009-04-14 12:17:45 +0200 oj r270755 : #i101059# add dep for manifest
2009-04-09 12:06:58 +0200 oj r270686 : #i93100# use OptimalSize from control to get height
2009-04-08 09:56:55 +0200 oj r270619 : #i92537# handle calculations in the select columns as well
2009-04-08 09:30:39 +0200 oj r270615 : #i96657# throw error message when the key doesn't have any columns
2009-04-07 12:08:26 +0200 oj r270592 : #i77501# impl preview of the executed report
2009-04-07 12:01:56 +0200 oj r270591 : #i77501# impl preview of the executed report
2009-04-07 11:41:03 +0200 oj r270590 : #i77501# impl preview of the executed report
2009-04-07 11:39:32 +0200 oj r270589 : #i77501# impl preview of the executed report
2009-04-07 11:29:25 +0200 oj r270588 : #i77501# convert dos to unix lineends
2009-04-07 11:28:23 +0200 oj r270587 : #i77501# impl preview of the executed report
2009-04-07 11:16:50 +0200 oj r270586 : #i77501# impl preview of the executed report
2009-04-07 11:16:00 +0200 oj r270585 : #i77501# impl preview of the executed report
2009-04-07 11:15:44 +0200 oj r270584 : #i77501# impl preview of the executed report
2009-04-07 11:15:28 +0200 oj r270583 : #i77501# impl preview of the executed report
2009-04-07 11:15:04 +0200 oj r270582 : #i77501# impl preview of the executed report
2009-04-06 15:38:54 +0200 fs r270559 : merge changes from CWS dba32a herein
2009-04-03 15:56:16 +0200 fs r270494 : ImpSvMEdit::Resize: do multiple iterations, if necessary
2009-04-03 14:35:49 +0200 fs r270487 : #i10000#
2009-04-03 13:17:16 +0200 fs r270476 : #i99056# display geometry information for controls, too
2009-04-03 13:16:37 +0200 fs r270475 : #i99056# better ordering of the geometry properties
2009-04-03 13:16:07 +0200 fs r270473 : #i99056# now that SvxShape supports property change listeners, forward add/remove requests to it
2009-04-03 13:13:18 +0200 fs r270472 : #i99056# at SvxShape, allow for PropertyChangeListeners for Size/Position
2009-04-03 09:29:27 +0200 oj r270456 : #i94571# use correct prop name
2009-04-03 09:14:54 +0200 fs r270451 : merge changes from CWS dba32a herein
2009-04-02 17:00:51 +0200 fs r270424 : better diagnostics
2009-04-02 16:35:19 +0200 fs r270421 : diagnostics
2009-04-02 16:34:50 +0200 fs r270420 : #i99056# mxUnoShape not accessible anymore, use impl_setUnoShape instead
2009-04-02 16:32:48 +0200 fs r270419 : #i99056# make getUnoShape cheaper: keep the pointer to the SvxShape all the time, so there's no need to ask for it in getUnoShape. As a consequence, we will later be able to use the pointer in scenarious where performance (potentially) matters
2009-04-02 16:31:13 +0200 fs r270417 : merge changes from CWS dba32a herein
2009-04-02 16:23:16 +0200 fs r270414 : merge changes from CWS dba32a herein
2009-04-02 14:10:35 +0200 fs r270405 : #i10000#
2009-04-02 14:06:26 +0200 fs r270404 : merge changes from CWS dba32a herein
2009-04-02 14:03:03 +0200 fs r270401 : #i10000#
2009-04-02 13:58:13 +0200 fs r270400 : #i10000#
2009-04-02 12:59:44 +0200 fs r270397 : merge changes from CWS dba32a herein
2009-04-02 12:46:30 +0200 fs r270396 : #i99056# let the form page maintain a mapping between control models and control shapes
2009-04-02 12:44:07 +0200 fs r270395 : merge changes from CWS dba32a herein
2009-04-02 12:42:06 +0200 fs r270394 : merge changes from CWS dba32a herein
2009-04-02 12:35:20 +0200 fs r270393 : #i10000# precompiled header
2009-04-02 12:05:31 +0200 fs r270392 : merge changes from CWS dba32a herein
2009-04-02 12:00:42 +0200 fs r270391 : merge changes from CWS dba32a herein
2009-04-02 11:47:26 +0200 fs r270390 : merge changes from CWS dba32a herein
2009-04-02 11:39:15 +0200 oj r270389 : #i94467# foxpro impl several new types
2009-04-02 11:35:58 +0200 fs r270387 : merge changes from CWS dba32a herein
2009-04-01 14:10:51 +0200 fs r270329 : merge changes from CWS dba32a herein
2009-03-31 17:29:50 +0200 fs r270290 : merge changes from CWS dba32a herein
2009-03-30 14:53:56 +0200 fs r270233 : #i100417# don't set grid column widths to 0, but to <void/>
2009-03-30 12:31:03 +0200 oj r270213 : #i100552# wrong orb used
2009-03-30 12:19:20 +0200 oj r270212 : #i98303# convertlike corrected to sal_Unicode
2009-03-30 11:58:25 +0200 fs r270210 : merge changes from CWS dba32a herein
2009-03-30 11:38:16 +0200 oj r270205 : remove duplicate code from merge
2009-03-30 11:02:27 +0200 fs r270202 : merge changes from CWS dba32a herein
2009-03-30 11:02:19 +0200 fs r270201 : merge changes from CWS dba32a herein
2009-03-30 10:31:26 +0200 oj r270200 : #i100665# only throw exception and do not drop table
2009-03-30 09:36:24 +0200 fs r270195 : assertion text
2009-03-28 20:21:58 +0100 fs r270187 : #ii10000#
2009-03-28 20:19:54 +0100 fs r270186 : removed unused help ids
2009-03-28 20:19:40 +0100 fs r270185 : removed unused help ids
2009-03-28 20:19:10 +0100 fs r270184 : #i100237# +DefaultState/XReset
2009-03-28 00:29:29 +0100 fs r270177 : CWS-TOOLING: rebase CWS dba32b to trunk@270033 (milestone: DEV300:m45)
2009-03-27 22:56:46 +0100 fs r270173 : #i100237# DEFAULT_CHECKED -> DEFAULT_STATE
2009-03-27 22:55:52 +0100 fs r270172 : #i100237# DefaultState property for buttons, enabled only when Toggle=Yes
2009-03-27 22:54:15 +0100 fs r270171 : #i100237# DEFAULT_CHECKED -> DEFAULT_STATE
2009-03-27 22:53:54 +0100 fs r270170 : #i100237# introduce a DefaultState property for buttons, which implies buttongs supporting XReset, which needed some refactoring
2009-03-27 13:31:41 +0100 fs r270152 : ignore output paths
2009-03-27 11:23:44 +0100 fs r270139 : tuned behavior with respect to invalid keys/values
2009-03-27 09:57:14 +0100 fs r270136 : don't allow Double.NaN
2009-03-27 09:56:16 +0100 fs r270135 : talk about Double.NaN
2009-03-26 12:14:30 +0100 fs r270067 : removed unused parameter
2009-03-26 12:14:02 +0100 fs r270066 : removed widening conversion when checking keys
2009-03-26 09:17:34 +0100 fs r270053 : separated the enumerator functionality into a dedicated interface, this way not burdening XMap with it
2009-03-26 09:17:11 +0100 fs r270052 : separated the enumerator functionality into a dedicated interface, this way not burdening XMap with it
2009-03-26 09:16:49 +0100 fs r270051 : separated the enumerator functionality into a dedicated interface, this way not burdening XMap with it
2009-03-25 21:55:20 +0100 fs r270044 : #i100541# properly calculat bNeedScrollBox
2009-03-25 12:56:17 +0100 fs r270019 : renamed the previously introduced error condition
2009-03-25 12:11:48 +0100 fs r270015 : #i100095# when the error messages contain non-trivial details (SQLState/ErrorCode), then always display the 'Details' button
2009-03-25 12:10:05 +0100 fs r270012 : renamed the previously introduced error condition
2009-03-25 12:01:04 +0100 fs r270011 : #i100095# when no address book (or respective profile) can be found, then use a dedicated ErrorCondition
2009-03-25 10:29:07 +0100 fs r270003 : add missing localization
2009-03-25 10:23:12 +0100 fs r270001 : in preparation of #i1000095#:
rework the error handling, allow using css.sdb.ErrorCondition values, plus
allow propagating the nsresult
2009-03-25 10:21:55 +0100 fs r270000 : in preparation of #i1000095#:
rework the error handling, allow using css.sdb.ErrorCondition values, plus
allow propagating the nsresult
2009-03-20 23:05:38 +0100 fs r269829 : XMap::getSize removed
2009-03-20 23:05:19 +0100 fs r269828 : changes as suggested by sb
2009-03-20 23:04:56 +0100 fs r269827 : enhanced documentation
2009-03-20 15:31:40 +0100 fs r269815 : changes as suggested by sb
2009-03-20 13:23:52 +0100 oj r269804 : #i92538# correct the zorder that fixedtext is infront of control
2009-03-20 12:59:38 +0100 oj r269801 : #i94571# paraadjust now supports BLOCK
2009-03-20 12:58:11 +0100 oj r269800 : #i94571# export style with data style
2009-03-20 12:57:05 +0100 oj r269799 : #i94571# text align is now paraadjust
2009-03-20 12:37:02 +0100 fs r269797 : enum keys only accepted if they have the exact type, not if they have *any* enum type
2009-03-20 12:28:31 +0100 fs r269794 : some changes requested by sb
2009-03-20 08:52:47 +0100 fs r269780 : doc
2009-03-20 07:37:31 +0100 oj r269779 : #i99913# only notifiy when values are different
2009-03-20 07:36:58 +0100 oj r269778 : #i99913# add undoenv as listener at the dataprovider
2009-03-19 22:52:52 +0100 fs r269771 : added comment
2009-03-19 22:40:06 +0100 fs r269770 : +testEnumeration
2009-03-19 22:39:41 +0100 fs r269769 : implemented enumeration, getKeySet, and getValues. Should be finished now.
2009-03-19 14:01:01 +0100 oj r269743 : #i99913# reset the modified state when selecting an object
2009-03-19 12:19:54 +0100 lla r269739 : #i72390# cleanups
2009-03-19 09:25:27 +0100 fs r269727 : #i10000#
2009-03-18 23:37:02 +0100 fs r269708 : extended checks for value type acceptance
2009-03-18 23:36:41 +0100 fs r269707 : fixed value type checks
2009-03-18 14:59:56 +0100 fs r269678 : initial complex test case for the new css.container.Map implementation
2009-03-18 14:59:24 +0100 fs r269677 : verifyExpectedException moved to base class (in complexlib), and renamed to assureException for consistency
2009-03-18 14:58:35 +0100 fs r269676 : removed unused imports
2009-03-18 14:58:03 +0100 fs r269675 : first implementation of the new css.container.Map service (not completed, yet)
2009-03-18 14:57:17 +0100 fs r269674 : base class for UNO components, freeing you from some repeating work
2009-03-18 14:55:53 +0100 fs r269672 : +assureException: call a given method with given parameters on a given object, ensure that a given exception is thrown by the method implementation
2009-03-18 14:54:58 +0100 fs r269671 : +getComponentContext
2009-03-18 14:54:00 +0100 fs r269670 : isEmpty returns a boolean, not a long
2009-03-18 14:14:43 +0100 oj r269663 : #i99743# now text also supports null
2009-03-18 13:54:14 +0100 oj r269660 : #i99223# remove check for 2 params
2009-03-18 13:33:35 +0100 oj r269659 : #i99060# replace text::ParagraphVertAlign with style::VerticalAlignment
2009-03-18 13:32:18 +0100 oj r269658 : #i99060# don't set void property when void isn't allowed
2009-03-18 13:31:11 +0100 oj r269657 : #i99060# handle vertical alignment
2009-03-18 13:28:28 +0100 oj r269656 : #i99060# remove unused elements from sytle
2009-03-18 09:35:42 +0100 lla r269639 : #i72390# cleanups
2009-03-18 09:31:20 +0100 lla r269638 : #i72390# add ButtonList
2009-03-18 09:30:46 +0100 lla r269637 : #i72390# renamed interface
2009-03-18 09:30:15 +0100 lla r269636 : #i72390# use ButtonList instead of ImageList
2009-03-18 09:29:05 +0100 lla r269635 : #i72390# new ButtonList, cleanups
2009-03-18 09:26:34 +0100 lla r269634 : #i72390# cleanups
2009-03-17 12:21:20 +0100 oj r269590 : #i99222# remove assertion
2009-03-17 12:17:22 +0100 oj r269589 : #i98605# impl scale mode
2009-03-17 12:10:42 +0100 oj r269588 : #i98605# impl scale mode
2009-03-17 11:40:15 +0100 oj r269584 : #i96944# doesn't create equation for shapes
2009-03-17 11:33:16 +0100 oj r269583 : #i96423# switch calc from float to long
2009-03-16 15:19:18 +0100 fs r269550 : #i41930# enable zoom for embedded/outplace documents
2009-03-16 14:25:54 +0100 oj r269542 : #i93734# remove ContextSensitive
2009-03-16 14:21:58 +0100 oj r269541 : #i99274# page header before group header
2009-03-16 14:18:23 +0100 oj r269539 : #i99110# fix value type
2009-03-16 14:14:16 +0100 fs r269537 : line ends
2009-03-16 14:11:06 +0100 fs r269535 : line ends
2009-03-16 14:08:34 +0100 fs r269534 : #i100087# (provided my np): allow for polymorphic types with more than one parameter
2009-03-16 12:30:31 +0100 oj r269521 : compile error
2009-03-16 12:19:12 +0100 oj r269519 : compile error
2009-03-16 10:39:28 +0100 oj r269511 : compile error under linux with swap
2009-03-13 10:33:04 +0100 oj r269462 : CWS-TOOLING: rebase CWS dba32b to trunk@269297 (milestone: DEV300:m43)
2009-03-12 14:37:25 +0100 fs r269416 : interface SequenceOutputStreamTest is unneeded, and pollutes the namespace here :)
2009-03-12 14:35:07 +0100 fs r269414 : not needed
2009-03-12 14:34:15 +0100 fs r269413 : preparation for multiple tests in this module
2009-03-12 14:33:02 +0100 fs r269412 : ShowTargets was moved from module integration.forms to module complexlib
2009-03-12 14:32:48 +0100 fs r269411 : helper class for projects containing multiple complex test cases (and following a certain structure)
2009-03-12 14:00:14 +0100 fs r269407 : proper module after the move
2009-03-12 13:59:10 +0100 fs r269406 : superseded by ../makefile.mk
2009-03-12 13:47:38 +0100 fs r269403 : not needed anymore
2009-03-12 13:45:46 +0100 fs r269402 : moved, in preparation of adding more test cases here, with a common infrastructure
2009-03-12 13:45:07 +0100 fs r269401 : moved from ../
2009-03-12 13:43:59 +0100 fs r269400 : moved to ./comphelper, in preparation of adding more test cases here, with a common infrastructure
2009-03-12 13:29:47 +0100 oj r269396 : #i99914# set parent on dataprovider
2009-03-12 13:10:35 +0100 oj r269393 : #i99832# check thrown exception and show error
2009-03-12 13:08:10 +0100 fs r269392 : reorganizing tests
2009-03-12 12:52:55 +0100 oj r269390 : #i99118# convert formatkey in numberformat
2009-03-12 12:34:53 +0100 fs r269388 : new API tests
2009-03-12 12:29:05 +0100 fs r269386 : Map not yet committed
2009-03-12 12:28:36 +0100 fs r269385 : oops, forgot the SequenceInputStream during the previous refactoring
2009-03-12 12:12:39 +0100 oj r269384 : #i99104# set HasCategories prop
2009-03-12 12:12:08 +0100 oj r269383 : #i99104# check HasCategories even for internal dataprovider
2009-03-12 12:10:40 +0100 oj r269382 : #i99104# set HasCategories prop
2009-03-12 10:51:49 +0100 fs r269373 : #i10000# exception specifications
2009-03-12 10:49:18 +0100 fs r269372 : #i10000# exception specifications
2009-03-12 10:44:02 +0100 fs r269371 : #i10000# exception specifications
2009-03-12 10:30:55 +0100 fs r269368 : refactored the UNO service registration in this module, using the helper classes provided by comphelper itself, so you have less effort when extending the list of to-be-registered components
2009-03-12 10:30:37 +0100 fs r269367 : module-local includes
2009-03-12 07:05:54 +0100 oj r269357 : #i99104# database dataprovider doesn't need dataranges and diagramdata
2009-03-11 10:58:28 +0100 oj r269306 : #i99911# check if name of the report is a valid file name
2009-03-11 10:03:23 +0100 oj r269299 : #i99666# the report is new when the HierarchicalDocumentName is empty
2009-03-10 11:32:45 +0100 oj r269258 : #i99221# use fallback for language
2009-03-10 10:48:40 +0100 oj r269255 : #i99433# now use OStringBuffer
2009-03-10 10:36:21 +0100 fs r269252 : initial version of (X)Map
2009-03-10 09:52:23 +0100 oj r269246 : #i99433# now use OStringBuffer
2009-03-10 08:56:13 +0100 oj r269240 : #i99655# patch applied
2009-03-09 07:35:33 +0100 lla r269058 : #i10000# wrong variable assignment fixed
2009-03-06 17:20:40 +0100 fs r269030 : some explicit defaults
2009-03-06 17:20:30 +0100 fs r269029 : #i98600#
2009-03-06 14:40:34 +0100 fs r269009 : #i87692# during reload, prevent the document being modified just because of some control content changes ...
2009-03-06 12:52:20 +0100 lla r268997 : #i10000# ambigous problem with FontWeight fixed
2009-03-06 11:39:32 +0100 fs r268989 : #i10000# (approved by pl): use --without-t1-library configure option
2009-03-06 10:55:43 +0100 fs r268986 : #i99953# depends on xmlscript module now
2009-03-06 10:54:04 +0100 fs r268985 : #i99953# also adjust the event names found in dialogs embedded in the forms
2009-03-06 09:53:41 +0100 fs r268977 : #i10000#
2009-03-06 09:30:41 +0100 lla r268973 : #i10000# merge problems
2009-03-05 17:52:34 +0100 fs r268932 : #i98593# for sub components which are actually controlled by a DocumentDefinition (aka XComponentSupplier aka XCommandProcessor), close them by executing the 'close' command, not by suspending/closing the controller (which cannot be intercepted)
2009-03-05 11:41:56 +0100 fs r268889 : default the drop down line count for list/combo boxes to 20
2009-03-05 11:39:10 +0100 fs r268887 : do not display empty error messages
2009-03-02 10:13:57 +0100 lla r268639 : #i91541# CWS rebase m41 to m42
2009-03-02 09:06:27 +0100 lla r268635 : #i10000# add ';' to strings
2009-02-26 11:18:00 +0100 fs r268492 : reportdesign depends on REPORTBUILDER, not REPORTDESIGN
2009-02-26 10:11:38 +0100 lla r268489 : CWS-TOOLING: rebase CWS dba32b to trunk@268395 (milestone: DEV300:m42)
2009-02-26 09:04:11 +0100 lla r268488 : CWS-TOOLING: rebase CWS dba32b to trunk@268395 (milestone: DEV300:m42)
2009-02-24 12:09:13 +0100 lla r268392 : #i91541# #i91542# cleanups
2009-02-24 08:08:06 +0100 lla r268382 : merge all dba32a changes into dba32b
2009-02-24 07:14:55 +0100 lla r268381 : merge all dba32a changes into dba32b
2009-02-23 21:44:28 +0100 fs r268377 : oops ... don't tamper with m_aListSourceValues at the end of loadData
2009-02-23 20:57:05 +0100 fs r268376 : #i98162# don't hold the values as strings, but as ORowSetValue, this way preserving their type, and being agnostic to different result/rowset implementations doing different to-string-conversations
2009-02-23 20:55:44 +0100 fs r268375 : getObject: throwFunctionNotSupportedException, instead of silently returning NULL
2009-02-23 20:55:20 +0100 fs r268374 : #i98162# some more supported types
2009-02-23 20:54:43 +0100 fs r268373 : #i98162# +operator !=
2009-02-20 09:35:39 +0100 fs r268306 : #i99422# for a font, display the font name, the style, and the size
2009-02-20 09:33:45 +0100 fs r268305 : #i99422# in the property browser, FONT supersedes CHARFONTNAME: the aggregated FormComponentHandler displays them more nicely now
2009-02-19 16:12:06 +0100 fs r268293 : #i99372# recognize DataType::FLOAT as numeric
2009-02-19 15:43:12 +0100 fs r268291 : #i99415#
2009-02-19 15:40:15 +0100 fs r268290 : #i99242# lcl_firstFocussableControl: take disabled controls into account
2009-02-19 15:34:36 +0100 fs r268289 : #i99396# properly decode the base name of the URL when using it as title
2009-02-19 15:19:05 +0100 fs r268287 : #i98247#
111 files changed, 4519 insertions, 1609 deletions
diff --git a/extensions/inc/extensio.hrc b/extensions/inc/extensio.hrc index a831143b5eeb..c2b627d25ecf 100644 --- a/extensions/inc/extensio.hrc +++ b/extensions/inc/extensio.hrc @@ -216,7 +216,7 @@ #define HID_PROP_SUBMIT_ENCODING (HID_FORMS_START + 58) #define HID_PROP_DEFAULTVALUE (HID_FORMS_START + 59) #define HID_PROP_SUBMIT_TARGET (HID_FORMS_START + 60) -#define HID_PROP_DEFAULT_CHECKED (HID_FORMS_START + 61) +#define HID_PROP_DEFAULT_STATE (HID_FORMS_START + 61) #define HID_PROP_IMAGE_URL (HID_FORMS_START + 62) #define HID_PROP_DEFAULT_SELECT_SEQ (HID_FORMS_START + 63) #define HID_PROP_MULTISELECTION (HID_FORMS_START + 64) @@ -458,9 +458,10 @@ #define HID_PROP_IMAGEPOSITION (HID_FORMS_START + 339) #define HID_PROP_NOLABEL (HID_FORMS_START + 340) #define HID_PROP_WRITING_MODE (HID_FORMS_START + 341) +#define HID_PROP_ANCHOR_TYPE (HID_FORMS_START + 343) // please adjust HID_LAST_FORMS_ID if you add new ids here! -#define HID_LAST_FORMS_ID HID_PROP_WRITING_MODE +#define HID_LAST_FORMS_ID HID_PROP_ANCHOR_TYPE #if HID_LAST_FORMS_ID > HID_FORMS_END #error id overflow diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 1c0e9a684e05..ad09e2d7122c 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -218,8 +218,8 @@ namespace dbp xColumn->setPropertyValue(s_sDataFieldProperty, makeAny(*pFormFieldName)); // the label xColumn->setPropertyValue(s_sLabelProperty, makeAny(::rtl::OUString(*pFormFieldName) += *pColumnLabelPostfix)); - // the width (0 => column will be auto-sized) - xColumn->setPropertyValue(s_sWidthProperty, makeAny(sal_Int32(0))); + // the width (<void/> => column will be auto-sized) + xColumn->setPropertyValue(s_sWidthProperty, Any()); // insert the column xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 4cb35e9f0c6f..23008fc9a1de 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -667,11 +667,21 @@ namespace pcr } //------------------------------------------------------------------ - void OBrowserListBox::SetPropertyValue(const ::rtl::OUString& _rEntryName, const Any& _rValue) + void OBrowserListBox::SetPropertyValue(const ::rtl::OUString& _rEntryName, const Any& _rValue, bool _bUnknownValue ) { ListBoxLines::iterator line = m_aLines.find( _rEntryName ); if ( line != m_aLines.end() ) - impl_setControlAsPropertyValue( line->second, _rValue ); + { + if ( _bUnknownValue ) + { + Reference< XPropertyControl > xControl( line->second.pLine->getControl() ); + OSL_ENSURE( xControl.is(), "OBrowserListBox::SetPropertyValue: illegal control!" ); + if ( xControl.is() ) + xControl->setValue( Any() ); + } + else + impl_setControlAsPropertyValue( line->second, _rValue ); + } } //------------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index faa6facb6fe4..a89e1dc83c39 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -164,7 +164,7 @@ namespace pcr sal_Bool RemoveEntry( const ::rtl::OUString& _rName ); void ChangeEntry( const OLineDescriptor&, sal_uInt16 nPos ); - void SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue ); + void SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue, bool _bUnknownValue ); ::com::sun::star::uno::Any GetPropertyValue( const ::rtl::OUString& rEntryName ) const; sal_uInt16 GetPropertyPos( const ::rtl::OUString& rEntryName ) const; ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index e1fc88553e76..d609dea69436 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -44,8 +44,10 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <unotools/transliterationwrapper.hxx> #include <osl/diagnose.h> +#include <tools/diagnose_ex.h> #include "formstrings.hxx" #include <functional> @@ -109,7 +111,7 @@ namespace pcr } //------------------------------------------------------------------------ - sal_Int16 CellBindingHelper::getControlSheetIndex( ) const + sal_Int16 CellBindingHelper::getControlSheetIndex( Reference< XSpreadsheet >& _out_rxSheet ) const { sal_Int16 nSheetIndex = -1; // every sheet has a draw page, and every draw page has a forms collection. @@ -137,18 +139,13 @@ namespace pcr { for ( sal_Int32 i = 0; i < xSheets->getCount(); ++i ) { - Reference< XDrawPageSupplier > xSuppPage; - xSheets->getByIndex( i ) >>= xSuppPage; + Reference< XDrawPageSupplier > xSuppPage( xSheets->getByIndex( i ), UNO_QUERY_THROW ); + Reference< XFormsSupplier > xSuppForms( xSuppPage->getDrawPage(), UNO_QUERY_THROW ); - Reference< XFormsSupplier > xSuppForms; - if ( xSuppPage.is() ) - xSuppForms = xSuppForms.query( xSuppPage->getDrawPage() ); - - OSL_ENSURE( xSuppForms.is(), "CellBindingHelper::getControlSheetIndex: could not determine the forms supplier!" ); - - if ( xSuppForms.is() && ( xSuppForms->getForms() == xFormsCollection ) ) + if ( xSuppForms->getForms() == xFormsCollection ) { // found it nSheetIndex = (sal_Int16)i; + _out_rxSheet.set( xSuppPage, UNO_QUERY_THROW ); break; } } @@ -156,7 +153,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( sal_False, "CellBindingHelper::getControlSheetIndex: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } return nSheetIndex; @@ -195,7 +192,8 @@ namespace pcr { try { - xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( (sal_Int32)getControlSheetIndex() ) ); + Reference< XSpreadsheet > xSheet; + xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( (sal_Int32)getControlSheetIndex( xSheet ) ) ); xConverter->setPropertyValue( _rInputProperty, _rInputValue ); _rOutputValue = xConverter->getPropertyValue( _rOutputProperty ); bSuccess = true; diff --git a/extensions/source/propctrlr/cellbindinghelper.hxx b/extensions/source/propctrlr/cellbindinghelper.hxx index 4660bb681507..e612bda0983a 100644 --- a/extensions/source/propctrlr/cellbindinghelper.hxx +++ b/extensions/source/propctrlr/cellbindinghelper.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/form/binding/XValueBinding.hpp> #include <com/sun/star/form/binding/XListEntrySource.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> /** === end UNO includes === **/ //............................................................................ @@ -205,6 +206,13 @@ namespace pcr const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource ) const; + /** retrieves the index of the sheet which our control belongs to + @return the index of the sheet which our control belongs to or -1, if an error occured + */ + sal_Int16 getControlSheetIndex( + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >& _out_rxSheet + ) const; + protected: /** creates an address object from a string representation of a cell address */ @@ -220,11 +228,6 @@ namespace pcr ::com::sun::star::table::CellRangeAddress& /* [out] */ _rAddress ) const; - /** retrieves the index of the sheet which our control belongs to - @return the index of the sheet which our control belongs to or -1, if an error occured - */ - sal_Int16 getControlSheetIndex( ) const; - /** determines if our document is a spreadsheet document, *and* can supply the given service */ diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index de4a907157d7..aed1d120bb09 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -163,7 +163,10 @@ namespace pcr { "com.sun.star.form.inspection.XSDValidationPropertyHandler", true }, // a handler which cares for XForms submissions - { "com.sun.star.form.inspection.SubmissionPropertyHandler", true } + { "com.sun.star.form.inspection.SubmissionPropertyHandler", true }, + + // a handler which cares for geometry properties of form controls + { "com.sun.star.form.inspection.FormGeometryHandler", true } }; sal_Int32 nFactories = sizeof( aFactories ) / sizeof( aFactories[ 0 ] ); diff --git a/extensions/source/propctrlr/editpropertyhandler.cxx b/extensions/source/propctrlr/editpropertyhandler.cxx index 0de64030db41..cd9d197e3fb5 100644 --- a/extensions/source/propctrlr/editpropertyhandler.cxx +++ b/extensions/source/propctrlr/editpropertyhandler.cxx @@ -293,7 +293,7 @@ namespace pcr _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_FONT_NAME, nTextType != TEXTTYPE_RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TEXTTYPE_SINGLELINE ); diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index b6dc84dff225..e28eb2e89224 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -103,7 +103,6 @@ #include <svx/svxids.hrc> #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> -#include <unotools/confignode.hxx> #include <vcl/msgbox.hxx> #include <vcl/stdtext.hxx> #include <vcl/wrkwin.hxx> @@ -344,7 +343,7 @@ namespace pcr sObjectID = sObjectID + xGrfObj->getUniqueID(); m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) ); } - else if ( PROPERTY_ID_FONT_NAME == nPropId ) + else if ( PROPERTY_ID_FONT == nPropId ) { // special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow Sequence< NamedValue > aFontPropertyValues; @@ -619,7 +618,7 @@ namespace pcr case 1: nWritingMode = WritingMode2::RL_TB; break; case 2: nWritingMode = WritingMode2::CONTEXT; break; default: - OSL_ENSURE( false, "FormComponentPropertyHandler::convertToControlValue: unexpected 'normalized value' for WritingMode!" ); + OSL_ENSURE( false, "FormComponentPropertyHandler::convertToPropertyValue: unexpected 'normalized value' for WritingMode!" ); nWritingMode = WritingMode2::CONTEXT; break; } @@ -764,6 +763,51 @@ namespace pcr } break; + case PROPERTY_ID_FONT: + { + FontDescriptor aFont; + OSL_VERIFY( _rPropertyValue >>= aFont ); + + ::rtl::OUStringBuffer displayName; + if ( !aFont.Name.getLength() ) + { + displayName.append( String( PcrRes( RID_STR_FONT_DEFAULT ) ) ); + } + else + { + // font name + displayName.append( aFont.Name ); + displayName.appendAscii( ", " ); + + // font style + ::FontWeight eWeight = VCLUnoHelper::ConvertFontWeight( aFont.Weight ); + USHORT nStyleResID = RID_STR_FONTSTYLE_REGULAR; + if ( aFont.Slant == FontSlant_ITALIC ) + { + if ( eWeight > WEIGHT_NORMAL ) + nStyleResID = RID_STR_FONTSTYLE_BOLD_ITALIC; + else + nStyleResID = RID_STR_FONTSTYLE_ITALIC; + } + else + { + if ( eWeight > WEIGHT_NORMAL ) + nStyleResID = RID_STR_FONTSTYLE_BOLD; + } + displayName.append( String( PcrRes( nStyleResID ) ) ); + + // font size + if ( aFont.Height ) + { + displayName.appendAscii( ", " ); + displayName.append( sal_Int32( aFont.Height ) ); + } + } + + aControlValue <<= displayName.makeStringAndClear(); + } + break; + default: aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); break; @@ -924,6 +968,7 @@ namespace pcr aInterestingProperties.push_back( PROPERTY_SHOWTHOUSANDSEP ); aInterestingProperties.push_back( PROPERTY_FORMATKEY ); aInterestingProperties.push_back( PROPERTY_EMPTY_IS_NULL ); + aInterestingProperties.push_back( PROPERTY_TOGGLE ); return Sequence< ::rtl::OUString >( &(*aInterestingProperties.begin()), aInterestingProperties.size() ); } @@ -1010,7 +1055,7 @@ namespace pcr }; break; - case PROPERTY_ID_FONT_NAME: + case PROPERTY_ID_FONT: bReadOnly = sal_True; aDescriptor.PrimaryButtonId = UID_PROP_DLG_FONT_TYPE; break; @@ -1238,7 +1283,7 @@ namespace pcr ::std::vector< ::rtl::OUString >::const_iterator pEnd = aEnumValues.end(); // for a checkbox: if "ambiguous" is not allowed, remove this from the sequence - if ( ( PROPERTY_ID_DEFAULTCHECKED == nPropId ) + if ( ( PROPERTY_ID_DEFAULT_STATE == nPropId ) || ( PROPERTY_ID_STATE == nPropId ) ) { @@ -1434,7 +1479,7 @@ namespace pcr eResult = InteractiveSelectionResult_ObtainedValue; break; - case PROPERTY_ID_FONT_NAME: + case PROPERTY_ID_FONT: if ( impl_executeFontDialog_nothrow( _rData, aGuard ) ) eResult = InteractiveSelectionResult_ObtainedValue; break; @@ -1661,7 +1706,7 @@ namespace pcr // ----- TriState ----- case PROPERTY_ID_TRISTATE: if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULTCHECKED : PROPERTY_STATE ); + _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE ); break; // case PROPERTY_ID_TRISTATE // ----- DecimalAccuracy ----- @@ -1747,6 +1792,14 @@ namespace pcr } break; + case PROPERTY_ID_TOGGLE: + { + sal_Bool bIsToggleButton = sal_False; + OSL_VERIFY( _rNewValue >>= bIsToggleButton ); + _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_STATE, bIsToggleButton ); + } + break; + default: DBG_ERROR( "FormComponentPropertyHandler::actuatingPropertyChanged: did not register for this property!" ); break; @@ -2260,67 +2313,6 @@ namespace pcr } //------------------------------------------------------------------------ - sal_Int16 FormComponentPropertyHandler::impl_getDocumentMeasurementUnit_throw() const - { - FieldUnit eUnit = FUNIT_NONE; - - Reference< XServiceInfo > xDocumentSI( impl_getContextDocument_nothrow(), UNO_QUERY ); - OSL_ENSURE( xDocumentSI.is(), "FormComponentPropertyHandler::impl_getDocumentMeasurementUnit_throw: No context document - where do I live?" ); - if ( xDocumentSI.is() ) - { - // determine the application type we live in - ::rtl::OUString sConfigurationLocation; - ::rtl::OUString sConfigurationProperty; - if ( xDocumentSI->supportsService( SERVICE_WEB_DOCUMENT ) ) - { // writer - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.WriterWeb/Layout/Other" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_TEXT_DOCUMENT ) ) - { // writer - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Writer/Layout/Other" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) ) - { // calc - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Calc/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_DRAWING_DOCUMENT ) ) - { - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Draw/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_PRESENTATION_DOCUMENT ) ) - { - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Impress/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - - // read the measurement unit from the configuration - if ( sConfigurationLocation.getLength() && sConfigurationProperty.getLength() ) - { - ::utl::OConfigurationTreeRoot aConfigTree( ::utl::OConfigurationTreeRoot::createWithServiceFactory( - m_aContext.getLegacyServiceFactory(), sConfigurationLocation, -1, ::utl::OConfigurationTreeRoot::CM_READONLY ) ); - sal_Int32 nUnitAsInt = (sal_Int32)FUNIT_NONE; - aConfigTree.getNodeValue( sConfigurationProperty ) >>= nUnitAsInt; - - // if this denotes a valid (and accepted) unit, then use it - if ( ( nUnitAsInt > FUNIT_NONE ) && ( nUnitAsInt <= FUNIT_100TH_MM ) ) - eUnit = static_cast< FieldUnit >( nUnitAsInt ); - } - } - - if ( FUNIT_NONE == eUnit ) - { - MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; - } - - return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 ); - } - - //------------------------------------------------------------------------ Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_throw( ) const { Reference< XRowSet > xRowSet = m_xRowSet; diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx index ad6f19cce98b..9b972896e856 100644 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ b/extensions/source/propctrlr/formcomponenthandler.hxx @@ -174,10 +174,6 @@ namespace pcr */ bool impl_shouldExcludeProperty_nothrow( const ::com::sun::star::beans::Property& _rProperty ) const; - /** determines the default measure unit for the document in which our component lives - */ - sal_Int16 impl_getDocumentMeasurementUnit_throw() const; - /** initializes the list of field names, if we're handling a control which supports the DataField property */ diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx new file mode 100644 index 000000000000..00cfb70ee31e --- /dev/null +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -0,0 +1,825 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_extensions.hxx" + +#include "propertyhandler.hxx" +#include "formmetadata.hxx" +#include "formstrings.hxx" +#include "handlerhelper.hxx" +#include "cellbindinghelper.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/inspection/XObjectInspectorUI.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/container/XMap.hpp> +#include <com/sun/star/inspection/XNumericControl.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/form/XGridColumnFactory.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/componentbase.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> + +//........................................................................ +namespace pcr +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::beans::UnknownPropertyException; + using ::com::sun::star::beans::Property; + using ::com::sun::star::awt::XControlModel; + using ::com::sun::star::drawing::XControlShape; + using ::com::sun::star::container::XMap; + using ::com::sun::star::inspection::LineDescriptor; + using ::com::sun::star::inspection::XPropertyControlFactory; + using ::com::sun::star::lang::NullPointerException; + using ::com::sun::star::beans::Optional; + using ::com::sun::star::inspection::XNumericControl; + using ::com::sun::star::drawing::XShape; + using ::com::sun::star::beans::PropertyChangeEvent; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::XPropertyChangeListener; + using ::com::sun::star::text::TextContentAnchorType; + using ::com::sun::star::text::TextContentAnchorType_AT_PARAGRAPH; + using ::com::sun::star::text::TextContentAnchorType_AS_CHARACTER; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::inspection::XObjectInspectorUI; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::sheet::XSpreadsheet; + using ::com::sun::star::table::XColumnRowRange; + using ::com::sun::star::table::XTableColumns; + using ::com::sun::star::table::XTableRows; + using ::com::sun::star::table::XCellRange; + using ::com::sun::star::container::XIndexAccess; + using ::com::sun::star::container::XChild; + using ::com::sun::star::form::XGridColumnFactory; + /** === end UNO using === **/ + namespace MeasureUnit = ::com::sun::star::util::MeasureUnit; + + typedef ::com::sun::star::awt::Point AwtPoint; + typedef ::com::sun::star::awt::Size AwtSize; + + #define ANCHOR_TO_SHEET 0 + #define ANCHOR_TO_CELL 1 + + //==================================================================== + //= BroadcastHelperBase + //==================================================================== + class BroadcastHelperBase + { + protected: + BroadcastHelperBase( ::osl::Mutex& _rMutex ) + :maBHelper( _rMutex ) + { + } + + protected: + ::cppu::OBroadcastHelper& getBroadcastHelper() { return maBHelper; } + + private: + ::cppu::OBroadcastHelper maBHelper; + }; + + //==================================================================== + //= ShapeGeometryChangeNotifier - declaration + //==================================================================== + /** helper class to work around the ...unfortunate implementation of property change broadcasts + in the XShape implementation, which broadcasts way too generous and unspecified + */ + typedef ::comphelper::ComponentBase ShapeGeometryChangeNotifier_CBase; + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener + > ShapeGeometryChangeNotifier_IBase; + + class ShapeGeometryChangeNotifier :public BroadcastHelperBase + ,public ShapeGeometryChangeNotifier_CBase + ,public ShapeGeometryChangeNotifier_IBase + { + public: + ShapeGeometryChangeNotifier( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rParentMutex, const Reference< XShape >& _shape ) + :BroadcastHelperBase( _rParentMutex ) + ,ShapeGeometryChangeNotifier_CBase( BroadcastHelperBase::getBroadcastHelper(), ::comphelper::ComponentBase::NoInitializationNeeded() ) + ,ShapeGeometryChangeNotifier_IBase() + ,m_rParent( _rParent ) + ,m_aPropertyChangeListeners( _rParentMutex ) + ,m_xShape( _shape ) + { + ENSURE_OR_THROW( m_xShape.is(), "illegal shape!" ); + impl_init_nothrow(); + } + + // property change broadcasting + void addPropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) + { + m_aPropertyChangeListeners.addInterface( _listener ); + } + void removePropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) + { + m_aPropertyChangeListeners.removeInterface( _listener ); + } + + // XComponent equivalent + void dispose() + { + ::osl::MutexGuard aGuard( getMutex() ); + impl_dispose_nothrow(); + } + + // XInterface + virtual void SAL_CALL acquire( ) throw () + { + m_rParent.acquire(); + } + + virtual void SAL_CALL release( ) throw () + { + m_rParent.release(); + } + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const PropertyChangeEvent& _event ) throw (RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const EventObject& _event ) throw (RuntimeException); + + protected: + virtual ~ShapeGeometryChangeNotifier() + { + if ( !getBroadcastHelper().bDisposed ) + { + acquire(); + dispose(); + } + } + + protected: + ::cppu::OBroadcastHelper& getBroadcastHelper() { return BroadcastHelperBase::getBroadcastHelper(); } + + private: + void impl_init_nothrow(); + void impl_dispose_nothrow(); + + private: + ::cppu::OWeakObject& m_rParent; + ::cppu::OInterfaceContainerHelper m_aPropertyChangeListeners; + Reference< XShape > m_xShape; + }; + + //==================================================================== + //= FormGeometryHandler - declaration + //==================================================================== + class FormGeometryHandler; + typedef HandlerComponentBase< FormGeometryHandler > FormGeometryHandler_Base; + /** a property handler for any virtual string properties + */ + class FormGeometryHandler : public FormGeometryHandler_Base + { + public: + FormGeometryHandler( + const Reference< XComponentContext >& _rxContext + ); + + static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (RuntimeException); + static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (RuntimeException); + + protected: + ~FormGeometryHandler(); + + protected: + // XPropertyHandler overriables + virtual Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException); + virtual LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); + virtual Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (RuntimeException); + virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& _rOldValue, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException); + + // OComponentHandler overridables + virtual void SAL_CALL disposing(); + + // PropertyHandler overridables + virtual Sequence< Property > SAL_CALL doDescribeSupportedProperties() const; + + protected: + virtual void onNewComponent(); + + private: + bool impl_haveTextAnchorType_nothrow() const; + bool impl_haveSheetAnchorType_nothrow() const; + void impl_setSheetAnchorType_nothrow( const sal_Int32 _nAnchorType ) const; + + private: + Reference< XControlShape > m_xAssociatedShape; + Reference< XPropertySet > m_xShapeProperties; + ::rtl::Reference< ShapeGeometryChangeNotifier > m_xChangeNotifier; + }; + + //==================================================================== + //= FormGeometryHandler - implementation + //==================================================================== + DBG_NAME( FormGeometryHandler ) + //-------------------------------------------------------------------- + FormGeometryHandler::FormGeometryHandler( const Reference< XComponentContext >& _rxContext ) + :FormGeometryHandler_Base( _rxContext ) + { + DBG_CTOR( FormGeometryHandler, NULL ); + } + + //-------------------------------------------------------------------- + FormGeometryHandler::~FormGeometryHandler( ) + { + if ( !rBHelper.bDisposed ) + { + acquire(); + dispose(); + } + + DBG_DTOR( FormGeometryHandler, NULL ); + } + + //-------------------------------------------------------------------- + void FormGeometryHandler::onNewComponent() + { + if ( m_xChangeNotifier.is() ) + { + m_xChangeNotifier->dispose(); + m_xChangeNotifier.clear(); + } + m_xAssociatedShape.clear(); + m_xShapeProperties.clear(); + + FormGeometryHandler_Base::onNewComponent(); + + try + { + Reference< XControlModel > xControlModel( m_xComponent, UNO_QUERY ); + if ( xControlModel.is() ) + { + // do not ask the map for shapes for grid control columns .... + Reference< XChild > xCompChild( m_xComponent, UNO_QUERY_THROW ); + Reference< XGridColumnFactory > xCheckGrid( xCompChild->getParent(), UNO_QUERY ); + if ( !xCheckGrid.is() ) + { + Reference< XMap > xControlMap( m_aContext.getContextValueByAsciiName( "ControlShapeAccess" ), UNO_QUERY_THROW ); + m_xAssociatedShape.set( xControlMap->get( makeAny( xControlModel ) ), UNO_QUERY_THROW ); + m_xShapeProperties.set( m_xAssociatedShape, UNO_QUERY_THROW ); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( m_xAssociatedShape.is() ) + m_xChangeNotifier = new ShapeGeometryChangeNotifier( *this, m_aMutex, m_xAssociatedShape.get() ); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL FormGeometryHandler::getImplementationName_static( ) throw (RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.FormGeometryHandler" ) ); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL FormGeometryHandler::getSupportedServiceNames_static( ) throw (RuntimeException) + { + Sequence< ::rtl::OUString > aSupported( 1 ); + aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.FormGeometryHandler" ) ); + return aSupported; + } + + //-------------------------------------------------------------------- + Any SAL_CALL FormGeometryHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); + + ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this ); + ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: no shape properties!", *this ); + + Any aReturn; + try + { + switch ( nPropId ) + { + case PROPERTY_ID_POSITIONX: + aReturn <<= m_xAssociatedShape->getPosition().X; + break; + case PROPERTY_ID_POSITIONY: + aReturn <<= m_xAssociatedShape->getPosition().Y; + break; + case PROPERTY_ID_WIDTH: + aReturn <<= m_xAssociatedShape->getSize().Width; + break; + case PROPERTY_ID_HEIGHT: + aReturn <<= m_xAssociatedShape->getSize().Height; + break; + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + aReturn = m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR_TYPE ); + OSL_ENSURE( aReturn.hasValue(), "FormGeometryHandler::getPropertyValue: illegal anchor type!" ); + break; + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + { + Reference< XSpreadsheet > xAnchorSheet( m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR ), UNO_QUERY ); + aReturn <<= sal_Int32( xAnchorSheet.is() ? ANCHOR_TO_SHEET : ANCHOR_TO_CELL ); + } + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::getPropertyValue: huh?" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return aReturn; + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); + + ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this ); + ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: properties, but no shape!", *this ); + + try + { + switch ( nPropId ) + { + case PROPERTY_ID_POSITIONX: + case PROPERTY_ID_POSITIONY: + { + sal_Int32 nPosition(0); + OSL_VERIFY( _rValue >>= nPosition ); + + AwtPoint aPos( m_xAssociatedShape->getPosition() ); + if ( nPropId == PROPERTY_ID_POSITIONX ) + aPos.X = nPosition; + else + aPos.Y = nPosition; + m_xAssociatedShape->setPosition( aPos ); + } + break; + + case PROPERTY_ID_WIDTH: + case PROPERTY_ID_HEIGHT: + { + sal_Int32 nSize(0); + OSL_VERIFY( _rValue >>= nSize ); + + AwtSize aSize( m_xAssociatedShape->getSize() ); + if ( nPropId == PROPERTY_ID_WIDTH ) + aSize.Width = nSize; + else + aSize.Height = nSize; + m_xAssociatedShape->setSize( aSize ); + } + break; + + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR_TYPE, _rValue ); + break; + + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + { + sal_Int32 nSheetAnchorType = 0; + OSL_VERIFY( _rValue >>= nSheetAnchorType ); + impl_setSheetAnchorType_nothrow( nSheetAnchorType ); + } + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::getPropertyValue: huh?" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //-------------------------------------------------------------------- + LineDescriptor SAL_CALL FormGeometryHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, + const Reference< XPropertyControlFactory >& _rxControlFactory ) + throw (UnknownPropertyException, NullPointerException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); + + LineDescriptor aLineDesc( PropertyHandler::describePropertyLine( _rPropertyName, _rxControlFactory ) ); + try + { + bool bIsSize = false; + switch ( nPropId ) + { + case PROPERTY_ID_WIDTH: + case PROPERTY_ID_HEIGHT: + bIsSize = true; + // NO break! + case PROPERTY_ID_POSITIONX: + case PROPERTY_ID_POSITIONY: + { + Optional< double > aZero( sal_True, 0 ); + Optional< double > aValueNotPresent( sal_False, 0 ); + aLineDesc.Control = PropertyHandlerHelper::createNumericControl( + _rxControlFactory, 2, bIsSize ? aZero : aValueNotPresent, aValueNotPresent, sal_False ); + + Reference< XNumericControl > xNumericControl( aLineDesc.Control, UNO_QUERY_THROW ); + xNumericControl->setValueUnit( MeasureUnit::MM_100TH ); + xNumericControl->setDisplayUnit( impl_getDocumentMeasurementUnit_throw() ); + } + break; + + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + // default handling from PropertyHandler is sufficient + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::describePropertyLine: huh?" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return aLineDesc; + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + OSL_PRECOND( m_xChangeNotifier.is(), "FormGeometryHandler::addPropertyChangeListener: no notified, implies no shape!?" ); + if ( m_xChangeNotifier.is() ) + m_xChangeNotifier->addPropertyChangeListener( _listener ); + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + OSL_PRECOND( m_xChangeNotifier.is(), "FormGeometryHandler::removePropertyChangeListener: no notified, implies no shape!?" ); + if ( m_xChangeNotifier.is() ) + m_xChangeNotifier->removePropertyChangeListener( _listener ); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL FormGeometryHandler::getActuatingProperties( ) throw (RuntimeException) + { + Sequence< ::rtl::OUString > aInterestedIn(1); + aInterestedIn[0] = PROPERTY_TEXT_ANCHOR_TYPE; + return aInterestedIn; + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) + { + if ( !_rxInspectorUI.is() ) + throw NullPointerException(); + + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); + + switch ( nActuatingPropId ) + { + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + { + TextContentAnchorType eAnchorType( TextContentAnchorType_AT_PARAGRAPH ); + OSL_VERIFY( _rNewValue >>= eAnchorType ); + _rxInspectorUI->enablePropertyUI( PROPERTY_POSITIONX, eAnchorType != TextContentAnchorType_AS_CHARACTER ); + } + break; + default: + OSL_ENSURE( false, "FormGeometryHandler::actuatingPropertyChanged: not registered for this property!" ); + break; + } + } + + //-------------------------------------------------------------------- + Sequence< Property > SAL_CALL FormGeometryHandler::doDescribeSupportedProperties() const + { + if ( !m_xAssociatedShape.is() ) + return Sequence< Property >(); + + ::std::vector< Property > aProperties; + + addInt32PropertyDescription( aProperties, PROPERTY_POSITIONX ); + addInt32PropertyDescription( aProperties, PROPERTY_POSITIONY ); + addInt32PropertyDescription( aProperties, PROPERTY_WIDTH ); + addInt32PropertyDescription( aProperties, PROPERTY_HEIGHT ); + + if ( impl_haveTextAnchorType_nothrow() ) + implAddPropertyDescription( aProperties, PROPERTY_TEXT_ANCHOR_TYPE, ::cppu::UnoType< TextContentAnchorType >::get() ); + + if ( impl_haveSheetAnchorType_nothrow() ) + addInt32PropertyDescription( aProperties, PROPERTY_SHEET_ANCHOR_TYPE ); + + return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::disposing() + { + FormGeometryHandler_Base::disposing(); + + if ( m_xChangeNotifier.is() ) + { + m_xChangeNotifier->dispose(); + m_xChangeNotifier.clear(); + } + } + + //-------------------------------------------------------------------- + bool FormGeometryHandler::impl_haveTextAnchorType_nothrow() const + { + ENSURE_OR_THROW( m_xShapeProperties.is(), "not to be called without shape properties" ); + try + { + Reference< XPropertySetInfo > xPSI( m_xShapeProperties->getPropertySetInfo(), UNO_SET_THROW ); + if ( xPSI->hasPropertyByName( PROPERTY_ANCHOR_TYPE ) ) + return true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; + } + + //-------------------------------------------------------------------- + bool FormGeometryHandler::impl_haveSheetAnchorType_nothrow() const + { + ENSURE_OR_THROW( m_xShapeProperties.is(), "not to be called without shape properties" ); + try + { + Reference< XPropertySetInfo > xPSI( m_xShapeProperties->getPropertySetInfo(), UNO_SET_THROW ); + if ( !xPSI->hasPropertyByName( PROPERTY_ANCHOR ) ) + return false; + Reference< XServiceInfo > xSI( m_xAssociatedShape, UNO_QUERY_THROW ); + if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) ) ) ) + return true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; + } + + //-------------------------------------------------------------------- + namespace + { + static sal_Int32 lcl_getLowerBoundRowOrColumn( const Reference< XIndexAccess >& _rxRowsOrColumns, const bool _bRows, + const AwtPoint& _rRelativePosition ) + { + sal_Int32 nAccumulated = 0; + + const sal_Int32& rRelativePos = _bRows ? _rRelativePosition.Y : _rRelativePosition.X; + + sal_Int32 nElements = _rxRowsOrColumns->getCount(); + sal_Int32 currentPos = 0; + for ( currentPos=0; currentPos<nElements; ++currentPos ) + { + Reference< XPropertySet > xRowOrColumn( _rxRowsOrColumns->getByIndex( currentPos ), UNO_QUERY_THROW ); + + sal_Bool bIsVisible = sal_True; + OSL_VERIFY( xRowOrColumn->getPropertyValue( PROPERTY_IS_VISIBLE ) >>= bIsVisible ); + if ( !bIsVisible ) + continue; + + sal_Int32 nHeightOrWidth( 0 ); + OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? PROPERTY_HEIGHT : PROPERTY_WIDTH ) >>= nHeightOrWidth ); + + if ( nAccumulated + nHeightOrWidth > rRelativePos ) + break; + + nAccumulated += nHeightOrWidth; + } + + return currentPos; + } + } + + //-------------------------------------------------------------------- + void FormGeometryHandler::impl_setSheetAnchorType_nothrow( const sal_Int32 _nAnchorType ) const + { + ENSURE_OR_THROW( m_xShapeProperties.is(), "illegal to be called without shape properties." ); + try + { + CellBindingHelper aHelper( m_xComponent, impl_getContextDocument_nothrow() ); + // find the sheet which the control belongs to + Reference< XSpreadsheet > xSheet; + aHelper.getControlSheetIndex( xSheet ); + + switch ( _nAnchorType ) + { + case ANCHOR_TO_SHEET: + OSL_ENSURE( xSheet.is(), + "FormGeometryHandler::impl_setSheetAnchorType_nothrow: sheet not found!" ); + if ( xSheet.is() ) + { + AwtPoint aPreservePosition( m_xAssociatedShape->getPosition() ); + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, makeAny( xSheet ) ); + m_xAssociatedShape->setPosition( aPreservePosition ); + } + break; + + case ANCHOR_TO_CELL: + { + Reference< XColumnRowRange > xColsRows( xSheet, UNO_QUERY_THROW ); + + // get the current anchor + Reference< XSpreadsheet > xCurrentAnchor; + OSL_VERIFY( m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR ) >>= xCurrentAnchor ); + OSL_ENSURE( xCurrentAnchor.is(), "FormGeometryHandler::impl_setSheetAnchorType_nothrow: only to be called when currently anchored to a sheet!" ); + + // get the current position + AwtPoint aRelativePosition( m_xAssociatedShape->getPosition() ); + + Reference< XTableColumns > xCols( xColsRows->getColumns(), UNO_SET_THROW ); + sal_Int32 nNewAnchorCol = lcl_getLowerBoundRowOrColumn( xCols.get(), false, aRelativePosition ); + + Reference< XTableRows > xRows( xColsRows->getRows(), UNO_SET_THROW ); + sal_Int32 nNewAnchorRow = lcl_getLowerBoundRowOrColumn( xRows.get(), true, aRelativePosition ); + + Reference< XCellRange > xSheetCellRange( xSheet, UNO_QUERY_THROW ); + Any aNewAnchorCell( xSheetCellRange->getCellByPosition( nNewAnchorCol, nNewAnchorRow ) ); + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, aNewAnchorCell ); + } + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::impl_setSheetAnchorType_nothrow: illegal anchor type!" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //==================================================================== + //= ShapeGeometryChangeNotifier - implementation + //==================================================================== + namespace + { + struct EventTranslation + { + ::rtl::OUString sPropertyName; + Any aNewPropertyValue; + + EventTranslation( const ::rtl::OUString& _propertyName, const Any& _newPropertyValue ) + :sPropertyName( _propertyName ) + ,aNewPropertyValue( _newPropertyValue ) + { + } + }; + } + + //-------------------------------------------------------------------- + void SAL_CALL ShapeGeometryChangeNotifier::propertyChange( const PropertyChangeEvent& _event ) throw (RuntimeException) + { + ::comphelper::ComponentMethodGuard aGuard( *this ); + + ::std::vector< EventTranslation > aEventTranslations; + aEventTranslations.reserve(2); + + if ( _event.PropertyName.equalsAscii( "Position" ) ) + { + AwtPoint aPos = m_xShape->getPosition(); + aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONX, makeAny( aPos.X ) ) ); + aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONY, makeAny( aPos.Y ) ) ); + } + else if ( _event.PropertyName.equalsAscii( "Size" ) ) + { + AwtSize aSize = m_xShape->getSize(); + aEventTranslations.push_back( EventTranslation( PROPERTY_WIDTH, makeAny( aSize.Width ) ) ); + aEventTranslations.push_back( EventTranslation( PROPERTY_HEIGHT, makeAny( aSize.Height ) ) ); + } + else if ( _event.PropertyName == PROPERTY_ANCHOR_TYPE ) + { + aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); + } + else if ( _event.PropertyName == PROPERTY_ANCHOR ) + { + aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); + } + + PropertyChangeEvent aTranslatedEvent( _event ); + aTranslatedEvent.Source = m_rParent; + + aGuard.clear(); + for ( ::std::vector< EventTranslation >::const_iterator t = aEventTranslations.begin(); + t != aEventTranslations.end(); + ++t + ) + { + aTranslatedEvent.PropertyName = t->sPropertyName; + aTranslatedEvent.NewValue = t->aNewPropertyValue; + m_aPropertyChangeListeners.notifyEach( &XPropertyChangeListener::propertyChange, aTranslatedEvent ); + } + } + + //-------------------------------------------------------------------- + void SAL_CALL ShapeGeometryChangeNotifier::disposing( const EventObject& /*_event*/ ) throw (RuntimeException) + { + ::comphelper::ComponentMethodGuard aGuard( *this ); + impl_dispose_nothrow(); + } + + //-------------------------------------------------------------------- + void ShapeGeometryChangeNotifier::impl_init_nothrow() + { + osl_incrementInterlockedCount( &m_refCount ); + try + { + Reference< XPropertySet > xShapeProperties( m_xShape, UNO_QUERY_THROW ); + xShapeProperties->addPropertyChangeListener( ::rtl::OUString(), this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + osl_decrementInterlockedCount( &m_refCount ); + } + + //-------------------------------------------------------------------- + void ShapeGeometryChangeNotifier::impl_dispose_nothrow() + { + try + { + Reference< XPropertySet > xShapeProperties( m_xShape, UNO_QUERY_THROW ); + xShapeProperties->removePropertyChangeListener( ::rtl::OUString(), this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + getBroadcastHelper().bDisposed = true; + } + +//........................................................................ +} // namespace pcr +//........................................................................ + +extern "C" void SAL_CALL createRegistryInfo_FormGeometryHandler() +{ + ::pcr::FormGeometryHandler::registerImplementation(); +} diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 70ae992e7044..ccfc3f746ef7 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -284,21 +284,23 @@ namespace pcr DEF_INFO_3( SPIN, SPIN, SPIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( REPEAT, REPEAT, REPEAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( REPEAT_DELAY, REPEAT_DELAY, REPEAT_DELAY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( VISIBLESIZE, VISIBLESIZE, VISIBLESIZE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_4( ORIENTATION, ORIENTATION, ORIENTATION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), + DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( DEFAULT_STATE, DEFAULT_STATE, DEFAULT_STATE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( CLASSID, CLASSID, CLASSID, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( TEXT_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), + DEF_INFO_3( SHEET_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( POSITIONX, POSITIONX, POSITIONX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( POSITIONY, POSITIONY, POSITIONY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_1( LISTINDEX, LISTINDEX, LISTINDEX, FORM_VISIBLE ), DEF_INFO_3( STRINGITEMLIST, STRINGITEMLIST, STRINGITEMLIST, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_2( DEFAULT_TEXT, DEFAULTTEXT, DEFAULTVALUE, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FONT_NAME, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( FONT, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_4( VISUALEFFECT, VISUALEFFECT, VISUALEFFECT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM_ONE, COMPOSEABLE ), DEF_INFO_4( ALIGN, ALIGN, ALIGN, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( VERTICAL_ALIGN, VERTICAL_ALIGN, VERTICAL_ALIGN, FORM_VISIBLE, ENUM, COMPOSEABLE ), @@ -337,7 +339,6 @@ namespace pcr DEF_INFO_3( SUBMIT_ENCODING, SUBMIT_ENCODING, SUBMIT_ENCODING, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( SUBMIT_METHOD, SUBMIT_METHOD, SUBMIT_METHOD, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( STATE, STATE, STATE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( DEFAULTCHECKED, DEFAULT_CHECKED, DEFAULT_CHECKED, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( DEFAULTBUTTON, DEFAULT_BUTTON, DEFAULT_BUTTON, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( IMAGE_URL, IMAGE_URL, IMAGE_URL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_4( IMAGEPOSITION, IMAGEPOSITION, IMAGEPOSITION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), @@ -469,7 +470,7 @@ namespace pcr case PROPERTY_ID_TIMEFORMAT: nStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST; break; - case PROPERTY_ID_DEFAULTCHECKED: + case PROPERTY_ID_DEFAULT_STATE: case PROPERTY_ID_STATE: nStringItemsResId = RID_RSC_ENUM_CHECKED; break; @@ -512,6 +513,12 @@ namespace pcr case PROPERTY_ID_WRITING_MODE: nStringItemsResId = RID_RSC_ENUM_WRITING_MODE; break; + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + nStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE; + break; + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + nStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE; + break; default: OSL_ENSURE( sal_False, "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" ); break; diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx index b1b23153dbdb..b49fae5cf3d8 100644 --- a/extensions/source/propctrlr/formmetadata.hxx +++ b/extensions/source/propctrlr/formmetadata.hxx @@ -200,7 +200,7 @@ namespace pcr #define PROPERTY_ID_LISTINDEX 56 #define PROPERTY_ID_STRINGITEMLIST 57 #define PROPERTY_ID_DEFAULT_TEXT 58 - #define PROPERTY_ID_FONT_NAME 59 + #define PROPERTY_ID_FONT 59 #define PROPERTY_ID_ALIGN 60 #define PROPERTY_ID_ROWHEIGHT 61 #define PROPERTY_ID_BACKGROUNDCOLOR 62 @@ -225,7 +225,7 @@ namespace pcr #define PROPERTY_ID_SUBMIT_TARGET 81 #define PROPERTY_ID_SUBMIT_METHOD 82 #define PROPERTY_ID_SUBMIT_ENCODING 83 - #define PROPERTY_ID_DEFAULTCHECKED 84 + #define PROPERTY_ID_DEFAULT_STATE 84 #define PROPERTY_ID_DEFAULTBUTTON 85 #define PROPERTY_ID_IMAGE_URL 86 #define PROPERTY_ID_DEFAULT_SELECT_SEQ 87 @@ -340,6 +340,8 @@ namespace pcr #define PROPERTY_ID_SCALE_MODE 196 #define PROPERTY_ID_INPUT_REQUIRED 197 #define PROPERTY_ID_WRITING_MODE 198 + #define PROPERTY_ID_TEXT_ANCHOR_TYPE 199 + #define PROPERTY_ID_SHEET_ANCHOR_TYPE 200 //............................................................................ } // namespace pcr diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src index 084825dfd05c..224587b11729 100644 --- a/extensions/source/propctrlr/formres.src +++ b/extensions/source/propctrlr/formres.src @@ -426,7 +426,7 @@ String RID_STR_SUBMIT_METHOD { Text [ en-US ] = "Type of submission" ; }; -String RID_STR_DEFAULT_CHECKED +String RID_STR_DEFAULT_STATE { Text [ en-US ] = "Default status" ; }; @@ -1430,3 +1430,73 @@ Resource RID_RSC_ENUM_WRITING_MODE Text [ en-US ] = "Use superordinate object settings"; }; }; + +String RID_STR_ANCHOR_TYPE +{ + Text [ en-US ] = "Anchor"; +}; + +Resource RID_RSC_ENUM_TEXT_ANCHOR_TYPE +{ + String 1 + { + Text [ en-US ] = "To Paragraph"; + }; + String 2 + { + Text [ en-US ] = "As Character"; + }; + String 3 + { + Text [ en-US ] = "To Page"; + }; + String 4 + { + Text [ en-US ] = "To Frame"; + }; + String 5 + { + Text [ en-US ] = "To Character"; + }; +}; + +Resource RID_RSC_ENUM_SHEET_ANCHOR_TYPE +{ + String 1 + { + Text [ en-US ] = "To Page"; + }; + String 2 + { + Text [ en-US ] = "To Cell"; + }; +}; + +String RID_STR_FONTSTYLE_REGULAR +{ + Text [ en-US ] = "Regular"; + Text [ x-comment ] = "That's the 'Regular' as used for a font style (as opposed to 'italic' and 'bold'), so please use a consistent translation."; +}; + +String RID_STR_FONTSTYLE_BOLD_ITALIC +{ + Text [ en-US ] = "Bold Italic"; + Text [ x-comment ] = "That's the 'Bold Italic' as used for a font style, so please use a consistent translation."; +}; + +String RID_STR_FONTSTYLE_ITALIC +{ + Text [ en-US ] = "Italic"; + Text [ x-comment ] = "That's the 'Italic' as used for a font style, so please use a consistent translation."; +}; + +String RID_STR_FONTSTYLE_BOLD +{ + Text [ en-US ] = "Bold"; + Text [ x-comment ] = "That's the 'Bold' as used for a font style, so please use a consistent translation."; +}; + +String RID_STR_FONT_DEFAULT +{ + Text [ en-US ] = "(Default)"; +}; diff --git a/extensions/source/propctrlr/formresid.hrc b/extensions/source/propctrlr/formresid.hrc index cfd9e7aaebfe..ad10cfd379e2 100644 --- a/extensions/source/propctrlr/formresid.hrc +++ b/extensions/source/propctrlr/formresid.hrc @@ -132,7 +132,7 @@ #define RID_STR_SUBMIT_TARGET ( RID_FORMBROWSER_START + 101 ) #define RID_STR_SUBMIT_METHOD ( RID_FORMBROWSER_START + 102 ) #define RID_STR_SUBMIT_ENCODING ( RID_FORMBROWSER_START + 103 ) -#define RID_STR_DEFAULT_CHECKED ( RID_FORMBROWSER_START + 104 ) +#define RID_STR_DEFAULT_STATE ( RID_FORMBROWSER_START + 104 ) #define RID_STR_DEFAULT_BUTTON ( RID_FORMBROWSER_START + 105 ) #define RID_STR_IMAGE_URL ( RID_FORMBROWSER_START + 106 ) #define RID_STR_DEFAULT_SELECT_SEQ ( RID_FORMBROWSER_START + 107 ) @@ -222,7 +222,7 @@ #define RID_STR_BOUND_CELL ( RID_FORMBROWSER_START + 191 ) #define RID_STR_LIST_CELL_RANGE ( RID_FORMBROWSER_START + 192 ) #define RID_STR_CELL_EXCHANGE_TYPE ( RID_FORMBROWSER_START + 193 ) - // FREE +#define RID_STR_ANCHOR_TYPE ( RID_FORMBROWSER_START + 194 ) #define RID_STR_SCROLLVALUE_MIN ( RID_FORMBROWSER_START + 195 ) #define RID_STR_DEFAULT_SCROLLVALUE ( RID_FORMBROWSER_START + 196 ) #define RID_STR_REPEAT_DELAY ( RID_FORMBROWSER_START + 197 ) @@ -279,7 +279,12 @@ #define RID_STR_SHOWS_ROOT_HANDLES ( RID_FORMBROWSER_START + 247 ) #define RID_STR_EDITABLE ( RID_FORMBROWSER_START + 248 ) #define RID_STR_INVOKES_STOP_NOT_EDITING ( RID_FORMBROWSER_START + 249 ) -#define RID_STR_NOLABEL ( RID_FORMBROWSER_START + 250 ) +#define RID_STR_NOLABEL ( RID_FORMBROWSER_START + 250 ) +#define RID_STR_FONTSTYLE_REGULAR ( RID_FORMBROWSER_START + 251 ) +#define RID_STR_FONTSTYLE_BOLD_ITALIC ( RID_FORMBROWSER_START + 252 ) +#define RID_STR_FONTSTYLE_ITALIC ( RID_FORMBROWSER_START + 253 ) +#define RID_STR_FONTSTYLE_BOLD ( RID_FORMBROWSER_START + 254 ) +#define RID_STR_FONT_DEFAULT ( RID_FORMBROWSER_START + 255 ) // ----------------------------------------------------------------------- @@ -340,6 +345,8 @@ #define RID_RSC_ENUM_YESNO ( RID_PROPCONTROLLER_START + 27 ) #define RID_RSC_ENUM_SHOWHIDE ( RID_PROPCONTROLLER_START + 28 ) #define RID_RSC_ENUM_WRITING_MODE ( RID_PROPCONTROLLER_START + 29 ) +#define RID_RSC_ENUM_TEXT_ANCHOR_TYPE ( RID_PROPCONTROLLER_START + 30 ) +#define RID_RSC_ENUM_SHEET_ANCHOR_TYPE ( RID_PROPCONTROLLER_START + 31 ) // ----------------------------------------------------------------------- // - ImageList - local ids diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index 0d77b45bb6cf..cc6bc9db824b 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -74,7 +74,7 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_XFORMS_BUTTONTYPE, "XFormsButtonType"); PCR_CONSTASCII_STRING( PROPERTY_STRINGITEMLIST, "StringItemList"); PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULTCHECKED, "DefaultState"); + PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState"); PCR_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey"); PCR_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier"); PCR_CONSTASCII_STRING( PROPERTY_SUBMIT_ACTION, "SubmitAction"); @@ -130,6 +130,7 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_ECHO_CHAR, "EchoChar"); PCR_CONSTASCII_STRING( PROPERTY_ROWHEIGHT, "RowHeight"); PCR_CONSTASCII_STRING( PROPERTY_HELPTEXT, "HelpText"); + PCR_CONSTASCII_STRING( PROPERTY_FONT, "FontDescriptor"); PCR_CONSTASCII_STRING( PROPERTY_FONT_NAME, "FontName"); PCR_CONSTASCII_STRING( PROPERTY_FONT_STYLENAME, "FontStyleName"); PCR_CONSTASCII_STRING( PROPERTY_FONT_FAMILY, "FontFamily"); @@ -263,6 +264,11 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_BINDING_ID, "BindingID" ); PCR_CONSTASCII_STRING( PROPERTY_ID, "ID" ); PCR_CONSTASCII_STRING( PROPERTY_WRITING_MODE, "WritingMode" ); + PCR_CONSTASCII_STRING( PROPERTY_TEXT_ANCHOR_TYPE, "TextAnchorType" ); + PCR_CONSTASCII_STRING( PROPERTY_SHEET_ANCHOR_TYPE, "SheetAnchorType" ); + PCR_CONSTASCII_STRING( PROPERTY_ANCHOR_TYPE, "AnchorType" ); + PCR_CONSTASCII_STRING( PROPERTY_ANCHOR, "Anchor" ); + PCR_CONSTASCII_STRING( PROPERTY_IS_VISIBLE, "IsVisible" ); PCR_CONSTASCII_STRING( PROPERTY_MODEL, "Model" ); diff --git a/extensions/source/propctrlr/makefile.mk b/extensions/source/propctrlr/makefile.mk index 47e0c995a49b..c043850e3c73 100644 --- a/extensions/source/propctrlr/makefile.mk +++ b/extensions/source/propctrlr/makefile.mk @@ -98,7 +98,8 @@ SLOFILES= $(SLO)$/controlfontdialog.obj \ $(SLO)$/defaulthelpprovider.obj \ $(SLO)$/MasterDetailLinkDialog.obj \ $(SLO)$/inspectormodelbase.obj \ - $(SLO)$/propertycontrolextender.obj + $(SLO)$/propertycontrolextender.obj \ + $(SLO)$/formgeometryhandler.obj SRS1NAME=$(TARGET) SRC1FILES= propres.src \ diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx index 0673c9ff5f3c..b4c87ab58ef2 100644 --- a/extensions/source/propctrlr/pcrservices.cxx +++ b/extensions/source/propctrlr/pcrservices.cxx @@ -62,6 +62,7 @@ extern "C" void SAL_CALL createRegistryInfo_ObjectInspectorModel(); extern "C" void SAL_CALL createRegistryInfo_SubmissionPropertyHandler(); extern "C" void SAL_CALL createRegistryInfo_StringRepresentation(); extern "C" void SAL_CALL createRegistryInfo_MasterDetailLinkDialog(); +extern "C" void SAL_CALL createRegistryInfo_FormGeometryHandler(); //--------------------------------------------------------------------------------------- @@ -88,6 +89,7 @@ extern "C" void SAL_CALL pcr_initializeModule() createRegistryInfo_SubmissionPropertyHandler(); createRegistryInfo_StringRepresentation(); createRegistryInfo_MasterDetailLinkDialog(); + createRegistryInfo_FormGeometryHandler(); s_bInit = sal_True; } } diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 1789ff0e9c00..c4dff2512a29 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -755,23 +755,32 @@ namespace pcr return; } - if ( m_sCommittingProperty != _rEvent.PropertyName ) + if ( m_sCommittingProperty == _rEvent.PropertyName ) + return; + + if ( !haveView() ) + return; + + Any aNewValue( _rEvent.NewValue ); + if ( impl_hasPropertyHandlerFor_nothrow( _rEvent.PropertyName ) ) { - Any aNewValue( _rEvent.NewValue ); - if ( impl_hasPropertyHandlerFor_nothrow( _rEvent.PropertyName ) ) - { - aNewValue = impl_getPropertyValue_throw( _rEvent.PropertyName ); + // forward the new value to the property box, to reflect the change in the UI + aNewValue = impl_getPropertyValue_throw( _rEvent.PropertyName ); - if ( haveView() ) - // forward the new value to the property box, to reflect the change in the UI - getPropertyBox().SetPropertyValue( _rEvent.PropertyName, aNewValue ); - } + // check whether the state is ambiguous. This is interesting in case we display the properties + // for multiple objects at once: In this case, we'll get a notification from one of the objects, + // but need to care for the "composed" value, which can be "ambiguous". + PropertyHandlerRef xHandler( impl_getHandlerForProperty_throw( _rEvent.PropertyName ), UNO_SET_THROW ); + PropertyState ePropertyState( xHandler->getPropertyState( _rEvent.PropertyName ) ); + bool bAmbiguousValue = ( PropertyState_AMBIGUOUS_VALUE == ePropertyState ); - // if it's a actuating property, then update the UI for any dependent - // properties - if ( impl_isActuatingProperty_nothrow( _rEvent.PropertyName ) ) - impl_broadcastPropertyChange_nothrow( _rEvent.PropertyName, aNewValue, _rEvent.OldValue, false ); + getPropertyBox().SetPropertyValue( _rEvent.PropertyName, aNewValue, bAmbiguousValue ); } + + // if it's a actuating property, then update the UI for any dependent + // properties + if ( impl_isActuatingProperty_nothrow( _rEvent.PropertyName ) ) + impl_broadcastPropertyChange_nothrow( _rEvent.PropertyName, aNewValue, _rEvent.OldValue, false ); } //------------------------------------------------------------------------ @@ -1423,14 +1432,14 @@ namespace pcr impl_broadcastPropertyChange_nothrow( rName, aNormalizedValue, aOldValue, false ); // and display it again. This ensures proper formatting - getPropertyBox().SetPropertyValue( rName, aNormalizedValue ); + getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); } catch(PropertyVetoException& eVetoException) { InfoBox(m_pView, eVetoException.Message).Execute(); PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName ); Any aNormalizedValue = handler->getPropertyValue( rName ); - getPropertyBox().SetPropertyValue( rName, aNormalizedValue ); + getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); } catch(Exception&) { diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx index d2ccc1ee83d5..f076da707800 100644 --- a/extensions/source/propctrlr/propertyeditor.cxx +++ b/extensions/source/propctrlr/propertyeditor.cxx @@ -437,11 +437,11 @@ namespace pcr } //------------------------------------------------------------------ - void OPropertyEditor::SetPropertyValue( const ::rtl::OUString& rEntryName, const Any& _rValue ) + void OPropertyEditor::SetPropertyValue( const ::rtl::OUString& rEntryName, const Any& _rValue, bool _bUnknownValue ) { OBrowserPage* pPage = getPage( rEntryName ); if ( pPage ) - pPage->getListBox().SetPropertyValue( rEntryName, _rValue ); + pPage->getListBox().SetPropertyValue( rEntryName, _rValue, _bUnknownValue ); } //------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx index e2715e2fd425..5881b579c3e0 100644 --- a/extensions/source/propctrlr/propertyeditor.hxx +++ b/extensions/source/propctrlr/propertyeditor.hxx @@ -107,7 +107,7 @@ namespace pcr sal_uInt16 GetCurPage(); void ClearAll(); - void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue ); + void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue ); ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const; sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const; ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index 5b3eb4919764..8d730d3e8c9c 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -34,13 +34,19 @@ #include "formmetadata.hxx" #include "formbrowsertools.hxx" #include "handlerhelper.hxx" +#include "formstrings.hxx" /** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/NullPointerException.hpp> #include <com/sun/star/util/XModifiable.hpp> /** === end UNO includes === **/ + #include <tools/debug.hxx> +#include <unotools/confignode.hxx> +#include <unotools/localedatawrapper.hxx> +#include <svtools/syslocale.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <algorithm> @@ -374,6 +380,67 @@ namespace pcr return m_xComponentPropertyInfo.is() && m_xComponentPropertyInfo->hasPropertyByName( _rPropName ); } + //-------------------------------------------------------------------- + sal_Int16 PropertyHandler::impl_getDocumentMeasurementUnit_throw() const + { + FieldUnit eUnit = FUNIT_NONE; + + Reference< XServiceInfo > xDocumentSI( impl_getContextDocument_nothrow(), UNO_QUERY ); + OSL_ENSURE( xDocumentSI.is(), "PropertyHandlerHelper::impl_getDocumentMeasurementUnit_throw: No context document - where do I live?" ); + if ( xDocumentSI.is() ) + { + // determine the application type we live in + ::rtl::OUString sConfigurationLocation; + ::rtl::OUString sConfigurationProperty; + if ( xDocumentSI->supportsService( SERVICE_WEB_DOCUMENT ) ) + { // writer + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.WriterWeb/Layout/Other" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_TEXT_DOCUMENT ) ) + { // writer + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Writer/Layout/Other" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) ) + { // calc + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Calc/Layout/Other/MeasureUnit" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_DRAWING_DOCUMENT ) ) + { + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Draw/Layout/Other/MeasureUnit" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_PRESENTATION_DOCUMENT ) ) + { + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Impress/Layout/Other/MeasureUnit" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + + // read the measurement unit from the configuration + if ( sConfigurationLocation.getLength() && sConfigurationProperty.getLength() ) + { + ::utl::OConfigurationTreeRoot aConfigTree( ::utl::OConfigurationTreeRoot::createWithServiceFactory( + m_aContext.getLegacyServiceFactory(), sConfigurationLocation, -1, ::utl::OConfigurationTreeRoot::CM_READONLY ) ); + sal_Int32 nUnitAsInt = (sal_Int32)FUNIT_NONE; + aConfigTree.getNodeValue( sConfigurationProperty ) >>= nUnitAsInt; + + // if this denotes a valid (and accepted) unit, then use it + if ( ( nUnitAsInt > FUNIT_NONE ) && ( nUnitAsInt <= FUNIT_100TH_MM ) ) + eUnit = static_cast< FieldUnit >( nUnitAsInt ); + } + } + + if ( FUNIT_NONE == eUnit ) + { + MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); + eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; + } + + return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 ); + } + //==================================================================== //= PropertyHandlerComponent //==================================================================== diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx index d44252cca0e7..4f1aa8f3e82f 100644 --- a/extensions/source/propctrlr/propertyhandler.hxx +++ b/extensions/source/propctrlr/propertyhandler.hxx @@ -298,6 +298,10 @@ namespace pcr /// determines whether our component has a given property bool impl_componentHasProperty_throw( const ::rtl::OUString& _rPropName ) const; + /** determines the default measure unit for the document in which our component lives + */ + sal_Int16 impl_getDocumentMeasurementUnit_throw() const; + private: PropertyHandler(); // never implemented PropertyHandler( const PropertyHandler& ); // never implemented diff --git a/extensions/util/hidother.src b/extensions/util/hidother.src index 0b82734c645d..5c14a2e8d08e 100644 --- a/extensions/util/hidother.src +++ b/extensions/util/hidother.src @@ -308,3 +308,4 @@ hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CAN hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; } hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; } hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; } +hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; } diff --git a/forms/qa/integration/forms/ShowTargets.java b/forms/qa/integration/forms/ShowTargets.java deleted file mode 100644 index 3c747adfb2bc..000000000000 --- a/forms/qa/integration/forms/ShowTargets.java +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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: ShowTargets.java,v $ - * $Revision: 1.4 $ - * - * 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 integration.forms; - -/** - * - * @author fs93730 - */ -public class ShowTargets -{ - /** Creates a new instance of ShowTargets */ - public ShowTargets() - { - } - - public static void main( String[] args ) - { - System.out.println( "possible targets (* denotes a test case which requires user interaction):" ); - System.out.println( " run" ); - - for ( int i = 0; i < args.length; ++i ) - { - // filter - if ( args[i].equals( "TestCase" ) ) - continue; - if ( args[i].equals( "TestSkeleton" ) ) - continue; - - String completePotentialClassName = args[i].replace( '/', '.' ); - - // get the class - Class potentialTestClass = null; - try { potentialTestClass = Class.forName( completePotentialClassName ); } - catch( java.lang.ClassNotFoundException e ) - { - continue; - } - - // see if it is derived from complexlib.ComplexTestCase - Class superClass = potentialTestClass.getSuperclass(); - while ( superClass != null ) - { - if ( superClass.getName().equals( "complexlib.ComplexTestCase" ) ) - { - if ( isInteractiveTest( potentialTestClass ) ) - System.out.print( "* " ); - else - System.out.print( " " ); - System.out.println( "run_" + args[i] ); - } - superClass = superClass.getSuperclass(); - } - } - } - - /** determines if the test denoted by a given Class is an interactive test - */ - static private boolean isInteractiveTest( Class testClass ) - { - java.lang.reflect.Method interactiveTestMethod = null; - try { interactiveTestMethod = testClass.getMethod( "isInteractiveTest", new Class[]{} ); } - catch( Exception e ) { } - - if ( interactiveTestMethod != null ) - { - try - { - Boolean result = (Boolean)interactiveTestMethod.invoke( null, new Object[]{} ); - return result.booleanValue(); - } - catch( Exception e ) { } - } - return false; - } -} diff --git a/forms/qa/makefile.mk b/forms/qa/makefile.mk index 7be518dc063b..822f67e1bb46 100644 --- a/forms/qa/makefile.mk +++ b/forms/qa/makefile.mk @@ -56,7 +56,7 @@ JARCOMPRESS = TRUE # --- Runner Settings ---------------------------------------------- # classpath and argument list -RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar +RUNNER_CLASSPATH = -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar" RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex .END @@ -75,7 +75,7 @@ ALL: ALLDEP .IF "$(BUILD_QADEVOOO)" == "YES" show_targets: - +@java $(RUNNER_CLASSPATH) integration.forms.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//)) + +@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//)) run: +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce forms_all.sce diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 38b1a0376a76..8907dcd82712 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -30,14 +30,18 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" + #include "Button.hxx" + +#include <com/sun/star/awt/XVclWindowPeer.hpp> + +#include <comphelper/streamsection.hxx> +#include <comphelper/basicio.hxx> +#include <tools/diagnose_ex.h> #include <tools/debug.hxx> #include <tools/urlobj.hxx> -#include <vos/mutex.hxx> #include <vcl/svapp.hxx> -#include <comphelper/streamsection.hxx> -#include <comphelper/basicio.hxx> -#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <vos/mutex.hxx> //......................................................................... namespace frm @@ -71,16 +75,40 @@ InterfaceRef SAL_CALL OButtonModel_CreateInstance(const Reference<XMultiServiceF OButtonModel::OButtonModel(const Reference<XMultiServiceFactory>& _rxFactory) :OClickableImageBaseModel( _rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON ) // use the old control name for compatibility reasons + ,m_aResetHelper( *this, m_aMutex ) + ,m_eDefaultState( STATE_NOCHECK ) { DBG_CTOR( OButtonModel, NULL ); m_nClassId = FormComponentType::COMMANDBUTTON; } //------------------------------------------------------------------ +Any SAL_CALL OButtonModel::queryAggregation( const Type& _type ) throw(RuntimeException) +{ + Any aReturn = OClickableImageBaseModel::queryAggregation( _type ); + if ( !aReturn.hasValue() ) + aReturn = OButtonModel_Base::queryInterface( _type ); + return aReturn; +} + +//------------------------------------------------------------------ +Sequence< Type > OButtonModel::_getTypes() +{ + return ::comphelper::concatSequences( + OClickableImageBaseModel::_getTypes(), + OButtonModel_Base::getTypes() + ); +} + +//------------------------------------------------------------------ OButtonModel::OButtonModel( const OButtonModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) :OClickableImageBaseModel( _pOriginal, _rxFactory ) + ,m_aResetHelper( *this, m_aMutex ) + ,m_eDefaultState( _pOriginal->m_eDefaultState ) { DBG_CTOR( OButtonModel, NULL ); + m_nClassId = FormComponentType::COMMANDBUTTON; + implInitializeImageURL(); } @@ -93,12 +121,13 @@ OButtonModel::~OButtonModel() //------------------------------------------------------------------------------ void OButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const { - BEGIN_DESCRIBE_PROPERTIES( 5, OClickableImageBaseModel ) - DECL_PROP1(BUTTONTYPE, FormButtonType, BOUND); - DECL_PROP1(DISPATCHURLINTERNAL, sal_Bool, BOUND); - DECL_PROP1(TARGET_URL, ::rtl::OUString, BOUND); - DECL_PROP1(TARGET_FRAME, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); + BEGIN_DESCRIBE_PROPERTIES( 6, OClickableImageBaseModel ) + DECL_PROP1( BUTTONTYPE, FormButtonType, BOUND ); + DECL_PROP1( DEFAULT_STATE, sal_Int16, BOUND ); + DECL_PROP1( DISPATCHURLINTERNAL, sal_Bool, BOUND ); + DECL_PROP1( TARGET_URL, ::rtl::OUString, BOUND ); + DECL_PROP1( TARGET_FRAME, ::rtl::OUString, BOUND ); + DECL_PROP1( TABINDEX, sal_Int16, BOUND ); END_DESCRIBE_PROPERTIES(); } @@ -205,6 +234,118 @@ void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream) throw } } +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::disposing() +{ + m_aResetHelper.disposing(); + OClickableImageBaseModel::disposing(); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::reset() throw (RuntimeException) +{ + if ( !m_aResetHelper.approveReset() ) + return; + + impl_resetNoBroadcast_nothrow(); + + m_aResetHelper.notifyResetted(); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::addResetListener( const Reference< XResetListener >& _listener ) throw (RuntimeException) +{ + m_aResetHelper.addResetListener( _listener ); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::removeResetListener( const Reference< XResetListener >& _listener ) throw (RuntimeException) +{ + m_aResetHelper.removeResetListener( _listener ); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const +{ + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + _rValue <<= (sal_Int16)m_eDefaultState; + break; + + default: + OClickableImageBaseModel::getFastPropertyValue( _rValue, _nHandle ); + break; + } +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw (Exception) +{ + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + { + sal_Int16 nDefaultState( (sal_Int16)STATE_NOCHECK ); + OSL_VERIFY( _rValue >>= nDefaultState ); + m_eDefaultState = (ToggleState)nDefaultState; + impl_resetNoBroadcast_nothrow(); + } + break; + + default: + OClickableImageBaseModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); + break; + } +} + +//-------------------------------------------------------------------- +sal_Bool SAL_CALL OButtonModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) throw (IllegalArgumentException) +{ + sal_Bool bModified = sal_False; + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultState ); + break; + + default: + bModified = OClickableImageBaseModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue ); + break; + } + return bModified; +} + +//-------------------------------------------------------------------- +Any OButtonModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const +{ + Any aDefault; + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + aDefault <<= (sal_Int16)STATE_NOCHECK; + break; + + default: + aDefault = OClickableImageBaseModel::getPropertyDefaultByHandle( _nHandle ); + break; + } + return aDefault; +} + +//-------------------------------------------------------------------- +void OButtonModel::impl_resetNoBroadcast_nothrow() +{ + try + { + setPropertyValue( PROPERTY_STATE, getPropertyValue( PROPERTY_DEFAULT_STATE ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + //================================================================== // OButtonControl //================================================================== diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx index 038f5b1e8aec..5bbb7f387f85 100644 --- a/forms/source/component/Button.hxx +++ b/forms/source/component/Button.hxx @@ -32,13 +32,19 @@ #define _FRM_BUTTON_HXX_ #include "clickableimage.hxx" +#include "togglestate.hxx" +#include "formnavigation.hxx" +#include "resettable.hxx" + #include <com/sun/star/awt/MouseEvent.hpp> #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/awt/ActionEvent.hpp> #include <com/sun/star/awt/XActionListener.hpp> #include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/form/XReset.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> -#include "formnavigation.hxx" + +#include <cppuhelper/implbase1.hxx> //......................................................................... namespace frm @@ -48,12 +54,20 @@ namespace frm //================================================================== // OButtonModel //================================================================== -class OButtonModel - :public OClickableImageBaseModel +typedef ::cppu::ImplHelper1 < ::com::sun::star::form::XReset + > OButtonModel_Base; +class OButtonModel :public OClickableImageBaseModel + ,public OButtonModel_Base { public: DECLARE_DEFAULT_LEAF_XTOR( OButtonModel ); + // UNO + DECLARE_UNO3_AGG_DEFAULTS( OButtonModel, OClickableImageBaseModel ); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + // ::com::sun::star::lang::XServiceInfo IMPLEMENTATION_NAME(OButtonModel); virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); @@ -63,13 +77,44 @@ public: virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + // XReset + virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + // OControlModel's property handling virtual void describeFixedProperties( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps ) const; + // XPropertySet and friends + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::uno::Exception); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; + + // OComponentHelper + virtual void SAL_CALL disposing(); + protected: DECLARE_XCLONEABLE(); + +private: + void impl_resetNoBroadcast_nothrow(); + + using ::cppu::OPropertySetHelper::getFastPropertyValue; + +private: + ResetHelper m_aResetHelper; + + // <properties> + ToggleState m_eDefaultState; // the default check state + // </properties> +protected: + using OClickableImageBaseModel::disposing; }; //================================================================== diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx index a8086d39b597..8e66ebc60ab6 100644 --- a/forms/source/component/CheckBox.cxx +++ b/forms/source/component/CheckBox.cxx @@ -209,7 +209,7 @@ void SAL_CALL OCheckBoxModel::read(const Reference<stario::XObjectInputStream>& break; } setReferenceValue( sReferenceValue ); - setDefaultChecked( static_cast< CheckState >( nDefaultChecked ) ); + setDefaultChecked( static_cast< ToggleState >( nDefaultChecked ) ); // Nach dem Lesen die Defaultwerte anzeigen if ( getControlSource().getLength() ) diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 21e3be3c4820..142f0f249b36 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -65,6 +65,7 @@ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/util/XCancellable.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/XModifiable2.hpp> #include <comphelper/basicio.hxx>
#include <comphelper/container.hxx>
@@ -143,6 +144,41 @@ namespace frm //......................................................................... //================================================================== +//= DocumentModifyGuard +//================================================================== +class DocumentModifyGuard +{ +public: + DocumentModifyGuard( const Reference< XInterface >& _rxFormComponent ) + :m_xDocumentModify( getXModel( _rxFormComponent ), UNO_QUERY ) + { + OSL_ENSURE( m_xDocumentModify.is(), "DocumentModifyGuard::DocumentModifyGuard: no document, or no XModifiable2!" ); + impl_changeModifiableFlag_nothrow( false ); + } + ~DocumentModifyGuard() + { + impl_changeModifiableFlag_nothrow( true ); + } + +private: + void impl_changeModifiableFlag_nothrow( const bool _enable ) + { + try + { + if ( m_xDocumentModify.is() ) + _enable ? m_xDocumentModify->enableSetModified() : m_xDocumentModify->disableSetModified(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + +private: + Reference< XModifiable2 > m_xDocumentModify; +}; + +//================================================================== //= OFormSubmitResetThread //=----------------------------------------------------------------- //= submitting and resetting html-forms asynchronously @@ -2941,6 +2977,10 @@ void ODatabaseForm::reload_impl(sal_Bool bMoveToFirst, const Reference< XInterac if (!isLoaded()) return; + DocumentModifyGuard aModifyGuard( *this ); + // ensures the document is not marked as "modified" just because we change some control's content during + // reloading ... + EventObject aEvent(static_cast<XWeak*>(this)); { // only if there is no approve listener we can post the event at this time diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index f0cc505d125e..6e700c28f6d8 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1293,8 +1293,8 @@ OBoundControlModel::OBoundControlModel( ,m_nValuePropertyAggregateHandle( -1 ) ,m_nFieldType( DataType::OTHER ) ,m_bValuePropertyMayBeVoid( false ) + ,m_aResetHelper( *this, m_aMutex ) ,m_aUpdateListeners(m_aMutex) - ,m_aResetListeners(m_aMutex) ,m_aFormComponentListeners( m_aMutex ) ,m_bInputRequired( sal_True ) ,m_pAggPropMultiplexer( NULL ) @@ -1328,8 +1328,8 @@ OBoundControlModel::OBoundControlModel( ,m_nValuePropertyAggregateHandle( _pOriginal->m_nValuePropertyAggregateHandle ) ,m_nFieldType( DataType::OTHER ) ,m_bValuePropertyMayBeVoid( _pOriginal->m_bValuePropertyMayBeVoid ) + ,m_aResetHelper( *this, m_aMutex ) ,m_aUpdateListeners( m_aMutex ) - ,m_aResetListeners( m_aMutex ) ,m_aFormComponentListeners( m_aMutex ) ,m_xValidator( _pOriginal->m_xValidator ) ,m_bInputRequired( sal_True ) @@ -1521,8 +1521,8 @@ void OBoundControlModel::disposing() // notify all our listeners com::sun::star::lang::EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aResetListeners.disposeAndClear( aEvt ); m_aUpdateListeners.disposeAndClear( aEvt ); + m_aResetHelper.disposing(); // disconnect from our database column // TODO: could we replace the following 5 lines with a call to impl_disconnectDatabaseColumn_noNotify? @@ -2482,26 +2482,20 @@ void OBoundControlModel::resetNoBroadcast() //----------------------------------------------------------------------------- void OBoundControlModel::addResetListener(const Reference<XResetListener>& l) throw (RuntimeException) { - m_aResetListeners.addInterface(l); + m_aResetHelper.addResetListener( l ); } //----------------------------------------------------------------------------- void OBoundControlModel::removeResetListener(const Reference<XResetListener>& l) throw (RuntimeException) { - m_aResetListeners.removeInterface(l); + m_aResetHelper.removeResetListener( l ); } //----------------------------------------------------------------------------- void OBoundControlModel::reset() throw (RuntimeException) { - cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); - EventObject aResetEvent(static_cast<XWeak*>(this)); - sal_Bool bContinue = sal_True; - while ( aIter.hasMoreElements() && bContinue ) - bContinue = static_cast< XResetListener* >( aIter.next() )->approveReset( aResetEvent ); - - if (!bContinue) - return; + if ( !m_aResetHelper.approveReset() ) + return; ControlModelLock aLock( *this ); @@ -2616,7 +2610,7 @@ void OBoundControlModel::reset() throw (RuntimeException) aLock.release(); - m_aResetListeners.notifyEach( &XResetListener::resetted, aResetEvent ); + m_aResetHelper.notifyResetted(); } // ----------------------------------------------------------------------------- diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index f7bc39fa1b89..ec953f66c6f6 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -54,27 +54,22 @@ #include <com/sun/star/sdb/CommandType.hpp> /** === end UNO includes === **/ -#include <connectivity/dbtools.hxx> -#include <connectivity/formattedcolumnvalue.hxx> -#include <connectivity/dbconversion.hxx> - -#include <vcl/svapp.hxx> - -#include <unotools/sharedunocomponent.hxx> - -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> - #include <comphelper/basicio.hxx> #include <comphelper/container.hxx> #include <comphelper/numbers.hxx> #include <comphelper/listenernotification.hxx> - +#include <connectivity/dbtools.hxx> +#include <connectivity/formattedcolumnvalue.hxx> +#include <connectivity/dbconversion.hxx> #include <cppuhelper/queryinterface.hxx> - #include <rtl/logfile.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <unotools/sharedunocomponent.hxx> +#include <vcl/svapp.hxx> #include <algorithm> +#include <functional> //......................................................................... @@ -94,14 +89,61 @@ namespace frm using namespace ::com::sun::star::form::binding; using namespace ::dbtools; - //================================================================== - //= ItemEvent - //================================================================== + using ::connectivity::ORowSetValue; + + //============================================================================== + //= helper + //============================================================================== + namespace + { + //-------------------------------------------------------------------------- + struct RowSetValueToString : public ::std::unary_function< ORowSetValue, ::rtl::OUString > + { + ::rtl::OUString operator()( const ORowSetValue& _value ) const + { + return _value.getString(); + } + }; + + //-------------------------------------------------------------------------- + struct AppendRowSetValueString : public ::std::unary_function< ::rtl::OUString, void > + { + AppendRowSetValueString( ::rtl::OUString& _string ) + :m_string( _string ) + { + } + + void operator()( const ::rtl::OUString _append ) + { + m_string += _append; + } + + private: + ::rtl::OUString& m_string; + }; + + //-------------------------------------------------------------------------- + Sequence< ::rtl::OUString > lcl_convertToStringSequence( const ValueList& _values ) + { + Sequence< ::rtl::OUString > aStrings( _values.size() ); + ::std::transform( + _values.begin(), + _values.end(), + aStrings.getArray(), + RowSetValueToString() + ); + return aStrings; + } + } + + //============================================================================== + //= ItemEventDescription + //============================================================================== typedef ::comphelper::EventHolder< ItemEvent > ItemEventDescription; - //================================================================== + //============================================================================== //= OListBoxModel - //================================================================== + //============================================================================== //------------------------------------------------------------------ InterfaceRef SAL_CALL OListBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) { @@ -146,8 +188,8 @@ namespace frm ,m_aListRowSet( getContext() ) ,m_eListSourceType( _pOriginal->m_eListSourceType ) ,m_aBoundColumn( _pOriginal->m_aBoundColumn ) - ,m_aListSourceSeq( _pOriginal->m_aListSourceSeq ) - ,m_aValueSeq( _pOriginal->m_aValueSeq ) + ,m_aListSourceValues( _pOriginal->m_aListSourceValues ) + ,m_aBoundValues( _pOriginal->m_aBoundValues ) ,m_aDefaultSelectSeq( _pOriginal->m_aDefaultSelectSeq ) ,m_nNULLPos(-1) ,m_bBoundComponent(sal_False) @@ -229,11 +271,11 @@ namespace frm break; case PROPERTY_ID_LISTSOURCE: - _rValue <<= m_aListSourceSeq; + _rValue <<= lcl_convertToStringSequence( m_aListSourceValues ); break; case PROPERTY_ID_VALUE_SEQ: - _rValue <<= m_aValueSeq; + _rValue <<= lcl_convertToStringSequence( m_aBoundValues ); break; case PROPERTY_ID_DEFAULT_SELECT_SEQ: @@ -266,24 +308,38 @@ namespace frm _rValue >>= m_eListSourceType; break; - case PROPERTY_ID_LISTSOURCE : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aListSourceSeq; - - if (m_eListSourceType == ListSourceType_VALUELIST) - m_aValueSeq = m_aListSourceSeq; - else if ( m_xCursor.is() && !hasField() && !hasExternalListSource() ) - // listbox is already connected to a database, and no external list source - // data source changed -> refresh - loadData( false ); - break; + case PROPERTY_ID_LISTSOURCE: + { + // extract + Sequence< ::rtl::OUString > aListSource; + OSL_VERIFY( _rValue >>= aListSource ); + + // copy to member + ValueList().swap(m_aListSourceValues); + ::std::copy( + aListSource.getConstArray(), + aListSource.getConstArray() + aListSource.getLength(), + ::std::insert_iterator< ValueList >( m_aListSourceValues, m_aListSourceValues.end() ) + ); + + // propagate + if ( m_eListSourceType == ListSourceType_VALUELIST ) + { + m_aBoundValues = m_aListSourceValues; + } + else + { + if ( m_xCursor.is() && !hasField() && !hasExternalListSource() ) + // listbox is already connected to a database, and no external list source + // data source changed -> refresh + loadData( false ); + } + } + break; case PROPERTY_ID_VALUE_SEQ : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aValueSeq; - break; + OSL_ENSURE( false, "ValueItemList is read-only!" ); + throw PropertyVetoException(); case PROPERTY_ID_DEFAULT_SELECT_SEQ : DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast< Sequence<sal_Int16>*>(NULL))), @@ -329,12 +385,12 @@ namespace frm break; case PROPERTY_ID_LISTSOURCE: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aListSourceSeq); + bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, lcl_convertToStringSequence( m_aListSourceValues ) ); break; case PROPERTY_ID_VALUE_SEQ : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aValueSeq); - break; + OSL_ENSURE( false, "ValueItemList is read-only!" ); + throw PropertyVetoException(); case PROPERTY_ID_DEFAULT_SELECT_SEQ : bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aDefaultSelectSeq); @@ -435,7 +491,7 @@ namespace frm _rxOutStream << nAnyMask; - _rxOutStream << m_aListSourceSeq; + _rxOutStream << lcl_convertToStringSequence( m_aListSourceValues ); _rxOutStream << (sal_Int16)m_eListSourceType; _rxOutStream << aDummySeq; _rxOutStream << m_aDefaultSelectSeq; @@ -481,9 +537,9 @@ namespace frm if (nVersion > 0x0004) { DBG_ERROR("OListBoxModel::read : invalid (means unknown) version !"); - m_aListSourceSeq.realloc(0); + ValueList().swap(m_aListSourceValues); m_aBoundColumn <<= (sal_Int16)0; - m_aValueSeq.realloc(0); + ValueList().swap(m_aBoundValues); m_eListSourceType = ListSourceType_VALUELIST; m_aDefaultSelectSeq.realloc(0); defaultCommonProperties(); @@ -588,17 +644,18 @@ namespace frm // PRE2: list source ::rtl::OUString sListSource; - // if our list source type is no value list, we need to concatenete + // if our list source type is no value list, we need to concatenate // the single list source elements - const ::rtl::OUString* pListSourceItem = m_aListSourceSeq.getConstArray(); - sal_Int32 i(0); - for ( i=0; i<m_aListSourceSeq.getLength(); ++i, ++pListSourceItem ) - sListSource = sListSource + *pListSourceItem; + ::std::for_each( + m_aListSourceValues.begin(), + m_aListSourceValues.end(), + AppendRowSetValueString( sListSource ) + ); // outta here if we don't have all pre-requisites if ( !xConnection.is() || !sListSource.getLength() ) { - m_aValueSeq = StringSequence(); + ValueList().swap(m_aBoundValues); return; } @@ -742,9 +799,7 @@ namespace frm } // Anzeige- und Werteliste fuellen - ::std::vector< ::rtl::OUString > aValueList, aStringList; - aValueList.reserve(16); - aStringList.reserve(16); + ValueList aDisplayList, aValueList; sal_Bool bUseNULL = hasField() && !isRequired(); try @@ -780,23 +835,20 @@ namespace frm ::dbtools::FormattedColumnValue aValueFormatter( getContext(), m_xCursor, xDataField ); // Feld der BoundColumn des ResultSets holen - Reference< XPropertySet > xBoundField; - if ((nBoundColumn > 0) && m_xColumn.is()) + sal_Int32 nBoundColumnType = DataType::SQLNULL; + if ( ( nBoundColumn > 0 ) && m_xColumn.is() ) { // don't look for a bound column if we're not connected to a field try { - xColumns->getByIndex(nBoundColumn) >>= xBoundField; + Reference< XPropertySet > xBoundField( xColumns->getByIndex( nBoundColumn ), UNO_QUERY_THROW ); + OSL_VERIFY( xBoundField->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) >>= nBoundColumnType ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } } - m_bBoundComponent = xBoundField.is(); - - ::std::auto_ptr< ::dbtools::FormattedColumnValue > pBoundFieldFormatter; - if ( xBoundField.is() ) - pBoundFieldFormatter.reset( new ::dbtools::FormattedColumnValue( getContext(), m_xCursor, xBoundField ) ); + m_bBoundComponent = ( nBoundColumnType != DataType::SQLNULL ); // Ist die LB an ein Feld gebunden und sind Leereintraege zulaessig // dann wird die Position fuer einen Leereintrag gemerkt @@ -804,20 +856,21 @@ namespace frm RTL_LOGFILE_CONTEXT( aLogContext, "OListBoxModel::loadData: string collection" ); ::rtl::OUString aStr; sal_Int16 entryPos = 0; - // per definitionem the list cursor is positioned _before_ the first row at the moment + ORowSetValue aBoundValue; + Reference< XRow > xCursorRow( xListCursor, UNO_QUERY_THROW ); while ( xListCursor->next() && ( entryPos++ < SHRT_MAX ) ) // SHRT_MAX is the maximum number of entries { aStr = aValueFormatter.getFormattedValue(); - aStringList.push_back(aStr); + aDisplayList.push_back( aStr ); - if ( pBoundFieldFormatter.get() ) + if ( m_bBoundComponent ) { - aStr = pBoundFieldFormatter->getFormattedValue(); - aValueList.push_back( aStr ); + aBoundValue.fill( nBoundColumn + 1, nBoundColumnType, xCursorRow ); + aValueList.push_back( aBoundValue ); } - if (bUseNULL && (m_nNULLPos == -1) && !aStr.getLength()) - m_nNULLPos = (sal_Int16)aStringList.size() - 1; + if ( bUseNULL && ( m_nNULLPos == -1 ) && !aStr.getLength() ) + m_nNULLPos = sal_Int16( aDisplayList.size() - 1 ); } } break; @@ -828,11 +881,11 @@ namespace frm if (xFieldNames.is()) { StringSequence seqNames = xFieldNames->getElementNames(); - sal_Int32 nFieldsCount = seqNames.getLength(); - const ::rtl::OUString* pustrNames = seqNames.getConstArray(); - - for (sal_Int32 k=0; k<nFieldsCount; ++k, ++pustrNames) - aStringList.push_back(*pustrNames); + ::std::copy( + seqNames.getConstArray(), + seqNames.getConstArray() + seqNames.getLength(), + ::std::insert_iterator< ValueList >( aDisplayList, aDisplayList.end() ) + ); } } break; @@ -857,25 +910,16 @@ namespace frm // NULL eintrag hinzufuegen if (bUseNULL && m_nNULLPos == -1) { - if (m_bBoundComponent) - aValueList.insert(aValueList.begin(), ::rtl::OUString()); + if ( m_bBoundComponent ) + aValueList.insert( aValueList.begin(), ORowSetValue() ); - aStringList.insert(aStringList.begin(), ::rtl::OUString()); + aDisplayList.insert( aDisplayList.begin(), ORowSetValue( ::rtl::OUString() ) ); m_nNULLPos = 0; } - m_aValueSeq.realloc(aValueList.size()); - ::rtl::OUString* pValues = m_aValueSeq.getArray(); - for ( i = 0; i < (sal_Int32)aValueList.size(); ++i, ++pValues) - *pValues = aValueList[i]; - - // String-Sequence fuer ListBox erzeugen - StringSequence aStringSeq(aStringList.size()); - ::rtl::OUString* pStrings = aStringSeq.getArray(); - for ( i = 0; i < (sal_Int32)aStringList.size(); ++i, ++pStrings ) - *pStrings = aStringList[i]; + m_aBoundValues = aValueList; - setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aStringSeq)); + setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( lcl_convertToStringSequence( aDisplayList ) ) ); } //------------------------------------------------------------------------------ @@ -890,19 +934,14 @@ namespace frm if ( !hasExternalListSource() ) impl_refreshDbEntryList( false ); - - if ( hasField() ) - m_pBoundFieldFormatter.reset( new ::dbtools::FormattedColumnValue( getContext(), m_xCursor, getField() ) ); } //------------------------------------------------------------------------------ void OListBoxModel::onDisconnectedDbColumn() { - m_pBoundFieldFormatter.reset( NULL ); - - if (m_eListSourceType != ListSourceType_VALUELIST) + if ( m_eListSourceType != ListSourceType_VALUELIST ) { - m_aValueSeq = StringSequence(); + ValueList().swap(m_aBoundValues); m_nNULLPos = -1; m_bBoundComponent = sal_False; @@ -914,81 +953,73 @@ namespace frm } //------------------------------------------------------------------------------ - StringSequence OListBoxModel::GetCurValueSeq() const + ValueList OListBoxModel::impl_getValues() const { - StringSequence aCurValues; + if ( !m_aBoundValues.empty() ) + return m_aBoundValues; - // Aus den selektierten Indizes Werte-Sequence aufbauen - DBG_ASSERT(m_xAggregateFastSet.is(), "OListBoxModel::GetCurValueSeq : invalid aggregate !"); - if (!m_xAggregateFastSet.is()) - return aCurValues; - - Any aTmp = m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ); - - Sequence<sal_Int16> aSelectSeq; aTmp >>= aSelectSeq; - const sal_Int16 *pSels = aSelectSeq.getConstArray(); - sal_uInt32 nSelCount = aSelectSeq.getLength(); + Sequence< ::rtl::OUString > aStringItems( getStringItemList() ); + ValueList aValues( aStringItems.getLength() ); + ::std::copy( + aStringItems.getConstArray(), + aStringItems.getConstArray() + aStringItems.getLength(), + aValues.begin() + ); - if (nSelCount) - { - StringSequence aValues( impl_getValues() ); + return aValues; + } + //------------------------------------------------------------------------------ + ORowSetValue OListBoxModel::getFirstSelectedValue() const + { + static const ORowSetValue s_aEmptyVaue; - const ::rtl::OUString *pVals = aValues.getConstArray(); - sal_Int32 nValCnt = aValues.getLength(); + DBG_ASSERT( m_xAggregateFastSet.is(), "OListBoxModel::getFirstSelectedValue: invalid aggregate!" ); + if ( !m_xAggregateFastSet.is() ) + return s_aEmptyVaue; - if (nSelCount > 1) - { - // Einfach- oder Mehrfach-Selektion - sal_Bool bMultiSel = false; - const_cast<OListBoxModel*>(this)->OPropertySetAggregationHelper::getFastPropertyValue(PROPERTY_ID_MULTISELECTION) >>= bMultiSel; - if (bMultiSel) - nSelCount = 1; - } + Sequence< sal_Int16 > aSelectedIndices; + OSL_VERIFY( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) >>= aSelectedIndices ); + if ( !aSelectedIndices.getLength() ) + // nothing selected at all + return s_aEmptyVaue; - // ist der Eintrag fuer NULL selektiert ? - // dann leere Selektion liefern - if (m_nNULLPos != -1 && nSelCount == 1 && pSels[0] == m_nNULLPos) - nSelCount = 0; + if ( ( m_nNULLPos != -1 ) && ( aSelectedIndices[0] == m_nNULLPos ) ) + // the dedicated "NULL" entry is selected + return s_aEmptyVaue; - aCurValues.realloc(nSelCount); - ::rtl::OUString *pCurVals = aCurValues.getArray(); + ValueList aValues( impl_getValues() ); - for (sal_uInt16 i = 0; i < nSelCount; i++) - { - if (pSels[i] < nValCnt) - pCurVals[i] = pVals[pSels[i]]; - } + size_t selectedValue = aSelectedIndices[0]; + if ( selectedValue >= aValues.size() ) + { + OSL_ENSURE( false, "OListBoxModel::getFirstSelectedValue: inconsistent selection/valuelist!" ); + return s_aEmptyVaue; } - return aCurValues; + + return aValues[ selectedValue ]; } //------------------------------------------------------------------------------ sal_Bool OListBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) { // current selektion list - Any aCurrentValue; - StringSequence aCurValueSeq = GetCurValueSeq(); - if ( aCurValueSeq.getLength() ) - aCurrentValue <<= aCurValueSeq.getConstArray()[0]; - - if ( !compare( aCurrentValue, m_aSaveValue ) ) + const ORowSetValue rCurrentValue( getFirstSelectedValue() ); + if ( rCurrentValue != m_aSaveValue ) { - if ( !aCurrentValue.hasValue() ) + if ( rCurrentValue.isNull() ) m_xColumnUpdate->updateNull(); else { try { - ::rtl::OUString sNewValue; - aCurrentValue >>= sNewValue; - m_xColumnUpdate->updateString( sNewValue ); + m_xColumnUpdate->updateObject( rCurrentValue.makeAny() ); } - catch(Exception&) + catch ( const Exception& ) { return sal_False; } } - m_aSaveValue = aCurrentValue; + m_aSaveValue = rCurrentValue; } return sal_True; } @@ -997,37 +1028,41 @@ namespace frm //------------------------------------------------------------------------------ Any OListBoxModel::translateDbColumnToControlValue() { - DBG_ASSERT( m_xAggregateFastSet.is() && m_xAggregateSet.is(), "OListBoxModel::translateDbColumnToControlValue: invalid aggregate !" ); - if ( !m_xAggregateFastSet.is() || !m_xAggregateSet.is() ) - return Any(); - - OSL_ENSURE( m_pBoundFieldFormatter.get(), "OListBoxModel::translateDbColumnToControlValue: illegal call!" ); - if ( !m_pBoundFieldFormatter.get() ) + Reference< XPropertySet > xBoundField( getField() ); + if ( !xBoundField.is() ) + { + OSL_ENSURE( false, "OListBoxModel::translateDbColumnToControlValue: no field? How could that happen?!" ); return Any(); + } - Sequence<sal_Int16> aSelSeq; + Sequence< sal_Int16 > aSelectionIndicies; // Bei NULL-Eintraegen Selektion aufheben! - ::rtl::OUString sValue = m_pBoundFieldFormatter->getFormattedValue(); - OSL_PRECOND( getField() == m_xColumn, "OListBoxModel::translateDbColumnToControlValue: inconsistency!" ); - // m_pBoundFieldFormatter is based on m_xField, and we use m_xColumn to check for wasNull - // => both should better be the same object ... - if ( m_xColumn->wasNull() ) + ORowSetValue aCurrentValue; + aCurrentValue.fill( xBoundField->getPropertyValue( PROPERTY_VALUE ) ); + + if ( aCurrentValue.isNull() ) { - m_aSaveValue.clear(); - if (m_nNULLPos != -1) + if ( m_nNULLPos != -1 ) { - aSelSeq.realloc(1); - aSelSeq.getArray()[0] = m_nNULLPos; + aSelectionIndicies.realloc(1); + aSelectionIndicies[0] = m_nNULLPos; } } else { - m_aSaveValue <<= sValue; - - aSelSeq = findValue( impl_getValues(), sValue, m_bBoundComponent ); + ValueList aValues( impl_getValues() ); + ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(), aCurrentValue ); + if ( curValuePos != aValues.end() ) + { + aSelectionIndicies.realloc( 1 ); + aSelectionIndicies[0] = curValuePos - aValues.begin(); + } } - return makeAny( aSelSeq ); + + m_aSaveValue = aCurrentValue; + + return makeAny( aSelectionIndicies ); } // XReset @@ -1158,7 +1193,7 @@ namespace frm aThisEntryIndexes.getConstArray(), aThisEntryIndexes.getConstArray() + aThisEntryIndexes.getLength(), ::std::insert_iterator< ::std::set< sal_Int16 > >( aSelectionSet, aSelectionSet.begin() ) - ); + ); } // copy the indexes to the sequence diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx index 9aeca0e851e2..60bd63b3712d 100644 --- a/forms/source/component/ListBox.hxx +++ b/forms/source/component/ListBox.hxx @@ -46,14 +46,13 @@ #include <com/sun/star/form/XChangeBroadcaster.hpp> /** === end UNO includes === **/ -#include <vcl/timer.hxx> - #include <comphelper/asyncnotification.hxx> - +#include <connectivity/FValue.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/implbase1.hxx> +#include <vcl/timer.hxx> -#include <memory> +#include <vector> namespace dbtools { @@ -67,21 +66,21 @@ namespace frm //================================================================== //= OListBoxModel //================================================================== +typedef ::std::vector< ::connectivity::ORowSetValue > ValueList; + class OListBoxModel :public OBoundControlModel ,public OEntryListHelper ,public OErrorBroadcaster { - CachedRowSet m_aListRowSet; // the row set to fill the list - ::std::auto_ptr< ::dbtools::FormattedColumnValue > - m_pBoundFieldFormatter; - ::com::sun::star::uno::Any m_aSaveValue; + CachedRowSet m_aListRowSet; // the row set to fill the list + ::connectivity::ORowSetValue m_aSaveValue; // <properties> ::com::sun::star::form::ListSourceType m_eListSourceType; // type der list source ::com::sun::star::uno::Any m_aBoundColumn; - StringSequence m_aListSourceSeq; // - StringSequence m_aValueSeq; // alle Werte, readonly + ValueList m_aListSourceValues; + ValueList m_aBoundValues; ::com::sun::star::uno::Sequence<sal_Int16> m_aDefaultSelectSeq; // DefaultSelected // </properties> @@ -89,8 +88,7 @@ class OListBoxModel :public OBoundControlModel sal_Bool m_bBoundComponent : 1; private: - // Helper functions - StringSequence GetCurValueSeq() const; + ::connectivity::ORowSetValue getFirstSelectedValue() const; virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); @@ -180,8 +178,7 @@ private: */ void impl_refreshDbEntryList( bool _bForce ); - StringSequence - impl_getValues() const { return m_aValueSeq.getLength() ? m_aValueSeq : getStringItemList(); } + ValueList impl_getValues() const; }; //================================================================== diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx index 78841aa89ecf..cd70d200f376 100644 --- a/forms/source/component/RadioButton.cxx +++ b/forms/source/component/RadioButton.cxx @@ -259,7 +259,7 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons } } - if (nHandle == PROPERTY_ID_DEFAULTCHECKED) + if (nHandle == PROPERTY_ID_DEFAULT_STATE) { sal_Int16 nValue; rValue >>= nValue; @@ -269,7 +269,7 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons Any aZero; nValue = 0; aZero <<= nValue; - SetSiblingPropsTo(PROPERTY_DEFAULTCHECKED, aZero); + SetSiblingPropsTo(PROPERTY_DEFAULT_STATE, aZero); } } } @@ -341,7 +341,7 @@ void SAL_CALL ORadioButtonModel::read(const Reference<XObjectInputStream>& _rxIn } setReferenceValue( sReferenceValue ); - setDefaultChecked( (CheckState)nDefaultChecked ); + setDefaultChecked( (ToggleState)nDefaultChecked ); // Nach dem Lesen die Defaultwerte anzeigen if ( getControlSource().getLength() ) diff --git a/forms/source/component/refvaluecomponent.cxx b/forms/source/component/refvaluecomponent.cxx index 7a9f71475229..cd6fd6eba04e 100644 --- a/forms/source/component/refvaluecomponent.cxx +++ b/forms/source/component/refvaluecomponent.cxx @@ -90,7 +90,7 @@ namespace frm switch ( _nHandle ) { case PROPERTY_ID_REFVALUE: _rValue <<= m_sReferenceValue; break; - case PROPERTY_ID_DEFAULTCHECKED: _rValue <<= (sal_Int16)m_eDefaultChecked; break; + case PROPERTY_ID_DEFAULT_STATE: _rValue <<= (sal_Int16)m_eDefaultChecked; break; case PROPERTY_ID_UNCHECKED_REFVALUE: OSL_ENSURE( m_bSupportSecondRefValue, "OReferenceValueComponent::getFastPropertyValue: not supported!" ); @@ -117,11 +117,11 @@ namespace frm OSL_VERIFY( _rValue >>= m_sNoCheckReferenceValue ); break; - case PROPERTY_ID_DEFAULTCHECKED: + case PROPERTY_ID_DEFAULT_STATE: { sal_Int16 nDefaultChecked( (sal_Int16)STATE_NOCHECK ); OSL_VERIFY( _rValue >>= nDefaultChecked ); - m_eDefaultChecked = (CheckState)nDefaultChecked; + m_eDefaultChecked = (ToggleState)nDefaultChecked; resetNoBroadcast(); } break; @@ -146,7 +146,7 @@ namespace frm bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_sNoCheckReferenceValue ); break; - case PROPERTY_ID_DEFAULTCHECKED: + case PROPERTY_ID_DEFAULT_STATE: bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultChecked ); break; @@ -168,7 +168,7 @@ namespace frm { BEGIN_DESCRIBE_PROPERTIES( m_bSupportSecondRefValue ? 3 : 2, OBoundControlModel ) DECL_PROP1( REFVALUE, ::rtl::OUString, BOUND ); - DECL_PROP1( DEFAULTCHECKED, sal_Int16, BOUND ); + DECL_PROP1( DEFAULT_STATE, sal_Int16, BOUND ); if ( m_bSupportSecondRefValue ) { DECL_PROP1( UNCHECKED_REFVALUE, ::rtl::OUString, BOUND ); diff --git a/forms/source/component/refvaluecomponent.hxx b/forms/source/component/refvaluecomponent.hxx index 856c53572432..40745b22764d 100644 --- a/forms/source/component/refvaluecomponent.hxx +++ b/forms/source/component/refvaluecomponent.hxx @@ -28,10 +28,11 @@ * ************************************************************************/ -#ifndef EFORMS2_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX -#define EFORMS2_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX +#ifndef FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX +#define FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX #include "FormComponent.hxx" +#include "togglestate.hxx" /** === begin UNO includes === **/ /** === end UNO includes === **/ @@ -41,8 +42,6 @@ namespace frm { //........................................................................ - enum CheckState { STATE_NOCHECK = 0, STATE_CHECK = 1, STATE_DONTKNOW = 2 }; - //==================================================================== //= OReferenceValueComponent //==================================================================== @@ -54,7 +53,7 @@ namespace frm // <properties> ::rtl::OUString m_sReferenceValue; // the reference value to use for data exchange ::rtl::OUString m_sNoCheckReferenceValue; // the reference value to be exchanged when the control is not checked - CheckState m_eDefaultChecked; // the default check state + ToggleState m_eDefaultChecked; // the default check state // </properties> sal_Bool m_bSupportSecondRefValue; // do we support the SecondaryRefValue property? @@ -65,8 +64,8 @@ namespace frm const ::rtl::OUString& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue; } - CheckState getDefaultChecked() const { return m_eDefaultChecked; } - void setDefaultChecked( CheckState _eChecked ) { m_eDefaultChecked = _eChecked; } + ToggleState getDefaultChecked() const { return m_eDefaultChecked; } + void setDefaultChecked( ToggleState _eChecked ) { m_eDefaultChecked = _eChecked; } protected: OReferenceValueComponent( @@ -109,5 +108,5 @@ namespace frm } // namespace frm //........................................................................ -#endif // EFORMS2_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX +#endif // FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX diff --git a/forms/source/helper/makefile.mk b/forms/source/helper/makefile.mk index 4c2d68fd639e..5739d1fcb6d0 100644 --- a/forms/source/helper/makefile.mk +++ b/forms/source/helper/makefile.mk @@ -1,3 +1,4 @@ + #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,8 @@ INCPRE+=$(SOLARINCDIR)$/offuh SLOFILES= $(SLO)$/formnavigation.obj \ $(SLO)$/controlfeatureinterception.obj \ $(SLO)$/urltransformer.obj \ - $(SLO)$/windowstateguard.obj + $(SLO)$/windowstateguard.obj \ + $(SLO)$/resettable.obj \ # --- Targets ---------------------------------- diff --git a/forms/source/helper/resettable.cxx b/forms/source/helper/resettable.cxx new file mode 100644 index 000000000000..3c67dfa5e46e --- /dev/null +++ b/forms/source/helper/resettable.cxx @@ -0,0 +1,101 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_forms.hxx" + +#include "resettable.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/weak.hxx> + +//........................................................................ +namespace frm +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::form::XResetListener; + using ::com::sun::star::lang::EventObject; + /** === end UNO using === **/ + + //==================================================================== + //= ResetHelper + //==================================================================== + //-------------------------------------------------------------------- + void ResetHelper::addResetListener( const Reference< XResetListener >& _listener ) + { + m_aResetListeners.addInterface( _listener ); + } + + //-------------------------------------------------------------------- + void ResetHelper::removeResetListener( const Reference< XResetListener >& _listener ) + { + m_aResetListeners.removeInterface( _listener ); + } + + //-------------------------------------------------------------------- + bool ResetHelper::approveReset() + { + ::cppu::OInterfaceIteratorHelper aIter( m_aResetListeners ); + EventObject aResetEvent( m_rParent ); + + sal_Bool bContinue = sal_True; + while ( aIter.hasMoreElements() && bContinue ) + bContinue = static_cast< XResetListener* >( aIter.next() )->approveReset( aResetEvent ); + + return bContinue; + } + + //-------------------------------------------------------------------- + void ResetHelper::notifyResetted() + { + EventObject aResetEvent( m_rParent ); + m_aResetListeners.notifyEach( &XResetListener::resetted, aResetEvent ); + } + + //-------------------------------------------------------------------- + void ResetHelper::disposing() + { + EventObject aEvent( m_rParent ); + m_aResetListeners.disposeAndClear( aEvent ); + } + +//........................................................................ +} // namespace frm +//........................................................................ diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx index 9329ca92ba14..05c8ad587902 100644 --- a/forms/source/inc/FormComponent.hxx +++ b/forms/source/inc/FormComponent.hxx @@ -36,6 +36,7 @@ #include "property.hrc"
#include "property.hxx"
#include "propertybaghelper.hxx"
+#include "resettable.hxx" #include "services.hxx"
#include "windowstateguard.hxx"
@@ -648,8 +649,8 @@ private: ::com::sun::star::uno::Type m_aValuePropertyType; bool m_bValuePropertyMayBeVoid; + ResetHelper m_aResetHelper; ::cppu::OInterfaceContainerHelper m_aUpdateListeners; - ::cppu::OInterfaceContainerHelper m_aResetListeners; ::cppu::OInterfaceContainerHelper m_aFormComponentListeners; ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx index 13fbf9723eeb..1eaee92f8421 100644 --- a/forms/source/inc/frm_strings.hxx +++ b/forms/source/inc/frm_strings.hxx @@ -135,7 +135,7 @@ namespace frm FORMS_CONSTASCII_STRING( PROPERTY_BUTTONTYPE, "ButtonType" ); FORMS_CONSTASCII_STRING( PROPERTY_STRINGITEMLIST, "StringItemList" ); FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText" ); - FORMS_CONSTASCII_STRING( PROPERTY_DEFAULTCHECKED, "DefaultState" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState" ); FORMS_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey" ); FORMS_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier" ); FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_ACTION, "SubmitAction" ); diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc index 065a46eb5b8c..0a3e3739d31a 100644 --- a/forms/source/inc/property.hrc +++ b/forms/source/inc/property.hrc @@ -118,7 +118,7 @@ namespace frm #define PROPERTY_ID_SUBMIT_ENCODING (PROPERTY_ID_START + 74) // FmSubmitEncoding #define PROPERTY_ID_DEFAULT_VALUE (PROPERTY_ID_START + 75) // ::rtl::OUString #define PROPERTY_ID_SUBMIT_TARGET (PROPERTY_ID_START + 76) // ::rtl::OUString -#define PROPERTY_ID_DEFAULTCHECKED (PROPERTY_ID_START + 77) // UINT16 +#define PROPERTY_ID_DEFAULT_STATE (PROPERTY_ID_START + 77) // UINT16 #define PROPERTY_ID_VALUE_SEQ (PROPERTY_ID_START + 78) // StringSeq #define PROPERTY_ID_IMAGE_URL (PROPERTY_ID_START + 79) // ::rtl::OUString // free diff --git a/forms/source/inc/resettable.hxx b/forms/source/inc/resettable.hxx new file mode 100644 index 000000000000..f8815d5e3eb3 --- /dev/null +++ b/forms/source/inc/resettable.hxx @@ -0,0 +1,75 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+#ifndef FORMS_RESETTABLE_HXX +#define FORMS_RESETTABLE_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/form/XResetListener.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/interfacecontainer.hxx> + +namespace cppu +{ + class OWeakObject; +} + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= ResetHelper + //==================================================================== + class ResetHelper + { + public: + ResetHelper( ::cppu::OWeakObject& _parent, ::osl::Mutex& _mutex ) + :m_rParent( _parent ) + ,m_aResetListeners( _mutex ) + { + } + + // XReset equivalents + void addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _listener ); + void removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _listener ); + + // calling listeners + bool approveReset(); + void notifyResetted(); + void disposing(); + + private: + ::cppu::OWeakObject& m_rParent; + ::cppu::OInterfaceContainerHelper m_aResetListeners; + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_RESETTABLE_HXX diff --git a/forms/source/inc/togglestate.hxx b/forms/source/inc/togglestate.hxx new file mode 100644 index 000000000000..04755000db19 --- /dev/null +++ b/forms/source/inc/togglestate.hxx @@ -0,0 +1,43 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+#ifndef FORMS_TOGGLESTATE_HXX +#define FORMS_TOGGLESTATE_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +//........................................................................ +namespace frm +{ +//........................................................................ + + enum ToggleState { STATE_NOCHECK = 0, STATE_CHECK = 1, STATE_DONTKNOW = 2 }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_TOGGLESTATE_HXX diff --git a/forms/source/misc/property.cxx b/forms/source/misc/property.cxx index a47b7b73b706..564cd822f145 100644 --- a/forms/source/misc/property.cxx +++ b/forms/source/misc/property.cxx @@ -125,7 +125,7 @@ void PropertyInfoService::initialize() ADD_PROP_ASSIGNMENT(BUTTONTYPE); ADD_PROP_ASSIGNMENT(STRINGITEMLIST); ADD_PROP_ASSIGNMENT(DEFAULT_TEXT); - ADD_PROP_ASSIGNMENT(DEFAULTCHECKED); + ADD_PROP_ASSIGNMENT(DEFAULT_STATE); ADD_PROP_ASSIGNMENT(DEFAULT_DATE); ADD_PROP_ASSIGNMENT(DEFAULT_TIME); ADD_PROP_ASSIGNMENT(DEFAULT_VALUE); diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.java b/wizards/com/sun/star/wizards/common/ConfigGroup.java index 7f0654849b75..b2870535123a 100644 --- a/wizards/com/sun/star/wizards/common/ConfigGroup.java +++ b/wizards/com/sun/star/wizards/common/ConfigGroup.java @@ -87,6 +87,7 @@ public class ConfigGroup implements ConfigNode * Java Object value. * @param field * @return the value of the field as a Object. + * @throws IllegalAccessException */ public Object convertValue(Field field) throws IllegalAccessException { diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index b17eccbcf3bf..ead63de88183 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -152,7 +152,12 @@ public abstract class Configuration ((XHierarchicalPropertySet) UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent)).setHierarchicalPropertyValue(name, value); } - /** Creates a new instance of RegistryEntry */ + /** Creates a new instance of RegistryEntry + * @param name + * @param parent + * @return + * @throws Exception + */ public static Object getConfigurationNode(String name, Object parent) throws Exception { return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name); diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index a18365f5fe0b..064033585ac1 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -29,10 +29,13 @@ ************************************************************************/ package com.sun.star.wizards.common; +// import java.util.Date; + +// import com.sun.star.awt.XToolkit; import com.sun.star.beans.PropertyValue; -import com.sun.star.frame.XDesktop; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.XFramesSupplier; +// import com.sun.star.frame.XDesktop; +// import com.sun.star.frame.XFrame; +// import com.sun.star.frame.XFramesSupplier; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index 229778b61ada..25dadf1643d3 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -136,8 +136,13 @@ public class FileAccess /** * Further information on arguments value see in OO Developer Guide, * chapter 6.2.7 + * @param xMSF + * @param sPath * @param sType use "share" or "user". Set to "" if not needed eg for the WorkPath; * In the return Officepath a possible slash at the end is cut off + * @param sSearchDir + * @return + * @throws NoValidPathException */ public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType, String sSearchDir) throws NoValidPathException { @@ -211,12 +216,12 @@ public class FileAccess return ResultPath; } - public static ArrayList getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException + public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException { //This method currently only works with sPath="Template" // String ResultPath = ""; - ArrayList aPathList = new ArrayList(); + ArrayList<String> aPathList = new ArrayList<String>(); String Template_writable = ""; String[] Template_internal; String[] Template_user; @@ -604,8 +609,8 @@ public class FileAccess String[][] LocLayoutFiles = new String[2][]; //{"",""}{""}; try { - java.util.Vector TitleVector = null; - java.util.Vector NameVector = null; + java.util.Vector<String> TitleVector = null; + java.util.Vector<String> NameVector = null; XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); @@ -615,8 +620,8 @@ public class FileAccess String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false); - TitleVector = new java.util.Vector(nameList.length); - NameVector = new java.util.Vector(nameList.length); + TitleVector = new java.util.Vector<String>(/*nameList.length*/); + NameVector = new java.util.Vector<String>(nameList.length); FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-"; @@ -734,8 +739,8 @@ public class FileAccess { throw new NoValidPathException(null, "Path not given."); } - ArrayList TitleVector = new ArrayList(); - ArrayList URLVector = new ArrayList(); + ArrayList<String> TitleVector = new ArrayList<String>(); + ArrayList<String> URLVector = new ArrayList<String>(); com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = null; try @@ -1135,7 +1140,7 @@ public class FileAccess String[] sFileData = null; try { - Vector oDataVector = new Vector(); + Vector<String> oDataVector = new Vector<String>(); Object oSimpleFileAccess = _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess); if (xSimpleFileAccess.exists(_filepath)) @@ -1147,7 +1152,7 @@ public class FileAccess xActiveDataSink.setInputStream(xInputStream); while (!xTextInputStream.isEOF()) { - oDataVector.addElement((String) xTextInputStream.readLine()); + oDataVector.addElement( xTextInputStream.readLine()); } xTextInputStream.closeInput(); sFileData = new String[oDataVector.size()]; diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java index ddde8f07f277..946548ec1032 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -36,8 +36,10 @@ import java.util.Calendar; import com.sun.star.beans.Property; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; +// import com.sun.star.i18n.NumberFormatIndex; import com.sun.star.lang.Locale; import com.sun.star.lang.XMultiServiceFactory; +// import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.RuntimeException; import com.sun.star.uno.UnoRuntime; @@ -204,7 +206,7 @@ public class Helper if (oUnoObject != null) { XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); - Property[] aProps = xPSet.getPropertySetInfo().getProperties(); + // Property[] aProps = xPSet.getPropertySetInfo().getProperties(); Object oObject = xPSet.getPropertyValue(PropertyName); return oObject; } diff --git a/wizards/com/sun/star/wizards/common/Renderer.java b/wizards/com/sun/star/wizards/common/IRenderer.java index 08334351326b..a7f15d3f6dff 100644 --- a/wizards/com/sun/star/wizards/common/Renderer.java +++ b/wizards/com/sun/star/wizards/common/IRenderer.java @@ -1,4 +1,5 @@ -/************************************************************************* +/* + ************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +36,7 @@ package com.sun.star.wizards.common; * Can be used to reference resources, internationalizartion * a.s.o */ -public interface Renderer +public interface IRenderer { public String render(Object object); diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index de22171abd3b..f5d87a570bf2 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -52,6 +52,7 @@ public class JavaTools { } +/* public static void main(String args[]) { String sPath = ""; @@ -75,7 +76,7 @@ public class JavaTools exception.printStackTrace(System.out); } } - +*/ public static String[] copyStringArray(String[] FirstArray) { if (FirstArray != null) @@ -141,7 +142,7 @@ public class JavaTools * @param _aIntegerVector * @return */ - public static int[] IntegerTointList(Vector _aIntegerVector) + public static int[] IntegerTointList(Vector<Integer> _aIntegerVector) { try { @@ -167,7 +168,7 @@ public class JavaTools * @param _aBooleanVector * @return */ - public static boolean[] BooleanTobooleanList(Vector _aBooleanVector) + public static boolean[] BooleanTobooleanList(Vector<Boolean> _aBooleanVector) { try { @@ -537,9 +538,7 @@ public class JavaTools public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist, int _compindex) { - String[][] retarray = new String[][] - { - }; + String[][] retarray = new String[][] {}; if ((baselist != null) && (_complist != null)) { if (baselist.length > 0) @@ -547,7 +546,8 @@ public class JavaTools Vector retvector = new Vector(); for (int i = 0; i < baselist.length; i++) { - if (FieldInList(_complist, baselist[i][_compindex]) != -1) + String sValue = baselist[i][_compindex]; + if (FieldInList(_complist, sValue) != -1) { retvector.add(baselist[i]); // else diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index 2b4f9d0b2521..a837b78ebbad 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -85,6 +85,10 @@ public class NumberFormatter /** + * @param _xMSF + * @param _xNumberFormatsSupplier + * @return + * @throws Exception * @deprecated * */ @@ -167,9 +171,8 @@ public class NumberFormatter /** * returns a numberformat for a FormatString. - * @param _xFormatObject - * @param _xNumberFormats - * @param FormatString + * @param _FormatString + * @param _aLocale * @return */ public int defineNumberFormat(String _FormatString, Locale _aLocale) diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index f65de8327677..bd92b6eb6fc3 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -106,7 +106,7 @@ public class NumericalHelper { byte retValue = 0; - boolean hasConversionWarning = false; + // boolean hasConversionWarning = false; TypeObject aTypeObject = getTypeObject(aValue); switch (aTypeObject.iType) { diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index 546a57644096..0881d97d623e 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -45,7 +45,7 @@ public class PropertySetHelper { protected XPropertySet m_xPropertySet; - private HashMap m_aHashMap; + private HashMap<String, Object> m_aHashMap; public PropertySetHelper(Object _aObj) { @@ -56,11 +56,11 @@ public class PropertySetHelper m_xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aObj); } - private HashMap getHashMap() + private HashMap<String, Object> getHashMap() { if (m_aHashMap == null) { - m_aHashMap = new HashMap(); + m_aHashMap = new HashMap<String, Object>(); } return m_aHashMap; } diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java index 49a84c98bc37..d8c4e2c6115c 100644 --- a/wizards/com/sun/star/wizards/common/Resource.java +++ b/wizards/com/sun/star/wizards/common/Resource.java @@ -43,7 +43,11 @@ public class Resource String Unit; String Module; - /** Creates a new instance of Resource */ + /** Creates a new instance of Resource + * @param _xMSF + * @param _Unit + * @param _Module + */ public Resource(XMultiServiceFactory _xMSF, String _Unit, String _Module) { this.xMSF = _xMSF; @@ -60,7 +64,7 @@ public class Resource Object[][] DummyArray = new Object[1][]; Object[] nIDArray = new Object[1]; nIDArray[0] = new Integer(nID); - String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray); + final String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray); return IDString; } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java index 5416f8e8fbd0..79ecb3ac4e0f 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -152,7 +152,6 @@ public class SystemDialog * * @param displayDir * @param defaultName - * @param url should the returned path be an url. If false converts the * given url to a local path. * @return */ @@ -293,7 +292,7 @@ public class SystemDialog int MaxCount = xPropertyValue.length; for (int i = 0; i < MaxCount; i++) { - PropertyValue aValue = (PropertyValue) xPropertyValue[i]; + PropertyValue aValue = xPropertyValue[i]; if (aValue != null && aValue.Name.equals("UIName")) { return AnyConverter.toString(aValue.Value); diff --git a/wizards/com/sun/star/wizards/common/TerminateWizardException.java b/wizards/com/sun/star/wizards/common/TerminateWizardException.java index 593cfd62a9c8..8437633dd61a 100644 --- a/wizards/com/sun/star/wizards/common/TerminateWizardException.java +++ b/wizards/com/sun/star/wizards/common/TerminateWizardException.java @@ -31,7 +31,7 @@ ************************************************************************/ package com.sun.star.wizards.common; -import com.sun.star.wizards.common.Resource; +// import com.sun.star.wizards.common.Resource; import com.sun.star.lang.XMultiServiceFactory; public class TerminateWizardException extends Exception diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java index 98f149bf66cd..562a52a8bf8d 100644 --- a/wizards/com/sun/star/wizards/common/UCB.java +++ b/wizards/com/sun/star/wizards/common/UCB.java @@ -55,11 +55,14 @@ import com.sun.star.uno.UnoRuntime; * There is an incosistency with argument order. * It should be always: dir,filename. */ -public class UCB { +public class UCB +{ + private Object ucb; private FileAccess fa; - public UCB(XMultiServiceFactory xmsf) throws Exception { + public UCB(XMultiServiceFactory xmsf) throws Exception + { String[] keys = new String[2]; keys[ 0 ] = "Local"; keys[ 1 ] = "Office"; @@ -72,31 +75,43 @@ public class UCB { throws Exception { if (!fa.exists(dir,true)) + { return; + } List l = listFiles(dir,null); for (int i = 0; i<l.size(); i++) + { delete(FileAccess.connectURLs(dir ,(String)l.get(i))); } + } - public void delete(String filename) throws Exception { + public void delete(String filename) throws Exception + { //System.out.println("UCB.delete(" + filename); executeCommand( getContent(filename),"delete",Boolean.TRUE); } - public void copy(String sourceDir, String targetDir) throws Exception { + public void copy(String sourceDir, String targetDir) throws Exception + { copy(sourceDir,targetDir,(Verifier)null); } - public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception { + public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception + { List files = listFiles(sourceDir,verifier); for (int i = 0; i<files.size(); i++) + { copy(sourceDir, (String)files.get(i), targetDir); + } } - public void copy(String sourceDir, String filename, String targetDir, String targetName ) throws Exception { + public void copy(String sourceDir, String filename, String targetDir, String targetName) throws Exception + { if (!fa.exists(targetDir,true)) + { fa.fileAccess.createFolder(targetDir); + } //System.out.println("UCB.copy(" + sourceDir + ", " + filename + ", " + targetDir+ ", " + targetName); executeCommand(ucb, "globalTransfer", copyArg(sourceDir,filename, targetDir,targetName)); } @@ -108,18 +123,21 @@ public class UCB { * @param targetDir * @throws Exception */ - public void copy(String sourceDir, String filename, String targetDir) throws Exception { + public void copy(String sourceDir, String filename, String targetDir) throws Exception + { copy(sourceDir,filename, targetDir, ""); } + /** * target name can be "", in which case the name stays lige the source name * @param sourceDir - * @param filename + * @param sourceFilename * @param targetDir - * @param targetName + * @param targetFilename * @return */ - public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename) { + public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename) + { GlobalTransferCommandArgument aArg = new GlobalTransferCommandArgument(); aArg.Operation = TransferCommandOperation.COPY; @@ -144,7 +162,8 @@ public class UCB { return xCmdProcessor.execute(aCommand, 0, null); } - public List listFiles(String path,Verifier verifier) throws Exception { + public List listFiles(String path, Verifier verifier) throws Exception + { Object xContent = getContent(path); OpenCommandArgument2 aArg = new OpenCommandArgument2(); @@ -166,27 +185,40 @@ public class UCB { List files = new Vector(); - if (xResultSet.first()) { + if (xResultSet.first()) + { // obtain XContentAccess interface for child content access and XRow for properties XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface( XContentAccess.class, xResultSet); XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, xResultSet); - do { + do + { // Obtain URL of child. String aId = xContentAccess.queryContentIdentifierString(); // First column: Title (column numbers are 1-based!) String aTitle = xRow.getString(1); if (aTitle.length() == 0 && xRow.wasNull()) - ;//ignore + { + ; //ignore + } else + { files.add(aTitle); - } while (xResultSet.next()); // next child + } + } + while (xResultSet.next()); // next child } if (verifier != null) + { for (int i = 0; i<files.size(); i++) + { if (!verifier.verify(files.get(i))) + { files.remove(i--); + } + } + } return files; } @@ -202,29 +234,40 @@ public class UCB { Object row = executeCommand(content,"getPropertyValues",pv); XRow xrow = (XRow)UnoRuntime.queryInterface(XRow.class,row); if (type.equals(String.class)) + { return xrow.getString(1); + } else if (type.equals(Boolean.class)) + { return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE; + } else if (type.equals(Integer.class)) + { return new Integer(xrow.getInt(1)); + } else if (type.equals(Short.class)) + { return new Short(xrow.getShort(1)); - else return null; + } + else + { + return null; + } } - public Object getContent(String path) throws Exception { + public Object getContent(String path) throws Exception + { //System.out.println("Getting Content for : " + path); - XContentIdentifier id = ((XContentIdentifierFactory)UnoRuntime - .queryInterface(XContentIdentifierFactory.class,ucb)).createContentIdentifier(path); + XContentIdentifier id = ((XContentIdentifierFactory) UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path); return ((XContentProvider)UnoRuntime.queryInterface( XContentProvider.class,ucb)).queryContent(id); } - public static interface Verifier { + public static interface Verifier + { + public boolean verify(Object object); } - - } diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java index b7e3dfb789b5..5e7a26cb2381 100644 --- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java +++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java @@ -34,7 +34,7 @@ import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.sdbc.DataType; import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.db.TypeInspector; +// import com.sun.star.wizards.db.TypeInspector; public class ColumnPropertySet { diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index ba6c5972801a..b26259fc8a47 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -63,7 +63,7 @@ public class CommandMetaData extends DBMetaData public String[][] AggregateFieldNames = new String[][] {}; public String[] NumericFieldNames = new String[] {}; public String[] NonAggregateFieldNames; - private int[] FieldTypes; + // private int[] FieldTypes; private int CommandType; private String Command; boolean bCatalogAtStart = true; @@ -92,10 +92,10 @@ public class CommandMetaData extends DBMetaData for (int i = 0; i < _FieldNames.length; i++) { FieldColumns[i] = new FieldColumn(this, _FieldNames[i], this.getCommandName(), false); - if (_bgetDefaultValue) - { - FieldColumns[i].getDefaultValue(); - } +// if (_bgetDefaultValue) +// { +// FieldColumns[i].getDefaultValue(); +// } } } @@ -153,7 +153,7 @@ public class CommandMetaData extends DBMetaData } String CurCommandName = CurFieldColumn.getCommandName(); CommandObject oCommand = getTableByName(CurCommandName); - Object oColumn = oCommand.xColumns.getByName(CurFieldColumn.m_sFieldName); + Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); XPropertySet xColumn = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn); return xColumn; } @@ -212,7 +212,7 @@ public class CommandMetaData extends DBMetaData { for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns[i].m_sFieldName.equals(_FieldName)) + if (FieldColumns[i].getFieldName().equals(_FieldName)) { if (FieldColumns[i].getCommandName().equals(_CommandName)) @@ -231,7 +231,7 @@ public class CommandMetaData extends DBMetaData { for (int i = 0; i < FieldColumns.length; i++) { - String sFieldName = FieldColumns[i].m_sFieldName; + String sFieldName = FieldColumns[i].getFieldName(); if (sFieldName.equals(_FieldName)) { return FieldColumns[i]; @@ -284,7 +284,7 @@ public class CommandMetaData extends DBMetaData // LLA: Group works with fields direct for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns[i].m_sFieldName.equals(_FieldTitle)) + if (FieldColumns[i].getFieldName().equals(_FieldTitle)) { return FieldColumns[i]; } @@ -298,15 +298,16 @@ public class CommandMetaData extends DBMetaData try { // Object oField; - java.util.Vector ResultFieldNames = new java.util.Vector(10); + java.util.Vector<String> ResultFieldNames = new java.util.Vector<String>(10); String[] FieldNames; CommandObject oCommand = this.getCommandByName(_commandname, _commandtype); - FieldNames = oCommand.xColumns.getElementNames(); + FieldNames = oCommand.getColumns().getElementNames(); if (FieldNames.length > 0) { for (int n = 0; n < FieldNames.length; n++) { - Object oField = oCommand.xColumns.getByName(FieldNames[n]); + final String sFieldName = FieldNames[n]; + Object oField = oCommand.getColumns().getByName(sFieldName); int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); // BinaryFieldTypes are not included in the WidthList if (JavaTools.FieldInIntTable(WidthList, iType) >= 0) @@ -314,15 +315,15 @@ public class CommandMetaData extends DBMetaData // if (_bAppendMode) // ResultFieldNames.addElement(_commandname + "." + FieldNames[n]); // else - ResultFieldNames.addElement(FieldNames[n]); + ResultFieldNames.addElement(sFieldName); } else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0) { - ResultFieldNames.addElement(FieldNames[n]); + ResultFieldNames.addElement(sFieldName); } } // FieldNames = new String[FieldNames.length]; - FieldTypes = new int[FieldNames.length]; + // FieldTypes = new int[FieldNames.length]; m_aAllFieldNames = new String[ResultFieldNames.size()]; ResultFieldNames.copyInto(m_aAllFieldNames); return true; @@ -346,7 +347,7 @@ public class CommandMetaData extends DBMetaData public String[] getOrderableColumns(String[] _fieldnames) { - Vector aOrderableColumns = new Vector(); + Vector<String> aOrderableColumns = new Vector<String>(); int ncount = 0; for (int i = 0; i < _fieldnames.length; i++) { @@ -400,7 +401,7 @@ public class CommandMetaData extends DBMetaData try { CommandObject oTable = super.getTableByName(_oFieldColumn.getCommandName()); - Object oField = oTable.xColumns.getByName(_oFieldColumn.getFieldName()); + Object oField = oTable.getColumns().getByName(_oFieldColumn.getFieldName()); int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); int ifound = java.util.Arrays.binarySearch(NumericTypes, iType); if ((ifound < NumericTypes.length) && (ifound > 0)) @@ -423,7 +424,7 @@ public class CommandMetaData extends DBMetaData { try { - Vector numericfieldsvector = new java.util.Vector(); + Vector<String> numericfieldsvector = new java.util.Vector<String>(); for (int i = 0; i < FieldColumns.length; i++) { if (isnumeric(FieldColumns[i])) @@ -444,14 +445,14 @@ public class CommandMetaData extends DBMetaData public String[] getFieldNames(String[] _sDisplayFieldNames, String _sCommandName) { - Vector sFieldNamesVector = new java.util.Vector(); + Vector<String> sFieldNamesVector = new java.util.Vector<String>(); for (int i = 0; i < FieldColumns.length; i++) { if (_sCommandName.equals(FieldColumns[i].getCommandName())) { if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1) { - sFieldNamesVector.addElement(FieldColumns[i].m_sFieldName); + sFieldNamesVector.addElement(FieldColumns[i].getFieldName()); } } } @@ -467,7 +468,7 @@ public class CommandMetaData extends DBMetaData String[] sFieldNames = new String[FieldColumns.length]; for (int i = 0; i < FieldColumns.length; i++) { - sFieldNames[i] = FieldColumns[i].m_sFieldName; + sFieldNames[i] = FieldColumns[i].getFieldName(); } return sFieldNames; } @@ -487,7 +488,7 @@ public class CommandMetaData extends DBMetaData { try { - Vector nonaggregatefieldsvector = new java.util.Vector(); + Vector<String> nonaggregatefieldsvector = new java.util.Vector<String>(); for (int i = 0; i < FieldColumns.length; i++) { if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1) @@ -593,7 +594,7 @@ public class CommandMetaData extends DBMetaData int a = 0; for (int i = 0; i < TotFieldCount; i++) { - CurFieldName = FieldColumns[i].m_sFieldName; + CurFieldName = FieldColumns[i].getFieldName(); if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0) { RecordFieldNames[a] = CurFieldName; @@ -688,7 +689,7 @@ public class CommandMetaData extends DBMetaData { if (xDBMetaData.supportsIntegrityEnhancementFacility()) { - java.util.Vector TableVector = new java.util.Vector(); + java.util.Vector<String> TableVector = new java.util.Vector<String>(); Object oTable = getTableNamesAsNameAccess().getByName(_stablename); XKeysSupplier xKeysSupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, oTable); xIndexKeys = xKeysSupplier.getKeys(); @@ -784,7 +785,7 @@ public class CommandMetaData extends DBMetaData { try { - boolean bCatalogAtStart = xDBMetaData.isCatalogAtStart(); + boolean bCatalogAtStart2 = xDBMetaData.isCatalogAtStart(); sCatalogSep = xDBMetaData.getCatalogSeparator(); sIdentifierQuote = xDBMetaData.getIdentifierQuoteString(); bCommandComposerAttributesalreadyRetrieved = true; diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 31a5db521008..be8721a8febe 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -90,30 +90,14 @@ import com.sun.star.sdbcx.XTablesSupplier; public class DBMetaData { - private XNameAccess m_xTableNames; - public XNameAccess xQueryNames; - private XInteractionHandler oInteractionHandler; - private XNameAccess xNameAccess; - private XInterface xDatabaseContext; + private XNameAccess xQueryNames; public XDatabaseMetaData xDBMetaData; - public XDataSource xDataSource; - public XOfficeDatabaseDocument xModel; - private XCompletedConnection xCompleted; - public XPropertySet xDataSourcePropertySet; - // private int[] nDataTypes = null; - private XWindowPeer xWindowPeer; + private XDataSource xDataSource; + private XOfficeDatabaseDocument xModel; + private XPropertySet xDataSourcePropertySet; public String[] DataSourceNames; public String[] CommandNames; - private String[] TableNames = new String[] - { - }; - private String[] QueryNames = new String[] - { - }; public java.util.Vector CommandObjects = new Vector(1); - protected int[][] WidthList; - protected int[] NumericTypes; - protected int[] BinaryTypes; public Locale aLocale; public int[] CommandTypes; public String DataSourceName; @@ -122,16 +106,54 @@ public class DBMetaData public com.sun.star.lang.XMultiServiceFactory xMSF; public XComponent xConnectionComponent; public SQLQueryComposer oSQLQueryComposer; - int iMaxColumnsInSelect; - int iMaxColumnsInGroupBy; - int iMaxColumnsInTable; - int iMaxColumnNameLength = -1; - int iMaxTableNameLength = -1; + + private XNameAccess m_xTableNames; + private XInteractionHandler oInteractionHandler; + private XNameAccess xNameAccess; + private XInterface xDatabaseContext; + private XCompletedConnection xCompleted; + // private int[] nDataTypes = null; + private XWindowPeer xWindowPeer; + private String[] TableNames = new String[] {}; + private String[] QueryNames = new String[] {}; + + protected int[][] WidthList; + protected static final int[] NumericTypes = { + DataType.TINYINT, // == -6; + DataType.BIGINT, // == -5 + DataType.NUMERIC, // == - 2 + DataType.DECIMAL, // == 3; + DataType.INTEGER, // == 4; + DataType.SMALLINT, // == 5; + DataType.FLOAT, // == 6; + DataType.REAL, // == 7; + DataType.DOUBLE, // == 8; + }; + protected static final int[] BinaryTypes = { //new int[12]; + DataType.BINARY, + DataType.VARBINARY, + DataType.LONGVARBINARY, + DataType.BLOB, + DataType.SQLNULL, + DataType.OBJECT, + DataType.DISTINCT, + DataType.STRUCT, + DataType.ARRAY, + DataType.CLOB, + DataType.REF + /* DataType.OTHER, */ + }; + + private int iMaxColumnsInSelect; + private int iMaxColumnsInGroupBy; + private int iMaxColumnsInTable; + private int iMaxColumnNameLength = -1; + private int iMaxTableNameLength = -1; private boolean bPasswordIsRequired; // private boolean bFormatKeysareset = false; - final int NOLIMIT = 9999999; - final int RID_DB_COMMON = 1000; - final int INVALID = 9999999; + private final static int NOLIMIT = 9999999; + protected final static int RID_DB_COMMON = 1000; + private final static int INVALID = 9999999; public TypeInspector oTypeInspector; private PropertyValue[] aInfoPropertyValues = null; private boolean bisSQL92CheckEnabled = false; @@ -139,6 +161,11 @@ public class DBMetaData private long lDateCorrection = INVALID; private boolean bdisposeConnection = false; + public XPropertySet getDataSourcePropertySet() + { + return xDataSourcePropertySet; + } + public DBMetaData(XMultiServiceFactory xMSF) { getInterfaces(xMSF); @@ -279,10 +306,10 @@ public class DBMetaData public class CommandObject { - public XNameAccess xColumns; - public XPropertySet xPropertySet; - public String Name; - public int CommandType; + private XNameAccess xColumns; + private XPropertySet xPropertySet; + private String Name; + private int CommandType; public CommandObject(String _CommandName, int _CommandType) { @@ -305,6 +332,7 @@ public class DBMetaData } XColumnsSupplier xCommandCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand); xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCommand); +// TODO: Performance leak getColumns() take very long. xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns()); } catch (Exception exception) @@ -312,6 +340,18 @@ public class DBMetaData exception.printStackTrace(System.out); } } + public XNameAccess getColumns() + { + return xColumns; + } + public String getName() + { + return Name; + } + public XPropertySet getPropertySet() + { + return xPropertySet; + } } public boolean hasEscapeProcessing(XPropertySet _xQueryPropertySet) @@ -398,30 +438,8 @@ public class DBMetaData WidthList[16][0] = DataType.TIMESTAMP; // == 93; // NumericTypes are all types where aggregate functions can be performed on. // Similarly to a major competitor date/time/timmestamp fields are not included - NumericTypes = new int[9]; - NumericTypes[0] = DataType.TINYINT; // == -6; - NumericTypes[1] = DataType.BIGINT; // == -5 - NumericTypes[2] = DataType.NUMERIC; // == - 2 - NumericTypes[3] = DataType.DECIMAL; // == 3; - NumericTypes[4] = DataType.INTEGER; // == 4; - NumericTypes[5] = DataType.SMALLINT; // == 5; - NumericTypes[6] = DataType.FLOAT; // == 6; - NumericTypes[7] = DataType.REAL; // == 7; - NumericTypes[8] = DataType.DOUBLE; // == 8; - - BinaryTypes = new int[12]; - BinaryTypes[0] = DataType.BINARY; - BinaryTypes[1] = DataType.VARBINARY; - BinaryTypes[2] = DataType.LONGVARBINARY; - BinaryTypes[3] = DataType.BLOB; - BinaryTypes[4] = DataType.SQLNULL; - BinaryTypes[5] = DataType.OBJECT; - BinaryTypes[6] = DataType.DISTINCT; - BinaryTypes[7] = DataType.STRUCT; - BinaryTypes[8] = DataType.ARRAY; - BinaryTypes[9] = DataType.CLOB; - BinaryTypes[10] = DataType.REF; - BinaryTypes[11] = DataType.OTHER; + + } public boolean isBinaryDataType(int _itype) @@ -542,15 +560,32 @@ public class DBMetaData return _sname; } + public XDataSource getDataSource() + { + if (xDataSource == null) + { + try + { + Object oDataSource = xNameAccess.getByName(DataSourceName); + xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource); + } + catch (com.sun.star.container.NoSuchElementException e) + { + } + catch (com.sun.star.lang.WrappedTargetException e) + { + } + } + return xDataSource; + } + private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces) { try { this.DataSourceName = _DataSourceName; - Object oDataSource = xNameAccess.getByName(DataSourceName); - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource); getDataSourceInterfaces(); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource); + XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, getDataSource()); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index 2b2826b40d02..c1909cdd2c25 100644 --- a/wizards/com/sun/star/wizards/db/FieldColumn.java +++ b/wizards/com/sun/star/wizards/db/FieldColumn.java @@ -40,26 +40,31 @@ import com.sun.star.wizards.common.*; public class FieldColumn { + protected int ColIndex; - public Object DefaultValue; - public String m_sFieldName; + private Object DefaultValue; + private String m_sFieldName; private String m_sDisplayFieldName; private String FieldTitle; - public int ColIndex; private String m_sCommandName; - public int FieldWidth; - public int DBFormatKey; - public int FieldType; - public int StandardFormatKey; - public boolean bIsNumberFormat; - public XPropertySet m_xColPropertySet; - public int iType; - protected int iDateFormatKey; - protected int iDateTimeFormatKey; - protected int iNumberFormatKey; - protected int iTextFormatKey; - protected int iTimeFormatKey; - protected int iLogicalFormatKey; + private int m_nDBFormatKey; + private int m_nFieldType; + private XPropertySet m_xColPropertySet; + + // field meta data + private int FieldWidth; + private int StandardFormatKey; + private boolean bIsNumberFormat; + + private static boolean bFormatKeysInitialized = false; + private static int iDateFormatKey; + private static int iDateTimeFormatKey; + private static int iNumberFormatKey; + private static int iTextFormatKey; + private static int iTimeFormatKey; + private static int iLogicalFormatKey; + + private CommandMetaData m_aCommandMetaData; public FieldColumn(CommandMetaData oCommandMetaData, String _DisplayFieldName) { @@ -67,10 +72,10 @@ public class FieldColumn m_sCommandName = oCommandMetaData.getCommandName(); m_sFieldName = getOnlyFieldName(m_sDisplayFieldName, m_sCommandName); // TODO: could be wrong here! - FieldTitle = _DisplayFieldName; // oCommandMetaData.getFieldTitle(m_sFieldName); +// FieldTitle = _DisplayFieldName; // oCommandMetaData.getFieldTitle(m_sFieldName); FieldTitle = m_sFieldName; DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(m_sCommandName); - setFormatKeys(oCommandMetaData, oTable.xColumns); + initializeFormatKeys(oCommandMetaData, oTable.getColumns()); } public FieldColumn(CommandMetaData oCommandMetaData, String _FieldName, String _CommandName, boolean _bInstantiateByDisplayName) @@ -87,17 +92,49 @@ public class FieldColumn m_sDisplayFieldName = composeDisplayFieldName(_CommandName, m_sFieldName); } FieldTitle = m_sFieldName; - DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(m_sCommandName); - setFormatKeys(oCommandMetaData, oTable.xColumns); + m_aCommandMetaData = oCommandMetaData; } public FieldColumn(CommandMetaData oCommandMetaData, XNameAccess _xColumns, String _FieldName) { m_sFieldName = _FieldName; - FieldTitle = m_sFieldName; +// FieldTitle = m_sFieldName; m_sDisplayFieldName = m_sFieldName; ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1; - setFormatKeys(oCommandMetaData, _xColumns); + initializeFormatKeys(oCommandMetaData, _xColumns); + } + + public int getFieldType() + { + if (m_nFieldType == 0) + { + DBMetaData.CommandObject oTable = m_aCommandMetaData.getTableByName(m_sCommandName); + initializeFormatKeys(m_aCommandMetaData, oTable.getColumns()); + } + return m_nFieldType; + } + + public int getFieldWidth() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return FieldWidth; + } + + public int getDBFormatKey() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return m_nDBFormatKey; + } + + public int getStandardFormatKey() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return StandardFormatKey; + } + public boolean isNumberFormat() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return bIsNumberFormat; } /** @@ -117,23 +154,27 @@ public class FieldColumn return _sCommandName + "." + _sFieldName; } - private void setFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns) + private void initializeFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns) { try { m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName)); ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1; - iType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); - - final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter(); - iDateFormatKey = aNumberFormatter.getDateFormatKey(); - iDateTimeFormatKey = aNumberFormatter.getDateTimeFormatKey(); - iNumberFormatKey = aNumberFormatter.getNumberFormatKey(); - iTextFormatKey = aNumberFormatter.getTextFormatKey(); - iTimeFormatKey = aNumberFormatter.getTimeFormatKey(); - iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey(); - - DefaultValue = getTyperelatedFieldData(); + m_nFieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); + getTyperelatedFieldData(); + + if (bFormatKeysInitialized == false) + { + final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter(); + + iDateFormatKey = aNumberFormatter.getDateFormatKey(); + iDateTimeFormatKey = aNumberFormatter.getDateTimeFormatKey(); + iNumberFormatKey = aNumberFormatter.getNumberFormatKey(); + iTextFormatKey = aNumberFormatter.getTextFormatKey(); + iTimeFormatKey = aNumberFormatter.getTimeFormatKey(); + iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey(); + bFormatKeysInitialized = true; + } } catch (Exception e) { @@ -143,6 +184,7 @@ public class FieldColumn public XPropertySet getXColumnPropertySet() { + getFieldType(); // will collect meta data 'bout the column, if not already done so return m_xColPropertySet; } @@ -188,59 +230,26 @@ public class FieldColumn return locCommandName; } - public int getFormatKey() - { - try - { - // int iKey; - int nDBFormatKey; - Object oKey = m_xColPropertySet.getPropertyValue("FormatKey"); - if (AnyConverter.isVoid(oKey)) - { - nDBFormatKey = StandardFormatKey; - } - else - { - nDBFormatKey = AnyConverter.toInt(oKey); - } - return nDBFormatKey; - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - return StandardFormatKey; - } - } - public boolean isBoolean() { boolean bIsBoolean = false; - try + switch ( getFieldType() ) { - FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); - switch (FieldType) - { - case DataType.BIT: // == -7; - case DataType.BOOLEAN: - bIsBoolean = true; - break; - default: - bIsBoolean = false; - } - } - catch (Exception exception) - { - exception.printStackTrace(System.out); + case DataType.BIT: // == -7; + case DataType.BOOLEAN: + bIsBoolean = true; + break; + default: + bIsBoolean = false; } return bIsBoolean; } - private Object getTyperelatedFieldData() + private void getTyperelatedFieldData() { try { - FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); - switch (FieldType) + switch ( getFieldType() ) { case DataType.BIT: // == -7; case DataType.BOOLEAN: @@ -340,20 +349,26 @@ public class FieldColumn bIsNumberFormat = true; break; } - DBFormatKey = getFormatKey(); - // TODO: the DefaultValue is not set in this function!!! - return DefaultValue; + + Object oKey = m_xColPropertySet.getPropertyValue("FormatKey"); + if (AnyConverter.isVoid(oKey)) + { + m_nDBFormatKey = StandardFormatKey; + } + else + { + m_nDBFormatKey = AnyConverter.toInt(oKey); + } } catch (Exception exception) { exception.printStackTrace(System.out); - return null; + m_nDBFormatKey = StandardFormatKey; } } private void getTextFieldWidth(int iWidth) { - // int iNewWidth = iWidth; try { FieldWidth = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Precision")); @@ -375,9 +390,9 @@ public class FieldColumn } } - public Object getDefaultValue() + public void initDefaultValue() { - switch (FieldType) + switch (getFieldType()) { case DataType.BIT: // == -7; case DataType.BOOLEAN: @@ -447,6 +462,13 @@ public class FieldColumn default: break; } + } + + public Object getDefaultValue() + { + if ( DefaultValue == null ) + initDefaultValue(); return DefaultValue; } + } diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 44b8833be6ea..229dd8624691 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -163,7 +163,7 @@ public class QueryMetaData extends CommandMetaData FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1]; for (int i = 0; i < FieldColumns.length; i++) { - if (!FieldColumns[i].m_sFieldName.equals(_sFieldName)) + if (!FieldColumns[i].getFieldName().equals(_sFieldName)) { if (!FieldColumns[i].getCommandName().equals(_sCommandName)) { @@ -222,8 +222,7 @@ public class QueryMetaData extends CommandMetaData public String[] getFieldNamesOfCommand(String _sCommandName) { CommandObject oTable = getTableByName(_sCommandName); - return oTable.xColumns.getElementNames(); - + return oTable.getColumns().getElementNames(); } public void initializeFieldTitleSet(boolean _bAppendMode) @@ -238,9 +237,10 @@ public class QueryMetaData extends CommandMetaData String[] aCommandNames = getIncludedCommandNames(); for (int i = 0; i < aCommandNames.length; i++) { - CommandObject oTable = getTableByName(aCommandNames[i]); - String sTableName = oTable.Name; - String[] LocFieldNames = oTable.xColumns.getElementNames(); + String sCommandName = aCommandNames[i]; + CommandObject oTable = getTableByName(sCommandName); + String sTableName = oTable.getName(); + String[] LocFieldNames = oTable.getColumns().getElementNames(); for (int a = 0; a < LocFieldNames.length; a++) { String sDisplayFieldName = FieldColumn.composeDisplayFieldName(sTableName, LocFieldNames[a]); @@ -276,7 +276,7 @@ public class QueryMetaData extends CommandMetaData { for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns[i].bIsNumberFormat) + if (FieldColumns[i].isNumberFormat()) { return true; } diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index ddeab925ff9b..cf2853861ccd 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -251,7 +251,7 @@ public class RecordParser extends QueryMetaData String[] sFieldNames = getFieldNames(); for (int i = 0; i < FieldColumns.length; i++) { - String sFieldName = FieldColumns[i].m_sFieldName; + String sFieldName = FieldColumns[i].getFieldName(); int nColIndex = JavaTools.FieldInList(AllQueryFieldNames, sFieldName) + 1; FieldColumns[i].ColIndex = nColIndex; if (nColIndex == -1) @@ -283,7 +283,7 @@ public class RecordParser extends QueryMetaData public Object getGroupColumnValue(int ColIndex) { FieldColumn CurDBFieldColumn = this.GroupFieldColumns[ColIndex]; - return getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.FieldType); + return getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.getFieldType()); } public boolean getcurrentRecordData(java.util.Vector DataVector) @@ -292,7 +292,7 @@ public class RecordParser extends QueryMetaData for (int i = 0; i < RecordFieldColumns.length; i++) { FieldColumn CurDBFieldColumn = this.RecordFieldColumns[i]; - RecordValueArray[i] = getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.FieldType); //FinalColIndex + RecordValueArray[i] = getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.getFieldType()); //FinalColIndex } DataVector.addElement(RecordValueArray); return true; diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 7122bb40528c..db5ccd32b8f7 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -337,7 +337,7 @@ public class SQLQueryComposer FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname); CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName()); String curAliasName = curComposedCommandName.getAliasName(); - return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.m_sFieldName); + return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.getFieldName()); } private CommandName getComposedCommandByAliasName(String _AliasName) diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index b390e44caefe..aa9986b8d9db 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -130,7 +130,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen try { createTypeInspector(); - sTableFilters = (String[]) AnyConverter.toArray(xDataSourcePropertySet.getPropertyValue("TableFilter")); + sTableFilters = (String[]) AnyConverter.toArray(getDataSourcePropertySet().getPropertyValue("TableFilter")); } catch (Exception e) { @@ -261,9 +261,9 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen if (!isColunnNameDuplicate(xNameAccessColumns, xColPropertySet)) { xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", new Integer(32423)) - } - else - { + } + else + { breturn = false; } } @@ -851,7 +851,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen sTableFilters = sNewTableFilters; try { - xDataSourcePropertySet.setPropertyValue("TableFilter", sTableFilters); + getDataSourcePropertySet().setPropertyValue("TableFilter", sTableFilters); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java index 5133ff6fcc42..479c3b6d5980 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -80,15 +80,15 @@ public class TypeInspector try { xResultSet = _xResultSet; - Vector aTypeNameVector = new Vector(); - Vector aTypeVector = new Vector(); - Vector aNullableVector = new Vector(); - Vector aAutoIncrementVector = new Vector(); - Vector aPrecisionVector = new Vector(); - Vector aMinScaleVector = new Vector(); - Vector aMaxScaleVector = new Vector(); - Vector aSearchableVector = new Vector(); - Integer[] aIntegerDataTypes = null; + Vector<String> aTypeNameVector = new Vector<String>(); + Vector<Integer> aTypeVector = new Vector<Integer>(); + Vector<Integer> aNullableVector = new Vector<Integer>(); + Vector<Boolean> aAutoIncrementVector = new Vector<Boolean>(); + Vector<Integer> aPrecisionVector = new Vector<Integer>(); + Vector<Integer> aMinScaleVector = new Vector<Integer>(); + Vector<Integer> aMaxScaleVector = new Vector<Integer>(); + Vector<Integer> aSearchableVector = new Vector<Integer>(); + // Integer[] aIntegerDataTypes = null; // XResultSet xResultSet = xDBMetaDagetTypeInfo(); XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); while (xResultSet.next()) diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index cad712c2d3be..ed48ddbc04ea 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -57,9 +57,9 @@ public class DatabaseControl extends Control { super(); // m_FieldColumn = _curfieldcolumn; - if (_curfieldcolumn.FieldType != DataType.TIMESTAMP) + if (_curfieldcolumn.getFieldType() != DataType.TIMESTAMP) { - createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.FieldType, _curfieldcolumn.getFieldTitle()); + createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.getFieldType(), _curfieldcolumn.getFieldTitle()); } } @@ -80,7 +80,7 @@ public class DatabaseControl extends Control try { m_nFieldType = _fieldtype; - String sFieldName = _curfieldcolumn.m_sFieldName; + String sFieldName = _curfieldcolumn.getFieldName(); String sUniqueName = Desktop.getUniqueName(_oGridControl.xNameAccess, sFieldName); String sGridColumnName = getGridColumnName(); diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 6a35a1399d7e..20555455e2fe 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -35,9 +35,11 @@ import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XControlModel; import com.sun.star.awt.XDevice; import com.sun.star.beans.XPropertySet; +import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XChild; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; +import com.sun.star.lang.WrappedTargetException; import com.sun.star.view.XControlAccess; import com.sun.star.wizards.common.*; @@ -70,9 +72,7 @@ public class FormHandler public XDrawPage xDrawPage; private XDrawPageSupplier xDrawPageSupplier; public String[] sModelServices = new String[8]; - public XNameContainer xNamedForm; public static ControlData[] oControlData; - // ControlData[] oImageControlData; public final static int SOLABEL = 0; public final static int SOTEXTBOX = 1; @@ -126,7 +126,7 @@ public class FormHandler sModelServices[SOGRIDCONTROL] = "com.sun.star.form.component.GridControl"; sModelServices[SOIMAGECONTROL] = "com.sun.star.form.component.DatabaseImageControl"; - oControlData = new ControlData[21]; + oControlData = new ControlData[22]; oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false); oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false); oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); @@ -149,6 +149,8 @@ public class FormHandler oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false); + + oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, "ImageControl", "TextField", false); } public int getControlType(int _fieldtype) @@ -298,7 +300,7 @@ public class FormHandler { for (int i = xDrawPage.getCount() - 1; i >= 0; i--) { - if (hasControlByName(_FormName, xDrawPage.getByIndex(i))) + if (belongsToForm(xDrawPage.getByIndex(i), _FormName)) { XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); xDrawPage.remove(xShape); @@ -311,7 +313,23 @@ public class FormHandler } } - public boolean hasControlByName(String _FormName, Object _oDrawPageElement) + public void removeElement( XNameContainer _parentContainer, String _formName ) + { + try + { + _parentContainer.removeByName( _formName ); + } + catch ( WrappedTargetException e ) + { + e.printStackTrace( System.err ); + } + catch( final NoSuchElementException e ) + { + e.printStackTrace( System.err ); + } + } + + public boolean belongsToForm(Object _oDrawPageElement, String _FormName) { XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement); if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape")) @@ -324,7 +342,7 @@ public class FormHandler XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, xControlModel); XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChild.getParent()); String sName = xNamed.getName(); - return _FormName.equals(xNamed.getName()); + return _FormName.equals(sName); } } return false; @@ -339,6 +357,7 @@ public class FormHandler { oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form"); _xNamedFormContainer.insertByName(_FormName, oDBForm); + XNameContainer xNamedForm; xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm); return xNamedForm; } diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java index f175db51762e..426aa026213b 100644 --- a/wizards/com/sun/star/wizards/document/GridControl.java +++ b/wizards/com/sun/star/wizards/document/GridControl.java @@ -77,7 +77,7 @@ public class GridControl extends Shape for (int i = 0; i < fieldcolumns.length; i++) { FieldColumn curfieldcolumn = fieldcolumns[i]; - if (curfieldcolumn.FieldType == DataType.TIMESTAMP) + if (curfieldcolumn.getFieldType() == DataType.TIMESTAMP) { TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn); } diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index 5b9473ba4c60..e147910fa90a 100644 --- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java +++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java @@ -41,19 +41,19 @@ import com.sun.star.wizards.ui.UIConsts; public class DataEntrySetter { - WizardDialog CurUnoDialog; - short curtabindex; - XRadioButton optNewDataOnly; - XRadioButton optDisplayAllData; - XCheckBox chknomodification; - XCheckBox chknodeletion; - XCheckBox chknoaddition; + private WizardDialog CurUnoDialog; + private short curtabindex; + private XRadioButton optNewDataOnly; + private XRadioButton optDisplayAllData; + private XCheckBox chknomodification; + private XCheckBox chknodeletion; + private XCheckBox chknoaddition; public DataEntrySetter(WizardDialog _CurUnoDialog) { this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SODATAPAGE * 100); - Integer IDataStep = new Integer(FormWizard.SODATAPAGE); + curtabindex = (short) (FormWizard.SODATA_PAGE * 100); + Integer IDataStep = new Integer(FormWizard.SODATA_PAGE); String sNewDataOnly = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 44); // String sDisplayAllData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 46); // String sNoModification = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 47); // AllowUpdates diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java index 0624624caaba..3e2721161c60 100644 --- a/wizards/com/sun/star/wizards/form/FieldLinker.java +++ b/wizards/com/sun/star/wizards/form/FieldLinker.java @@ -45,22 +45,22 @@ import com.sun.star.wizards.ui.DBLimitedFieldSelection; public class FieldLinker extends DBLimitedFieldSelection { - XFixedText[] lblSlaveFields; - XFixedText[] lblMasterFields; - XListBox[] lstSlaveFields; - XListBox[] lstMasterFields; - final int SOMASTERINDEX = 1; - final int SOSLAVEINDEX = 0; - int SOFIRSTLINKLST = 0; - int SOSECLINKLST = 1; - int SOTHIRDLINKLST = 2; - int SOFOURTHLINKLST = 3; - int[] SOLINKLST = null; - String[] sSlaveListHeader; - String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); - String sSlaveHidString; - String sMasterHidString; - Integer IListBoxPosX; + private XFixedText[] lblSlaveFields; + private XFixedText[] lblMasterFields; + private XListBox[] lstSlaveFields; + private XListBox[] lstMasterFields; + private final int SOMASTERINDEX = 1; + private final int SOSLAVEINDEX = 0; + private int SOFIRSTLINKLST = 0; + private int SOSECLINKLST = 1; + private int SOTHIRDLINKLST = 2; + private int SOFOURTHLINKLST = 3; + private int[] SOLINKLST = null; + private String[] sSlaveListHeader; + private String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); + private String sSlaveHidString; + private String sMasterHidString; + private Integer IListBoxPosX; public FieldLinker(WizardDialog _CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int _firsthelpid) { @@ -104,11 +104,29 @@ public class FieldLinker extends DBLimitedFieldSelection lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), new String[] { - "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Dropdown", + "Enabled", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sSlaveHidString, new Integer(97), new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), new Integer(97) + Boolean.TRUE, + new Boolean(bDoEnable), + UIConsts.INTEGER_12, + sSlaveHidString, + Short.valueOf(UnoDialog.getListBoxLineCount()), + new Integer(97), + new Integer(iCurPosY + 10), + IStep, + new Short(curtabindex++), + new Integer(97) }); lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(), @@ -124,11 +142,29 @@ public class FieldLinker extends DBLimitedFieldSelection lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), new String[] { - "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Dropdown", + "Enabled", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sMasterHidString, new Integer(206), new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), new Integer(97) + Boolean.TRUE, + new Boolean(bDoEnable), + UIConsts.INTEGER_12, + sMasterHidString, + Short.valueOf(UnoDialog.getListBoxLineCount()), + new Integer(206), + new Integer(iCurPosY + 10), + IStep, + new Short(curtabindex++), + new Integer(97) }); iCurPosY = iCurPosY + 38; } @@ -140,8 +176,10 @@ public class FieldLinker extends DBLimitedFieldSelection protected void enableNextControlRow(int curindex) { - setMaxSelIndex(); - boolean bDoEnable = ((lstSlaveFields[curindex].getSelectedItemPos() > 0) && (lstMasterFields[curindex].getSelectedItemPos() > 0)); + // setMaxSelIndex(); + boolean bSlaveField = lstSlaveFields[curindex].getSelectedItemPos() > 0; + boolean bMasterField = lstMasterFields[curindex].getSelectedItemPos() > 0; + boolean bDoEnable = (bSlaveField && bMasterField); if (!bDoEnable) { moveupSelectedItems(curindex, bDoEnable); @@ -152,9 +190,9 @@ public class FieldLinker extends DBLimitedFieldSelection } } - protected void setMaxSelIndex() + protected int getMaxSelIndex() { - MaxSelIndex = -1; + int MaxSelIndex = -1; for (int i = 0; i < rowcount; i++) { if ((lstSlaveFields[i].getSelectedItemPos() > 0) && (lstMasterFields[i].getSelectedItemPos() > 0)) @@ -162,6 +200,7 @@ public class FieldLinker extends DBLimitedFieldSelection MaxSelIndex += 1; } } + return MaxSelIndex; } protected void toggleControlRow(int i, boolean bDoEnable) @@ -174,14 +213,8 @@ public class FieldLinker extends DBLimitedFieldSelection Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "Enabled", new Boolean(bDoEnable)); if (bDoEnable == false) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] - { - 0 - }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] - { - 0 - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] { 0 }); } } } @@ -193,34 +226,22 @@ public class FieldLinker extends DBLimitedFieldSelection if ((iNextMasterItemPos != 0) && (iNextSlaveItemPos != 0)) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] - { - iNextMasterItemPos - }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] - { - iNextSlaveItemPos - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] {iNextMasterItemPos }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] {iNextSlaveItemPos}); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] - { - 0 - }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] - { - 0 - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] { 0 }); toggleControlRow(curindex, true); } } public void initialize(String[] _AllMasterFieldNames, String[] _AllSlaveFieldNames, String[][] _LinkFieldNames) { - short[] MasterSelList = null; - short[] SlaveSelList = null; + // short[] MasterSelList = null; + // short[] SlaveSelList = null; String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX); String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX); - String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); + String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefiened-' String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames); for (int i = 0; i < super.rowcount; i++) { @@ -249,10 +270,10 @@ public class FieldLinker extends DBLimitedFieldSelection */ public String[][] getLinkFieldNames() { - String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19); - setMaxSelIndex(); - String[][] LinkFieldNames = new String[2][MaxSelIndex + 1]; - for (int i = 0; i <= MaxSelIndex; i++) + // setMaxSelIndex(); + int nSelectedIndex = getMaxSelIndex(); + String[][] LinkFieldNames = new String[2][nSelectedIndex + 1]; + for (int i = 0; i <= nSelectedIndex; i++) { LinkFieldNames[0][i] = lstSlaveFields[i].getSelectedItem(); LinkFieldNames[1][i] = lstMasterFields[i].getSelectedItem(); @@ -260,18 +281,17 @@ public class FieldLinker extends DBLimitedFieldSelection int iduplicate = JavaTools.getDuplicateFieldIndex(LinkFieldNames); if (iduplicate != -1) { + String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19); String sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLinkFieldsAreDuplicate, LinkFieldNames[0][iduplicate], "<FIELDNAME1>"); sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLocLinkFieldsAreDuplicate, LinkFieldNames[1][iduplicate], "<FIELDNAME2>"); - CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKERPAGE); + CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKER_PAGE); CurUnoDialog.enableNavigationButtons(true, true, true); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocLinkFieldsAreDuplicate); CurUnoDialog.setFocus("lstSlaveFieldLink" + (iduplicate + 1)); return null; } - else - { return LinkFieldNames; - } + } public void enable(boolean _bdoenable) diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index b17808bb7201..2b1ffc5786e2 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -55,7 +55,7 @@ public class Finalizer public Finalizer(WizardDialog _CurUnoDialog) { this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SOSTOREPAGE * 100); + curtabindex = (short) (FormWizard.SOSTORE_PAGE * 100); String slblFormName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 50); String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 51); diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index 4ba746573852..989bb333b437 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -58,7 +58,7 @@ public class FormConfiguration XFixedText lblRelations; XListBox lstRelations; String[] sreferencedTables; - Integer ISubFormStep; + // Integer ISubFormStep; CommandFieldSelection CurSubFormFieldSelection; String SSUBFORMMODE = "toggleSubFormMode"; String STOGGLESTEPS = "toggleSteps"; @@ -69,14 +69,15 @@ public class FormConfiguration public FormConfiguration(WizardDialog _CurUnoDialog) { this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SOSUBFORMPAGE * 100); - Integer ISubFormStep = new Integer(FormWizard.SOSUBFORMPAGE); + curtabindex = (short) (FormWizard.SOSUBFORM_PAGE * 100); + Integer ISubFormStep = new Integer(FormWizard.SOSUBFORM_PAGE); String sOnExistingRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 5); String sOnManualRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 7); String sSelectManually = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 4); String sSelectRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 8); String sSubFormDescription = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 3); + // CheckBox 'Add sub form' chkcreateSubForm = CurUnoDialog.insertCheckBox("chkcreateSubForm", SSUBFORMMODE, this, new String[] { @@ -134,6 +135,11 @@ public class FormConfiguration CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue()); } + // public void disableSubFormCheckBox() + // { + // Helper.setUnoPropertyValue(UnoDialog.getModel(chkcreateSubForm), "Enabled", Boolean.FALSE); + // } + public RelationController getRelationController() { return oRelationController; @@ -174,15 +180,15 @@ public class FormConfiguration } else if (optSelectManually.getState()) { - CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0)); - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, true); + CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0)); + CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true); } } else { - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, false); - CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKERPAGE, false); - CurUnoDialog.enablefromStep(FormWizard.SOCONTROLPAGE, true); + CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, false); + CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false); + CurUnoDialog.enablefromStep(FormWizard.SOCONTROL_PAGE, true); } toggleRelationsListbox(); } @@ -210,18 +216,18 @@ public class FormConfiguration { if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName)) { - CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDSPAGE, true); - CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKERPAGE, false); + CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, true); + CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false); return; } else { - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, true); - CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, false); + CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true); + CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, false); return; } } - CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDSPAGE, false); + CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, false); } private void toggleRelationsListbox() diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 339c0551ccbd..1f67ee576196 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -49,44 +49,45 @@ import com.sun.star.wizards.document.TimeStampControl; public class FormControlArranger { - XNameContainer xFormName; - XMultiServiceFactory xMSF; - public DatabaseControl[] DBControlList = null; + protected DatabaseControl[] DBControlList = null; + + private XNameContainer xFormName; + private XMultiServiceFactory xMSF; private Control[] LabelControlList = null; private XStatusIndicator xProgressBar; private FieldColumn[] FieldColumns; - DatabaseControl curDBControl; + private DatabaseControl curDBControl; // Control curLabelControl; - int icurArrangement; - boolean bIsFirstRun; - boolean bIsVeryFirstRun; - boolean bControlsareCreated; - int cXOffset; - int cYOffset; - final int cVertDistance = 200; - final int cHoriDistance = 300; - final int cLabelGap = 100; - final double CMAXREDUCTION = 0.7; - FormHandler oFormHandler; - int iReduceWidth; - int nXTCPos; - int nYTCPos; - int nXDBPos; - int nYDBPos; - int nTCHeight; - int nTCWidth; - int nDBHeight; - int nDBWidth; - int nMaxTCWidth; - int nFormWidth; - int nFormHeight; - int nMaxRowY; - int nSecMaxRowY; - int nMaxColRightX; - int a; - int StartA; - int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form - Short NBorderType = new Short((short) 1); //3-D Border + private int icurArrangement; + private boolean bIsFirstRun; + private boolean bIsVeryFirstRun; + private boolean bControlsareCreated; + private int cXOffset; + private int cYOffset; + private static final int cVertDistance = 200; + private static final int cHoriDistance = 300; + private static final int cLabelGap = 100; + private static final double CMAXREDUCTION = 0.7; + private FormHandler oFormHandler; + private int iReduceWidth; + private int nXTCPos; + private int nYTCPos; + private int nXDBPos; + private int nYDBPos; + private int nTCHeight; + private int nTCWidth; + private int nDBHeight; + private int nDBWidth; + private int nMaxTCWidth; + private int nFormWidth; + private int nFormHeight; + private int nMaxRowY; + private int nSecMaxRowY; + private int nMaxColRightX; + private int a; + private int StartA; + private int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form + private Short NBorderType = new Short((short) 1); //3-D Border public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize) { @@ -140,7 +141,7 @@ public class FormControlArranger private boolean isReducable(int _index) { boolean bisreducable = false; - int ntype = this.FieldColumns[_index].FieldType; + int ntype = this.FieldColumns[_index].getFieldType(); switch (ntype) { case DataType.TINYINT: @@ -294,7 +295,7 @@ public class FormControlArranger { nControlBaseWidth = curDBControl.getSize().Width; } - if (FieldColumns[i].FieldType == DataType.TIMESTAMP) + if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP) { TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl; nControlBaseWidth = oDBTimeStampControl.getSize().Width; @@ -570,7 +571,7 @@ public class FormControlArranger { Point aPoint = new Point(nXTCPos, nYTCPos); Size aSize = new Size(nTCWidth, nTCHeight); - final String sFieldName = FieldColumns[i].m_sFieldName; + final String sFieldName = FieldColumns[i].getFieldName(); this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize); if (bIsVeryFirstRun) { @@ -581,7 +582,7 @@ public class FormControlArranger } String sTitle = FieldColumns[i].getFieldTitle(); nTCWidth = LabelControlList[i].getPreferredWidth(sTitle); - } + } Control curLabelControl = LabelControlList[i]; if (icurArrangement == FormWizard.SOCOLUMNARLEFT) { @@ -625,8 +626,8 @@ public class FormControlArranger { try { - String sFieldName = FieldColumns[i].m_sFieldName; - int nFieldType = FieldColumns[i].FieldType; + String sFieldName = FieldColumns[i].getFieldName(); + int nFieldType = FieldColumns[i].getFieldType(); Point aPoint = new Point(nXDBPos, nYDBPos); if (bControlsareCreated) @@ -664,8 +665,7 @@ public class FormControlArranger } if (nFieldType == DataType.LONGVARCHAR) /* memo */ { - LabelControlList[i].setPropertyValue("MultiLine", Boolean.TRUE); - // Helper.setUnoPropertyValue(LabelControlList[i], "MultiLine", Boolean.TRUE); + Helper.setUnoPropertyValue(LabelControlList[i], "MultiLine", Boolean.TRUE); } checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true); aDBControl.setPropertyValue("Border", NBorderType); diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 7938b139decc..b3e163859f7b 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -37,7 +37,6 @@ import com.sun.star.awt.Size; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameContainer; -import com.sun.star.frame.XModel; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; @@ -53,35 +52,28 @@ import com.sun.star.wizards.document.GridControl; public class FormDocument extends TextDocument { - - public FormHandler oFormHandler; - public ViewHandler oViewHandler; - public TextStyleHandler oTextStyleHandler; - public XPropertySet xPropPageStyle; - public final int SOSYMBOLMARGIN = 2000; + protected Vector oControlForms = new Vector(); + protected CommandMetaData oMainFormDBMetaData; + protected CommandMetaData oSubFormDBMetaData; + protected String[][] LinkFieldNames; + + private FormHandler oFormHandler; + private ViewHandler oViewHandler; + private TextStyleHandler oTextStyleHandler; + private XPropertySet xPropPageStyle; private final int SOFORMGAP = 2000; - public Vector oControlForms = new Vector(); - public CommandMetaData oMainFormDBMetaData; - public CommandMetaData oSubFormDBMetaData; private boolean bhasSubForm; private UIControlArranger curUIControlArranger; - public StyleApplier curStyleApplier; - public String[][] LinkFieldNames; - public XModel xModel; - private String sMsgEndAutopilot; - int MainFormStandardHeight; - int nPageWidth; - int nPageHeight; - int nFormWidth; - int nFormHeight; - int nMainFormFieldCount; - int totfieldcount; - Point aMainFormPoint; - Point aSubFormPoint; - final static String SOMAINFORM = "MainForm"; - final static String SOSUBFORM = "SubForm"; - - public FormDocument(XMultiServiceFactory xMSF, Resource oResource) + private StyleApplier curStyleApplier; + private int nPageWidth; + private int nPageHeight; + private int nFormWidth; + private int nFormHeight; + private Point aMainFormPoint; + private final static String SOMAINFORM = "MainForm"; + private final static String SOSUBFORM = "SubForm"; + + public FormDocument(XMultiServiceFactory xMSF) { super(xMSF, new TextDocument.ModuleIdentifier("com.sun.star.sdb.FormDesign"), true); try @@ -101,7 +93,6 @@ public class FormDocument extends TextDocument Size aSize = oTextStyleHandler.changePageAlignment(xPropPageStyle, true); nPageWidth = aSize.Width; nPageHeight = aSize.Height; - sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33); } catch (Exception e) { @@ -129,7 +120,7 @@ public class FormDocument extends TextDocument try { int nMargin; - totfieldcount = getTotFieldCount(); + int totfieldcount = getMainFieldCount() + getSubFieldCount(); if (totfieldcount > 30) { nMargin = 500; @@ -156,15 +147,16 @@ public class FormDocument extends TextDocument } } - public void initialize(boolean _baddParentForm, boolean _bhasSubForm, boolean _bModifySubForm, Short _NBorderType) + public void initialize(boolean _baddParentForm, boolean _bShouldHaveSubForm, boolean _bModifySubForm, Short _NBorderType) { - bhasSubForm = _bhasSubForm; + bhasSubForm = _bShouldHaveSubForm; adjustPageStyle(); if (_baddParentForm) { if (oControlForms.size() == 0) { - oControlForms.addElement(new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID))); + final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID)); + oControlForms.addElement(aMainControlForm); } else { @@ -173,13 +165,15 @@ public class FormDocument extends TextDocument } ((ControlForm) oControlForms.get(0)).initialize(curUIControlArranger.getSelectedArrangement(0), _NBorderType); } - if (_bhasSubForm) + if (_bShouldHaveSubForm) { if (oControlForms.size() == 1) { adjustMainFormSize(_NBorderType); - oControlForms.addElement(new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize())); - ((ControlForm) oControlForms.get(1)).initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType); + final ControlForm aSubControlForm = new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize()); + oControlForms.addElement(aSubControlForm); + /* ((ControlForm) oControlForms.get(1))*/ + aSubControlForm.initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType); } else if (_bModifySubForm) { @@ -193,20 +187,28 @@ public class FormDocument extends TextDocument } else { - if (oFormHandler.hasFormByName(SOSUBFORM)) - { - oFormHandler.removeFormByName(SOSUBFORM); + ControlForm aMainForm = (ControlForm) oControlForms.get(0); + // boolean bHasSubForm = aMainForm.xFormContainer.hasByName(SOSUBFORM); + // WRONG if (oFormHandler.hasFormByName(SOSUBFORM)) + if (aMainForm.xFormContainer != null && aMainForm.xFormContainer.hasByName(SOSUBFORM)) + { + oFormHandler.removeControlsofForm(SOSUBFORM); + oFormHandler.removeElement( aMainForm.xFormContainer, SOSUBFORM ); + ((ControlForm) oControlForms.get(1)).oFormController = null; + // aMainForm.xFormContainer = null; // .removeFormByName(SOSUBFORM); oControlForms.remove(1); adjustMainFormSize(_NBorderType); } } } - private int getTotFieldCount() + private int getMainFieldCount() + { + return oMainFormDBMetaData.getFieldNames().length; + } + private int getSubFieldCount() { - nMainFormFieldCount = oMainFormDBMetaData.getFieldNames().length; - totfieldcount = nMainFormFieldCount + oSubFormDBMetaData.getFieldNames().length; - return totfieldcount; + return oSubFormDBMetaData.getFieldNames().length; } private Size getMainFormSize(int _curArrangement) @@ -220,12 +222,11 @@ public class FormDocument extends TextDocument } else { - totfieldcount = getTotFieldCount(); - nMainFormHeight = (int) (((double) nMainFormFieldCount / (double) totfieldcount) * ((double) (nFormHeight - SOFORMGAP) / 2)); + int nTotalFieldCount = getMainFieldCount() + getSubFieldCount(); + nMainFormHeight = (int) (((double) getMainFieldCount() / (double) nTotalFieldCount) * ((double) (nFormHeight - SOFORMGAP) / 2)); } } Size aMainFormSize = new Size(nFormWidth, nMainFormHeight); - MainFormStandardHeight = nMainFormHeight; return aMainFormSize; } diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 9c865a179565..5b0a7939f6c2 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -29,6 +29,7 @@ ************************************************************************/ package com.sun.star.wizards.form; +import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XComponent; @@ -40,39 +41,35 @@ import com.sun.star.wizards.ui.*; public class FormWizard extends WizardDialog { - CommandFieldSelection curDBCommandFieldSelection; - FormConfiguration curFormConfiguration; - CommandFieldSelection curSubFormFieldSelection; - FormDocument curFormDocument; - FieldLinker curFieldLinker; - UIControlArranger curControlArranger; - DataEntrySetter CurDataEntrySetter; - StyleApplier curStyleApplier; - Finalizer curFinalizer; - static String slblFields; - static String slblSelFields; - String sShowBinaryFields = ""; - String sMsgWizardName = ""; - String serrFormNameexists = ""; - public static final int SONULLPAGE = 0; - public static final int SOMAINPAGE = 1; - public static final int SOSUBFORMPAGE = 2; - public static final int SOSUBFORMFIELDSPAGE = 3; - public static final int SOFIELDLINKERPAGE = 4; - public static final int SOCONTROLPAGE = 5; - public static final int SODATAPAGE = 6; - public static final int SOSTYLEPAGE = 7; - public static final int SOSTOREPAGE = 8; + private CommandFieldSelection curDBCommandFieldSelection; + private FormConfiguration curFormConfiguration; + private CommandFieldSelection curSubFormFieldSelection; + private FormDocument curFormDocument; + private FieldLinker curFieldLinker; + private UIControlArranger curControlArranger; + private DataEntrySetter CurDataEntrySetter; + private StyleApplier curStyleApplier; + private Finalizer curFinalizer; + private static String slblFields; + private static String slblSelFields; + private String sShowBinaryFields = ""; + private String serrFormNameexists = ""; + public static final int SOMAIN_PAGE = 1; + public static final int SOSUBFORM_PAGE = 2; + public static final int SOSUBFORMFIELDS_PAGE = 3; + public static final int SOFIELDLINKER_PAGE = 4; + public static final int SOCONTROL_PAGE = 5; + public static final int SODATA_PAGE = 6; + public static final int SOSTYLE_PAGE = 7; + public static final int SOSTORE_PAGE = 8; public static final int SOCOLUMNARLEFT = 1; public static final int SOCOLUMNARTOP = 2; public static final int SOGRID = 3; public static final int SOTOPJUSTIFIED = 4; - String WizardHeaderText[] = new String[8]; - String slblTables; - boolean bFormOpenMode; - boolean bcreateForm = false; - String FormName; - Short NBorderValue = null; + private String slblTables; + private boolean bFormOpenMode; + private boolean bcreateForm = false; + private String FormName; public FormWizard(XMultiServiceFactory xMSF) { @@ -94,11 +91,12 @@ public class FormWizard extends WizardDialog } } + // @Override protected void enterStep(int nOldStep, int nNewStep) { try { - if ((nOldStep < SOCONTROLPAGE) && (nNewStep >= SOCONTROLPAGE)) + if ((nOldStep < SOCONTROL_PAGE) && (nNewStep >= SOCONTROL_PAGE)) { curFormDocument.initialize(curDBCommandFieldSelection.isModified(), curFormConfiguration.hasSubForm(), curSubFormFieldSelection.isModified(), getBorderType()); curDBCommandFieldSelection.setModified(false); @@ -106,29 +104,51 @@ public class FormWizard extends WizardDialog } switch (nNewStep) { - case SOMAINPAGE: + case SOMAIN_PAGE: curDBCommandFieldSelection.setModified(false); break; - case SOSUBFORMPAGE: - RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, curDBCommandFieldSelection.getSelectedCommandName()); + case SOSUBFORM_PAGE: + { + final String sCommandName = curDBCommandFieldSelection.getSelectedCommandName(); + RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, sCommandName); curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController); + } break; - case SOSUBFORMFIELDSPAGE: - String spreselectedTableName = curFormConfiguration.getreferencedTableName(); - curSubFormFieldSelection.preselectCommand(spreselectedTableName, (spreselectedTableName.length() > 0)); + case SOSUBFORMFIELDS_PAGE: + { + String sPreSelectedTableName = curFormConfiguration.getreferencedTableName(); + boolean bReadOnly = (sPreSelectedTableName.length() > 0); + if (sPreSelectedTableName.length() == 0) + { + final String sTableName = curSubFormFieldSelection.getSelectedCommandName(); + String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames(); + curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames); + } + else + { + curSubFormFieldSelection.preselectCommand(sPreSelectedTableName, bReadOnly); + } + } break; - case SOFIELDLINKERPAGE: - curFieldLinker.initialize(curFormDocument.oMainFormDBMetaData.getFieldNames(), curFormDocument.oSubFormDBMetaData.getFieldNames(), curFormDocument.LinkFieldNames); + case SOFIELDLINKER_PAGE: + { + final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames(); + final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames(); + curFieldLinker.initialize(aMainFieldNames, aSubFieldNames, curFormDocument.LinkFieldNames); + } break; - case SOCONTROLPAGE: + case SOCONTROL_PAGE: curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm()); break; - case SODATAPAGE: + case SODATA_PAGE: break; - case SOSTYLEPAGE: + case SOSTYLE_PAGE: break; - case SOSTOREPAGE: - this.curFinalizer.initialize(this.curDBCommandFieldSelection.getSelectedCommandName(), curFormDocument); + case SOSTORE_PAGE: + { + String sTableName = this.curDBCommandFieldSelection.getSelectedCommandName(); + this.curFinalizer.initialize(sTableName, curFormDocument); + } break; default: break; @@ -145,36 +165,61 @@ public class FormWizard extends WizardDialog return curStyleApplier.getBorderType(); } + // @Override protected void leaveStep(int nOldStep, int nNewStep) { switch (nOldStep) { - case SOMAINPAGE: + case SOMAIN_PAGE: // curFormDocument.oMainFormDBMetaData.setFieldNames(curDBCommandFieldSelection.getSelectedFieldNames()); - curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, curDBCommandFieldSelection.getSelectedCommandName(), curDBCommandFieldSelection.getSelectedFieldNames()); - curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, curFormDocument.oMainFormDBMetaData.getFieldNames(), 1); + { + final String sTableName = curDBCommandFieldSelection.getSelectedCommandName(); + final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames(); + curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames); + + final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames(); + try + { + curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aMainFieldNames, 1); + } + catch (java.lang.Exception e) + {} + } break; - case SOSUBFORMPAGE: + case SOSUBFORM_PAGE: break; - case SOSUBFORMFIELDSPAGE: - curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, curSubFormFieldSelection.getSelectedCommandName(), curSubFormFieldSelection.getSelectedFieldNames()); - curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, curFormDocument.oSubFormDBMetaData.getFieldNames(), 0); + case SOSUBFORMFIELDS_PAGE: + { + final String sTableName = curSubFormFieldSelection.getSelectedCommandName(); + final String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames(); + curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames); + + final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames(); + try + { + curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aSubFieldNames, 0); + } + catch (java.lang.Exception e) + {} + } break; - case SOFIELDLINKERPAGE: + case SOFIELDLINKER_PAGE: + curFormDocument.LinkFieldNames = curFieldLinker.getLinkFieldNames(); break; - case SOCONTROLPAGE: + case SOCONTROL_PAGE: break; - case SODATAPAGE: + case SODATA_PAGE: break; - case SOSTYLEPAGE: + case SOSTYLE_PAGE: break; - case SOSTOREPAGE: + case SOSTORE_PAGE: break; default: break; } } +/* public static void main(String args[]) { @@ -190,7 +235,14 @@ public class FormWizard extends WizardDialog curproperties = new PropertyValue[1]; // curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); - curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); //file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");*// /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1");*// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");* // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); //Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties); + curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); + // file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); + // MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); + // /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1"); + // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); + // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); + // Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties); + CurFormWizard.startFormWizard(xLocMSF, curproperties); } } @@ -199,13 +251,14 @@ public class FormWizard extends WizardDialog exception.printStackTrace(System.out); } } +*/ public void buildSteps() throws NoValidPathException { curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411); curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); curFormDocument.xProgressBar.setValue(20); - + // Label Help Text insertLabel("lblBinaryHelpText", new String[] { @@ -213,13 +266,13 @@ public class FormWizard extends WizardDialog }, new Object[] { - new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAINPAGE), new Integer(210) + new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAIN_PAGE), new Integer(210) }); curFormConfiguration = new FormConfiguration(this); curFormDocument.xProgressBar.setValue(30); - curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDSPAGE, 92, slblFields, slblSelFields, slblTables, true, 34431); + curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDS_PAGE, 92, slblFields, slblSelFields, slblTables, true, 34431); curSubFormFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); insertLabel("lblSubFormBinaryHelpText", new String[] @@ -228,12 +281,12 @@ public class FormWizard extends WizardDialog }, new Object[] { - new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDSPAGE), new Integer(210) + new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDS_PAGE), new Integer(210) }); curFormDocument.xProgressBar.setValue(40); - curFieldLinker = new FieldLinker(this, SOFIELDLINKERPAGE, 95, 30, 210, 34441); + curFieldLinker = new FieldLinker(this, SOFIELDLINKER_PAGE, 95, 30, 210, 34441); curFormDocument.xProgressBar.setValue(50); curControlArranger = new UIControlArranger(this, curFormDocument); @@ -254,10 +307,11 @@ public class FormWizard extends WizardDialog curFormDocument.xProgressBar.end(); } + // @Override public void finishWizard() { int ncurStep = getCurrentStep(); - if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)) + if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE)) { this.curFinalizer.initialize(curDBCommandFieldSelection.getSelectedCommandName(), this.curFormDocument); String sNewFormName = curFinalizer.getName(); @@ -267,7 +321,7 @@ public class FormWizard extends WizardDialog FormName = curFinalizer.getName(); if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration)) { - ; + if (curFinalizer.finish()) { bcreateForm = true; @@ -283,6 +337,7 @@ public class FormWizard extends WizardDialog } } + // @Override public void cancelWizard() { bcreateForm = false; @@ -293,14 +348,14 @@ public class FormWizard extends WizardDialog { addRoadmap(); int i = 0; - i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAINPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORMPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDSPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKERPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROLPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATAPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLEPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 87), SOSTOREPAGE); + i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAIN_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORM_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDS_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKER_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROL_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATA_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLE_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 87), SOSTORE_PAGE); setRoadmapInteractive(true); setRoadmapComplete(true); setCurrentRoadmapItemID((short) 1); @@ -311,7 +366,7 @@ public class FormWizard extends WizardDialog XComponent[] ret = null; try { - curFormDocument = new FormDocument(xMSF, m_oResource); + curFormDocument = new FormDocument(xMSF); if (curFormDocument.oMainFormDBMetaData.getConnection(CurPropertyValue)) { curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[] @@ -319,10 +374,12 @@ public class FormWizard extends WizardDialog Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection) }); curFormDocument.xProgressBar.setValue(20); + // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields"); buildSteps(); + // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields"); this.curDBCommandFieldSelection.preselectCommand(CurPropertyValue, false); - createWindowPeer(curFormDocument.xWindowPeer); - curFormDocument.oMainFormDBMetaData.setWindowPeer(xControl.getPeer()); + XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer); + curFormDocument.oMainFormDBMetaData.setWindowPeer(xWindowPeer2 /* xControl.getPeer() */ ); // setAutoMnemonic("lblDialogHeader", false); insertFormRelatedSteps(); short RetValue = executeDialog(curFormDocument.xFrame); @@ -347,7 +404,6 @@ public class FormWizard extends WizardDialog private boolean getFormResources() { - sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_FORM); sShowBinaryFields = m_oResource.getResText(UIConsts.RID_FORM + 2); slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6); slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12); @@ -362,11 +418,13 @@ public class FormWizard extends WizardDialog protected int ID; + // @Override public int getID() { return ID; } + // @Override public void setID(String sIncSuffix) { ID = 1; @@ -381,6 +439,7 @@ public class FormWizard extends WizardDialog } } + // @Override public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) { if (ID == 1) @@ -393,6 +452,7 @@ public class FormWizard extends WizardDialog } } + // @Override public void shiftFromRightToLeft(String[] SelItems, String[] NewItems) { // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox @@ -405,11 +465,12 @@ public class FormWizard extends WizardDialog toggleSubFormSteps(); } } - + // @Override public void moveItemDown(String item) { } + // @Override public void moveItemUp(String item) { } @@ -418,7 +479,7 @@ public class FormWizard extends WizardDialog { curSubFormFieldSelection.setModified(true); boolean benable = curSubFormFieldSelection.getSelectedFieldNames().length > 0; - enablefromStep(SOFIELDLINKERPAGE, benable); + enablefromStep(SOFIELDLINKER_PAGE, benable); if (benable) { curFieldLinker.enable(!curFormConfiguration.areexistingRelationsdefined()); @@ -430,7 +491,7 @@ public class FormWizard extends WizardDialog { curDBCommandFieldSelection.setModified(true); boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0; - enablefromStep(SOSUBFORMPAGE, benable); + enablefromStep(SOSUBFORM_PAGE, benable); setControlProperty("btnWizardNext", "Enabled", new Boolean(benable)); if (benable) { @@ -440,8 +501,8 @@ public class FormWizard extends WizardDialog } else { - setStepEnabled(SOSUBFORMFIELDSPAGE, false); - setStepEnabled(SOFIELDLINKERPAGE, false); + setStepEnabled(SOSUBFORMFIELDS_PAGE, false); + setStepEnabled(SOFIELDLINKER_PAGE, false); } } setControlProperty("btnWizardFinish", "Enabled", new Boolean(benable)); diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index c322e8933682..153de51a1f45 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -53,55 +53,57 @@ import com.sun.star.wizards.document.TimeStampControl; import com.sun.star.wizards.text.TextStyleHandler; import com.sun.star.wizards.ui.*; import com.sun.star.wizards.ui.UIConsts; +import java.util.ArrayList; + +// TODO: Style Templates fuer OOo? public class StyleApplier { - WizardDialog CurUnoDialog; - XPropertySet xPageStylePropertySet; - XMultiServiceFactory xMSF; - short curtabindex; - XRadioButton optNoBorder; - XRadioButton opt3DLook; - XRadioButton optFlat; - XListBox lstStyles; - Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles; - FormDocument curFormDocument; - short iOldLayoutPos; - int SOLAYOUTLST = 0; - String SCHANGELAYOUT = "changeLayout"; - String SCHANGEBORDERTYPE = "changeBorderLayouts"; - String[] StyleNames; - String[] StyleNodeNames; - String[] FileNames; - String StylesPath; - final static int SOBACKGROUNDCOLOR = 0; - final static int SODBTEXTCOLOR = 1; - final static int SOLABELTEXTCOLOR = 2; + private WizardDialog CurUnoDialog; + private XPropertySet xPageStylePropertySet; + private XMultiServiceFactory xMSF; + private short curtabindex; + private XRadioButton optNoBorder; + private XRadioButton opt3DLook; + private XRadioButton optFlat; + private XListBox lstStyles; + private Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles; + private FormDocument curFormDocument; + private short iOldLayoutPos; + private int SOLAYOUTLST = 0; + private static final String SCHANGELAYOUT = "changeLayout"; + private static final String SCHANGEBORDERTYPE = "changeBorderLayouts"; + private String[] StyleNames; + private String[] StyleNodeNames; + private String[] FileNames; + // private String StylesPath; + private final static int SOBACKGROUNDCOLOR = 0; + private final static int SODBTEXTCOLOR = 1; + private final static int SOLABELTEXTCOLOR = 2; // final static int SODBCONTROLBACKGROUNDCOLOR = 3; - final static int SOLABELBACKGROUNDCOLOR = 4; - final static int SOBORDERCOLOR = 5; - Short IBorderValue = new Short((short) 1); + private final static int SOLABELBACKGROUNDCOLOR = 4; + private final static int SOBORDERCOLOR = 5; + private Short IBorderValue = new Short((short) 1); public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException { - try - { +// try +// { this.curFormDocument = _curFormDocument; xMSF = curFormDocument.xMSF; - StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); - StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); + TextStyleHandler oTextStyleHandler = new TextStyleHandler(xMSF, curFormDocument.xTextDocument); xPageStylePropertySet = oTextStyleHandler.getStyleByName("PageStyles", "Standard"); this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SOSTYLEPAGE * 100); - Integer IStyleStep = new Integer(FormWizard.SOSTYLEPAGE); + curtabindex = (short) (FormWizard.SOSTYLE_PAGE * 100); + Integer IStyleStep = new Integer(FormWizard.SOSTYLE_PAGE); String sPageStyles = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 86); String sNoBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 29); String s3DLook = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 30); String sFlat = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 31); String sFieldBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 28); - XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); +// XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); setStyles(); short[] SelLayoutPos; SelLayoutPos = new short[] @@ -168,11 +170,11 @@ public class StyleApplier { UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(98) }); - } - catch (Exception e) - { - e.printStackTrace(System.out); - } +// } +// catch (Exception e) +// { +// e.printStackTrace(System.out); +// } } /* public void initialize(short _iStyleindex){ @@ -356,9 +358,49 @@ public class StyleApplier return -1; } + private XMultiServiceFactory getMSF() + { + return xMSF; + } + + private ArrayList<String> getStylePaths() + { + ArrayList<String> aStylePaths = new ArrayList<String>(); + try + { + // TODO: check different languages in header layouts + aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", "", ""); + FileAccess.combinePaths(getMSF(), aStylePaths, "/wizard/form/styles"); + + String[][] LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aStylePaths, ".css"); + + } + catch (com.sun.star.wizards.common.NoValidPathException e) + { + // if there are problems, don't show anything is a little bit hard. + aStylePaths.add("default"); + } + return aStylePaths; + } + + private String getStylePath() + { +// TODO: umstellen auf mehrere Pfade + String StylesPath = ""; + try + { + StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); + StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); + } + catch (NoValidPathException e) + { + } + return StylesPath; + } + private int[] getStyleColors(String _filename) { - String sFilePath = this.StylesPath + "/" + _filename; + String sFilePath = getStylePath() + "/" + _filename; int[] oStylePropList = new int[6]; String[] sData = FileAccess.getDataFromTextFile(xMSF, sFilePath); oStylePropList[SOBACKGROUNDCOLOR] = getStyleColor(sData, ".toctitle {", "background-color:"); @@ -414,9 +456,12 @@ public class StyleApplier { if (_iStyleColors[SODBTEXTCOLOR] > -1) { - if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) + DatabaseControl aDBControl = DBControls[n]; + if (aDBControl != null) + { + if (aDBControl.xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) { - TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; + TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; for (int i = 0; i < 2; i++) { XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); @@ -425,7 +470,8 @@ public class StyleApplier } else { - setDBControlColors(DBControls[n].xPropertySet, _iStyleColors); + setDBControlColors(aDBControl.xPropertySet, _iStyleColors); + } } } } diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index d741de9f9b63..5e967e3fa096 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -39,7 +39,8 @@ import com.sun.star.lang.EventObject; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.document.Control; -import com.sun.star.wizards.ui.ImageList; +// import com.sun.star.wizards.ui.ImageList; +import com.sun.star.wizards.ui.ButtonList; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog; @@ -51,37 +52,32 @@ import javax.swing.event.ListDataListener; public class UIControlArranger { - FormWizard CurUnoDialog; - FormDocument curFormDocument; - short curtabindex; - XRadioButton optAlignLeft; - XRadioButton optAlignRight; - XControl flnLabelPlacement; - int Index = 1; - String[] HelpTexts = new String[4]; - String[] sArrangementHeader = new String[2]; - ArrangeImageList[] oImageList = new ArrangeImageList[2]; - Integer IControlStep; - final int SOBASEIMAGEYPOSITION = 66; - final int SOIMAGELISTHEIGHT = 60; - final String SOALIGNMETHOD = "alignLabelControls"; + private FormWizard CurUnoDialog; + private FormDocument curFormDocument; + private short curtabindex; + private XRadioButton optAlignLeft; + private XRadioButton optAlignRight; + private XControl flnLabelPlacement; + private String[] HelpTexts = new String[4]; + // private String[] sArrangementHeader = new String[2]; + // private ArrangeImageList[] m_aArrangeList = new ArrangeImageList[2]; + private ArrangeButtonList[] m_aArrangeList = new ArrangeButtonList[2]; + private Integer IControlStep; + private final int SOBASEIMAGEYPOSITION = 66; + private final int SOIMAGELISTHEIGHT = 60; + private final String SOALIGNMETHOD = "alignLabelControls"; public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException { this.CurUnoDialog = _CurUnoDialog; this.curFormDocument = _curFormDocument; - curtabindex = (short) (FormWizard.SOCONTROLPAGE * 100); - IControlStep = new Integer(FormWizard.SOCONTROLPAGE); + curtabindex = (short) (FormWizard.SOCONTROL_PAGE * 100); + IControlStep = new Integer(FormWizard.SOCONTROL_PAGE); String sLabelPlacment = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 32); String sAlignLeft = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 33); String sAlignRight = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 34); - sArrangementHeader[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 41); - sArrangementHeader[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 42); - HelpTexts[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 36); - HelpTexts[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 37); - HelpTexts[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); - HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39); + // Label "Label Placement" ----------------- flnLabelPlacement = CurUnoDialog.insertFixedLine("lnLabelPlacement", new String[] { @@ -91,6 +87,7 @@ public class UIControlArranger { UIConsts.INTEGERS[8], sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207) }); + // Radio Button "Align Left" optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this, new String[] { @@ -100,6 +97,7 @@ public class UIControlArranger { UIConsts.INTEGERS[10], "HID:34451", sAlignLeft, new Integer(107), new Integer(38), new Short((short) 1), IControlStep, new Short(curtabindex++), new Integer(171) }); + // Radio Button "Align Right" optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this, new String[] { @@ -110,23 +108,73 @@ public class UIControlArranger UIConsts.INTEGERS[10], "HID:34452", sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171) }); + + HelpTexts[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 36); // "Columnar - Labels Left" + HelpTexts[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 37); // "Columnar - Labels of Top" + HelpTexts[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); // "As Data Sheet" + HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39); // In Blocks - Labels Above" + +// flnLabelPlacement = CurUnoDialog.insertFixedLine("lnArrangementHeader1", +// new String[] +// { +// "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" +// }, +// new Object[] +// { +// UIConsts.INTEGERS[8], sArrangementHeader[0], new Integer(97), new Integer(60), IControlStep, new Short(curtabindex++), new Integer(207) +// }); +// +// boolean bEnabled = true; +// int nBtnWidth = 16; +// int nXPos = 97; +// int nYPos = 70; +// CurUnoDialog.insertButton("btnLayout1", "btnLayout1", +// new String[] +// { +// "Enabled", +// "Height", +// "HelpURL", +// "Label", +// "PositionX", +// "PositionY", +// "Step", +// "TabIndex", +// "Width" +// }, +// new Object[] +// { +// Boolean.valueOf(bEnabled), +// new Integer(14), +///* TODO: WRONG!*/ "HID:34452", +// "1", +// new Integer(nXPos + nBtnWidth), +// new Integer(nYPos), +// IControlStep, +// new Short(curtabindex++), +// new Integer(16) +// }); + DefaultListModel imageModel = new DefaultListModel(); for (int i = 0; i < HelpTexts.length; i++) { imageModel.addElement(new Integer(i)); } - oImageList[0] = new ArrangeImageList(0, imageModel); - oImageList[1] = new ArrangeImageList(1, imageModel); + String sMainArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 41); // "Arrangement of the main form" + m_aArrangeList[0] = new ArrangeButtonList(0, imageModel, sMainArrangementHeader); + + String sSubArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 42); // "Arrangement of the sub form" + m_aArrangeList[1] = new ArrangeButtonList(1, imageModel, sSubArrangementHeader); enableAlignControlGroup(false); } public int getSelectedArrangement(int _formindex) { - return oImageList[_formindex].ilLayouts.getSelected() + 1; + return m_aArrangeList[_formindex].m_aButtonList.getSelected() + 1; } - private class LayoutRenderer implements ImageList.ImageRenderer + private class LayoutRenderer implements ButtonList.IImageRenderer { + int Index = 1; public Object[] getImageUrls(Object listitem) { @@ -154,7 +202,7 @@ public class UIControlArranger public void enableSubFormImageList(boolean _bdoEnable) { - oImageList[1].ilLayouts.setenabled(_bdoEnable); + m_aArrangeList[1].m_aButtonList.setenabled(_bdoEnable); CurUnoDialog.setControlProperty("lnLabelPlacment_2", "Enabled", new Boolean(_bdoEnable)); } @@ -203,46 +251,180 @@ public class UIControlArranger Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), "Enabled", new Boolean(_bEnableAlignControlGroup)); } - private class ArrangeImageList implements XItemListener +// private class ArrangeImageList implements XItemListener +// { +// +// private int formindex; +// private ImageList m_aButtonList = null; // new ImageList(); +// +// public ArrangeImageList(int _formindex, ListModel model, String _sArrangementHeader) +// { +// formindex = _formindex; +// Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT); +// // Label ArrangementHeader ---------------------- +// CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1), +// new String[] +// { +// "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" +// }, +// new Object[] +// { +// UIConsts.INTEGERS[8], _sArrangementHeader, new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207) +// }); +// +// int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT; +// m_aButtonList = new ImageList(); +// m_aButtonList.setPos(new Size(107, nypos)); +// m_aButtonList.setImageSize(new Size(26, 26)); +// m_aButtonList.setCols(4); +// m_aButtonList.setRows(1); +// m_aButtonList.m_aControlName = "ImageList_" + formindex; +// m_aButtonList.setStep(new Short((short) FormWizard.SOCONTROL_PAGE)); +// m_aButtonList.setShowButtons(false); +// m_aButtonList.setRenderer(new LayoutRenderer()); +// m_aButtonList.setSelectionGap(new Size(2, 2)); +// m_aButtonList.setGap(new Size(3, 3)); +// m_aButtonList.scaleImages = Boolean.FALSE; +// m_aButtonList.tabIndex = (int) curtabindex++; +// m_aButtonList.helpURL = 34453 + (formindex * 4); +// +// m_aButtonList.setListModel(model); +// m_aButtonList.create(CurUnoDialog); +// m_aButtonList.setSelected(FormWizard.SOGRID - 1); +// m_aButtonList.addItemListener(this); +// } +// +// public void setToLeftAlign() +// { +// Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), "State", new Short((short) 1)); +// } +// +// /* (non-Javadoc) +// * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener) +// */ +// public void addListDataListener(ListDataListener arg0) +// { +// // TODO Auto-generated method stub +// } +// +// public void itemStateChanged(ItemEvent arg0) +// { +// try +// { +// if (m_aArrangeList[formindex].m_aButtonList.isenabled()) +// { +// boolean bEnableAlignControlGroup; +// if (curFormDocument.oControlForms.size() == 2) +// { +// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); +// final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1); +// +// bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) || +// (nSelected1 == FormWizard.SOCOLUMNARLEFT)); +// } +// else +// { +// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); +// bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT); +// } +// enableAlignControlGroup(bEnableAlignControlGroup); +// final Short nBorderType = CurUnoDialog.getBorderType(); +// final int nSelected = m_aButtonList.getSelected() + 1; +// ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType); +// } +// } +// catch (RuntimeException e) +// { +// e.printStackTrace(); +// } +// } +// +// /* (non-Javadoc) +// * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent) +// */ +// public void contentsChanged(ListDataEvent arg0) +// { +// // TODO Auto-generated method stub +// } +// +// /* (non-Javadoc) +// * @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent) +// */ +// public void intervalAdded(ListDataEvent arg0) +// { +// // TODO Auto-generated method stub +// } +// +// /* (non-Javadoc) +// * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent) +// */ +// public void intervalRemoved(ListDataEvent arg0) +// { +// // TODO Auto-generated method stub +// } +// +// /* (non-Javadoc) +// * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject) +// */ +// public void disposing(EventObject arg0) +// { +// // TODO Auto-generated method stub +// } +// } + + private class ArrangeButtonList implements XItemListener { - int formindex; - ImageList ilLayouts = new ImageList(); + private int formindex; + private ButtonList m_aButtonList = null; // new ImageList(); - public ArrangeImageList(int _formindex, ListModel model) + public ArrangeButtonList(int _formindex, ListModel model, String _sArrangementHeader) { formindex = _formindex; Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT); + // Label ArrangementHeader ---------------------- CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1), new String[] { - "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Height", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - UIConsts.INTEGERS[8], sArrangementHeader[_formindex], new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207) + UIConsts.INTEGERS[8], + _sArrangementHeader, + new Integer(97), + YPos, + IControlStep, + new Short(curtabindex++), + new Integer(207) }); - int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT; - ilLayouts = new ImageList(); - ilLayouts.setPos(new Size(107, nypos)); - ilLayouts.setImageSize(new Size(26, 26)); - ilLayouts.setCols(4); - ilLayouts.setRows(1); - ilLayouts.name = "ImageList_" + formindex; - ilLayouts.setStep(new Short((short) FormWizard.SOCONTROLPAGE)); - ilLayouts.setShowButtons(false); - ilLayouts.setRenderer(new LayoutRenderer()); - ilLayouts.setSelectionGap(new Size(2, 2)); - ilLayouts.setGap(new Size(3, 3)); - ilLayouts.scaleImages = Boolean.FALSE; - ilLayouts.tabIndex = (int) curtabindex++; - ilLayouts.helpURL = 34453 + (formindex * 4); - - ilLayouts.setListModel(model); - ilLayouts.create(CurUnoDialog); - ilLayouts.setSelected(FormWizard.SOGRID - 1); - ilLayouts.addItemListener(this); + int nypos = SOBASEIMAGEYPOSITION + 12 - 5 + _formindex * SOIMAGELISTHEIGHT; + m_aButtonList = new ButtonList(); + m_aButtonList.setPos(new Size(107, nypos)); + m_aButtonList.setButtonSize(new Size(26 + 6, 26 + 5)); + m_aButtonList.setCols(4); + m_aButtonList.setRows(1); + m_aButtonList.setName( "ButtonList_" + formindex ); + m_aButtonList.setStep(Short.valueOf((short) FormWizard.SOCONTROL_PAGE)); + m_aButtonList.setShowButtons(false); // shows a button line at ''wrong'' position like |<| 1..4/4 |>| + m_aButtonList.setRenderer(new LayoutRenderer()); + m_aButtonList.setSelectionGap(new Size(2, 2)); + m_aButtonList.setGap(new Size(3, 3)); +// m_aButtonList.scaleImages = Boolean.FALSE; + m_aButtonList.tabIndex = (int) curtabindex++; + m_aButtonList.helpURL = 34453 + (formindex * 4); + + m_aButtonList.setListModel(model); + m_aButtonList.create(CurUnoDialog); + m_aButtonList.setSelected(FormWizard.SOGRID - 1); + m_aButtonList.addItemListener(this); } public void setToLeftAlign() @@ -262,19 +444,26 @@ public class UIControlArranger { try { - if (oImageList[formindex].ilLayouts.isenabled()) + if (m_aArrangeList[formindex].m_aButtonList.isenabled()) { boolean bEnableAlignControlGroup; if (curFormDocument.oControlForms.size() == 2) { - bEnableAlignControlGroup = (((oImageList[0].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT) || ((oImageList[1].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT)); + final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); + final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1); + + bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) || + (nSelected1 == FormWizard.SOCOLUMNARLEFT)); } else { - bEnableAlignControlGroup = ((oImageList[0].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT); + final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); + bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT); } enableAlignControlGroup(bEnableAlignControlGroup); - ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(ilLayouts.getSelected() + 1, CurUnoDialog.getBorderType()); + final Short nBorderType = CurUnoDialog.getBorderType(); + final int nSelected = m_aButtonList.getSelected() + 1; + ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType); } } catch (RuntimeException e) diff --git a/wizards/com/sun/star/wizards/letter/LocaleCodes.java b/wizards/com/sun/star/wizards/letter/LocaleCodes.java index 08974e08eb4a..8e1ddfb34498 100644 --- a/wizards/com/sun/star/wizards/letter/LocaleCodes.java +++ b/wizards/com/sun/star/wizards/letter/LocaleCodes.java @@ -61,8 +61,9 @@ public class LocaleCodes extends Resource return LS; } - public String[] getIDs() { - String []Ids = new String [135]; + public String[] getIDs() + { + String[] Ids = new String[135]; Ids[0] = "Afrikaans;af;1078"; Ids[1] = "Albanian;sq;1052"; diff --git a/wizards/com/sun/star/wizards/makefile.mk b/wizards/com/sun/star/wizards/makefile.mk index 50c1f84397f0..d876d1903d5d 100644 --- a/wizards/com/sun/star/wizards/makefile.mk +++ b/wizards/com/sun/star/wizards/makefile.mk @@ -75,7 +75,7 @@ JAVAFILES= \ common$/ConfigSet.java \ common$/XMLProvider.java \ common$/XMLHelper.java \ - common$/Renderer.java \ + common$/IRenderer.java \ common$/Indexable.java \ common$/TerminateWizardException.java \ common$/UCB.java \ @@ -115,6 +115,7 @@ JAVAFILES= \ ui$/FilterComponent.java \ ui$/FieldSelection.java \ ui$/ImageList.java \ + ui$/ButtonList.java \ ui$/PathSelection.java \ ui$/PeerConfig.java \ ui$/SortingComponent.java \ diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 8535b2a4a876..7079b1109742 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -51,7 +51,7 @@ public class Finalizer public Finalizer(QueryWizard _CurUnoDialog, QuerySummary _CurDBMetaData) { - short curtabindex = (short) (100 * QueryWizard.SOSUMMARYPAGE); + short curtabindex = (short) (100 * QueryWizard.SOSUMMARY_PAGE); String reslblQueryTitle; String resoptDisplayQuery; String resoptModifyQuery; @@ -73,7 +73,7 @@ public class Finalizer }, new Object[] { - new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(52) + new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52) }); m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[] { @@ -81,7 +81,7 @@ public class Finalizer }, new Object[] { - new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(90) + new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90) }); CurUnoDialog.insertLabel("lblHowGoOn", new String[] { @@ -89,7 +89,7 @@ public class Finalizer }, new Object[] { - new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(112) + new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(112) }); this.xRadioDisplayQuery = CurUnoDialog.insertRadioButton("optDisplayQuery", new String[] @@ -98,7 +98,7 @@ public class Finalizer }, new Object[] { - new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118) + new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) }); this.xRadioModifyQuery = CurUnoDialog.insertRadioButton("optModifyQuery", @@ -108,7 +108,7 @@ public class Finalizer }, new Object[] { - new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118) + new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) }); CurUnoDialog.insertFixedLine("flnSummary", new String[] { diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java index b382553d68c8..611068d8b953 100644 --- a/wizards/com/sun/star/wizards/query/QuerySummary.java +++ b/wizards/com/sun/star/wizards/query/QuerySummary.java @@ -150,7 +150,7 @@ public class QuerySummary extends QueryMetaData { CurString = BaseString; FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName()); - int iAggregate = getAggregateIndex(FieldColumns[i].m_sFieldName); + int iAggregate = getAggregateIndex(FieldColumns[i].getFieldName()); if (iAggregate > -1) { String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")"; @@ -254,4 +254,4 @@ public class QuerySummary extends QueryMetaData } return sReturn; } -}
\ No newline at end of file +} diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 14df991ba04c..181c83d9134a 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -53,36 +53,34 @@ public class QueryWizard extends WizardDialog return CurFrame; } public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; - public static final int SOFIELDSELECTIONPAGE = 1; - public static final int SOSORTINGPAGE = 2; - public static final int SOFILTERPAGE = 3; - public static final int SOAGGREGATEPAGE = 4; - public static final int SOGROUPSELECTIONPAGE = 5; - public static final int SOGROUPFILTERPAGE = 6; - public static final int SOTITLESPAGE = 7; - public static final int SOSUMMARYPAGE = 8; - CommandFieldSelection CurDBCommandFieldSelection; - SortingComponent CurSortingComponent; - FieldSelection CurGroupFieldSelection; - TitlesComponent CurTitlesComponent; - FilterComponent CurFilterComponent; - FilterComponent CurGroupFilterComponent; - AggregateComponent CurAggregateComponent; - Finalizer CurFinalizer; - WizardDialog CurWizardDialog; - QuerySummary CurDBMetaData; - String[][] UIRepresentation; - String reslblFieldHeader; - String reslblAliasHeader; - String reslblFields; - String reslblSelFields; - String reslblTables; - String resQuery; - String resQueryWizard; - String reslblGroupBy; - String resmsgNonNumericAsGroupBy; - XComponent[] components = null; //Resources Object - short CurTabIndex = 0; + private static final int SOFIELDSELECTION_PAGE = 1; + private static final int SOSORTING_PAGE = 2; + private static final int SOFILTER_PAGE = 3; + private static final int SOAGGREGATE_PAGE = 4; + private static final int SOGROUPSELECTION_PAGE = 5; + private static final int SOGROUPFILTER_PAGE = 6; + private static final int SOTITLES_PAGE = 7; + protected static final int SOSUMMARY_PAGE = 8; + private CommandFieldSelection CurDBCommandFieldSelection; + private SortingComponent CurSortingComponent; + private FieldSelection CurGroupFieldSelection; + private TitlesComponent CurTitlesComponent; + private FilterComponent CurFilterComponent; + private FilterComponent CurGroupFilterComponent; + private AggregateComponent CurAggregateComponent; + private Finalizer CurFinalizer; + private QuerySummary CurDBMetaData; + private String reslblFieldHeader; + private String reslblAliasHeader; + private String reslblFields; + private String reslblSelFields; + private String reslblTables; + // private String resQuery; + private String resQueryWizard; + private String reslblGroupBy; + private String resmsgNonNumericAsGroupBy; + private XComponent[] components = null; //Resources Object + // private short CurTabIndex = 0; public QueryWizard(XMultiServiceFactory xMSF) { @@ -91,20 +89,18 @@ public class QueryWizard extends WizardDialog CurDBMetaData = new QuerySummary(xMSF, m_oResource); } - public static void main(String args[]) +/* public static void main(String args[]) { - String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; // //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 + String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager"; try { XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr); if (xLocMSF != null) { PropertyValue[] curproperties = new PropertyValue[1]; - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/Mydbwizard2DocAssign.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/nyt1.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); - + curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///G:/temp/abc.odb"); // curproperties[0] = Properties.createProperty("DataSourceName", "TESTDB"); + QueryWizard CurQueryWizard = new QueryWizard(xLocMSF); CurQueryWizard.startQueryWizard(xLocMSF, curproperties); } @@ -114,36 +110,8 @@ public class QueryWizard extends WizardDialog jexception.printStackTrace(System.out); } } -//!<<<<<<< QueryWizard.java -//! public void startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) { -//! try { -//! if (CurDBMetaData.getConnection(CurPropertyValues)){ -//! reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4); -//! reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent -//! reslblAliasHeader = m_oResource.getResText(UIConsts.RID_QUERY + 20); //Fieldtitles header in AliasComponent -//! reslblSelFields = m_oResource.getResText(UIConsts.RID_QUERY + 50); -//! reslblTables = m_oResource.getResText(UIConsts.RID_QUERY + 3); -//! reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18); -//! resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2); -//! resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88); -//! Helper.setUnoPropertyValues(xDialogModel, new String[] { "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width" }, -//! new Object[] { new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310)}); -//! drawNaviBar(); -//! setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8); -//! this.setMaxStep(8); -//! buildSteps(); -//! this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValues, false); -//! CurFrame = Desktop.getActiveFrame(xMSF); -//!// CurFrame = OfficeDocument.createNewFrame(xMSF, this); -//!// desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame); -//! -//! xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow()); -//! this.xMSF = xMSF; -//! createWindowPeer(xWindowPeer); -//! CurDBMetaData.setWindowPeer(this.xControl.getPeer()); -//! insertQueryRelatedSteps(); -//! short RetValue = executeDialog(CurFrame.getContainerWindow().getPosSize()); -//!======= + */ + public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) { try @@ -179,8 +147,6 @@ public class QueryWizard extends WizardDialog { CurFrame = Desktop.getActiveFrame(xMSF); } - // CurFrame = OfficeDocument.createNewFrame(xMSF, this); - // desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame); XWindowPeer windowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow()); this.xMSF = xMSF; @@ -193,7 +159,6 @@ public class QueryWizard extends WizardDialog catch (java.lang.Exception jexception) { jexception.printStackTrace(System.out); -//!>>>>>>> 1.14 } CurGroupFilterComponent = null; CurTitlesComponent = null; @@ -224,16 +189,16 @@ public class QueryWizard extends WizardDialog CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID")); switch (CurItemID) { - case SOAGGREGATEPAGE: + case SOAGGREGATE_PAGE: if (_bEnabled == true) { bEnabled = ((CurDBMetaData.hasNumericalFields()) && (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())); } break; - case SOGROUPSELECTIONPAGE: + case SOGROUPSELECTION_PAGE: bEnabled = CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY; break; - case SOGROUPFILTERPAGE: + case SOGROUPFILTER_PAGE: bEnabled = false; if (_bEnabled == true) { @@ -269,21 +234,21 @@ public class QueryWizard extends WizardDialog setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80); addRoadmap(); int i = 0; - i = insertRoadmapItem(0, true, SOFIELDSELECTIONPAGE - 1, SOFIELDSELECTIONPAGE); - i = insertRoadmapItem(i, false, SOSORTINGPAGE - 1, SOSORTINGPAGE); // Orderby is always supported - i = insertRoadmapItem(i, false, SOFILTERPAGE - 1, SOFILTERPAGE); + i = insertRoadmapItem(0, true, SOFIELDSELECTION_PAGE - 1, SOFIELDSELECTION_PAGE); + i = insertRoadmapItem(i, false, SOSORTING_PAGE - 1, SOSORTING_PAGE); // Orderby is always supported + i = insertRoadmapItem(i, false, SOFILTER_PAGE - 1, SOFILTER_PAGE); if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()) { - i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATEPAGE - 1, SOAGGREGATEPAGE); + i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATE_PAGE - 1, SOAGGREGATE_PAGE); } if (CurDBMetaData.xDBMetaData.supportsGroupBy()) { - i = insertRoadmapItem(i, false, SOGROUPSELECTIONPAGE - 1, SOGROUPSELECTIONPAGE); - i = insertRoadmapItem(i, false, SOGROUPFILTERPAGE - 1, SOGROUPFILTERPAGE); + i = insertRoadmapItem(i, false, SOGROUPSELECTION_PAGE - 1, SOGROUPSELECTION_PAGE); + i = insertRoadmapItem(i, false, SOGROUPFILTER_PAGE - 1, SOGROUPFILTER_PAGE); } // if (CurDBMetaData.xDBMetaData.supportsColumnAliasing()) don't use -> too dangerous!!! - i = insertRoadmapItem(i, false, SOTITLESPAGE - 1, SOTITLESPAGE); - i = insertRoadmapItem(i, false, SOSUMMARYPAGE - 1, SOSUMMARYPAGE); + i = insertRoadmapItem(i, false, SOTITLES_PAGE - 1, SOTITLES_PAGE); + i = insertRoadmapItem(i, false, SOSUMMARY_PAGE - 1, SOSUMMARY_PAGE); setRoadmapInteractive(true); setRoadmapComplete(true); setCurrentRoadmapItemID((short) 1); @@ -304,21 +269,21 @@ public class QueryWizard extends WizardDialog CurDBCommandFieldSelection = new CommandFieldSelection(this, CurDBMetaData, 120, reslblFields, reslblSelFields, reslblTables, true, 40850); CurDBCommandFieldSelection.setAppendMode(true); CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - CurSortingComponent = new SortingComponent(this, SOSORTINGPAGE, 95, 27, 210, 40865); - CurFilterComponent = new FilterComponent(this, xMSF, SOFILTERPAGE, 97, 27, 209, 3, CurDBMetaData, 40878); + CurSortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865); + CurFilterComponent = new FilterComponent(this, xMSF, SOFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40878); CurFilterComponent.addNumberFormats(); if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()) { - CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATEPAGE, 97, 69, 209, 5, 40895); + CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATE_PAGE, 97, 69, 209, 5, 40895); } if (CurDBMetaData.xDBMetaData.supportsGroupBy()) { - CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTIONPAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false); + CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTION_PAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false); CurGroupFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTERPAGE, 97, 27, 209, 3, CurDBMetaData, 40923); + CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40923); } - CurTitlesComponent = new TitlesComponent(this, SOTITLESPAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940); + CurTitlesComponent = new TitlesComponent(this, SOTITLES_PAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940); CurFinalizer = new Finalizer(this, CurDBMetaData); enableNavigationButtons(false, false, false); } @@ -331,7 +296,7 @@ public class QueryWizard extends WizardDialog public void finishWizard() { int ncurStep = getCurrentStep(); - if ((switchToStep(ncurStep, SOSUMMARYPAGE)) || (ncurStep == SOSUMMARYPAGE)) + if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE)) { components = CurFinalizer.finish(); } @@ -341,7 +306,7 @@ public class QueryWizard extends WizardDialog { try { - if (nOldStep <= SOGROUPSELECTIONPAGE && nNewStep > SOGROUPSELECTIONPAGE) + if (nOldStep <= SOGROUPSELECTION_PAGE && nNewStep > SOGROUPSELECTION_PAGE) { if (CurDBMetaData.xDBMetaData.supportsGroupBy()) { @@ -352,26 +317,26 @@ public class QueryWizard extends WizardDialog } switch (nNewStep) { - case SOFIELDSELECTIONPAGE: + case SOFIELDSELECTION_PAGE: break; - case SOSORTINGPAGE: + case SOSORTING_PAGE: CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames()); break; - case SOFILTERPAGE: + case SOFILTER_PAGE: CurFilterComponent.initialize(CurDBMetaData.getFilterConditions(), CurDBMetaData.getDisplayFieldNames()); break; - case SOAGGREGATEPAGE: + case SOAGGREGATE_PAGE: CurAggregateComponent.initialize(); break; - case SOGROUPSELECTIONPAGE: + case SOGROUPSELECTION_PAGE: break; - case SOGROUPFILTERPAGE: + case SOGROUPFILTER_PAGE: CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames()); break; - case SOTITLESPAGE: + case SOTITLES_PAGE: CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet); break; - case SOSUMMARYPAGE: + case SOSUMMARY_PAGE: CurFinalizer.initialize(); break; default: @@ -388,35 +353,35 @@ public class QueryWizard extends WizardDialog { switch (nOldStep) { - case SOFIELDSELECTIONPAGE: + case SOFIELDSELECTION_PAGE: CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames()); CurDBMetaData.initializeFieldTitleSet(true); CurDBMetaData.setNumericFields(); searchForOutdatedFields(); break; - case SOSORTINGPAGE: + case SOSORTING_PAGE: CurDBMetaData.setSortFieldNames(CurSortingComponent.getSortFieldNames()); break; - case SOFILTERPAGE: + case SOFILTER_PAGE: CurDBMetaData.setFilterConditions(CurFilterComponent.getFilterConditions()); break; - case SOAGGREGATEPAGE: + case SOAGGREGATE_PAGE: CurDBMetaData.AggregateFieldNames = CurAggregateComponent.getAggregateFieldNames(); break; - case SOGROUPSELECTIONPAGE: + case SOGROUPSELECTION_PAGE: break; - case SOGROUPFILTERPAGE: + case SOGROUPFILTER_PAGE: CurDBMetaData.setGroupByFilterConditions(this.CurGroupFilterComponent.getFilterConditions()); break; - case SOTITLESPAGE: + case SOTITLES_PAGE: CurDBMetaData.setFieldTitles(CurTitlesComponent.getFieldTitles()); break; - case SOSUMMARYPAGE: + case SOSUMMARY_PAGE: break; default: break; } - if (nOldStep < SOGROUPSELECTIONPAGE && nNewStep >= SOGROUPSELECTIONPAGE) + if (nOldStep < SOGROUPSELECTION_PAGE && nNewStep >= SOGROUPSELECTION_PAGE) { try { @@ -428,7 +393,7 @@ public class QueryWizard extends WizardDialog CurGroupFieldSelection.initialize(CurDBMetaData.getUniqueAggregateFieldNames(), false, CurDBMetaData.xDBMetaData.getMaxColumnsInGroupBy()); CurGroupFieldSelection.intializeSelectedFields(CurDBMetaData.NonAggregateFieldNames); CurGroupFieldSelection.setMultipleMode(false); - setStepEnabled(SOGROUPFILTERPAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0); + setStepEnabled(SOGROUPFILTER_PAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0); } } } @@ -492,7 +457,7 @@ public class QueryWizard extends WizardDialog else { boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled)); } } @@ -502,17 +467,9 @@ public class QueryWizard extends WizardDialog if (ID == 1) { enableWizardSteps(NewItems); -//! <<<<<<< QueryWizard.java -//! String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName()); -//! CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames); -//! CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems); -//! // String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems); -//! // CurDBCommandFieldSelection.fillUpFieldsListbox(); -//! ======= String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName()); CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames); CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems); -//! >>>>>>> 1.14 CurDBCommandFieldSelection.toggleCommandListBox(NewItems); } @@ -533,7 +490,7 @@ public class QueryWizard extends WizardDialog } else { - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled)); } } } diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index 5377a62168c2..57e46662a2d1 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -105,7 +105,7 @@ public class DBColumn bIsGroupColumn = false; if (CurDBMetaData.RecordFieldColumns != null) { - CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].m_sFieldName); + CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].getFieldName()); } else { @@ -132,7 +132,7 @@ public class DBColumn XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = "Column"; XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); - if (isNameCell(xLocCellCursor, CurDBField.m_sFieldName, CompString) || (_bforce)) + if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce)) { xNameCell = xCell; xNameTextCell = xTextCell; @@ -196,7 +196,7 @@ public class DBColumn xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = TableName.substring(4); XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); - if (isNameCell(xLocCellCursor, CurDBField.m_sFieldName, CompString)) + if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString)) { xNameCell = xCell; xNameTextCell = xTextCell; @@ -244,7 +244,7 @@ public class DBColumn } else { - oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.DBFormatKey, CurDBMetaData.getNumberFormatter()); + oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.getDBFormatKey(), CurDBMetaData.getNumberFormatter()); } setCellFont(); } @@ -261,7 +261,7 @@ public class DBColumn xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); xTextCursor.setString(""); - oTextFieldHandler.insertUserField(xTextCursor, CurDBField.m_sFieldName, CurDBField.getFieldTitle()); + oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell) @@ -270,7 +270,7 @@ public class DBColumn xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); xTextCursor.setString(""); - oTextFieldHandler.insertUserField(xTextCursor, CurDBField.m_sFieldName, CurDBField.getFieldTitle()); + oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } public void formatValueCell() @@ -284,7 +284,7 @@ public class DBColumn private boolean checkforLeftAlignment() { - bAlignLeft = ((CurDBField.bIsNumberFormat) && (ValColumn == xTableColumns.getCount() - 1)); + bAlignLeft = ((CurDBField.isNumberFormat()) && (ValColumn == xTableColumns.getCount() - 1)); return bAlignLeft; } @@ -364,9 +364,9 @@ public class DBColumn try { Object CurGroupValue; - if (bIsGroupColumn == false && CurDBField.bIsNumberFormat == false) + if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false) { - CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.FieldWidth, _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames()); + CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames()); } else { @@ -378,7 +378,9 @@ public class DBColumn Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value)); } - if ((CurDBField.FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN)) + int nFieldType = CurDBField.getFieldType(); + if ((nFieldType == com.sun.star.sdbc.DataType.BIT) || + (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN)) { CharFontName = "StarSymbol"; Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName); @@ -414,8 +416,9 @@ public class DBColumn try { XPropertyState xPropertyState; - int FieldType = CurDBField.FieldType; - if ((FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN)) + int nFieldType = CurDBField.getFieldType(); + if ((nFieldType == com.sun.star.sdbc.DataType.BIT) || + (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN)) { CharFontName = "StarSymbol"; PropertyState = com.sun.star.beans.PropertyState.DIRECT_VALUE; diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java index a1250e8f86b7..579ffb43fd67 100644 --- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java +++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java @@ -38,11 +38,11 @@ import java.util.Vector; public class GroupFieldHandler extends FieldSelection { - IReportDocument CurReportDocument; + private IReportDocument CurReportDocument; private Vector GroupFieldVector = new Vector(); - QueryMetaData CurDBMetaData; - WizardDialog oWizardDialog; - static final short MAXSELFIELDS = 4; + private QueryMetaData CurDBMetaData; + private WizardDialog oWizardDialog; + private static final short MAXSELFIELDS = 4; public GroupFieldHandler(IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog) { @@ -130,7 +130,7 @@ public class GroupFieldHandler extends FieldSelection super.toggleListboxButtons(iFieldsSelIndex, iSelFieldsSelIndex); int iSelCount = xSelectedFieldsListBox.getItemCount(); if (iSelCount >= MAXSELFIELDS) - { + { CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", Boolean.FALSE); } } @@ -139,7 +139,7 @@ public class GroupFieldHandler extends FieldSelection { int iSelCount = xSelectedFieldsListBox.getItemCount(); if (iSelCount < MAXSELFIELDS) - { + { super.selectFields(bMoveAll); } diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index ad85ccc5bd77..7e74e3fc685b 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -344,7 +344,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < nSize; i++) { DBColumn CurDBColumn = (DBColumn) DBColumnsVector.elementAt(i); - String sFieldName = CurDBColumn.CurDBField.m_sFieldName; + String sFieldName = CurDBColumn.CurDBField.getFieldName(); if (!sFieldName.equals(_sNewNames[i])) { CurDBColumn.CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_sNewNames[i]); @@ -467,13 +467,13 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { removeGroupNamesofRecordTable(iSelCount); FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.addElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.addElement(CurFieldColumn.getFieldName()); GroupCount += 1; try { String sPath = FileAccess.getPathFromList(xMSF, ReportPath, "cnt-default.ott"); oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1); - CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.m_sFieldName, GroupCount - 1, TBLGROUPSECTION + (GroupCount)); + CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.getFieldName(), GroupCount - 1, TBLGROUPSECTION + (GroupCount)); CurDBColumn.formatValueCell(); if (CurDBColumn != null) { @@ -500,7 +500,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { removeGroupNamesofRecordTable(NewSelGroupNames.length + 1); FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.removeElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.removeElement(CurFieldColumn.getFieldName()); try { oTextSectionHandler.removeLastTextSection(); @@ -610,8 +610,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { FieldColumn oFieldColumn1 = (FieldColumn) _oObject1; FieldColumn oFieldColumn2 = (FieldColumn) _oObject2; - DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.m_sFieldName); - DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.m_sFieldName); + DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.getFieldName()); + DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.getFieldName()); if (oDBColumn1.ValColumn < oDBColumn2.ValColumn) { return -1; @@ -631,7 +631,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < DBColumnsVector.size(); i++) { DBColumn oDBColumn = (DBColumn) DBColumnsVector.get(i); - if (oDBColumn.CurDBField.m_sFieldName.equals(_FieldName)) + if (oDBColumn.CurDBField.getFieldName().equals(_FieldName)) { return oDBColumn; } @@ -647,7 +647,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < _FieldColumns.length; i++) { FieldColumn CurFieldColumn = _FieldColumns[i]; - if (!CurFieldColumn.m_sFieldName.equals(_FieldName)) + if (!CurFieldColumn.getFieldName().equals(_FieldName)) { aFieldColumns.add(CurFieldColumn); } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index fb45ad376107..3d79c5d2d8ac 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -257,9 +257,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme { getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser()); DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); - if (getRecordParser().hasEscapeProcessing(oCommand.xPropertySet)) + if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet())) { - getRecordParser().Command = (String) oCommand.xPropertySet.getPropertyValue("Command"); + getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command"); getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command); getRecordParser().oSQLQueryComposer.prependSortingCriteria(); } diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index d3abec37c593..a4b4e3af18ad 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -72,57 +72,57 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple { // XMultiServiceFactory xMSF; // QueryMetaData CurDBMetaData; - FieldSelection CurGroupFieldSelection; - SortingComponent CurSortingComponent; - UnoDialog CurUnoProgressDialog; - TitlesComponent CurTitlesComponent; - CommandFieldSelection CurDBCommandFieldSelection; - GroupFieldHandler CurGroupFieldHandler; - ReportLayouter CurReportLayouter; - ReportFinalizer CurReportFinalizer; - PropertyValue[] DBGPROPERTYVALUE; - String sCommandName = ""; - int nCommandType = -1; - int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; + protected FieldSelection CurGroupFieldSelection; + private SortingComponent CurSortingComponent; + // private UnoDialog CurUnoProgressDialog; + private TitlesComponent CurTitlesComponent; + private CommandFieldSelection CurDBCommandFieldSelection; + private GroupFieldHandler CurGroupFieldHandler; + private ReportLayouter CurReportLayouter; + private ReportFinalizer CurReportFinalizer; + private PropertyValue[] DBGPROPERTYVALUE; + // private String sCommandName = ""; + // private int nCommandType = -1; + private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; private String m_sReportName = ""; - public static final String SOREPORTFORMNAME = "ReportSource"; - final int SOSELGROUPLST = 33; - final int SOTXTCOLTITLE = 48; - final int SOTITLESCROLLBAR = 49; - public static final int SONULLPAGE = 0; - public static final int SOMAINPAGE = 1; - public static final int SOTITLEPAGE = 2; - public static final int SOGROUPPAGE = 3; - public static final int SOSORTPAGE = 4; - public static final int SOTEMPLATEPAGE = 5; - public static final int SOSTOREPAGE = 6; + protected static final String SOREPORTFORMNAME = "ReportSource"; + // private final int SOSELGROUPLST = 33; + // private final int SOTXTCOLTITLE = 48; + // private final int SOTITLESCROLLBAR = 49; + // private static final int SONULLPAGE = 0; + private static final int SOMAINPAGE = 1; + private static final int SOTITLEPAGE = 2; + protected static final int SOGROUPPAGE = 3; + private static final int SOSORTPAGE = 4; + protected static final int SOTEMPLATEPAGE = 5; + protected static final int SOSTOREPAGE = 6; // ReportTextDocument CurReportDocument; // ReportTextImplementation CurReportDocument; - IReportDocument CurReportDocument; - static String sMsgWizardName; - static String slblFields; - static String slblSelFields; - static String sShowBinaryFields; - static String sGroupings; - String[] WizardHeaderText = new String[6]; - static String[] WizardTitle = new String[6]; - static String sWriterFilterName; - static String slstDatabasesDefaultText; - static String slstTablesDefaultText; - static String sMsgErrorOccured; - static String sMsgSavingImpossible; - static String sMsgNoConnection; + protected IReportDocument CurReportDocument; + private static String sMsgWizardName; + private static String slblFields; + private static String slblSelFields; + private static String sShowBinaryFields; + // private static String sGroupings; + private String[] WizardHeaderText = new String[6]; + // private static String[] WizardTitle = new String[6]; + // private static String sWriterFilterName; + private static String slstDatabasesDefaultText; + private static String slstTablesDefaultText; + private static String sMsgErrorOccured; + private static String sMsgSavingImpossible; + // private static String sMsgNoConnection; // Progress display relevant Strings - static String slblColumnTitles; - static String slblColumnNames; - static String sMsgNoConnectionforDataimport; - static String sMsgQueryCreationImpossible; - public static String sMsgFilePathInvalid; - static String slblTables; + private static String slblColumnTitles; + private static String slblColumnNames; + private static String sMsgNoConnectionforDataimport; + private static String sMsgQueryCreationImpossible; + private static String sMsgFilePathInvalid; + private static String slblTables; // public static String sBlindTextNote; - public static boolean bCloseDocument; - public boolean bHasEscapeProcessing = true; + protected static boolean bCloseDocument; + private boolean bHasEscapeProcessing = true; public ReportWizard(XMultiServiceFactory xMSF) { @@ -133,11 +133,27 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width" + "Height", + "Moveable", + "Name", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Title", + "Width" }, new Object[] { - new Integer(210), Boolean.TRUE, "DialogReport", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), sMsgWizardName, new Integer(310) + Integer.valueOf(210), + Boolean.TRUE, + "DialogReport", + new Integer(102), + new Integer(41), + new Integer(1), + new Short((short) 0), + sMsgWizardName, + new Integer(310) }); drawNaviBar(); setRightPaneHeaders(this.WizardHeaderText); @@ -325,8 +341,8 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple { String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName); - bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet); - String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); + bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); + String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command"); if (bHasEscapeProcessing) { // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); @@ -356,7 +372,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } return bQueryCreated; } - +/* public static void main(String args[]) { String ConnectStr = "uno:socket,host=localhost,port=8107;urp;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 @@ -388,7 +404,8 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } System.exit(1); } - +*/ +/* private static void tests(XMultiServiceFactory _xMSF) { try @@ -467,6 +484,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } } +*/ public void buildSteps() { @@ -504,7 +522,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple public void finishWizard() { - int ncurStep = getCurrentStep(); + final int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)) { if (this.executeQuery()) @@ -578,7 +596,7 @@ private static void initializeLogger(XMultiServiceFactory _xMSF) { XComponentContext xContext = Helper.getComponentContext(_xMSF); - Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool"); + final Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool"); if (aLoggerPool == null) { System.out.println("Can't get singleton from logging"); @@ -884,7 +902,7 @@ public static XLogger getLogger() { String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName); - bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet); + bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); } super.setStepEnabled(SOSORTPAGE, bdoenable); diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 2af974ac048c..dad827841e96 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -382,7 +382,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { // removeGroupNamesofRecordTable(iSelCount); final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.addElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.addElement(CurFieldColumn.getFieldName()); } return true; } @@ -400,7 +400,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { // throw new UnsupportedOperationException("Not supported yet."); final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.removeElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.removeElement(CurFieldColumn.getFieldName()); } private void setPageOrientation(int nOrientation, boolean bDoLayout) @@ -606,8 +606,8 @@ public class ReportBuilderImplementation extends ReportImplementationHelper int[] FieldWidths = new int[FieldNames.length]; for (int i = 0; i < FieldNames.length; i++) { - FieldTypes[i] = a.FieldColumns[i].FieldType; - FieldWidths[i] = a.FieldColumns[i].FieldWidth; + FieldTypes[i] = a.FieldColumns[i].getFieldType(); + FieldWidths[i] = a.FieldColumns[i].getFieldWidth(); } getReportBuilderLayouter().setTableName(_nType, TableName); // getReportBuilderLayouter().insertFields(getRecordParser().getRecordFieldNames()); diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index df05f8255d06..1990eefda006 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -227,7 +227,7 @@ public class FieldFormatter implements XItemListener boolean benableShiftUpButton = false; boolean benableShiftDownButton = false; boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems") != null; - int ilistcount = UnoDialog.getListBoxItemCount(xlstFieldNames); + int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); boolean blistispopulated = (ilistcount > 0); if (bfieldnameisselected) { @@ -269,7 +269,7 @@ public class FieldFormatter implements XItemListener String fieldname = fieldnames[ipos]; xlstFieldNames.removeItems(ipos, (short) 1); CurUnoDialog.fielditems.remove(fieldname); - int ilistcount = UnoDialog.getListBoxItemCount(xlstFieldNames); + int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); if ((ipos) < ilistcount) { Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java index b66a842e35ae..f25ad3152911 100644 --- a/wizards/com/sun/star/wizards/table/Finalizer.java +++ b/wizards/com/sun/star/wizards/table/Finalizer.java @@ -36,7 +36,6 @@ import com.sun.star.sdbc.SQLException; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.db.TableDescriptor; -import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.*; public class Finalizer @@ -164,7 +163,7 @@ public class Finalizer String sSchema = ""; try { - sSchema = (String) curtabledescriptor.xDataSourcePropertySet.getPropertyValue("User"); + sSchema = (String) curtabledescriptor.getDataSourcePropertySet().getPropertyValue("User"); } catch (Exception e1) { diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 791c79d64d77..afedae2fb7ad 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -48,26 +48,26 @@ import com.sun.star.wizards.ui.XFieldSelectionListener; public class PrimaryKeyHandler implements XFieldSelectionListener { - TableWizard CurUnoDialog; - short curtabindex; - String SPRIMEKEYMODE = "togglePrimeKeyFields"; - String SSINGLEKEYMODE = "toggleSinglePrimeKeyFields"; - String SSEVERALKEYMODE = "toggleSeveralPrimeKeyFields"; - XRadioButton optAddAutomatically; - XRadioButton optUseExisting; - XRadioButton optUseSeveral; - XCheckBox chkUsePrimaryKey; - XCheckBox chkcreatePrimaryKey; - XCheckBox chkApplyAutoValueExisting; - XCheckBox chkApplyAutoValueAutomatic; - XListBox lstSinglePrimeKey; - XFixedText lblPrimeFieldName; - FieldSelection curPrimaryKeySelection; - String[] fieldnames; - TableDescriptor curTableDescriptor; - int nAutoPrimeKeyDataType; - boolean bAutoPrimaryKeysupportsAutoIncrmentation; - final String SAUTOMATICKEYFIELDNAME = "ID"; + private TableWizard CurUnoDialog; + private short curtabindex; + private final static String SPRIMEKEYMODE = "togglePrimeKeyFields"; + private final static String SSINGLEKEYMODE = "toggleSinglePrimeKeyFields"; + private final static String SSEVERALKEYMODE = "toggleSeveralPrimeKeyFields"; + private XRadioButton optAddAutomatically; + private XRadioButton optUseExisting; + private XRadioButton optUseSeveral; + private XCheckBox chkUsePrimaryKey; + private XCheckBox chkcreatePrimaryKey; + private XCheckBox chkApplyAutoValueExisting; + private XCheckBox chkApplyAutoValueAutomatic; + private XListBox lstSinglePrimeKey; + private XFixedText lblPrimeFieldName; + private FieldSelection curPrimaryKeySelection; + private String[] fieldnames; + private TableDescriptor curTableDescriptor; + private int nAutoPrimeKeyDataType; + private boolean bAutoPrimaryKeysupportsAutoIncrmentation; + private final static String SAUTOMATICKEYFIELDNAME = "ID"; public PrimaryKeyHandler(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor) { @@ -76,15 +76,15 @@ public class PrimaryKeyHandler implements XFieldSelectionListener bAutoPrimaryKeysupportsAutoIncrmentation = isAutoPrimeKeyAutoIncrementationsupported(); curtabindex = (short) ((TableWizard.SOPRIMARYKEYPAGE * 100) - 20); Integer IPRIMEKEYSTEP = new Integer(TableWizard.SOPRIMARYKEYPAGE); - String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26); - String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27); - String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31); - String sApplyAutoValue = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 33); - String sAddAutomatically = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 28); - String sUseExisting = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 29); - String sUseSeveral = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 30); - String slblAvailableFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 4); - String slblSelPrimaryFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 32); + final String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26); + final String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27); + final String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31); + final String sApplyAutoValue = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 33); + final String sAddAutomatically = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 28); + final String sUseExisting = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 29); + final String sUseSeveral = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 30); + final String slblAvailableFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 4); + final String slblSelPrimaryFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 32); CurUnoDialog.insertLabel("lblExplanation", new String[] { @@ -158,11 +158,29 @@ public class PrimaryKeyHandler implements XFieldSelectionListener lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this, new String[] { - "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Dropdown", + "Enabled", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:41231", new Integer(162), new Integer(115), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(80) + Boolean.TRUE, + Boolean.FALSE, + new Integer(12), + "HID:41231", + Short.valueOf(UnoDialog.getListBoxLineCount()), + new Integer(162), + new Integer(115), + IPRIMEKEYSTEP, + new Short(curtabindex++), + new Integer(80) }); chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", SPRIMEKEYMODE, this, @@ -181,7 +199,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener public void initialize() { - boolean breselect; + // boolean breselect; fieldnames = curTableDescriptor.getNonBinaryFieldNames(); String[] skeyfieldnames = curPrimaryKeySelection.getSelectedFieldNames(); curPrimaryKeySelection.initialize(fieldnames, false); diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 89f3bacc31ee..43e250302781 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -60,27 +60,27 @@ import com.sun.star.wizards.ui.XFieldSelectionListener; public class ScenarioSelector extends FieldSelection implements XItemListener, XFieldSelectionListener { - XFixedText lblExplanation; - XFixedText lblCategories; - XRadioButton optBusiness; - XRadioButton optPrivate; - XListBox xTableListBox; - TableWizard CurUnoDialog; - TableDescriptor curtabledescriptor; - CGCategory oCGCategory; - CGTable oCGTable; - String SELECTCATEGORY = "selectCategory"; + private XFixedText lblExplanation; + private XFixedText lblCategories; + private XRadioButton optBusiness; + private XRadioButton optPrivate; + private XListBox xTableListBox; + private TableWizard CurTableWizardUnoDialog; + private TableDescriptor curtabledescriptor; + private CGCategory oCGCategory; + protected CGTable oCGTable; + private String SELECTCATEGORY = "selectCategory"; private int curcategory; - public boolean bcolumnnameislimited; + protected boolean bcolumnnameislimited; private int imaxcolumnchars; - String smytable; - Locale aLocale; - XMultiServiceFactory xMSF; + private String smytable; + private Locale aLocale; + private XMultiServiceFactory xMSF; public ScenarioSelector(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor, String _reslblFields, String _reslblSelFields) { super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true); - CurUnoDialog = (TableWizard) _CurUnoDialog; + CurTableWizardUnoDialog = _CurUnoDialog; xMSF = CurUnoDialog.xMSF; aLocale = Configuration.getOfficeLocale(xMSF); curtabledescriptor = _curtabledescriptor; @@ -117,7 +117,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X new Integer(8), sCategories, new Integer(91), new Integer(60), IMAINSTEP, new Short(pretabindex++), new Integer(100) }); - optBusiness = CurUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this, + optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this, new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" @@ -127,7 +127,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X UIConsts.INTEGERS[8], "HID:41206", sBusiness, new Integer(98), new Integer(70), new Short((short) 1), IMAINSTEP, new Short(pretabindex++), new Integer(78) }); - optPrivate = CurUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this, + optPrivate = CurTableWizardUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this, new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" @@ -219,13 +219,13 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public String[] getSelectedFieldNames() { String[] displayfieldnames = super.getSelectedFieldNames(); - Vector afieldnameVector = new Vector(); + Vector<String> afieldnameVector = new Vector<String>(); int a = 0; for (int i = 0; i < displayfieldnames.length; i++) { try { - FieldDescription ofielddescription = (FieldDescription) CurUnoDialog.fielditems.get(displayfieldnames[i]); + FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(displayfieldnames[i]); if (ofielddescription != null) { afieldnameVector.addElement(ofielddescription.getName()); @@ -255,7 +255,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X { try { - FieldDescription curfielddescription = (FieldDescription) CurUnoDialog.fielditems.get(fieldnames[i]); + FieldDescription curfielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]); PropertyValue[] aProperties = curfielddescription.getPropertyValues(); this.curtabledescriptor.addColumn(aProperties); } @@ -276,12 +276,12 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X String[] fieldnames = super.getSelectedFieldNames(); if ((fieldnames.length) > 0) { - for (int i = 0; i < CurUnoDialog.fielditems.size(); i++) + for (int i = 0; i < CurTableWizardUnoDialog.fielditems.size(); i++) { String stablename = ""; try { - FieldDescription ofielddescription = (FieldDescription) CurUnoDialog.fielditems.get(fieldnames[i]); + FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]); stablename = ofielddescription.gettablename(); } catch (RuntimeException e) @@ -336,7 +336,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) { - if (!CurUnoDialog.verifyfieldcount(NewItems.length)) + if (!CurTableWizardUnoDialog.verifyfieldcount(NewItems.length)) { for (int i = 0; i < SelItems.length; i++) { @@ -353,7 +353,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X for (int i = 0; i < NewItems.length; i++) { int iduplicate; - if (CurUnoDialog.fielditems.containsKey(NewItems[i])) + if (CurTableWizardUnoDialog.fielditems.containsKey(NewItems[i])) { iduplicate = JavaTools.getDuplicateFieldIndex(NewItems, NewItems[i]); if (iduplicate != -1) @@ -361,31 +361,31 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X XNameAccess xNameAccessFieldNode; String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], ""); FieldDescription curfielddescription = new FieldDescription(xMSF, aLocale, this, sdisplayname, NewItems[iduplicate], imaxcolumnchars); - CurUnoDialog.fielditems.put(sdisplayname, curfielddescription); + CurTableWizardUnoDialog.fielditems.put(sdisplayname, curfielddescription); NewItems[iduplicate] = sdisplayname; setSelectedFieldNames(NewItems); } } else { - CurUnoDialog.fielditems.put(NewItems[i], new FieldDescription(xMSF, aLocale, this, NewItems[i], NewItems[i], imaxcolumnchars)); + CurTableWizardUnoDialog.fielditems.put(NewItems[i], new FieldDescription(xMSF, aLocale, this, NewItems[i], NewItems[i], imaxcolumnchars)); } } } - CurUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); + CurTableWizardUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); } public void shiftFromRightToLeft(String[] SelItems, String[] NewItems) { for (int i = 0; i < SelItems.length; i++) { - if (CurUnoDialog.fielditems.containsKey(SelItems[i])) + if (CurTableWizardUnoDialog.fielditems.containsKey(SelItems[i])) { - CurUnoDialog.fielditems.remove(SelItems[i]); + CurTableWizardUnoDialog.fielditems.remove(SelItems[i]); this.curtabledescriptor.dropColumnbyName(SelItems[i]); } } - CurUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); + CurTableWizardUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); } public void moveItemDown(String item) diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 624eb0473074..8b4e0288ef8c 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -223,6 +223,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet } } +/* public static void main(String args[]) { String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; @@ -245,7 +246,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet exception.printStackTrace(System.out); } } - +*/ public void buildSteps() { curScenarioSelector = new ScenarioSelector(this, this.curTableDescriptor, slblFields, slblSelFields); @@ -331,7 +332,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard"); PropertyValue[] aProperties = new PropertyValue[4]; aProperties[0] = Properties.createProperty("ActiveConnection", curTableDescriptor.DBConnection); - aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.xDataSource); + aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.getDataSource()); aProperties[2] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE)); aProperties[3] = Properties.createProperty("Command", scomposedtablename); XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oFormWizard); diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java new file mode 100644 index 000000000000..d68306c5b915 --- /dev/null +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -0,0 +1,911 @@ +/************************************************************************* + * + * 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: ImageList.java,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.ui; + +import com.sun.star.awt.Size; +import com.sun.star.awt.XActionListener; +import com.sun.star.awt.XButton; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XFixedText; +import com.sun.star.awt.XItemEventBroadcaster; +import com.sun.star.awt.XItemListener; +// import com.sun.star.awt.XView; +import com.sun.star.awt.XWindow; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.IRenderer; +import com.sun.star.wizards.common.PropertySetHelper; +// import com.sun.star.wizards.ui.event.*; +import javax.swing.ListModel; +import javax.swing.event.ListDataEvent; + +/** + * + * @author rpiterman,ll93751 + */ +public class ButtonList implements XItemEventBroadcaster, XActionListener +{ + + private XFixedText lblImageText; + private XButton btnBack; + private XButton btnNext; + private XFixedText lblCounter; + private XControl m_aButtons[]; + private boolean benabled = true; + private UnoDialog2 oUnoDialog; + private Size gap = new Size(4, 4); + private int cols = 4; + private int rows = 3; + private Size m_aButtonSize = new Size(20, 20); + private Size pos; + private Size selectionGap = new Size(2, 2); + private boolean showButtons = true; + private Short step; + private boolean refreshOverNull = true; + private int imageTextLines = 1; + private boolean rowSelect = false; + public int tabIndex; + public Boolean scaleImages = Boolean.TRUE; + private String m_aControlName = "il"; + private int m_nCurrentSelection = -1; + private int pageStart = 0; + public int helpURL = 0; + private IImageRenderer renderer; + private ListModel listModel; + public IRenderer counterRenderer = new SimpleCounterRenderer(); + private final static int LINE_HEIGHT = 8; //private MethodInvocation METHOD_MOUSE_ENTER_IMAGE; + + /** Getter for property m_aButtonSize. + * @return Value of property m_aButtonSize. + * + */ + public Size getButtonSize() + { + return this.m_aButtonSize; + } + public void setName(String _sName) + { + m_aControlName = _sName; + } + + /** Setter for property m_aButtonSize. + * @param imageSize New value of property m_aButtonSize. + */ + public void setButtonSize(Size imageSize) + { + this.m_aButtonSize = imageSize; + } + +// @Override + public void disposing(EventObject arg0) + { + // throw new UnsupportedOperationException("Not supported yet."); + } + + public void create(UnoDialog2 dialog) + { + oUnoDialog = dialog; + + int imageTextHeight = imageTextLines * LINE_HEIGHT; + + int nXPos = pos.Width + 1; + int nYPos = pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height; + int nWidth = cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2; + + lblImageText = dialog.insertLabel(m_aControlName + "_imageText", + new String[] + { + "Height", + "HelpURL", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Tabstop", + "Width" + }, + new Object[] + { + Integer.valueOf(imageTextHeight), + "", + "(1)", + Integer.valueOf(nXPos), + Integer.valueOf(nYPos), + step, + Short.valueOf((short) 0), + Boolean.FALSE, + Integer.valueOf(nWidth) + }); + + + if (showButtons) + { + final String[] pNames1 = new String[] + { + "Height", + "HelpURL", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Tabstop", + "Width" + }; + + final Integer btnSize = Integer.valueOf(14); + +// TODO: if list of strings not the same length of list object, office will die. + btnBack = dialog.insertButton(m_aControlName + "_btnBack", "prevPage", this, pNames1, new Object[] + { + btnSize, + "HID:" + helpURL++, + Integer.valueOf(pos.Width), + Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + Short.valueOf((short) (tabIndex + 1)), + Boolean.TRUE, + btnSize + }); + + btnNext = dialog.insertButton(m_aControlName + "_btnNext", "nextPage", this, pNames1, new Object[] + { + btnSize, + "HID:" + helpURL++, + Integer.valueOf(pos.Width + (m_aButtonSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), + Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + new Short((short) (tabIndex + 2)), + Boolean.TRUE, + btnSize + }); + + lblCounter = dialog.insertLabel(m_aControlName + "_lblCounter", pNames1, new Object[] + { + Integer.valueOf(LINE_HEIGHT), + "", + Integer.valueOf(pos.Width + btnSize.intValue() + 1), + Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), + step, + Short.valueOf((short) 0), + Boolean.FALSE, + Integer.valueOf(cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) + }); + + Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1)); + Helper.setUnoPropertyValue(getModel(btnBack), "Label", "<"); + Helper.setUnoPropertyValue(getModel(btnNext), "Label", ">"); + + + } + + m_tabIndex = new Short((short) tabIndex); + + m_aButtons = new XControl[rows * cols]; + + + m_aButtonHeight = Integer.valueOf(m_aButtonSize.Height); + m_aButtonWidth = Integer.valueOf(m_aButtonSize.Width); + + for (int r = 0; r < rows; r++) + { + for (int c = 0; c < cols; c++) + { + XButton aButton = createButton(dialog, r, c); + XControl aControl = (XControl)UnoRuntime.queryInterface(XControl.class, aButton); + m_aButtons[r * cols + c] = aControl; + } + } + refreshImages(); + } + + private Integer m_aButtonHeight; + private Integer m_aButtonWidth; + private Short m_tabIndex; + + private XButton createButton(UnoDialog2 dialog, int _row, int _col) + { + String sButtonName = m_aControlName + "_button" + (_row * cols + _col); + int nButtonX = getButtonPosX(_col); + int nButtonY = getButtonPosY(_row); + XButton aButton = dialog.insertImageButton(sButtonName, this, + new String[] + { + /* "Border", */ + /* "BackgroundColor", */ + "Height", + "HelpURL", + /* "Label", */ + "PositionX", + "PositionY", + /* "ScaleImage", */ + "Step", + "TabIndex", + "Tabstop", + "Toggle", + "Width" + }, + new Object[] + { + /* Short.valueOf((short) 1), */ /* NO_BORDER, */ + /* BACKGROUND_COLOR, */ + m_aButtonHeight, + "HID:" + helpURL++, + /* "Test", */ + Integer.valueOf(nButtonX), + Integer.valueOf(nButtonY), + /* scaleImages, */ + step, + m_tabIndex, + Boolean.TRUE, + Boolean.TRUE, /* Toggle */ + m_aButtonWidth + }); + + XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, aButton); + win.setEnable(true); + win.setVisible(true); + return aButton; + } + + private int getButtonPosX(int _col) + { + final int nXPos = pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width; + return nXPos; + } + + private int getButtonPosY(int _row) + { + final int nYPos = pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height; + return nYPos; + } + + private void refreshImages() + { + if (showButtons) + { + refreshCounterText(); + } + if (refreshOverNull) + { + for (int i = 0; i < m_aButtons.length; i++) + { + setVisible(m_aButtons[i], false); + } + } + boolean focusable = true; + for (int i = 0; i < m_aButtons.length; i++) + { + Object[] oResources = renderer.getImageUrls(getObjectFor(i)); + if (oResources != null) + { + if (oResources.length == 1) + { + Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "ImageURL", (String) oResources[0]); + } + else if (oResources.length == 2) + { + oUnoDialog.getPeerConfiguration().setImageUrl(m_aButtons[i].getModel(), oResources[0], oResources[1]); +// Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "ImageURL", oResources[0]); + } + boolean bTabStop = Boolean.TRUE; // focusable ? Boolean.TRUE : Boolean.FALSE; + Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "Tabstop", bTabStop); + // Object aEnabled = Helper.getUnoPropertyValue(m_aButtons[i].getModel(), "Enabled"); + if (refreshOverNull) + { + setVisible(m_aButtons[i], true); + } + focusable = false; + } + } +// refreshSelection(); + } + + private void refreshCounterText() + { + Helper.setUnoPropertyValue(getModel(lblCounter), "Label", counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize()))); + } + + private int pageEnd() + { + int i = pageStart + cols * rows; + if (i > listModel.getSize() - 1) + { + return listModel.getSize(); + } + else + { + return i; + } + } + + /** Utility field holding list of ItemListeners. */ + private transient java.util.ArrayList<XItemListener> m_aItemListenerList; + private void setVisible(Object control, boolean visible) + { + final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, control); + xWindow.setVisible(visible); + } + + /** + * + * @param i + * @return the Object in the list model corresponding to the given image index. + */ + private Object getObjectFor(int i) + { + int ii = getIndexFor(i); + if (listModel.getSize() <= ii) + { + return null; + } + else + { + return listModel.getElementAt(ii); + } + } + + /** + * + * @param i + * @return the index in the listModel for the given image index. + */ + private int getIndexFor(int i) + { + return pageStart + i; + } + + private int getImageIndexFor(int i) + { + return i - pageStart; + } + + public void contentsChanged(ListDataEvent event) + { + /*//if the content that was changed is in the displayed range, refresh... + if ( (event.getIndex1() < getIndexFor(0)) // range is before... + || event.getIndex0() > getIndexFor( cols*rows - 1)) ; //do nothing + else + refreshImages(); + */ //m_nCurrentSelection = 0; + //pageStart = 0; + //if (event.refreshImages(); + } + + public void intervalAdded(ListDataEvent event) + { + if (event.getIndex0() <= m_nCurrentSelection) + { + if (event.getIndex1() <= m_nCurrentSelection) + { + m_nCurrentSelection += event.getIndex1() - event.getIndex0() + 1; + } + } + if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols())) + { + refreshImages(); + } + } + + public void intervalRemoved(ListDataEvent event) + { + //contentsChanged(event); + } + + /** Registers ItemListener to receive events. + * @param listener The listener to register. + * + */ + // @Override + public synchronized void addItemListener(XItemListener listener) + { + if (m_aItemListenerList == null) + { + m_aItemListenerList = new java.util.ArrayList<XItemListener>(); + } + m_aItemListenerList.add(listener); + } + + /** Removes ItemListener from the list of listeners. + * @param listener The listener to remove. + * + */ + public synchronized void removeItemListener(XItemListener listener) + { + if (m_aItemListenerList != null) + { + m_aItemListenerList.remove(listener); + } + } + + /** Notifies all registered listeners about the event. + * + * @param event The event to be fired + * + */ + private void fireItemSelected() + { +// java.awt.event.ItemEvent event = new java.awt.event.ItemEvent(this, 0, +// getSelectedObject(), java.awt.event.ItemEvent.SELECTED); + java.util.ArrayList list; + synchronized(this) + { + if (m_aItemListenerList == null) + { + return; + } + list = (java.util.ArrayList) m_aItemListenerList.clone(); + } + for (int i = 0; i < list.size(); i++) + { + ((com.sun.star.awt.XItemListener) list.get(i)).itemStateChanged(null); + } + } + + /** + * @return + */ + public int getCols() + { + return cols; + } + + /** + * @return + */ + public Size getGap() + { + return gap; + } + + /** + * @return + */ + public ListModel getListModel() + { + return listModel; + } + + /** + * @return + */ + public Short getStep() + { + return step; + } + + /** + * @return + */ + public int getPageStart() + { + return pageStart; + } + + /** + * @return + */ + public Size getPos() + { + return pos; + } + + /** + * @return + */ + public IImageRenderer getRenderer() + { + return renderer; + } + + /** + * @return + */ + public int getRows() + { + return rows; + } + + /** + * @return + */ + public int getSelected() + { + return m_nCurrentSelection; + } + + /** + * @return + */ + public Size getSelectionGap() + { + return selectionGap; + } + + /** + * @return + */ + public boolean isShowButtons() + { + return showButtons; + } + + /** + * @param i + */ + public void setCols(int i) + { + cols = i; + } + + /** + * @param size + */ + public void setGap(Size size) + { + gap = size; + } + + /** + * @param model + */ + public void setListModel(ListModel model) + { + listModel = model; + } + + /** + * @param short1 + */ + public void setStep(Short short1) + { + step = short1; + } + + /** + * @param i + */ + public void setPageStart(int i) + { + if (i == pageStart) + { + return; + } + pageStart = i; + enableButtons(); + refreshImages(); + } + + /** + * @param _size + */ + public void setPos(Size _size) + { + pos = _size; + } + + /** + * @param _renderer + */ + public void setRenderer(IImageRenderer _renderer) + { + this.renderer = _renderer; + } + + /** + * @param i + */ + public void setRows(int i) + { + rows = i; + } + + /** + * @param i + */ + public void setSelected(int i) + { + if (rowSelect && (i >= 0)) + { + i = (i / cols) * cols; + } + if (m_nCurrentSelection == i) + { + return; + } + m_nCurrentSelection = i; + refreshImageText(); + refreshSelection(); + fireItemSelected(); + } + +/* + public void setSelected(Object object) + { + if (object == null) + { + setSelected(-1); + } + else + { + for (int i = 0; i < getListModel().getSize(); i++) + { + if (getListModel().getElementAt(i).equals(object)) + { + setSelected(i); + return; + } + } + } + setSelected(-1); + + } +*/ + + /** + * set the text under the button list + */ + private void refreshImageText() + { + Object item = m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; + final String sText = " " + renderer.render(item); + Helper.setUnoPropertyValue(getModel(lblImageText), "Label", sText); + } + + /** + * @param size + */ + public void setSelectionGap(Size size) + { + selectionGap = size; + } + + /** + * @param b + */ + public void setShowButtons(boolean b) + { + showButtons = b; + } + + public void nextPage() + { + if (pageStart < getListModel().getSize() - rows * cols) + { + setPageStart(pageStart + rows * cols); + } + } + + public void prevPage() + { + if (pageStart == 0) + { + return; + } + int i = pageStart - rows * cols; + if (i < 0) + { + i = 0; + } + setPageStart(i); + } + + private void enableButtons() + { + enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize())); + enable(btnBack, new Boolean(pageStart > 0)); + } + + private void enable(Object control, Boolean enable) + { + Helper.setUnoPropertyValue(getModel(control), "Enabled", enable); + } + + private Object getModel(Object control) + { + return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + } + + private void setBorder(Object control, Short border) + { + Helper.setUnoPropertyValue(getModel(control), "Border", border); + //XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer(); + //peer.invalidate(InvalidateStyle.CHILDREN); + } + + + public Object[] getSelectedObjects() + { + return new Object[] + { + getListModel().getElementAt(m_nCurrentSelection) + }; + } + + + /** + */ + public static interface IImageRenderer extends IRenderer + { + + /** + * + * @param listItem + * @return two resource ids for an image referenced in the imaglist resourcefile of the + * wizards project; The second one of them is designed to be used for High Contrast Mode. + */ + public Object[] getImageUrls(Object listItem); + } + + private static class SimpleCounterRenderer implements IRenderer + { + + // @Override + public String render(Object counter) + { + return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max; + } + } + + public static class Counter + { + + public int start, end, max; + + public Counter(int start_, int end_, int max_) + { + start = start_; + end = end_; + max = max_; + } + } + + public Object getSelectedObject() + { + return m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; + } + + + public void setRowSelect(boolean b) + { + rowSelect = b; + } + + public boolean isRowSelect() + { + return rowSelect; + } + + + /** + * jump to the given item (display the screen + * that contains the given item). + * @param i + */ + public void display(int i) + { + int is = (getCols() * getRows()); + int ps = (listModel.getSize() / is) * is; + setPageStart(ps); + } + + /** + * @return + */ + public boolean isenabled() + { + return benabled; + } + + /** + * @param b + */ + public void setenabled(boolean b) + { + + for (int i = 0; i < m_aButtons.length; i++) + { + UnoDialog2.setEnabled(m_aButtons[i], b); + } +// UnoDialog2.setEnabled(grbxSelectedImage, b); + UnoDialog2.setEnabled(lblImageText, b); + if (showButtons) + { + UnoDialog2.setEnabled(btnBack, b); + UnoDialog2.setEnabled(btnNext, b); + UnoDialog2.setEnabled(lblCounter, b); + } + benabled = b; + } + +/** + * refresh on all buttons, the selected button will get state pressed + */ + private void refreshSelection() + { + // reset all buttons to not set + for (int i = 0; i < m_aButtons.length; i++) + { + if (m_aButtons[i] != null) + { + XControlModel xModel = (XControlModel)UnoDialog2.getModel(m_aButtons[i]); + PropertySetHelper aHelper = new PropertySetHelper(xModel); + if (i == m_nCurrentSelection) + { + final short one = 1; + aHelper.setPropertyValueDontThrow("State", Short.valueOf(one)); + } + else + { + final short zero = 0; + aHelper.setPropertyValueDontThrow("State", Short.valueOf(zero)); + } + } + } + } + +/** + * implementation of XActionListener + * will call if a button from the m_aButtonList is pressed. + * @param actionEvent + */ +// @Override + public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) + { + // bStopProcess = true; + XControlModel xModel = (XControlModel)UnoDialog2.getModel(actionEvent.Source); + PropertySetHelper aHelper = new PropertySetHelper(xModel); + + int nState = aHelper.getPropertyValueAsInteger("State", -1); + if (nState == 0) + { + // this will avoid a wrong state, if already pressed. + aHelper.setPropertyValueDontThrow("State", Short.valueOf((short)1)); + } + + // check which Button is pressed. + String sControlName = aHelper.getPropertyValueAsString("Name", ""); + final String sButton = sControlName.substring(7 + m_aControlName.length()); + int nButton = new Integer(sButton).intValue(); + + // int image = getImageFromEvent(event); + int index = getIndexFor(nButton); + if (index < listModel.getSize()) + { + // focus(image); + setSelected(index); + } + + } + + +} diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index eb698a3b35bc..37ff4a46b49e 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -31,12 +31,12 @@ package com.sun.star.wizards.ui; import com.sun.star.wizards.common.*; import com.sun.star.wizards.db.*; -import com.sun.star.awt.XWindow; +// import com.sun.star.awt.XWindow; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.sdb.CommandType; // import com.sun.star.sdbc.SQLException; import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; +// import com.sun.star.uno.UnoRuntime; import com.sun.star.awt.*; import com.sun.star.beans.PropertyValue; import java.text.Collator; @@ -45,20 +45,20 @@ import java.util.Comparator; public class CommandFieldSelection extends FieldSelection implements Comparator { - CommandMetaData CurDBMetaData; - XListBox xTableListBox; - XFixedText xlblTable; - String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; - String sTableListBoxName; - String sTableLabelName; - String sQueryPrefix; - String sTablePrefix; + private CommandMetaData CurDBMetaData; + private XListBox xTableListBox; + private XFixedText xlblTable; + // private String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; + private String sTableListBoxName; + private String sTableLabelName; + private String sQueryPrefix; + private String sTablePrefix; private short m_iSelPos = -1; - short iOldSelPos = -1; - boolean bpreselectCommand = true; - boolean bgetQueries; + private short iOldSelPos = -1; + private boolean bpreselectCommand = true; + private boolean bgetQueries; // boolean AppendMode; - WizardDialog oWizardDialog; + private WizardDialog oWizardDialog; private Collator aCollator = null; class ItemListenerImpl implements com.sun.star.awt.XItemListener @@ -137,6 +137,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator sTablePrefix = getTablePrefix(); sQueryPrefix = getQueryPrefix(); Integer LabelWidth = new Integer(getListboxWidth().intValue() + 6); + // Label 'Tables or Queries' xlblTable = CurUnoDialog.insertLabel(sTableLabelName, new String[] { @@ -146,6 +147,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator { Boolean.FALSE, new Integer(8), _reslblTables, new Integer(95), new Integer(27), IStep, new Short((short) 3), LabelWidth }); + // DropDown Listbox TableNames xTableListBox = CurUnoDialog.insertListBox(sTableListBoxName, 0, null, new ItemListenerImpl(), new String[] { @@ -232,27 +234,28 @@ public class CommandFieldSelection extends FieldSelection implements Comparator boolean binitialize = false; String curCommandName = ""; //As the peer of the control might not yet exist we have to query the model for the SelectedItems - String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList"); short iSelPos = getselectedItemPos(); + // String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList"); + final String sSelectedTableName = xTableListBox.getItem(iSelPos); if (!bgetQueries) { - curCommandName = sLocList[iSelPos]; + curCommandName = sSelectedTableName; // sLocList[iSelPos]; CurDBMetaData.setTableByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode); } else { - if (sLocList[iSelPos].startsWith(sTablePrefix)) + if (sSelectedTableName.startsWith(sTablePrefix)) { CurDBMetaData.setCommandType(CommandType.TABLE); - curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sTablePrefix); + curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sTablePrefix); CurDBMetaData.setTableByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode); } else { CurDBMetaData.setCommandType(CommandType.QUERY); - curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sQueryPrefix); + curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sQueryPrefix); CurDBMetaData.setQueryByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode); } @@ -456,22 +459,19 @@ public class CommandFieldSelection extends FieldSelection implements Comparator short iselpos = (short) JavaTools.FieldInList(sitems, getTablePrefix() + _selitem); if (iselpos > -1) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] - { - iselpos - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] { iselpos }); } this.fillUpFieldsListbox(); } else { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] - { - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] {} ); + this.fillUpFieldsListbox(); } if (_bReadOnly) { Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0)); } + toggleListboxButtons((short)-1,(short)-1); } } diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java index 40323852f3e7..7cf333ddf362 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -56,7 +56,7 @@ public abstract class DBLimitedFieldSelection protected int iCurPosY; protected int FirstHelpIndex; protected int iCompPosX; - protected int MaxSelIndex; + // protected int MaxSelIndex; public DBLimitedFieldSelection(WizardDialog _CurUnoDialog, int iStep, int _iCompPosX, int iCompPosY, int iCompWidth, int _FirstHelpIndex) { @@ -70,7 +70,7 @@ public abstract class DBLimitedFieldSelection ICompPosX = new Integer(iCompPosX); ICompPosY = new Integer(iCompPosY); ICompWidth = new Integer(iCompWidth); - boolean bDoEnable; + // boolean bDoEnable; iCurPosY = iCompPosY; for (int i = 0; i < rowcount; i++) { @@ -86,20 +86,22 @@ public abstract class DBLimitedFieldSelection protected abstract void updateFromNextControlRow(int CurIndex); - protected abstract void setMaxSelIndex(); + // protected abstract void setMaxSelIndex(); + + protected abstract int getMaxSelIndex(); protected void moveupSelectedItems(int CurIndex, boolean bDoEnable) { - short iNextItemPos; + // short iNextItemPos; if ((bDoEnable == false) && (MAXSELINDEX > CurIndex)) { for (int i = CurIndex; i < MAXSELINDEX; i++) { updateFromNextControlRow(i); } - if (MaxSelIndex < rowcount - 2) + if (getMaxSelIndex() < rowcount - 2) { - toggleControlRow(MaxSelIndex + 2, false); + toggleControlRow(getMaxSelIndex() + 2, false); } } else @@ -131,26 +133,17 @@ public abstract class DBLimitedFieldSelection int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldNames[curindex]); if (index > -1) { - SelList = new short[] - { - (short) (index) - }; + SelList = new short[] { (short) (index) }; } else { - SelList = new short[] - { - (short) (0) - }; + SelList = new short[] { (short) (0) }; } Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); return; } } - SelList = new short[] - { - (short) (0) - }; + SelList = new short[] { (short) (0) }; Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); } @@ -160,10 +153,7 @@ public abstract class DBLimitedFieldSelection Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames); short[] SelList = null; int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName); - SelList = new short[] - { - (short) (index) - }; + SelList = new short[] { (short) (index) }; Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); } } diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index e66a2e58af65..dac15efc375a 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -42,41 +42,38 @@ import java.util.*; */ public class FieldSelection { + public XListBox xFieldsListBox; // Left ListBox + public XListBox xSelectedFieldsListBox; // right (selected) ListBox - public UnoDialog CurUnoDialog; - public XListBox xFieldsListBox; - public XListBox xSelectedFieldsListBox; - public XFieldSelectionListener xFieldSelection; - public int maxfieldcount = 10000000; - public String sIncSuffix; - protected Integer IStep; + protected UnoDialog CurUnoDialog; + protected String sIncSuffix; protected int FirstHelpIndex; - protected short curtabindex; + protected boolean AppendMode = false; + protected Integer IStep; + + protected int CompPosX; + protected int CompPosY; + protected int CompHeight; + protected int CompWidth; + + private XFieldSelectionListener xFieldSelection; + private int maxfieldcount = 10000000; private String[] AllFieldNames; private Integer ListBoxWidth; - public Integer SelListBoxPosX; - boolean bisModified = false; - boolean AppendMode = false; - - final int SOCMDMOVESEL = 1; - final int SOCMDMOVEALL = 2; - final int SOCMDREMOVESEL = 3; - final int SOCMDREMOVEALL = 4; - final int SOCMDMOVEUP = 5; - final int SOCMDMOVEDOWN = 6; - final int SOFLDSLST = 7; - final int SOSELFLDSLST = 8; - final int cmdButtonWidth = 16; - final int cmdButtonHoriDist = 4; - final int cmdButtonHeight = 14; - final int cmdButtonVertiDist = 2; - final int lblHeight = 8; - final int lblVertiDist = 2; - - int CompPosX; - int CompPosY; - int CompHeight; - int CompWidth; + + private Integer SelListBoxPosX; + + private boolean bisModified = false; + + private final static int SOCMDMOVESEL = 1; + private final static int SOCMDMOVEALL = 2; + private final static int SOCMDREMOVESEL = 3; + private final static int SOCMDREMOVEALL = 4; + private final static int SOCMDMOVEUP = 5; + private final static int SOCMDMOVEDOWN = 6; + private final static int SOFLDSLST = 7; + private final static int SOSELFLDSLST = 8; + class ItemListenerImpl implements com.sun.star.awt.XItemListener { @@ -181,18 +178,19 @@ public class FieldSelection return AppendMode; } - public FieldSelection(UnoDialog CurUnoDialog, int iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) + public FieldSelection(UnoDialog CurUnoDialog, int _iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) { try { - String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39); - String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40); - String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41); - String AccessTextRemoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 42); - String AccessMoveFieldUp = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 43); - String AccessMoveFieldDown = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 44); + final String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39); + final String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40); + final String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41); + final String AccessTextRemoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 42); + final String AccessMoveFieldUp = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 43); + final String AccessMoveFieldDown = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 44); + FirstHelpIndex = _FirstHelpIndex; - curtabindex = UnoDialog.setInitialTabindex(iStep); + short curtabindex = UnoDialog.setInitialTabindex(_iStep); int ShiftButtonCount = 2; int a = 0; this.CurUnoDialog = CurUnoDialog; @@ -203,12 +201,18 @@ public class FieldSelection Object btnmoveall = null; Object btnremoveall = null; - ListBoxWidth = new Integer((int) ((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2)); - Integer cmdShiftButtonPosX = new Integer((int) (CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist)); + final int cmdButtonWidth = 16; + final int cmdButtonHoriDist = 4; + final int lblHeight = 8; + final int lblVertiDist = 2; + + ListBoxWidth = new Integer(((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2)); + Integer cmdShiftButtonPosX = new Integer((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist)); Integer ListBoxPosY = new Integer(CompPosY + lblVertiDist + lblHeight); Integer ListBoxHeight = new Integer(CompHeight - 8 - 2); SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist); - IStep = new Integer(iStep); + + IStep = new Integer(_iStep); if (bshowFourButtons == true) { ShiftButtonCount = 4; @@ -221,6 +225,7 @@ public class FieldSelection sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "lblFields_"); + // Label CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblFields" + sIncSuffix, new String[] { @@ -231,6 +236,7 @@ public class FieldSelection new Integer(8), slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), new Integer(109) }); + // Listbox 'Available fields' xFieldsListBox = CurUnoDialog.insertListBox("lstFields" + sIncSuffix, SOFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { @@ -289,6 +295,7 @@ public class FieldSelection FontDescriptor oFontDesc = new FontDescriptor(); oFontDesc.Name = "StarSymbol"; + // Label 'Fields in the form' CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelFields" + sIncSuffix, new String[] { @@ -299,6 +306,7 @@ public class FieldSelection new Integer(8), slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth }); + // ListBox 'Fields in the form' xSelectedFieldsListBox = CurUnoDialog.insertListBox("lstSelFields" + sIncSuffix, SOSELFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { @@ -364,7 +372,10 @@ public class FieldSelection if (ButtonCount > 0) { YPosArray = new Integer[ButtonCount]; - YPosArray[0] = new Integer((int) (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2))); + final int cmdButtonHeight = 14; + final int cmdButtonVertiDist = 2; + + YPosArray[0] = new Integer( (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2))); if (ButtonCount > 1) { for (int i = 1; i < ButtonCount; i++) @@ -616,9 +627,9 @@ public class FieldSelection else { int MaxOriginalCount = AllFieldNames.length; - int MaxSelected = OldSelFieldItems.length; + // int MaxSelected = OldSelFieldItems.length; String[] SelList = xFieldsListBox.getItems(); - Vector NewSourceVector = new Vector(); + Vector<String> NewSourceVector = new Vector<String>(); for (int i = 0; i < MaxOriginalCount; i++) { SearchString = AllFieldNames[i]; diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index c84db4674c96..6dbc246ca84c 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -163,9 +163,9 @@ public class FilterComponent XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue); XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl); - Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", new Boolean(CurFieldColumn.bIsNumberFormat)); + Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", Boolean.valueOf(CurFieldColumn.isNumberFormat())); final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter(); - aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.DBFormatKey, aNumberFormatter); + aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.getDBFormatKey(), aNumberFormatter); // } break; @@ -313,18 +313,18 @@ public class FilterComponent String sFieldName = CurControlRow.getSelectedFieldName(); int nOperator = (int) CurControlRow.getSelectedOperator(); FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); - if (aFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTextFormatKey()) + if (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getTextFormatKey()) { aValue = "'" + CurControlRow.getValue() + "'"; } //// TODO the following code is bound to be deprecated as soon as the query composer is able to handle date/time values as numbers - else if ((aFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateFormatKey()) || - (aFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey())) + else if ((aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getDateFormatKey()) || + (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey())) { String sDate = CurControlRow.getDateTimeString(true); aValue = "{D '" + sDate + "' }"; // FormatsSupplier } - else if (aFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTimeFormatKey()) + else if (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getTimeFormatKey()) { String sTime = CurControlRow.getDateTimeString(true); aValue = "'{T '" + sTime + "' }"; @@ -335,7 +335,7 @@ public class FilterComponent // if void if (! AnyConverter.isVoid(aValue)) { - switch (aFieldColumn.FieldType) + switch (aFieldColumn.getFieldType()) { case DataType.TINYINT: case DataType.BIGINT: @@ -383,7 +383,7 @@ public class FilterComponent PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]]; String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, smsgDuplicateCondition); - CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2))); + CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", Integer.valueOf(1), Integer.valueOf(2))); return new PropertyValue[][] { }; @@ -495,7 +495,7 @@ public class FilterComponent { this.curHelpID = _firstHelpID; this.xMSF = _xMSF; - this.IStep = new Integer(iStep); + this.IStep = Integer.valueOf(iStep); curtabindex = UnoDialog.setInitialTabindex(iStep); this.CurUnoDialog = CurUnoDialog; @@ -534,15 +534,15 @@ public class FilterComponent }, new Object[] { - new Integer(9), + Integer.valueOf(9), "HID:" + curHelpID++, soptMatchAll, - new Integer(iPosX), - new Integer(iPosY), - new Short((short) 1), + Integer.valueOf(iPosX), + Integer.valueOf(iPosY), + Short.valueOf((short) 1), IStep, - new Short(curtabindex++), - new Integer(203) + Short.valueOf(curtabindex++), + Integer.valueOf(203) }); optMatchAny = CurUnoDialog.insertRadioButton("optMatchAny" + sIncSuffix, SOOPTORMODE, new ItemListenerImpl(), new String[] @@ -558,14 +558,14 @@ public class FilterComponent }, new Object[] { - new Integer(9), + Integer.valueOf(9), "HID:" + curHelpID++, soptMatchAny, - new Integer(iPosX), - new Integer(iPosY + 12), + Integer.valueOf(iPosX), + Integer.valueOf(iPosY + 12), IStep, - new Short(curtabindex++), - new Integer(203) + Short.valueOf(curtabindex++), + Integer.valueOf(203) }); getfilterstate(); @@ -693,14 +693,14 @@ public class FilterComponent }, new Object[] { - new Boolean(isEnabled()), - new Integer(9), + Boolean.valueOf(isEnabled()), + Integer.valueOf(9), slblFieldNames, - new Integer(nPosX1), - new Integer(iCompPosY + 13), + Integer.valueOf(nPosX1), + Integer.valueOf(iCompPosY + 13), IStep, - new Short(curtabindex++), - new Integer(nFieldWidth) + Short.valueOf(curtabindex++), + Integer.valueOf(nFieldWidth) }); // Label Operator @@ -718,14 +718,14 @@ public class FilterComponent }, new Object[] { - new Boolean(isEnabled()), - new Integer(9), + Boolean.valueOf(isEnabled()), + Integer.valueOf(9), slblOperators, - new Integer(nPosX2), - new Integer(iCompPosY + 13), + Integer.valueOf(nPosX2), + Integer.valueOf(iCompPosY + 13), IStep, - new Short(curtabindex++), - new Integer(nOperatorWidth) + Short.valueOf(curtabindex++), + Integer.valueOf(nOperatorWidth) }); // Label Value @@ -743,14 +743,14 @@ public class FilterComponent }, new Object[] { - new Boolean(isEnabled()), - new Integer(9), + Boolean.valueOf(isEnabled()), + Integer.valueOf(9), slblValue, - new Integer(nPosX3), - new Integer(iCompPosY + 13), + Integer.valueOf(nPosX3), + Integer.valueOf(iCompPosY + 13), IStep, - new Short(curtabindex++), - new Integer(nValueWidth) + Short.valueOf(curtabindex++), + Integer.valueOf(nValueWidth) }); // Listbox Fields @@ -761,6 +761,7 @@ public class FilterComponent "Dropdown", "Height", "HelpURL", + "LineCount", "PositionX", "PositionY", "Step", @@ -769,15 +770,16 @@ public class FilterComponent }, new Object[] { - new Boolean(isEnabled()), + Boolean.valueOf(isEnabled()), Boolean.TRUE, - new Integer(13), + Integer.valueOf(13), "HID:" + _firstRowHelpID++, - new Integer(nPosX1), - new Integer(iCompPosY + 23), + Short.valueOf(UnoDialog.getListBoxLineCount() /* 7 */) , + Integer.valueOf(nPosX1), + Integer.valueOf(iCompPosY + 23), IStep, - new Short(curtabindex++), - new Integer(nFieldWidth) + Short.valueOf(curtabindex++), + Integer.valueOf(nFieldWidth) }); // Listbox Operators @@ -798,17 +800,17 @@ public class FilterComponent }, new Object[] { - new Boolean(isEnabled()), + Boolean.valueOf(isEnabled()), Boolean.TRUE, - new Integer(13), + Integer.valueOf(13), "HID:" + _firstRowHelpID++, - new Short((short) sLogicOperators.length /* 7 */ ), - new Integer(nPosX2), - new Integer(iCompPosY + 23), + Short.valueOf((short) sLogicOperators.length /* 7 */ ), + Integer.valueOf(nPosX2), + Integer.valueOf(iCompPosY + 23), IStep, sLogicOperators, - new Short(curtabindex++), - new Integer(nOperatorWidth) + Short.valueOf(curtabindex++), + Integer.valueOf(nOperatorWidth) }); ControlElements[SOTXTVALUE] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(), new String[] @@ -824,14 +826,14 @@ public class FilterComponent }, new Object[] { - new Boolean(isEnabled()), - new Integer(13), + Boolean.valueOf(isEnabled()), + Integer.valueOf(13), "HID:" + _firstRowHelpID++, - new Integer(nPosX3), - new Integer(iCompPosY + 23), + Integer.valueOf(nPosX3), + Integer.valueOf(iCompPosY + 23), IStep, - new Short(curtabindex++), - new Integer(nValueWidth) + Short.valueOf(curtabindex++), + Integer.valueOf(nValueWidth) }); // ControlElements[6] = CurUnoDialog.insertListBox((new StringBuilder()).append("lstBoolean").append(sCompSuffix).toString(), SO_BOOLEANLIST[Index], null, new ItemListenerImpl(), new String[] { @@ -993,7 +995,7 @@ public class FilterComponent // enable all Controls Fieldname, operator, value for (int i = 0; i < ControlElements.length; i++) { - Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", new Boolean(_bEnabled)); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", Boolean.valueOf(_bEnabled)); } m_bEnabled = _bEnabled; if (isEnabled()) diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java index 363cc2d49311..fd93a3192d8a 100644 --- a/wizards/com/sun/star/wizards/ui/ImageList.java +++ b/wizards/com/sun/star/wizards/ui/ImageList.java @@ -29,11 +29,24 @@ ************************************************************************/ package com.sun.star.wizards.ui; -import com.sun.star.awt.*; +// import com.sun.star.awt.*; + +import com.sun.star.awt.Key; +import com.sun.star.awt.KeyEvent; +import com.sun.star.awt.MouseEvent; +import com.sun.star.awt.Size; +import com.sun.star.awt.XButton; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XFixedText; +import com.sun.star.awt.XItemEventBroadcaster; +import com.sun.star.awt.XItemListener; +import com.sun.star.awt.XKeyListener; +import com.sun.star.awt.XMouseListener; +import com.sun.star.awt.XWindow; import com.sun.star.lang.EventObject; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; import com.sun.star.wizards.ui.event.*; @@ -52,13 +65,13 @@ import javax.swing.event.ListDataListener; public class ImageList implements XItemEventBroadcaster, ListDataListener { - private XControl imgContainer; + // private XControl imgContainer; private XFixedText lblImageText; private XFixedText grbxSelectedImage; private XButton btnBack; private XButton btnNext; private XFixedText lblCounter; - private XControl images[]; + private XControl m_aImages[]; private boolean benabled = true; private UnoDialog2 oUnoDialog; private Size gap = new Size(4, 4); @@ -80,9 +93,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private int pageStart = 0; public int helpURL = 0; private CommonListener uiEventListener = new CommonListener(); - private ImageRenderer renderer; + private IImageRenderer renderer; private ListModel listModel; - public Renderer counterRenderer = new SimpleCounterRenderer(); + public IRenderer counterRenderer = new SimpleCounterRenderer(); private Object dialogModel; private ImageKeyListener imageKeyListener; private static final Integer BACKGROUND_COLOR = new Integer(16777216); //new Integer(SystemColor.window.getRGB() + 16777216); @@ -110,6 +123,32 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener this.imageSize = imageSize; } + class OMouseListener implements XMouseListener + { + public OMouseListener() + {} + public void mousePressed(MouseEvent arg0) + { + focus(getImageIndexFor(getSelected())); + } + + public void mouseReleased(MouseEvent arg0) + { + } + + public void mouseEntered(MouseEvent arg0) + { + } + + public void mouseExited(MouseEvent arg0) + { + } + + public void disposing(EventObject arg0) + { + } + } + public void create(UnoDialog2 dialog) { oUnoDialog = dialog; @@ -121,12 +160,26 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener MOVE_SELECTION_VALS[2] = step; - imgContainer = dialog.insertImage(name + "lblContainer", new String[] + XControl imgContainer = dialog.insertImage(name + "lblContainer", + new String[] { - "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Width" - }, new Object[] + "BackgroundColor", + "Border", + "Height", + "PositionX", + "PositionY", + "Step", + "Width" + }, + new Object[] { - BACKGROUND_COLOR, new Short((short) 1), new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), new Integer(pos.Width), new Integer(pos.Height), step, new Integer((imageSize.Width + gap.Width) * cols + gap.Width) + BACKGROUND_COLOR, + new Short((short) 1), + new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + new Integer(pos.Width), + new Integer(pos.Height), + step, + new Integer((imageSize.Width + gap.Width) * cols + gap.Width) }); opeerConfig.setPeerProperties(imgContainer, new String[] @@ -143,74 +196,99 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener uiEventListener.add(dName,EventNames.EVENT_WINDOW_SHOWN,"disableContainerMouseEvents",this); */ - int selectionWidth = rowSelect ? (imageSize.Width + gap.Width) * cols - gap.Width + (selectionGap.Width * 2) : imageSize.Width + (selectionGap.Width * 2); + int selectionWidth = rowSelect ? + (imageSize.Width + gap.Width) * cols - gap.Width + (selectionGap.Width * 2) : + imageSize.Width + (selectionGap.Width * 2); grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[] { - "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Tabstop", "Width" + "BackgroundColor", + "Border", + "Height", + "PositionX", + "PositionY", + "Step", + "Tabstop", + "Width" }, new Object[] { - TRANSPARENT, new Short((short) 1), new Integer(imageSize.Height + (selectionGap.Height * 2)), //height + TRANSPARENT, + new Short((short) 1), + new Integer(imageSize.Height + (selectionGap.Height * 2)), + //height new Integer(0), //posx new Integer(0), //posy - step, Boolean.TRUE, new Integer(selectionWidth) + step, + Boolean.TRUE, + new Integer(selectionWidth) }); XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage); - xWindow.addMouseListener(new XMouseListener() - { - - public void mousePressed(MouseEvent arg0) - { - focus(getImageIndexFor(getSelected())); - } - - public void mouseReleased(MouseEvent arg0) - { - } - - public void mouseEntered(MouseEvent arg0) - { - } - - public void mouseExited(MouseEvent arg0) - { - } - - public void disposing(EventObject arg0) - { - } - }); - + xWindow.addMouseListener(new OMouseListener()); final String[] pNames1 = new String[] { - "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Tabstop", "Width" + "Height", + "HelpURL", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Tabstop", + "Width" }; lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[] { - new Integer(imageTextHeight), "", new Integer(pos.Width + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), step, new Short((short) 0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2) + new Integer(imageTextHeight), + "", + new Integer(pos.Width + 1), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), + step, + new Short((short) 0), + Boolean.FALSE, + new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2) }); - final Integer btnSize = new Integer(14); if (showButtons) { + final Integer btnSize = new Integer(14); btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[] { - btnSize, "HID:" + helpURL++, new Integer(pos.Width), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short) (tabIndex + 1)), Boolean.TRUE, btnSize + btnSize, + "HID:" + helpURL++, + new Integer(pos.Width), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + new Short((short) (tabIndex + 1)), + Boolean.TRUE, + btnSize }); btnNext = dialog.insertButton(name + "_btnNext", "nextPage", this, pNames1, new Object[] { - btnSize, "HID:" + helpURL++, new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short) (tabIndex + 2)), Boolean.TRUE, btnSize + btnSize, + "HID:" + helpURL++, + new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + new Short((short) (tabIndex + 2)), + Boolean.TRUE, + btnSize }); lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[] { - new Integer(LINE_HEIGHT), "", new Integer(pos.Width + btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), step, new Short((short) 0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) + new Integer(LINE_HEIGHT), + "", + new Integer(pos.Width + btnSize.intValue() + 1), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), + step, + new Short((short) 0), + Boolean.FALSE, + new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) }); Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1)); @@ -221,9 +299,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener } imageKeyListener = new ImageKeyListener(); - tabIndex_ = new Short((short) tabIndex); + m_tabIndex = new Short((short) tabIndex); - images = new XControl[rows * cols]; + m_aImages = new XControl[rows * cols]; try { @@ -236,14 +314,14 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener e.printStackTrace(); } - _imageHeight = new Integer(imageSize.Height); - _imageWidth = new Integer(imageSize.Width); + m_imageHeight = new Integer(imageSize.Height); + m_imageWidth = new Integer(imageSize.Width); for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { - images[r * cols + c] = createImage(dialog, r, c); + m_aImages[r * cols + c] = createImage(dialog, r, c); } } refreshImages(); @@ -251,20 +329,42 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener listModel.addListDataListener(this); } - private Integer _imageHeight, _imageWidth; + private Integer m_imageHeight, m_imageWidth; private final static String[] IMAGE_PROPS = new String[] { - "Border", "BackgroundColor", "Height", "HelpURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Tabstop", "Width" + "Border", + "BackgroundColor", + "Height", + "HelpURL", + "PositionX", + "PositionY", + "ScaleImage", + "Step", + "TabIndex", + "Tabstop", + "Width" }; //used for optimization - private Short tabIndex_; + private Short m_tabIndex; - private XControl createImage(UnoDialog2 dialog, int row, int col) - { - String imageName = name + "_image" + (row * cols + col); - XControl image = dialog.insertImage(imageName, IMAGE_PROPS, new Object[] + private XControl createImage(UnoDialog2 dialog, int _row, int _col) + { + String imageName = name + "_image" + (_row * cols + _col); + XControl image = dialog.insertImage(imageName, + IMAGE_PROPS, + new Object[] { - NO_BORDER, BACKGROUND_COLOR, _imageHeight, "HID:" + helpURL++, new Integer(imagePosX(col)), new Integer(imagePosY(row)), scaleImages, step, tabIndex_, Boolean.FALSE, _imageWidth + NO_BORDER, + BACKGROUND_COLOR, + m_imageHeight, + "HID:" + helpURL++, + new Integer(getImagePosX(_col)), + new Integer(getImagePosY(_row)), + scaleImages, + step, + m_tabIndex, + Boolean.FALSE, + m_imageWidth }); XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, image); @@ -277,12 +377,12 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener return image; } - private int imagePosX(int col) + private int getImagePosX(int col) { return pos.Width + col * (imageSize.Width + gap.Width) + gap.Width; } - private int imagePosY(int row) + private int getImagePosY(int row) { return pos.Height + row * (imageSize.Height + gap.Height) + gap.Height; } @@ -296,29 +396,29 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener hideSelection(); if (refreshOverNull) { - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { - setVisible(images[i], false); + setVisible(m_aImages[i], false); } } boolean focusable = true; - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { Object[] oResources = renderer.getImageUrls(getObjectFor(i)); if (oResources != null) { if (oResources.length == 1) { - Helper.setUnoPropertyValue(images[i].getModel(), "ImageURL", (String) oResources[0]); + Helper.setUnoPropertyValue(m_aImages[i].getModel(), "ImageURL", (String) oResources[0]); } else if (oResources.length == 2) { - oUnoDialog.getPeerConfiguration().setImageUrl(images[i].getModel(), oResources[0], oResources[1]); + oUnoDialog.getPeerConfiguration().setImageUrl(m_aImages[i].getModel(), oResources[0], oResources[1]); } - Helper.setUnoPropertyValue(images[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE); + Helper.setUnoPropertyValue(m_aImages[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE); if (refreshOverNull) { - setVisible(images[i], true); + setVisible(m_aImages[i], true); } focusable = false; } @@ -377,8 +477,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener int row = image / cols; int col = rowSelect ? 0 : image - (row * cols); - MOVE_SELECTION_VALS[0] = new Integer(imagePosX(col) - selectionGap.Width); - MOVE_SELECTION_VALS[1] = new Integer(imagePosY(row) - selectionGap.Height); + MOVE_SELECTION_VALS[0] = new Integer(getImagePosX(col) - selectionGap.Width); + MOVE_SELECTION_VALS[1] = new Integer(getImagePosY(row) - selectionGap.Height); Helper.setUnoPropertyValues(getModel(grbxSelectedImage), MOVE_SELECTION, MOVE_SELECTION_VALS); @@ -386,7 +486,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener { setVisible(grbxSelectedImage, true); //now focus... } - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { if (i != image) { @@ -394,7 +494,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener } else { - Helper.setUnoPropertyValue(images[image].getModel(), "Tabstop", Boolean.TRUE); + Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE); } } } @@ -569,7 +669,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener /** * @return */ - public ImageRenderer getRenderer() + public IImageRenderer getRenderer() { return renderer; } @@ -663,7 +763,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener /** * @param renderer */ - public void setRenderer(ImageRenderer renderer) + public void setRenderer(IImageRenderer renderer) { this.renderer = renderer; } @@ -782,7 +882,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener int i = getImageFromEvent(event); //TODO what is when the image does not display an image? if (getIndexFor(i) != selected) - setBorder(images[i],imageBorderMO); + setBorder(m_aImages[i],imageBorderMO); } public void mouseExitImage(Object event) { @@ -790,7 +890,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener int i = getImageFromEvent(event); //TODO what is when the image does not display an image? if (getIndexFor(i) != selected) - setBorder(images[i],imageBorder); + setBorder(m_aImages[i],imageBorder); } */ private void setBorder(Object control, Short border) @@ -829,7 +929,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener /** */ - public static interface ImageRenderer extends Renderer + public static interface IImageRenderer extends IRenderer { /** @@ -841,7 +941,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener public Object[] getImageUrls(Object listItem); } - private static class SimpleCounterRenderer implements Renderer + private static class SimpleCounterRenderer implements IRenderer { public String render(Object counter) @@ -877,7 +977,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener } else { - pageStart = (selected / images.length) * images.length; + pageStart = (selected / m_aImages.length) * m_aImages.length; } if (oldPageStart != pageStart) { @@ -980,15 +1080,15 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private final void focus(int image) { - Helper.setUnoPropertyValue(images[image].getModel(), "Tabstop", + Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, images[image]); + XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_aImages[image]); xWindow.setFocus(); } private final void defocus(int image) { - Helper.setUnoPropertyValue(UnoDialog.getModel(images[image]), "Tabstop", + Helper.setUnoPropertyValue(UnoDialog.getModel(m_aImages[image]), "Tabstop", Boolean.FALSE); } @@ -1019,9 +1119,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener public void setenabled(boolean b) { - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { - UnoDialog2.setEnabled(images[i], b); + UnoDialog2.setEnabled(m_aImages[i], b); } UnoDialog2.setEnabled(grbxSelectedImage, b); UnoDialog2.setEnabled(lblImageText, b); diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 256a28eff6b6..120b26367c8d 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -233,7 +233,8 @@ public class UnoDialog implements EventNames Property[] allProps = xPSet.getPropertySetInfo().getProperties(); for (int i = 0; i < allProps.length; i++) { - System.out.println(allProps[i].Name); + String sName = allProps[i].Name; + System.out.println(sName); } } catch (com.sun.star.uno.Exception exception) @@ -276,7 +277,10 @@ public class UnoDialog implements EventNames public static int getListBoxItemCount(XListBox _xListBox) { - String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList"); + // This function may look ugly, but this is the only way to check the count + // of values in the model,which is always right. + // the control is only a view and could be right or not. + final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList"); return fieldnames.length; } @@ -831,6 +835,7 @@ public class UnoDialog implements EventNames } XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); xReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit); + // TEUER! xControl.createPeer(xToolkit, parentPeer); xWindowPeer = xControl.getPeer(); return xControl.getPeer(); @@ -878,7 +883,9 @@ public class UnoDialog implements EventNames public static Object getModel(Object control) { - return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control); + XControlModel xModel = xControl.getModel(); + return xModel; } public static void setEnabled(Object control, boolean enabled) diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index 94c6117486c6..236233ecf8a8 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -51,6 +51,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames /** * Override this method to return another listener. + * @return */ protected AbstractListener createListener() { @@ -85,6 +86,23 @@ public class UnoDialog2 extends UnoDialog implements EventNames return insertButton(sName, actionPerformed, this, sPropNames, oPropValues); } + public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, Object eventTarget, String[] sPropNames, Object[] oPropValues) + { + + XButton xButton = (XButton) insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues, XButton.class); + + if (actionPerformed != null) + { + xButton.addActionListener(actionPerformed); + } + return xButton; + } + + public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, String[] sPropNames, Object[] oPropValues) + { + return insertImageButton(sName, actionPerformed, this, sPropNames, oPropValues); + } + public XCheckBox insertCheckBox(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { @@ -199,7 +217,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames { new Short((short) 0), new Integer(10), UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), new Integer(10) }); - super.getPeerConfiguration().setImageUrl(super.getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC); + super.getPeerConfiguration().setImageUrl(getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC); return xImgControl; } @@ -331,8 +349,8 @@ public class UnoDialog2 extends UnoDialog implements EventNames { ex.printStackTrace(); } - - return xDlgContainer.getControl(componentName); + final Object aObj = xDlgContainer.getControl(componentName); + return aObj; } private void setControlPropertiesDebug(Object model, String[] names, Object[] values) diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 42cca588a5ce..2e101ff3398a 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -35,7 +35,7 @@ import com.sun.star.wizards.ui.event.CommonListener; import com.sun.star.wizards.ui.event.EventNames; import com.sun.star.wizards.ui.event.MethodInvocation; import com.sun.star.uno.UnoRuntime; -import com.sun.star.awt.XItemEventBroadcaster; +// import com.sun.star.awt.XItemEventBroadcaster; import com.sun.star.awt.*; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.XInterface; @@ -85,6 +85,8 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * "HID:(hid+3)" - the next button * "HID:(hid+4)" - the create button * "HID:(hid+5)" - the cancel button + * @param xMSF + * @param hid_ */ public WizardDialog(XMultiServiceFactory xMSF, int hid_) { @@ -96,6 +98,10 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL //new Resource(xMSF,"Common","com"); } + /** + * + * @return + */ public Resource getResource() { return oWizardResource; @@ -378,6 +384,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL /* (non-Javadoc) * @see com.sun.star.wizards.ui.XCompletion#iscompleted(int) */ + /** + * + * @param _ndialogpage + * @return + */ public boolean iscompleted(int _ndialogpage) { return false; @@ -386,6 +397,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * @see com.sun.star.wizards.ui.XCompletion#ismodified(int) */ + /** + * + * @param _ndialogpage + * @return + */ public boolean ismodified(int _ndialogpage) { return false; @@ -394,6 +410,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean) */ + /** + * + * @param _ndialogpage + * @param _biscompleted + */ public void setcompleted(int _ndialogpage, boolean _biscompleted) { } @@ -401,6 +422,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * @see com.sun.star.wizards.ui.XCompletion#setmodified(int, java.lang.Object, java.lang.Object) */ + /** + * + * @param _ndialogpage + * @param ooldValue + * @param onewValue + */ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue) { } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index 0beea52edf48..5e18f931fa34 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -51,7 +51,6 @@ import java.util.Iterator; * Data Object. */ public abstract class DataAware { - protected static Class[] EMPTY_ARRAY = new Class[0]; /** * this is the data object. @@ -294,11 +293,18 @@ public abstract class DataAware { * @param obj the object which contains the property. * @return the get method reflection object. */ - protected Method createGetMethod(String propName, Object obj) { + private static Class[] EMPTY_ARRAY = new Class[0]; + + protected Method createGetMethod(String propName, Object obj) + { Method m = null; - try { //try to get a "get" method. + try + { //try to get a "get" method. + m = obj.getClass().getMethod("get" + propName, EMPTY_ARRAY); - } catch (NoSuchMethodException ex1) { + } + catch (NoSuchMethodException ex1) + { throw new IllegalArgumentException("get" + propName + "() method does not exist on " + obj.getClass().getName()); } return m; diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java index 0f42d4be15c0..0d50664b9efe 100644 --- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java +++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java @@ -151,7 +151,7 @@ public class BackgroundsDialog extends ImageListDialog * @author rpiterman * */ - private class BGRenderer implements ImageList.ImageRenderer + private class BGRenderer implements ImageList.IImageRenderer { private int cut; diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java index e21d1407193f..92702b978eec 100644 --- a/wizards/com/sun/star/wizards/web/IconsDialog.java +++ b/wizards/com/sun/star/wizards/web/IconsDialog.java @@ -46,7 +46,7 @@ import com.sun.star.wizards.web.data.CGIconSet; * It also implements the ImageList.ImageRenderer interface, to handle * its own objects. */ -public class IconsDialog extends ImageListDialog implements ImageList.ImageRenderer, ListModel +public class IconsDialog extends ImageListDialog implements ImageList.IImageRenderer, ListModel { private ConfigSet set; diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java index 8414068481b9..4fbf832f32ff 100644 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.java +++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java @@ -36,7 +36,7 @@ import com.sun.star.awt.XFixedText; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; import com.sun.star.wizards.ui.ImageList; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog2; @@ -259,7 +259,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts * @author rpiterman * */ - public static class ARenderer implements Renderer + public static class ARenderer implements IRenderer { String template; diff --git a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java index a688ffb7fdd6..6caa4dfda3c6 100644 --- a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java +++ b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java @@ -32,7 +32,7 @@ package com.sun.star.wizards.web; import java.util.Hashtable; import java.util.Map; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; /** * @author rpiterman @@ -42,7 +42,7 @@ import com.sun.star.wizards.common.Renderer; * display the current task status. * (renders the state to resource strings) */ -public class ProcessStatusRenderer implements Renderer, WebWizardConst +public class ProcessStatusRenderer implements IRenderer, WebWizardConst { Map strings = new Hashtable(12); diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java index 05f4bf9a3222..4f478c97aa21 100644 --- a/wizards/com/sun/star/wizards/web/StatusDialog.java +++ b/wizards/com/sun/star/wizards/web/StatusDialog.java @@ -34,7 +34,7 @@ import com.sun.star.awt.XFixedText; import com.sun.star.awt.XProgressBar; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.wizards.ui.UnoDialog2; import com.sun.star.wizards.ui.event.MethodInvocation; @@ -58,7 +58,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener private XFixedText lblCounter; private XButton btnCancel; private String[] res; - private Renderer renderer; + private IRenderer renderer; private boolean enableBreak = false; private boolean closeOnFinish = true; private MethodInvocation finishedMethod; @@ -284,7 +284,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener /** * @return the subTask renderer object */ - public Renderer getRenderer() + public IRenderer getRenderer() { return renderer; } @@ -292,7 +292,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener /** * @param renderer */ - public void setRenderer(Renderer renderer) + public void setRenderer(IRenderer renderer) { this.renderer = renderer; } diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java index 26746c09d01d..ce06a065868f 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java @@ -912,7 +912,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC * @author rpiterman */ - private class LayoutRenderer implements ImageList.ImageRenderer + private class LayoutRenderer implements ImageList.IImageRenderer { public Object[] getImageUrls(Object listItem) |