diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-22 11:01:27 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-22 11:01:27 +0000 |
commit | 7599f68cee9141cd16ca7697872b5f83c6ae9ad9 (patch) | |
tree | 7b6af2b3e3e2afad6302a623743ae5077acf3d9f /reportdesign/source | |
parent | 213aa2c95aa520cac3b5bcc68f373bec8d4ebf42 (diff) |
CWS-TOOLING: integrate CWS dba32a
2009-04-16 13:08:19 +0200 oj r270882 : #i14538# set property at control
2009-04-16 13:04:28 +0200 oj r270881 : #i98557# remove binary string for SRB
2009-04-15 13:19:10 +0200 oj r270838 : #i96782# use type set at view
2009-04-14 14:53:20 +0200 oj r270778 : #i96782# set initialize size for custom shape
2009-04-06 14:19:14 +0200 oj r270546 : #i88432# correct pos when < 0 while resizing
2009-04-06 13:36:13 +0200 oj r270541 : #i96782# handle toolbar and menubar differently
2009-04-06 13:33:54 +0200 oj r270540 : #i96782# handle toolbar and menubar differently
2009-04-06 12:28:23 +0200 oj r270534 : #i96782# handle toolbar and menubar differently
2009-04-06 12:27:44 +0200 oj r270533 : #i96782# handle toolbar and menubar differently
2009-04-06 12:24:32 +0200 oj r270532 : #i96782# handle toolbar and menubar differently
2009-04-06 12:15:15 +0200 oj r270531 : do not initialze when field is empty
2009-04-06 10:06:08 +0200 oj r270528 : #i96782# clean up of menubar and remove duplicates
2009-04-06 09:47:49 +0200 oj r270527 : #i96519# adjust help text dynamic
2009-04-03 13:43:20 +0200 oj r270482 : do not need to remove section from observer they are already disposed
2009-04-03 13:27:28 +0200 fs r270479 : #i97356#
2009-04-02 11:30:39 +0200 fs r270386 : UNX line ends
2009-04-02 10:54:51 +0200 fs r270379 : UNX line ends
2009-04-02 10:39:57 +0200 fs r270378 : UNX line ends
2009-04-02 10:37:24 +0200 fs r270377 : why did this survive the rebase? was removed on trunk ...
2009-03-31 13:31:12 +0200 fs r270277 : component_foo should be public
2009-03-28 00:21:01 +0100 fs r270176 : manuallly merged the changes which happened in CWS before resync to m45, where the directory had been moved from reportdesign/registry to reportbuilder/registry
2009-03-27 23:01:20 +0100 fs r270174 : CWS-TOOLING: rebase CWS dba32a to trunk@270033 (milestone: DEV300:m45)
2009-03-11 12:23:35 +0100 fs r269310 : #i99958# ensure the ControlModelLock doesn't release twice
2009-03-06 09:07:32 +0100 fs r268970 : ignore output paths in SVN's status
2009-03-06 09:07:08 +0100 fs r268969 : ignore output paths in SVN's status
2009-03-04 11:28:02 +0100 oj r268800 : copy and paste error, check correct end now
2009-03-03 15:49:11 +0100 fs r268736 : #i10000# those merges were lost during the rebase (m38->m42)
2009-03-03 13:25:27 +0100 lla r268720 : #i99652# fix wrong refactoring
2009-02-27 11:12:56 +0100 fs r268566 : beautified
2009-02-27 10:53:47 +0100 fs r268561 : doFormListening(false) only when actually isFormListening() (found during complex test case XMLFormSettings with assertions)
2009-02-26 20:55:31 +0100 fs r268546 : #i96530# set the Label property of the bound control, if we didn't create a dedicated label control
2009-02-26 11:53:09 +0100 fs r268494 : #i10000#
2009-02-26 11:27:50 +0100 fs r268493 : #i10000#
2009-02-26 11:17:08 +0100 fs r268490 : reportdesign depends on REPORTBUILDER, not REPORTDESIGN
2009-02-25 11:39:48 +0100 fs r268422 : #i10000# post-resync: INFO_ESCAPE_DATETIME got lost during rebase
2009-02-24 23:24:10 +0100 fs r268411 : CWS-TOOLING: rebase CWS dba32a to trunk@268395 (milestone: DEV300:m42)
2009-02-20 15:09:48 +0100 fs r268324 : respect ImplicitCatalog/SchemaRestriction in all necessary places
2009-02-20 13:48:10 +0100 oj r268318 : order of initialize corrected
2009-02-14 15:07:52 +0100 fs r267759 : #i98975# when an image does not have a bitmap, but a text, draw this (as placeholder)
2009-02-14 15:02:40 +0100 fs r267758 : consolidated and removed some duplicate code
2009-02-14 13:52:23 +0100 fs r267756 : #i10000#
2009-02-13 22:08:34 +0100 fs r267750 : #i100000#
2009-02-13 22:07:25 +0100 fs r267749 : #i10000#
2009-02-13 21:55:36 +0100 fs r267747 : #i10000#
2009-02-13 21:54:27 +0100 fs r267746 : use const_cast
2009-02-13 21:29:10 +0100 fs r267745 : #i10000#
2009-02-13 21:27:39 +0100 fs r267744 : #i10000#
2009-02-13 20:59:13 +0100 fs r267742 : #i10000#
2009-02-13 13:21:30 +0100 fs r267717 : better diagnostics
2009-02-13 13:17:24 +0100 fs r267715 : #i58313# support Catalog/SchemaRestriction settings, which are applied in getTables when 'all catalogs/schemas' are to be retrieved
2009-02-13 13:16:14 +0100 fs r267714 : filter out some more known global settings
2009-02-13 12:39:43 +0100 fs r267713 : #i58313# ImplicitCatalog/SchemaRestriction
2009-02-13 12:36:50 +0100 fs r267712 : when exporting data source settings, allow for properties which have a VOID default value, but are currently not VOID
2009-02-13 12:35:57 +0100 fs r267711 : implement XSet, to allow inserting properties which have a default value of VOID
2009-02-13 12:35:03 +0100 fs r267710 : +addVoidProperty
2009-02-13 10:20:08 +0100 fs r267697 : removed unused variable
2009-02-13 09:46:46 +0100 fs r267695 : refactored the table filtering code, to have a better base for introducing additional low level filters
2009-02-10 09:23:07 +0100 lla r267537 : #i10000# wrong line feed, double named variable
2009-02-09 12:13:08 +0100 oj r267508 : #i98605# notify hanlder
2009-02-09 11:50:34 +0100 oj r267507 : #i98926# solve refcount problem
2009-02-09 11:50:05 +0100 oj r267506 : #i98971# fix for simple html
2009-02-09 11:49:24 +0100 oj r267505 : #i98971# fix for simple html
2009-02-09 11:47:27 +0100 oj r267504 : invoke on copy
2009-02-09 09:51:00 +0100 fs r267500 : #i98316#
2009-02-09 09:46:10 +0100 fs r267499 : setCurrentSelection: don't reset the current form when we de-select everything
2009-02-09 09:43:45 +0100 fs r267498 : #i98316#
2009-02-08 21:25:18 +0100 fs r267496 : #i98272# introduce late ctor for cloning
2009-02-07 21:08:39 +0100 fs r267485 : #i98272# when copy-constructing a FmFormPageImpl, use the XCloneable of the forms collection, instead of XPersistObject (which is incompletely implemented)
2009-02-07 21:07:26 +0100 fs r267484 : removed obsolete include guards
2009-02-07 21:05:22 +0100 fs r267483 : #i98272# implement XCloneable
2009-02-06 15:02:48 +0100 lla r267467 : #i96523# add XImageControl
2009-02-06 14:41:38 +0100 oj r267463 : #i98926# late init when connection disposed but only when asked for
2009-02-06 13:49:57 +0100 lla r267457 : #i92860# bigint in forms doesn't allow input of values > 1, fixed
2009-02-06 13:03:55 +0100 oj r267455 : ImageScaleMode
2009-02-05 14:48:19 +0100 lla r267424 : #i89335# dropdown listboxes are 14 instead of 7 lines high
2009-02-05 13:40:00 +0100 oj r267423 : #i96945# insert new prop Opaque
2009-02-05 13:39:19 +0100 oj r267422 : #i96945# insert layer handling for hell and heaven
2009-02-05 13:29:32 +0100 lla r267420 : #i89335# add is null, is not null, is not like filter condition
2009-02-04 12:23:02 +0100 oj r267364 : #i98821# load table font settings
2009-02-04 10:05:27 +0100 oj r267351 : #i98821# load table font settings
2009-02-04 09:23:22 +0100 fs r267350 : checking persistency of UI settings in database documents - for the moment, capture table formattings (which is issue 98821)
2009-02-04 09:22:15 +0100 fs r267349 : moved some methods which are of wider interest from DatabaseDocument to FileHelper resp. TestCase
2009-02-04 08:56:27 +0100 oj r267347 : #i97586# UcbStreamHelper::CreateStream doesn't check all streamModes use different method
2009-02-04 08:23:26 +0100 oj r267346 : #i98701# check key size is >= 3 and some redesign
2009-02-03 23:29:24 +0100 fs r267345 : return the component (controller), not the frame
2009-02-03 23:28:53 +0100 fs r267344 : openExisting returns a controller now, not the frame (this was a bug)
2009-02-03 23:28:25 +0100 fs r267343 : openElement: properly return the component in the table/query case
2009-02-02 12:48:17 +0100 oj r267261 : #i96013# fix for relative path
2009-02-02 10:33:28 +0100 lla r267253 : #i98557# cleanups and consolidation
2009-02-02 09:37:23 +0100 lla r267250 : #i88432# resize will no longer move components to other sections
2009-02-02 09:08:24 +0100 oj r267245 : #i97475# write 0x1A at the end of the file
2009-01-30 19:39:20 +0100 lla r267230 : #i10000# unused parameters
2009-01-30 09:51:09 +0100 fs r267181 : onsolete
2009-01-30 09:49:27 +0100 fs r267180 : onsolete
2009-01-29 14:28:22 +0100 oj r267139 : #i96825# import cell style
2009-01-29 14:23:12 +0100 oj r267137 : #i98601# export imagescalehandler
2009-01-29 14:19:57 +0100 lla r267135 : #i98601# add ImageScaleMode
2009-01-29 13:21:08 +0100 oj r267124 : #i98601# impl ScaleMode
2009-01-29 13:20:56 +0100 oj r267123 : #i98601# impl ScaleMode
2009-01-29 08:46:40 +0100 oj r267095 : new property: ScaleMode
2009-01-29 08:45:23 +0100 oj r267094 : new ScaleMode from UnControlImageModel
2009-01-29 08:28:12 +0100 oj r267093 : #i87930# close all sub forms/reports when the desktop is going to be terminated and no db frame exists
2009-01-28 19:54:34 +0100 lla r267082 : #i98557# pictures in report wizard
2009-01-28 15:06:25 +0100 oj r267060 : #i87930# close all sub forms/reports when the desktop is going to be terminated and no db frame exists
2009-01-28 11:38:41 +0100 lla r267046 : #i76783# handle binary fields in forms
2009-01-28 09:24:43 +0100 lla r267025 : #i10000#
2009-01-28 08:40:04 +0100 fs r267024 : #i10000#
2009-01-28 08:04:43 +0100 oj r267023 : #i93456# use resource strings for function names
2009-01-27 13:26:05 +0100 oj r266988 : check data field is type field or expression
2009-01-27 13:07:17 +0100 oj r266985 : check data field length
2009-01-27 11:48:19 +0100 oj r266974 : #i96823# return dll string as column name when no alias exists
2009-01-27 09:53:11 +0100 fs r266958 : display the message of a caught exception
2009-01-27 09:44:13 +0100 fs r266957 : #i58313# when retrieving all tables, just set an empty table type filter - the connection will care for translating this, by respecting the TableTypeFilterMode setting
2009-01-27 09:36:09 +0100 fs r266956 : #i58313# getTables: per JDBC spec, is not a valid table type filter. Translate it to 'null'.
2009-01-26 11:24:49 +0100 lla r266912 : #i97865# cleanups (AddField viewable in remote mode)
2009-01-26 07:49:27 +0100 lla r266897 : #i97865# AddField opens in remote case
2009-01-26 07:48:58 +0100 lla r266896 : #i97865# AddField opens in remote case
2009-01-26 07:48:42 +0100 lla r266895 : #i97865# AddField opens in remote case
2009-01-23 15:04:40 +0100 fs r266825 : consolidate the usage of OSQLMessageBox with MessageType==Warning into OSQLWarningBox
2009-01-23 10:47:33 +0100 fs r266787 : +supportsUserAdministration
2009-01-23 10:47:11 +0100 fs r266784 : use DatabaseMetaData.supportsUserAdministration
2009-01-23 07:55:59 +0100 lla r266767 : #i10000# fix gcc compiler failures
2009-01-21 15:08:55 +0100 lla r266673 : #i97265# Labels in HC (IsDark) with other color (viewable)
2009-01-19 14:58:54 +0100 lla r266504 : #i96523# last problems with FormatKey and '0' values fixed
2009-01-19 14:58:00 +0100 lla r266503 : #i96519# AddField help text
2009-01-19 11:59:02 +0100 fs r266485 : #i96523# for formatted field models, init them with TreatAsNumber = false
2009-01-16 10:31:49 +0100 lla r266405 : #i96793# add shrink to popup menu
2009-01-16 09:21:44 +0100 lla r266401 : #i96519# AddField contains a help text
2009-01-15 11:21:49 +0100 lla r266357 : #i96523# problem with XVclWindowPeer not fixed now
2009-01-15 09:19:20 +0100 lla r266335 : #i96523# more crashes fixed.
2009-01-14 13:08:34 +0100 lla r266291 : #i96523# problems with crashes fixed
2009-01-13 10:54:24 +0100 lla r266199 : #i96523# show datasource in formattedfields new files
2009-01-13 10:52:39 +0100 lla r266198 : #i96523# show datasource in formattedfields
2009-01-13 09:41:50 +0100 lla r266197 : #i96526# handling none existance default.otr
2009-01-12 12:55:49 +0100 fs r266151 : don't expect the control model to be a BoundComponent before adding as modify listener
2009-01-12 12:51:33 +0100 fs r266149 : #i88458# let the ImageControl be an XModifyBroadcaster, so the forms runtime can notice when the user changes the control content while it does not have the focus
2009-01-09 13:41:22 +0100 fs r266080 : doc
2009-01-09 13:14:14 +0100 fs r266077 : #i97377# SetModified when order is changed via DnD
2009-01-07 09:55:40 +0100 oj r265951 : merge from master
2009-01-07 09:55:24 +0100 oj r265950 : removed observer
2009-01-07 09:55:06 +0100 oj r265949 : merge from master
2009-01-07 07:29:11 +0100 oj r265945 : shadow var changed
2009-01-06 07:25:57 +0100 oj r265893 : CWS-TOOLING: rebase CWS dba32a to trunk@265758 (milestone: DEV300:m38)
2009-01-05 13:18:22 +0100 oj r265865 : convert to unix le
2009-01-05 09:13:52 +0100 lla r265857 : #i79423# lc_ sc_ permutation fix
2009-01-02 19:40:59 +0100 lla r265847 : #i79423# section shrink icons
2008-12-22 11:37:57 +0100 lla r265749 : #i97484# move component to negative Y-position
2008-12-22 11:37:05 +0100 lla r265748 : #i97484# move component to negative Y-position
2008-12-22 11:35:33 +0100 lla r265747 : #i97484# move component to negative Y-position
2008-12-22 11:25:07 +0100 lla r265745 : #i96757# changes via property browser was not undoable
2008-12-18 15:10:38 +0100 fs r265694 : corrected an condition in doFormListening, which otherwise leads to uncommitable grid columns in documents which are loaded from disc (not in documents which are newly created)
2008-12-18 14:54:39 +0100 fs r265692 : Hide Columns text slightly changed
2008-12-18 13:44:15 +0100 fs r265683 : #i94068# properly display erros happening during a form operation - at least once, and at most once
2008-12-18 11:28:29 +0100 fs r265677 : document the new InputRequired property
2008-12-18 11:04:15 +0100 fs r265676 : #i96530# createControlLabelPair: don't actually create a label for a checkbox
2008-12-18 10:35:53 +0100 fs r265674 : #i95226# when a column is replaced, and it's the selected column, update the selection
2008-12-18 10:34:42 +0100 fs r265673 : #i95226# refactoring of the implReplaced method
2008-12-18 10:34:28 +0100 fs r265672 : #i95226# when replacing a grid column, update the property browser
2008-12-18 10:33:17 +0100 fs r265671 : when an element is removed, remove it from m_aCurrentSelection, too (if necessary)
2008-12-18 10:31:57 +0100 fs r265670 : Hide Columns text slightly changed
2008-12-18 10:15:56 +0100 lla r265669 : #i14538# do not allow to press finish button twice
2008-12-18 08:56:33 +0100 lla r265665 : #i10000# build depend=t problem hacked.
2008-12-17 20:59:10 +0100 fs r265656 : #i89821# don't let a MultiLineEdit select all text when it receives the focus
2008-12-17 12:10:54 +0100 fs r265594 : #i97356#
2008-12-17 12:06:29 +0100 fs r265593 : #i97355# Print -> Printable
2008-12-17 11:59:31 +0100 fs r265591 : #i97350# combo boxes comment on list selection (as list boxes already do)
2008-12-16 09:53:57 +0100 lla r265527 : #i96526# handling none existance default.otr
2008-12-15 14:48:39 +0100 lla r265500 : #i79423# reparing, was wrong implemented
2008-12-12 15:08:33 +0100 lla r265424 : #i10000# remove wrong carridge returns
2008-12-12 15:07:55 +0100 lla r265423 : #i10000# remove wrong carridge returns
2008-12-12 15:06:41 +0100 lla r265422 : #i10000# remove wrong carridge returns
2008-12-12 10:23:13 +0100 lla r265395 : #i95234# reset DragDelta
2008-12-12 10:11:02 +0100 lla r265393 : #i79423# pre versions of shrink buttons
2008-12-11 15:32:13 +0100 fs r265318 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:30:06 +0100 fs r265316 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:07:05 +0100 fs r265307 : removed superfluous text
2008-12-11 12:29:54 +0100 lla r265282 : #i96757# cleanup second try
2008-12-11 12:09:15 +0100 lla r265278 : #i96757# cleanup
2008-12-11 12:07:56 +0100 lla r265277 : #i95234#
2008-12-10 14:04:39 +0100 lla r265183 : #i93472# D&D fixes
2008-12-10 12:29:33 +0100 lla r265168 : #i94067# add (APP|SYS)FONT to XUnitConversion
2008-12-10 12:15:02 +0100 lla r265166 : #i94067# add APPFONT, SYSFONT to MeasureUnit
2008-12-10 11:52:10 +0100 lla r265163 : #i94067# add comments
2008-12-06 20:33:05 +0100 fs r264935 : #i10000# precompiled header
2008-12-05 09:29:26 +0100 fs r264889 : #i10000#
2008-12-05 09:07:31 +0100 fs r264888 : #i10000#
2008-12-04 13:25:46 +0100 fs r264838 : CWS-TOOLING: rebase CWS dba32a to trunk@264807 (milestone: DEV300:m37)
2008-12-03 23:49:13 +0100 fs r264808 : merge changes from trunk, to be able to do a rebase
2008-12-03 17:13:09 +0100 lla r264801 : #i91041# update documentation
2008-12-03 16:57:04 +0100 lla r264799 : #i94067# allow convert(Point|Size)ToLogic as pixel also
2008-12-02 12:36:32 +0100 lla r264687 : #i96782# bring toolbar objects to menu structure
2008-12-02 10:32:44 +0100 lla r264667 : #i86255# make property work
2008-12-02 09:22:47 +0100 lla r264659 : #i79423# add section shrink toolbar
2008-12-02 07:41:22 +0100 lla r264657 : #i86255# add check box for Escape DateTime property
2008-12-02 07:37:17 +0100 lla r264656 : #i79423# new shrink buttons
2008-11-26 11:55:28 +0100 fs r264362 : #i96541#
FillPropertySet: do not only catch UnknownPropertyException when setting the Char/ParaAutoStyleName,
but also care for the other exceptions which can be thrown by XPropertySet::setPropertyValue.
This is actually not the real fix for #i96541#, but only a follow-up. The root cause of the issue
was fixed in CWS dba301b, but this here was another (potential) bug which popped up during investigations.
2008-11-25 09:04:40 +0100 lla r264273 : #i82083# new toolbox in GroupsSorting dialog
2008-11-25 08:56:08 +0100 lla r264272 : #i94729# change token strings into string list, move class out of function
2008-11-24 15:52:22 +0100 fs r264251 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:51:45 +0100 fs r264249 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:45:21 +0100 fs r264244 : #i96532# the API default for ParamNameSubst is false
2008-11-24 15:45:04 +0100 fs r264243 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:44:14 +0100 fs r264241 : #i96532# slight refactoring of exporting properties which have a XML default different from the API default
2008-11-24 10:50:01 +0100 lla r264216 : #i82083# icons for new toolbox
2008-11-24 09:38:45 +0100 lla r264205 : #i82083# new toolbox in GroupsSorting dialog
2008-11-24 09:32:20 +0100 lla r264201 : #i96501# cleanup assertions
2008-11-24 09:12:55 +0100 lla r264198 : #i83082# enhancement for toolboxes, better HC comfort
2008-11-24 08:46:43 +0100 lla r264197 : #i96501# fix problem with negative positions
2008-11-21 11:44:47 +0100 fs r264118 : #i57042# introduce a counter for suspending change notifications of a given property, so recursive calls are possible
2008-11-21 11:02:17 +0100 fs r264116 : #i96388# don't call ExecuteContextMenuAction when no action was chosen by the user
2008-11-21 10:36:53 +0100 fs r264114 : #i47384# assertion was wrong
2008-11-14 12:33:15 +0100 fs r263673 : #i47318# XRowSetChangeBroadcaster/Listener, to be able to listen for changes in an XRowSetSupplier's RowSet
2008-11-14 12:30:29 +0100 fs r263672 : #i47318# more refactoring
- BoundControlModels now listen at the XRowSetSupplier for changes in the supplied
RowSet, to properly revoke/register old/new listeners at the RowSet
- replaced ::osl::Mutex in various places with a ControlModelLock
2008-11-14 12:20:55 +0100 fs r263671 : when BUILD_TYPE includes QADEVOOO, the BUILD_QADEVOOO needs to bet set, too
2008-11-14 12:19:21 +0100 fs r263670 : oops, this was not intended to be committed
2008-11-12 11:08:10 +0100 fs r263579 : #i96096# new ctors taking UNO_QUERY_THROW
2008-11-12 09:15:54 +0100 fs r263576 : no need to load the complete dialog just to get a string which the dialog itself loads from resource
2008-11-10 17:55:45 +0100 fs r263535 : spelling in comment
2008-11-10 15:51:14 +0100 fs r263523 : #i47318# various refactorings
1. don't forward syntetic XLoadListener events from the grid control to
the grid columns. Instead, forward GridColumn::XChild::setParent to
the base class, which then can add itself as load listener
2. removed various occurances of XMultiServiceFactory, instead use the
::comphelper::ComponentContext
3. in O(Bound)ControlModel, have a mechanism to lock the instance (using
ControlModelLock) and fire property changes when the last lock dies.
2008-11-10 12:49:24 +0100 oj r263513 : #i94729# change token strings into string list
2008-11-10 12:13:15 +0100 oj r263512 : #i95222# export chart:title style as well
2008-11-10 08:55:25 +0100 oj r263507 : #i93471# show the correct tabpage when selecting a different object
2008-11-07 23:38:29 +0100 fs r263490 : #i95977# for the event input controls, add a component extending their functionality so they're reset when the users presses DEL
2008-11-07 23:35:39 +0100 fs r263489 : during #i95977#: When a VCL Window is deleted from within VCL code, the respective WindowPeer was never disposed. Corrected this.
2008-11-07 14:57:07 +0100 fs r263420 : #i95963# human-readable display names for event bindings
2008-11-06 10:34:52 +0100 fs r263366 : #i95865# don't use library names containing InvalidZipEntryFileNames - workaround until i95409 is fixed
2008-11-06 10:33:28 +0100 fs r263365 : #i95865#
copied the following change from CWS odfmetadata2 (not yet integrated) into CWS dba31d
- comphelper/inc/comphelper/storagehelper.hxx,
comphelper/source/misc/storagehelper.cxx:
+ add function IsValidZipEntryFileName (moved from module package)
Diffstat (limited to 'reportdesign/source')
61 files changed, 3355 insertions, 834 deletions
diff --git a/reportdesign/source/core/api/ImageControl.cxx b/reportdesign/source/core/api/ImageControl.cxx index c1830dd9c128..7b3147eac364 100644 --- a/reportdesign/source/core/api/ImageControl.cxx +++ b/reportdesign/source/core/api/ImageControl.cxx @@ -42,6 +42,7 @@ #include <tools/debug.hxx> #include <comphelper/property.hxx> #include "FormatCondition.hxx" +#include <com/sun/star/awt/ImageScaleMode.hpp> #include <com/sun/star/text/ParagraphVertAlign.hpp> #include "ReportHelperImpl.hxx" // ============================================================================= @@ -131,7 +132,7 @@ OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _x :ImageControlBase(m_aMutex) ,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_bScaleImage(sal_False) +,m_nScaleMode(awt::ImageScaleMode::None) ,m_bPreserveIRI(sal_True) { DBG_CTOR( rpt_OImageControl,NULL); @@ -144,7 +145,7 @@ OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _x :ImageControlBase(m_aMutex) ,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_bScaleImage(sal_False) +,m_nScaleMode(awt::ImageScaleMode::None) ,m_bPreserveIRI(sal_True) { DBG_CTOR( rpt_OImageControl,NULL); @@ -254,7 +255,7 @@ void SAL_CALL OImageControl::setHyperLinkName(const ::rtl::OUString & the_value) } // ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OImageControl::getControlBackground() throw (::com::sun::star::beans::UnknownPropertyException, uno::RuntimeException) +::sal_Int32 SAL_CALL OImageControl::getControlBackground() throw (beans::UnknownPropertyException, uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); return m_aProps.aFormatProperties.m_bBackgroundTransparent ? COL_TRANSPARENT : m_aProps.aFormatProperties.nBackgroundColor; @@ -364,16 +365,6 @@ uno::Reference< util::XCloneable > SAL_CALL OImageControl::createClone( ) throw // ----------------------------------------------------------------------------- // XImageControl -::sal_Bool SAL_CALL OImageControl::getScaleImage() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bScaleImage; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setScaleImage( ::sal_Bool _scaleimage ) throw (uno::RuntimeException) -{ - set(PROPERTY_SCALEIMAGE,_scaleimage,m_bScaleImage); -} // ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OImageControl::getImageURL() throw (uno::RuntimeException) { @@ -488,6 +479,19 @@ void SAL_CALL OImageControl::setSize( const awt::Size& aSize ) throw (beans::Pro return ::rtl::OUString(); } // ----------------------------------------------------------------------------- +::sal_Int16 SAL_CALL OImageControl::getScaleMode() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + return m_nScaleMode; +} +// ----------------------------------------------------------------------------- +void SAL_CALL OImageControl::setScaleMode( ::sal_Int16 _scalemode ) throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + if ( _scalemode < awt::ImageScaleMode::None ||_scalemode > awt::ImageScaleMode::Anisotropic ) + throw lang::IllegalArgumentException(); + set(PROPERTY_SCALEMODE,_scalemode,m_nScaleMode); +} +// ----------------------------------------------------------------------------- ::sal_Bool SAL_CALL OImageControl::getPreserveIRI() throw (uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 3ec6585c2931..c85e754eb63c 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -71,15 +71,12 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/task/ErrorCodeIOException.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC #include "corestrings.hrc" -#endif #include "Groups.hxx" +#include "RptDef.hxx" #include "Section.hxx" #include "FixedLine.hxx" -#ifndef REPORTDESIGN_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif #include "core_resource.hxx" #include "Tools.hxx" #include <tools/debug.hxx> @@ -679,8 +676,10 @@ void OReportDefinition::init() m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges(); m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM ); SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin(); - rAdmin.NewStandardLayer(); - rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ) ); + rAdmin.NewStandardLayer(RPT_LAYER_FRONT); + rAdmin.NewLayer(UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "back" ) ), RPT_LAYER_BACK ); + rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ), RPT_LAYER_HIDDEN ); + m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext); if ( !m_pImpl->m_xStorage.is() ) m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage(); @@ -1396,14 +1395,25 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS /** property map for export info set */ comphelper::PropertyMapEntry aExportInfoMap[] = { - { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0}, - { MAP_LEN( "StreamName"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "StreamName") , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "StreamRelPath") , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "BaseURI") , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) ); SvtSaveOptions aSaveOpt; xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")), uno::makeAny(aSaveOpt.IsPrettyPrinting())); + if ( aSaveOpt.IsSaveRelFSys() ) + { + const ::rtl::OUString sVal( aDescriptor.getUnpackedValueOrDefault(aDescriptor.PROP_DOCUMENTBASEURL(),::rtl::OUString()) ); + xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(sVal)); + } // if ( aSaveOpt.IsSaveRelFSys() ) + const ::rtl::OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),::rtl::OUString()) ); + xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")), uno::makeAny(sHierarchicalDocumentName)); + + sal_Int32 nArgsLen = aDelegatorArguments.getLength(); aDelegatorArguments.realloc(nArgsLen+1); aDelegatorArguments[nArgsLen++] <<= xInfoSet; diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx index 5641896dbbee..8c4413d9fd75 100644 --- a/reportdesign/source/core/api/Shape.cxx +++ b/reportdesign/source/core/api/Shape.cxx @@ -70,6 +70,7 @@ OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext) ,ShapePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getShapeOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nZOrder(0) +,m_bOpaque(sal_False) { DBG_CTOR( rpt_OShape,NULL); m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_SHAPE,m_aProps.aComponent.m_xContext->getServiceManager()); @@ -83,6 +84,7 @@ OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext ,ShapePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getShapeOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nZOrder(0) +,m_bOpaque(sal_False) ,m_sServiceName(_sServiceName) { DBG_CTOR( rpt_OShape,NULL); @@ -93,7 +95,7 @@ OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext uno::Reference<beans::XPropertySet> xProp(_xShape,uno::UNO_QUERY); if ( xProp.is() ) { - xProp->getPropertyValue(PROPERTY_ZORDER) >>= m_nZOrder; + xProp->getPropertyValue(PROPERTY_ZORDER) >>= m_nZOrder; xProp.clear(); } m_aProps.aComponent.setShape(_xShape,this,m_refCount); @@ -451,6 +453,18 @@ void SAL_CALL OShape::setZOrder( ::sal_Int32 _zorder ) throw (uno::RuntimeExcept set(PROPERTY_ZORDER,_zorder,m_nZOrder); } // ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OShape::getOpaque() throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + return m_bOpaque; +} +// ----------------------------------------------------------------------------- +void SAL_CALL OShape::setOpaque( ::sal_Bool _opaque ) throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + set(PROPERTY_OPAQUE,_opaque,m_bOpaque); +} +// ----------------------------------------------------------------------------- drawing::HomogenMatrix3 SAL_CALL OShape::getTransformation() throw (uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); diff --git a/reportdesign/source/core/inc/ImageControl.hxx b/reportdesign/source/core/inc/ImageControl.hxx index 5f8b11dfa6ff..c2f21c7fb11a 100644 --- a/reportdesign/source/core/inc/ImageControl.hxx +++ b/reportdesign/source/core/inc/ImageControl.hxx @@ -55,7 +55,7 @@ namespace reportdesign friend class OShapeHelper; OReportControlModel m_aProps; ::rtl::OUString m_aImageURL; - ::sal_Bool m_bScaleImage; + sal_Int16 m_nScaleMode; ::sal_Bool m_bPreserveIRI; private: OImageControl(const OImageControl&); @@ -119,12 +119,12 @@ namespace reportdesign virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); // XImageControl - virtual ::sal_Bool SAL_CALL getScaleImage() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setScaleImage( ::sal_Bool _scaleimage ) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getPreserveIRI() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setPreserveIRI( ::sal_Bool _preserveiri ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getScaleMode() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); // XImageProducerSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > SAL_CALL getImageProducer( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/reportdesign/source/core/inc/Shape.hxx b/reportdesign/source/core/inc/Shape.hxx index 02328b9839b3..b2a5353214d7 100644 --- a/reportdesign/source/core/inc/Shape.hxx +++ b/reportdesign/source/core/inc/Shape.hxx @@ -59,6 +59,7 @@ namespace reportdesign OReportControlModel m_aProps; com::sun::star::drawing::HomogenMatrix3 m_Transformation; ::sal_Int32 m_nZOrder; + ::sal_Bool m_bOpaque; ::rtl::OUString m_sServiceName; ::rtl::OUString m_CustomShapeEngine; @@ -125,6 +126,9 @@ namespace reportdesign virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setCustomShapeGeometry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _customshapegeometry ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getOpaque() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setOpaque( ::sal_Bool _opaque ) throw (::com::sun::star::uno::RuntimeException); + // XShapeDescriptor virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index 92c721dbc049..f549582019b2 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -37,6 +37,10 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/report/XFixedText.hpp> +#include <com/sun/star/report/XFormattedField.hpp> + + #include "Section.hxx" #include "corestrings.hrc" @@ -118,19 +122,26 @@ namespace reportdesign return ::com::sun::star::awt::Size(_pShape->m_aProps.aComponent.m_nWidth,_pShape->m_aProps.aComponent.m_nHeight); } - template<typename T> static void setPosition( const ::com::sun::star::awt::Point& aPosition ,T* _pShape) + template<typename T> static void setPosition( const ::com::sun::star::awt::Point& _aPosition ,T* _pShape) { - OSL_ENSURE(aPosition.X >= 0 && aPosition.Y >= 0,"Illegal position!"); + // we know it is not allowed that the position in smaller 0, but in NbcMove() it will handled right. + // only at 'Undo' it is possible to short set the position smaller 0 + // OSL_ENSURE(_aPosition.X >= 0 && _aPosition.Y >= 0,"set to Illegal position!"); ::osl::MutexGuard aGuard(_pShape->m_aMutex); + ::com::sun::star::awt::Point aOldPos; + aOldPos.X = _pShape->m_aProps.aComponent.m_nPosX; + aOldPos.Y = _pShape->m_aProps.aComponent.m_nPosY; + + ::com::sun::star::awt::Point aPosition(_aPosition); if ( _pShape->m_aProps.aComponent.m_xShape.is() ) { - ::com::sun::star::awt::Point aOldPos = _pShape->m_aProps.aComponent.m_xShape->getPosition(); + aOldPos = _pShape->m_aProps.aComponent.m_xShape->getPosition(); _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X; _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y; _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition); } - _pShape->set(PROPERTY_POSITIONX,aPosition.X,_pShape->m_aProps.aComponent.m_nPosX); - _pShape->set(PROPERTY_POSITIONY,aPosition.Y,_pShape->m_aProps.aComponent.m_nPosY); + _pShape->set(PROPERTY_POSITIONX,aPosition.X,aOldPos.X); + _pShape->set(PROPERTY_POSITIONY,aPosition.Y,aOldPos.Y); } template<typename T> static ::com::sun::star::awt::Point getPosition(T* _pShape) { @@ -138,7 +149,7 @@ namespace reportdesign if ( _pShape->m_aProps.aComponent.m_xShape.is() ) { ::com::sun::star::awt::Point aPosition = _pShape->m_aProps.aComponent.m_xShape->getPosition(); - OSL_ENSURE(aPosition.X >= 0 && aPosition.Y >= 0,"Illegal position!"); +// OSL_ENSURE(aPosition.X >= 0 && aPosition.Y >= 0,"Illegal position!"); return aPosition; } return ::com::sun::star::awt::Point(_pShape->m_aProps.aComponent.m_nPosX,_pShape->m_aProps.aComponent.m_nPosY); diff --git a/reportdesign/source/core/misc/reportformula.cxx b/reportdesign/source/core/misc/reportformula.cxx index f99919f2e941..7bbd76f31796 100644 --- a/reportdesign/source/core/misc/reportformula.cxx +++ b/reportdesign/source/core/misc/reportformula.cxx @@ -177,6 +177,15 @@ namespace rptui m_sUndecoratedContent = _rHd.m_sUndecoratedContent; return *this; } + //-------------------------------------------------------------------- + ::rtl::OUString ReportFormula::getEqualUndecoratedContent() const + { + ::rtl::OUStringBuffer aBuffer; + aBuffer.appendAscii( "=" ); + aBuffer.append( getUndecoratedContent() ); + return aBuffer.makeStringAndClear(); + } + //........................................................................ } // namespace rptui //........................................................................ diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 1a5f7ebcde62..b5974a226341 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -67,9 +67,11 @@ #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/report/XFormattedField.hpp> #include <comphelper/genericpropertyset.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/property.hxx> +#include <tools/diagnose_ex.h> #include "PropertyForward.hxx" #include <connectivity/dbtools.hxx> #include "UndoActions.hxx" @@ -86,6 +88,7 @@ using namespace beans; using namespace reportdesign; using namespace container; using namespace script; +using namespace report; //---------------------------------------------------------------------------- sal_uInt16 OObjectBase::getObjectType(const uno::Reference< report::XReportComponent>& _xComponent) { @@ -151,6 +154,16 @@ SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportCompon break; case OBJ_CUSTOMSHAPE: pNewObj = OCustomShape::Create( _xComponent ); + try + { + sal_Bool bOpaque = sal_False; + _xComponent->getPropertyValue(PROPERTY_OPAQUE) >>= bOpaque; + pNewObj->SetLayer(bOpaque ? RPT_LAYER_FRONT : RPT_LAYER_BACK); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } break; case OBJ_DLG_SUBREPORT: case OBJ_OLE2: @@ -563,6 +576,8 @@ OUnoObject::OUnoObject(const ::rtl::OUString& _sComponentName ,m_nObjectType(_nObjectType) { DBG_CTOR( rpt_OUnoObject, NULL); + if ( rModelName.getLength() ) + impl_initializeModel_nothrow(); } //---------------------------------------------------------------------------- OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xComponent @@ -574,6 +589,9 @@ OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xCompon { DBG_CTOR( rpt_OUnoObject, NULL); mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + + if ( rModelName.getLength() ) + impl_initializeModel_nothrow(); } //---------------------------------------------------------------------------- OUnoObject::~OUnoObject() @@ -582,6 +600,40 @@ OUnoObject::~OUnoObject() //mxUnoShape = uno::WeakReference< uno::XInterface >(); } // ----------------------------------------------------------------------------- +void OUnoObject::impl_initializeModel_nothrow() +{ + try + { + Reference< XFormattedField > xFormatted( m_xReportComponent, UNO_QUERY ); + if ( xFormatted.is() ) + { + const Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW ); + const ::rtl::OUString sTreatAsNumberProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TreatAsNumber" ) ); + xModelProps->setPropertyValue( sTreatAsNumberProperty, makeAny( sal_False ) ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} +// ----------------------------------------------------------------------------- +void OUnoObject::impl_setReportComponent_nothrow() +{ + if ( m_xReportComponent.is() ) + return; + + OReportModel* pReportModel = static_cast<OReportModel*>(GetModel()); + OSL_ENSURE( pReportModel, "OUnoObject::impl_setReportComponent_nothrow: no report model!" ); + if ( !pReportModel ) + return; + + OXUndoEnvironment::OUndoEnvLock aLock( pReportModel->GetUndoEnv() ); + m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); + + impl_initializeModel_nothrow(); +} +// ----------------------------------------------------------------------------- UINT16 OUnoObject::GetObjIdentifier() const { return UINT16(m_nObjectType); @@ -623,14 +675,47 @@ void OUnoObject::NbcMove( const Size& rSize ) // stop listening OObjectBase::EndListening(sal_False); + bool bPositionFixed = false; + Size aUndoSize(0,0); + bool bUndoMode = false; if ( m_xReportComponent.is() ) { OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + if (pRptModel->GetUndoEnv().IsUndoMode()) + { + // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode + bUndoMode = true; + } OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv()); - m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.A()); - m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.B()); - } + // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point? + int nNewX = m_xReportComponent->getPositionX() + rSize.A(); + // can this hinder us to set components outside the area? + // if (nNewX < 0) + // { + // nNewX = 0; + // } + m_xReportComponent->setPositionX(nNewX); + int nNewY = m_xReportComponent->getPositionY() + rSize.B(); + if (nNewY < 0 && !bUndoMode) + { + aUndoSize.B() = abs(nNewY); + bPositionFixed = true; + nNewY = 0; + } + m_xReportComponent->setPositionY(nNewY); + } + if (bPositionFixed) + { + // OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + // if ( pRptModel ) + // { + // if (! pRptModel->GetUndoEnv().IsLocked()) + // { + GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize)); + // } + // } + } // set geometry properties SetPropsFromRect(GetLogicRect()); @@ -678,27 +763,23 @@ FASTBOOL OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) FASTBOOL bResult = SdrUnoObj::EndCreate(rStat, eCmd); if ( bResult ) { - OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); - if ( pRptModel ) + impl_setReportComponent_nothrow(); + // set labels + if ( m_xReportComponent.is() ) { - OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv()); - if ( !m_xReportComponent.is() ) - m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); - // set labels - if ( m_xReportComponent.is() ) + try { - try + if ( supportsService( SERVICE_FIXEDTEXT ) ) { - if ( supportsService( SERVICE_FIXEDTEXT ) ) - { - m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) ); - } - } - catch(const uno::Exception&) - { - OSL_ENSURE(0,"OUnoObject::EndCreate: Exception caught!"); + m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) ); } } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + + impl_initializeModel_nothrow(); } // set geometry properties SetPropsFromRect(GetLogicRect()); @@ -804,8 +885,7 @@ void OUnoObject::CreateMediator(sal_Bool _bReverse) { if ( !m_xMediator.is() ) { - if ( !m_xReportComponent.is() ) - m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); + impl_setReportComponent_nothrow(); Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY); if ( !m_xMediator.is() && m_xReportComponent.is() && xControlModel.is() ) diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx index e39b5d7957cc..1db6b8e95c98 100644 --- a/reportdesign/source/core/sdr/RptPage.cxx +++ b/reportdesign/source/core/sdr/RptPage.cxx @@ -58,6 +58,9 @@ OReportPage::OReportPage( OReportModel& _rModel OReportPage::OReportPage( const OReportPage& rPage ) :SdrPage( rPage ) ,rModel(rPage.rModel) + ,m_xSection(rPage.m_xSection) + ,m_bSpecialInsertMode(rPage.m_bSpecialInsertMode) + ,m_aTemporaryObjectList(rPage.m_aTemporaryObjectList) { DBG_CTOR( rpt_OReportPage,NULL); } @@ -83,18 +86,15 @@ ULONG OReportPage::getIndexOf(const uno::Reference< report::XReportComponent >& DBG_CHKTHIS( rpt_OReportPage,NULL); ULONG nCount = GetObjCount(); ULONG i = 0; - if ( nCount != CONTAINER_ENTRY_NOTFOUND ) + for (; i < nCount; ++i) { - for (; i < nCount; ++i) + OObjectBase* pObj = dynamic_cast<OObjectBase*>(GetObj(i)); + OSL_ENSURE(pObj,"Invalid object found!"); + if ( pObj && pObj->getReportComponent() == _xObject ) { - OObjectBase* pObj = dynamic_cast<OObjectBase*>(GetObj(i)); - OSL_ENSURE(pObj,"Invalid object found!"); - if ( pObj && pObj->getReportComponent() == _xObject ) - { - break; - } - } // for (; i < nCount; ++i) - } + break; + } + } // for (; i < nCount; ++i) return i; } //---------------------------------------------------------------------------- diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx index efcc718bfe90..4fd0fbad8dd7 100644 --- a/reportdesign/source/core/sdr/UndoActions.cxx +++ b/reportdesign/source/core/sdr/UndoActions.cxx @@ -27,6 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#include "precompiled_reportdesign.hxx" + #include "UndoActions.hxx" #include "UndoEnv.hxx" #include "formatnormalizer.hxx" @@ -93,8 +95,6 @@ namespace rptui return pMemFunSection; } -DECLARE_STL_USTRINGACCESS_MAP(bool, AllProperties); -DECLARE_STL_STDKEY_MAP(uno::Reference< beans::XPropertySet >, AllProperties, PropertySetInfoCache); //------------------------------------------------------------------------------ TYPEINIT1( OCommentUndoAction, SdrUndoAction ); DBG_NAME(rpt_OCommentUndoAction) @@ -446,544 +446,8 @@ Reference< XPropertySet> OUndoPropertyReportSectionAction::getObject() { return m_pMemberFunction(&m_aReportHelper).get(); } -// ----------------------------------------------------------------------------- - -class OXUndoEnvironmentImpl -{ - OXUndoEnvironmentImpl(OXUndoEnvironmentImpl&); - void operator =(OXUndoEnvironmentImpl&); -public: - OReportModel& m_rModel; - PropertySetInfoCache m_aPropertySetCache; - FormatNormalizer m_aFormatNormalizer; - ConditionUpdater m_aConditionUpdater; - ::osl::Mutex m_aMutex; - ::std::vector< uno::Reference< container::XChild> > m_aSections; - oslInterlockedCount m_nLocks; - sal_Bool m_bReadOnly; - - OXUndoEnvironmentImpl(OReportModel& _rModel); -}; - -OXUndoEnvironmentImpl::OXUndoEnvironmentImpl(OReportModel& _rModel) : m_rModel(_rModel) - ,m_aFormatNormalizer( _rModel ) - ,m_aConditionUpdater() - ,m_nLocks(0) - ,m_bReadOnly(sal_False) -{ -} -//------------------------------------------------------------------------------ -DBG_NAME( rpt_OXUndoEnvironment ); -//------------------------------------------------------------------------------ -OXUndoEnvironment::OXUndoEnvironment(OReportModel& _rModel) - :m_pImpl(new OXUndoEnvironmentImpl(_rModel) ) -{ - DBG_CTOR( rpt_OXUndoEnvironment,NULL); - StartListening(m_pImpl->m_rModel); -} - -//------------------------------------------------------------------------------ -OXUndoEnvironment::~OXUndoEnvironment() -{ - DBG_DTOR( rpt_OXUndoEnvironment,NULL); -} -// ----------------------------------------------------------------------------- -void OXUndoEnvironment::Lock() -{ - OSL_ENSURE(m_refCount,"Illegall call to dead object!"); - osl_incrementInterlockedCount( &m_pImpl->m_nLocks ); -} -void OXUndoEnvironment::UnLock() -{ - OSL_ENSURE(m_refCount,"Illegall call to dead object!"); - - osl_decrementInterlockedCount( &m_pImpl->m_nLocks ); -} -sal_Bool OXUndoEnvironment::IsLocked() const { return m_pImpl->m_nLocks != 0; } -// ----------------------------------------------------------------------------- -void OXUndoEnvironment::RemoveSection(OReportPage* _pPage) -{ - if ( _pPage ) - { - Reference< XInterface > xSection(_pPage->getSection()); - if ( xSection.is() ) - RemoveElement( xSection ); - } -} -//------------------------------------------------------------------------------ -void OXUndoEnvironment::Clear(const Accessor& /*_r*/) -{ - OUndoEnvLock aLock(*this); - -#if OSL_DEBUG_LEVEL > 0 - PropertySetInfoCache::iterator aIter = m_pImpl->m_aPropertySetCache.begin(); - PropertySetInfoCache::iterator aEnd = m_pImpl->m_aPropertySetCache.end(); - int ndbg_len = m_pImpl->m_aPropertySetCache.size(); - ndbg_len = ndbg_len; - for (int idbg_ = 0; aIter != aEnd; ++aIter,++idbg_) - { - uno::Reference<beans::XPropertySet> xProp(aIter->first,uno::UNO_QUERY); - xProp->getPropertySetInfo(); - int nlen = aIter->second.size(); - nlen = nlen; - } -#endif - m_pImpl->m_aPropertySetCache.clear(); - - sal_uInt16 nCount = m_pImpl->m_rModel.GetPageCount(); - sal_uInt16 i; - for (i = 0; i < nCount; i++) - { - OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetPage(i) ); - RemoveSection(pPage); - } - - nCount = m_pImpl->m_rModel.GetMasterPageCount(); - for (i = 0; i < nCount; i++) - { - OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetMasterPage(i) ); - RemoveSection(pPage); - } - - m_pImpl->m_aSections.clear(); - - if (IsListening(m_pImpl->m_rModel)) - EndListening(m_pImpl->m_rModel); -} -//------------------------------------------------------------------------------ -void OXUndoEnvironment::ModeChanged() -{ - m_pImpl->m_bReadOnly = !m_pImpl->m_bReadOnly; - - if (!m_pImpl->m_bReadOnly) - StartListening(m_pImpl->m_rModel); - else - EndListening(m_pImpl->m_rModel); -} -//------------------------------------------------------------------------------ -void OXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) -{ - if (rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_MODECHANGED ) - ModeChanged(); -} -// ----------------------------------------------------------------------------- -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OXUndoEnvironment::disposing(const EventObject& e) throw( RuntimeException ) -{ - // check if it's an object we have cached informations about - Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY); - if ( xSourceSet.is() ) - { - uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY); - if ( xSection.is() ) - RemoveSection(xSection); - else - RemoveElement(xSourceSet); - /*if (!m_pImpl->m_aPropertySetCache.empty()) - m_pImpl->m_aPropertySetCache.erase(xSourceSet);*/ - } -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEvent ) throw(uno::RuntimeException) -{ - ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex ); - - if ( IsLocked() ) - return; - - Reference< XPropertySet > xSet( _rEvent.Source, UNO_QUERY ); - if (!xSet.is()) - return; - - dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); - if ( !pController ) - return; - - // no Undo for transient and readonly props. - // let's see if we know something about the set -#if OSL_DEBUG_LEVEL > 0 - int nlen = m_pImpl->m_aPropertySetCache.size(); - nlen = nlen; -#endif - PropertySetInfoCache::iterator aSetPos = m_pImpl->m_aPropertySetCache.find(xSet); - if (aSetPos == m_pImpl->m_aPropertySetCache.end()) - { - AllProperties aNewEntry; - aSetPos = m_pImpl->m_aPropertySetCache.insert(PropertySetInfoCache::value_type(xSet,aNewEntry)).first; - DBG_ASSERT(aSetPos != m_pImpl->m_aPropertySetCache.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?"); - } - if ( aSetPos == m_pImpl->m_aPropertySetCache.end() ) - return; - - // now we have access to the cached info about the set - // let's see what we know about the property - AllProperties& rPropInfos = aSetPos->second; - AllPropertiesIterator aPropertyPos = rPropInfos.find( _rEvent.PropertyName ); - if (aPropertyPos == rPropInfos.end()) - { // nothing 'til now ... have to change this .... - // the attributes - INT32 nAttributes = xSet->getPropertySetInfo()->getPropertyByName( _rEvent.PropertyName ).Attributes; - bool bTransReadOnly = ((nAttributes & PropertyAttribute::READONLY) != 0) || ((nAttributes & PropertyAttribute::TRANSIENT) != 0); - - // insert the new entry - aPropertyPos = rPropInfos.insert( AllProperties::value_type( _rEvent.PropertyName, bTransReadOnly ) ).first; - DBG_ASSERT(aPropertyPos != rPropInfos.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?"); - } - - implSetModified(); - - // now we have access to the cached info about the property affected - // and are able to decide wether or not we need an undo action - - // no UNDO for transient/readonly properties - if ( aPropertyPos->second ) - return; - - // give components with sub responsibilities a chance - m_pImpl->m_aFormatNormalizer.notifyPropertyChange( _rEvent ); - m_pImpl->m_aConditionUpdater.notifyPropertyChange( _rEvent ); - - aGuard.clear(); - // TODO: this is a potential race condition: two threads here could in theory - // add their undo actions out-of-order - - ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - ORptUndoPropertyAction* pUndo = NULL; - try - { - uno::Reference< report::XSection> xSection( xSet, uno::UNO_QUERY ); - if ( xSection.is() ) - { - uno::Reference< report::XGroup> xGroup = xSection->getGroup(); - if ( xGroup.is() ) - pUndo = new OUndoPropertyGroupSectionAction( m_pImpl->m_rModel, _rEvent, OGroupHelper::getMemberFunction( xSection ), xGroup ); - else - pUndo = new OUndoPropertyReportSectionAction( m_pImpl->m_rModel, _rEvent, OReportHelper::getMemberFunction( xSection ), xSection->getReportDefinition() ); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - if ( pUndo == NULL ) - pUndo = new ORptUndoPropertyAction( m_pImpl->m_rModel, _rEvent ); - - pController->addUndoActionAndInvalidate(pUndo); - pController->InvalidateAll(); -} -// ----------------------------------------------------------------------------- -::std::vector< uno::Reference< container::XChild> >::const_iterator OXUndoEnvironment::getSection(const Reference<container::XChild>& _xContainer) const -{ - ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end(); - if ( _xContainer.is() ) - { - aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer); - - if ( aFind == m_pImpl->m_aSections.end() ) - { - Reference<container::XChild> xParent(_xContainer->getParent(),uno::UNO_QUERY); - aFind = getSection(xParent); - } - } - return aFind; -} -// XContainerListener -//------------------------------------------------------------------------------ -void SAL_CALL OXUndoEnvironment::elementInserted(const ContainerEvent& evt) throw(uno::RuntimeException) -{ - ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); - - // neues Object zum lauschen - Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY ); - if ( !IsLocked() ) - { - Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY ); - if ( xReportComponent.is() ) - { - Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY); - - ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get()); - - if ( aFind != m_pImpl->m_aSections.end() ) - { - OUndoEnvLock aLock(*this); - try - { - OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection>(*aFind,uno::UNO_QUERY)); - OSL_ENSURE(pPage,"No page could be found for section!"); - if ( pPage ) - pPage->insertObject(xReportComponent); - } - catch(uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - } - } - else - { - uno::Reference< report::XFunctions> xContainer(evt.Source,uno::UNO_QUERY); - if ( xContainer.is() ) - { - dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); - pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel - ,rptui::Inserted - ,xContainer.get() - ,xIface - ,RID_STR_UNDO_ADDFUNCTION)); - } - } - } - - AddElement(xIface); - - implSetModified(); -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::implSetModified() -{ - //if ( !IsLocked() ) - m_pImpl->m_rModel.SetModified( sal_True ); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OXUndoEnvironment::elementReplaced(const ContainerEvent& evt) throw(uno::RuntimeException) -{ - ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); - - Reference< XInterface > xIface(evt.ReplacedElement,uno::UNO_QUERY); - OSL_ENSURE(xIface.is(), "OXUndoEnvironment::elementReplaced: invalid container notification!"); - RemoveElement(xIface); - - xIface.set(evt.Element,uno::UNO_QUERY); - AddElement(xIface); - - implSetModified(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OXUndoEnvironment::elementRemoved(const ContainerEvent& evt) throw(uno::RuntimeException) -{ - ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); - - Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY ); - if ( !IsLocked() ) - { - Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY); - ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get()); - - Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY ); - if ( aFind != m_pImpl->m_aSections.end() && xReportComponent.is() ) - { - OXUndoEnvironment::OUndoEnvLock aLock(*this); - try - { - OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection >( *aFind, uno::UNO_QUERY_THROW ) ); - OSL_ENSURE( pPage, "OXUndoEnvironment::elementRemoved: no page for the section!" ); - if ( pPage ) - pPage->removeSdrObject(xReportComponent); - } - catch(const uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - else - { - uno::Reference< report::XFunctions> xFunctions(evt.Source,uno::UNO_QUERY); - if ( xFunctions.is() ) - { - dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); - pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel - ,rptui::Removed - ,xFunctions.get() - ,xIface - ,RID_STR_UNDO_ADDFUNCTION)); - } - } - } - - if ( xIface.is() ) - RemoveElement(xIface); - - implSetModified(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException) -{ - implSetModified(); -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::AddSection(const Reference< report::XSection > & _xSection) -{ - OUndoEnvLock aLock(*this); - try - { - uno::Reference<container::XChild> xChild = _xSection.get(); - uno::Reference<report::XGroup> xGroup(xChild->getParent(),uno::UNO_QUERY); - m_pImpl->m_aSections.push_back(xChild); - Reference< XInterface > xInt(_xSection); - AddElement(xInt); - } - catch(const uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSection) -{ - OUndoEnvLock aLock(*this); - try - { - uno::Reference<container::XChild> xChild(_xSection.get()); - m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(), - xChild), m_pImpl->m_aSections.end()); - Reference< XInterface > xInt(_xSection); - RemoveElement(xInt); - } - catch(uno::Exception&){} -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::TogglePropertyListening(const Reference< XInterface > & Element) -{ - // am Container horchen - Reference< XIndexAccess > xContainer(Element, UNO_QUERY); - if (xContainer.is()) - { - Reference< XInterface > xInterface; - sal_Int32 nCount = xContainer->getCount(); - for(sal_Int32 i = 0;i != nCount;++i) - { - xInterface.set(xContainer->getByIndex( i ),uno::UNO_QUERY); - TogglePropertyListening(xInterface); - } - } - - Reference< XPropertySet > xSet(Element, UNO_QUERY); - if (xSet.is()) - { - if (!m_pImpl->m_bReadOnly) - xSet->addPropertyChangeListener( ::rtl::OUString(), this ); - else - xSet->removePropertyChangeListener( ::rtl::OUString(), this ); - } -} - - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::switchListening( const Reference< XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(()) -{ - OSL_PRECOND( _rxContainer.is(), "OXUndoEnvironment::switchListening: invalid container!" ); - if ( !_rxContainer.is() ) - return; - - try - { - // also handle all children of this element - Reference< XInterface > xInterface; - sal_Int32 nCount = _rxContainer->getCount(); - for(sal_Int32 i = 0;i != nCount;++i) - { - xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY); - if ( _bStartListening ) - AddElement( xInterface ); - else - RemoveElement( xInterface ); - } - - // be notified of any changes in the container elements - Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY ); - // OSL_ENSURE( xSimpleContainer.is(), "OXUndoEnvironment::switchListening: how are we expected to be notified of changes in the container?" ); - if ( xSimpleContainer.is() ) - { - if ( _bStartListening ) - xSimpleContainer->addContainerListener( this ); - else - xSimpleContainer->removeContainerListener( this ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(()) -{ - OSL_PRECOND( _rxObject.is(), "OXUndoEnvironment::switchListening: how should I listen at a NULL object?" ); - - try - { - if ( !m_pImpl->m_bReadOnly ) - { - Reference< XPropertySet > xProps( _rxObject, UNO_QUERY ); - if ( xProps.is() ) - { - if ( _bStartListening ) - xProps->addPropertyChangeListener( ::rtl::OUString(), this ); - else - xProps->removePropertyChangeListener( ::rtl::OUString(), this ); - } - } - - Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY ); - if ( xBroadcaster.is() ) - { - if ( _bStartListening ) - xBroadcaster->addModifyListener( this ); - else - xBroadcaster->removeModifyListener( this ); - } - } - catch( const Exception& ) - { - //OSL_ENSURE( sal_False, "OXUndoEnvironment::switchListening: caught an exception!" ); - } -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::AddElement(const Reference< XInterface >& _rxElement ) -{ - if ( !IsLocked() ) - m_pImpl->m_aFormatNormalizer.notifyElementInserted( _rxElement ); - - // if it's a container, start listening at all elements - Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY ); - if ( xContainer.is() ) - switchListening( xContainer, true ); - - switchListening( _rxElement, true ); -} - -//------------------------------------------------------------------------------ -void OXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement) -{ - uno::Reference<beans::XPropertySet> xProp(_rxElement,uno::UNO_QUERY); - if (!m_pImpl->m_aPropertySetCache.empty()) - m_pImpl->m_aPropertySetCache.erase(xProp); - switchListening( _rxElement, false ); - - Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY ); - if ( xContainer.is() ) - switchListening( xContainer, false ); -} //============================================================================ } // rptui diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx new file mode 100644 index 000000000000..55929333c079 --- /dev/null +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -0,0 +1,626 @@ +/************************************************************************* + * + * 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: UndoActions.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "UndoActions.hxx" +#include "UndoEnv.hxx" +#include "formatnormalizer.hxx" +#include "conditionupdater.hxx" +#include "corestrings.hrc" +#include "rptui_slotid.hrc" +#include "RptDef.hxx" +#include "ModuleHelper.hxx" +#include "RptObject.hxx" +#include "RptPage.hxx" +#include "RptResId.hrc" +#include "RptModel.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/script/XEventAttacherManager.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +/** === end UNO includes === **/ + +#include <connectivity/dbtools.hxx> +#include <svtools/smplhint.hxx> +#include <tools/diagnose_ex.h> +#include <comphelper/stl_types.hxx> +#include <vcl/svapp.hxx> +#include <dbaccess/singledoccontroller.hxx> +#include <svx/unoshape.hxx> +#include <vos/mutex.hxx> + +namespace rptui +{ + using namespace ::com::sun::star; + using namespace uno; + using namespace lang; + using namespace script; + using namespace beans; + using namespace awt; + using namespace util; + using namespace container; + using namespace report; +//---------------------------------------------------------------------------- + + +DECLARE_STL_USTRINGACCESS_MAP(bool, AllProperties); +DECLARE_STL_STDKEY_MAP(uno::Reference< beans::XPropertySet >, AllProperties, PropertySetInfoCache); + +// ----------------------------------------------------------------------------- + +class OXUndoEnvironmentImpl +{ + OXUndoEnvironmentImpl(OXUndoEnvironmentImpl&); + void operator =(OXUndoEnvironmentImpl&); +public: + OReportModel& m_rModel; + PropertySetInfoCache m_aPropertySetCache; + FormatNormalizer m_aFormatNormalizer; + ConditionUpdater m_aConditionUpdater; + ::osl::Mutex m_aMutex; + ::std::vector< uno::Reference< container::XChild> > m_aSections; + oslInterlockedCount m_nLocks; + sal_Bool m_bReadOnly; + sal_Bool m_bIsUndo; + + OXUndoEnvironmentImpl(OReportModel& _rModel); +}; + +OXUndoEnvironmentImpl::OXUndoEnvironmentImpl(OReportModel& _rModel) : m_rModel(_rModel) + ,m_aFormatNormalizer( _rModel ) + ,m_aConditionUpdater() + ,m_nLocks(0) + ,m_bReadOnly(sal_False) + ,m_bIsUndo(sal_False) +{ +} + +//------------------------------------------------------------------------------ +DBG_NAME( rpt_OXUndoEnvironment ); +//------------------------------------------------------------------------------ +OXUndoEnvironment::OXUndoEnvironment(OReportModel& _rModel) + :m_pImpl(new OXUndoEnvironmentImpl(_rModel) ) +{ + DBG_CTOR( rpt_OXUndoEnvironment,NULL); + StartListening(m_pImpl->m_rModel); +} + +//------------------------------------------------------------------------------ +OXUndoEnvironment::~OXUndoEnvironment() +{ + DBG_DTOR( rpt_OXUndoEnvironment,NULL); +} +// ----------------------------------------------------------------------------- +void OXUndoEnvironment::Lock() +{ + OSL_ENSURE(m_refCount,"Illegal call to dead object!"); + osl_incrementInterlockedCount( &m_pImpl->m_nLocks ); +} +void OXUndoEnvironment::UnLock() +{ + OSL_ENSURE(m_refCount,"Illegal call to dead object!"); + + osl_decrementInterlockedCount( &m_pImpl->m_nLocks ); +} +sal_Bool OXUndoEnvironment::IsLocked() const { return m_pImpl->m_nLocks != 0; } +// ----------------------------------------------------------------------------- +void OXUndoEnvironment::RemoveSection(OReportPage* _pPage) +{ + if ( _pPage ) + { + Reference< XInterface > xSection(_pPage->getSection()); + if ( xSection.is() ) + RemoveElement( xSection ); + } +} +//------------------------------------------------------------------------------ +void OXUndoEnvironment::Clear(const Accessor& /*_r*/) +{ + OUndoEnvLock aLock(*this); + +#if OSL_DEBUG_LEVEL > 0 + // TODO: LLA->OJ please describe what you are doing in this code fragment. + PropertySetInfoCache::iterator aIter = m_pImpl->m_aPropertySetCache.begin(); + PropertySetInfoCache::iterator aEnd = m_pImpl->m_aPropertySetCache.end(); + int ndbg_len = m_pImpl->m_aPropertySetCache.size(); + ndbg_len = ndbg_len; + for (int idbg_ = 0; aIter != aEnd; ++aIter,++idbg_) + { + uno::Reference<beans::XPropertySet> xProp(aIter->first,uno::UNO_QUERY); + xProp->getPropertySetInfo(); + int nlen = aIter->second.size(); + nlen = nlen; + } +#endif + m_pImpl->m_aPropertySetCache.clear(); + + sal_uInt16 nCount = m_pImpl->m_rModel.GetPageCount(); + sal_uInt16 i; + for (i = 0; i < nCount; i++) + { + OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetPage(i) ); + RemoveSection(pPage); + } + + nCount = m_pImpl->m_rModel.GetMasterPageCount(); + for (i = 0; i < nCount; i++) + { + OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetMasterPage(i) ); + RemoveSection(pPage); + } + + m_pImpl->m_aSections.clear(); + + if (IsListening(m_pImpl->m_rModel)) + EndListening(m_pImpl->m_rModel); +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::ModeChanged() +{ + m_pImpl->m_bReadOnly = !m_pImpl->m_bReadOnly; + + if (!m_pImpl->m_bReadOnly) + StartListening(m_pImpl->m_rModel); + else + EndListening(m_pImpl->m_rModel); +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) +{ + if (rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_MODECHANGED ) + ModeChanged(); +} +// ----------------------------------------------------------------------------- +// XEventListener +//------------------------------------------------------------------------------ +void SAL_CALL OXUndoEnvironment::disposing(const EventObject& e) throw( RuntimeException ) +{ + // check if it's an object we have cached informations about + Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY); + if ( xSourceSet.is() ) + { + uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY); + if ( xSection.is() ) + RemoveSection(xSection); + else + RemoveElement(xSourceSet); + /*if (!m_pImpl->m_aPropertySetCache.empty()) + m_pImpl->m_aPropertySetCache.erase(xSourceSet);*/ + } +} + +// XPropertyChangeListener +//------------------------------------------------------------------------------ +void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEvent ) throw(uno::RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex ); + + if ( IsLocked() ) + return; + + Reference< XPropertySet > xSet( _rEvent.Source, UNO_QUERY ); + if (!xSet.is()) + return; + + dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); + if ( !pController ) + return; + + // no Undo for transient and readonly props. + // let's see if we know something about the set +#if OSL_DEBUG_LEVEL > 0 + int nlen = m_pImpl->m_aPropertySetCache.size(); + nlen = nlen; +#endif + PropertySetInfoCache::iterator aSetPos = m_pImpl->m_aPropertySetCache.find(xSet); + if (aSetPos == m_pImpl->m_aPropertySetCache.end()) + { + AllProperties aNewEntry; + aSetPos = m_pImpl->m_aPropertySetCache.insert(PropertySetInfoCache::value_type(xSet,aNewEntry)).first; + DBG_ASSERT(aSetPos != m_pImpl->m_aPropertySetCache.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?"); + } + if ( aSetPos == m_pImpl->m_aPropertySetCache.end() ) + return; + + // now we have access to the cached info about the set + // let's see what we know about the property + AllProperties& rPropInfos = aSetPos->second; + AllPropertiesIterator aPropertyPos = rPropInfos.find( _rEvent.PropertyName ); + if (aPropertyPos == rPropInfos.end()) + { // nothing 'til now ... have to change this .... + // the attributes + INT32 nAttributes = xSet->getPropertySetInfo()->getPropertyByName( _rEvent.PropertyName ).Attributes; + bool bTransReadOnly = ((nAttributes & PropertyAttribute::READONLY) != 0) || ((nAttributes & PropertyAttribute::TRANSIENT) != 0); + + // insert the new entry + aPropertyPos = rPropInfos.insert( AllProperties::value_type( _rEvent.PropertyName, bTransReadOnly ) ).first; + DBG_ASSERT(aPropertyPos != rPropInfos.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?"); + } + + implSetModified(); + + // now we have access to the cached info about the property affected + // and are able to decide wether or not we need an undo action + + // no UNDO for transient/readonly properties + if ( aPropertyPos->second ) + return; + + // give components with sub responsibilities a chance + m_pImpl->m_aFormatNormalizer.notifyPropertyChange( _rEvent ); + m_pImpl->m_aConditionUpdater.notifyPropertyChange( _rEvent ); + + aGuard.clear(); + // TODO: this is a potential race condition: two threads here could in theory + // add their undo actions out-of-order + + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ORptUndoPropertyAction* pUndo = NULL; + try + { + uno::Reference< report::XSection> xSection( xSet, uno::UNO_QUERY ); + if ( xSection.is() ) + { + uno::Reference< report::XGroup> xGroup = xSection->getGroup(); + if ( xGroup.is() ) + pUndo = new OUndoPropertyGroupSectionAction( m_pImpl->m_rModel, _rEvent, OGroupHelper::getMemberFunction( xSection ), xGroup ); + else + pUndo = new OUndoPropertyReportSectionAction( m_pImpl->m_rModel, _rEvent, OReportHelper::getMemberFunction( xSection ), xSection->getReportDefinition() ); + } + } + catch(const Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( pUndo == NULL ) + pUndo = new ORptUndoPropertyAction( m_pImpl->m_rModel, _rEvent ); + + pController->addUndoActionAndInvalidate(pUndo); + pController->InvalidateAll(); +} +// ----------------------------------------------------------------------------- +::std::vector< uno::Reference< container::XChild> >::const_iterator OXUndoEnvironment::getSection(const Reference<container::XChild>& _xContainer) const +{ + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end(); + if ( _xContainer.is() ) + { + aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer); + + if ( aFind == m_pImpl->m_aSections.end() ) + { + Reference<container::XChild> xParent(_xContainer->getParent(),uno::UNO_QUERY); + aFind = getSection(xParent); + } + } + return aFind; +} +// XContainerListener +//------------------------------------------------------------------------------ +void SAL_CALL OXUndoEnvironment::elementInserted(const ContainerEvent& evt) throw(uno::RuntimeException) +{ + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + // neues Object zum lauschen + Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY ); + if ( !IsLocked() ) + { + Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY ); + if ( xReportComponent.is() ) + { + Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY); + + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get()); + + if ( aFind != m_pImpl->m_aSections.end() ) + { + OUndoEnvLock aLock(*this); + try + { + OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection>(*aFind,uno::UNO_QUERY)); + OSL_ENSURE(pPage,"No page could be found for section!"); + if ( pPage ) + pPage->insertObject(xReportComponent); + } + catch(uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + + } + } + else + { + uno::Reference< report::XFunctions> xContainer(evt.Source,uno::UNO_QUERY); + if ( xContainer.is() ) + { + dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); + pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel + ,rptui::Inserted + ,xContainer.get() + ,xIface + ,RID_STR_UNDO_ADDFUNCTION)); + } + } + } + + AddElement(xIface); + + implSetModified(); +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::implSetModified() +{ + //if ( !IsLocked() ) + m_pImpl->m_rModel.SetModified( sal_True ); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OXUndoEnvironment::elementReplaced(const ContainerEvent& evt) throw(uno::RuntimeException) +{ + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + Reference< XInterface > xIface(evt.ReplacedElement,uno::UNO_QUERY); + OSL_ENSURE(xIface.is(), "OXUndoEnvironment::elementReplaced: invalid container notification!"); + RemoveElement(xIface); + + xIface.set(evt.Element,uno::UNO_QUERY); + AddElement(xIface); + + implSetModified(); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OXUndoEnvironment::elementRemoved(const ContainerEvent& evt) throw(uno::RuntimeException) +{ + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY ); + if ( !IsLocked() ) + { + Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY); + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get()); + + Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY ); + if ( aFind != m_pImpl->m_aSections.end() && xReportComponent.is() ) + { + OXUndoEnvironment::OUndoEnvLock aLock(*this); + try + { + OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection >( *aFind, uno::UNO_QUERY_THROW ) ); + OSL_ENSURE( pPage, "OXUndoEnvironment::elementRemoved: no page for the section!" ); + if ( pPage ) + pPage->removeSdrObject(xReportComponent); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + else + { + uno::Reference< report::XFunctions> xFunctions(evt.Source,uno::UNO_QUERY); + if ( xFunctions.is() ) + { + dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); + pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel + ,rptui::Removed + ,xFunctions.get() + ,xIface + ,RID_STR_UNDO_ADDFUNCTION)); + } + } + } + + if ( xIface.is() ) + RemoveElement(xIface); + + implSetModified(); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException) +{ + implSetModified(); +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::AddSection(const Reference< report::XSection > & _xSection) +{ + OUndoEnvLock aLock(*this); + try + { + uno::Reference<container::XChild> xChild = _xSection.get(); + uno::Reference<report::XGroup> xGroup(xChild->getParent(),uno::UNO_QUERY); + m_pImpl->m_aSections.push_back(xChild); + Reference< XInterface > xInt(_xSection); + AddElement(xInt); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSection) +{ + OUndoEnvLock aLock(*this); + try + { + uno::Reference<container::XChild> xChild(_xSection.get()); + m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(), + xChild), m_pImpl->m_aSections.end()); + Reference< XInterface > xInt(_xSection); + RemoveElement(xInt); + } + catch(uno::Exception&){} +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::TogglePropertyListening(const Reference< XInterface > & Element) +{ + // am Container horchen + Reference< XIndexAccess > xContainer(Element, UNO_QUERY); + if (xContainer.is()) + { + Reference< XInterface > xInterface; + sal_Int32 nCount = xContainer->getCount(); + for(sal_Int32 i = 0;i != nCount;++i) + { + xInterface.set(xContainer->getByIndex( i ),uno::UNO_QUERY); + TogglePropertyListening(xInterface); + } + } + + Reference< XPropertySet > xSet(Element, UNO_QUERY); + if (xSet.is()) + { + if (!m_pImpl->m_bReadOnly) + xSet->addPropertyChangeListener( ::rtl::OUString(), this ); + else + xSet->removePropertyChangeListener( ::rtl::OUString(), this ); + } +} + + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::switchListening( const Reference< XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(()) +{ + OSL_PRECOND( _rxContainer.is(), "OXUndoEnvironment::switchListening: invalid container!" ); + if ( !_rxContainer.is() ) + return; + + try + { + // also handle all children of this element + Reference< XInterface > xInterface; + sal_Int32 nCount = _rxContainer->getCount(); + for(sal_Int32 i = 0;i != nCount;++i) + { + xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY); + if ( _bStartListening ) + AddElement( xInterface ); + else + RemoveElement( xInterface ); + } + + // be notified of any changes in the container elements + Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY ); + // OSL_ENSURE( xSimpleContainer.is(), "OXUndoEnvironment::switchListening: how are we expected to be notified of changes in the container?" ); + if ( xSimpleContainer.is() ) + if ( _bStartListening ) + xSimpleContainer->addContainerListener( this ); + else + xSimpleContainer->removeContainerListener( this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(()) +{ + OSL_PRECOND( _rxObject.is(), "OXUndoEnvironment::switchListening: how should I listen at a NULL object?" ); + + try + { + if ( !m_pImpl->m_bReadOnly ) + { + Reference< XPropertySet > xProps( _rxObject, UNO_QUERY ); + if ( xProps.is() ) + if ( _bStartListening ) + xProps->addPropertyChangeListener( ::rtl::OUString(), this ); + else + xProps->removePropertyChangeListener( ::rtl::OUString(), this ); + } + + Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY ); + if ( xBroadcaster.is() ) + if ( _bStartListening ) + xBroadcaster->addModifyListener( this ); + else + xBroadcaster->removeModifyListener( this ); + } + catch( const Exception& ) + { + //OSL_ENSURE( sal_False, "OXUndoEnvironment::switchListening: caught an exception!" ); + } +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::AddElement(const Reference< XInterface >& _rxElement ) +{ + if ( !IsLocked() ) + m_pImpl->m_aFormatNormalizer.notifyElementInserted( _rxElement ); + + // if it's a container, start listening at all elements + Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY ); + if ( xContainer.is() ) + switchListening( xContainer, true ); + + switchListening( _rxElement, true ); +} + +//------------------------------------------------------------------------------ +void OXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement) +{ + uno::Reference<beans::XPropertySet> xProp(_rxElement,uno::UNO_QUERY); + if (!m_pImpl->m_aPropertySetCache.empty()) + m_pImpl->m_aPropertySetCache.erase(xProp); + switchListening( _rxElement, false ); + + Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY ); + if ( xContainer.is() ) + switchListening( xContainer, false ); +} + +void OXUndoEnvironment::SetUndoMode(sal_Bool _bUndo) +{ + m_pImpl->m_bIsUndo = _bUndo; +} + +sal_Bool OXUndoEnvironment::IsUndoMode() const +{ + return m_pImpl->m_bIsUndo; +} +//============================================================================ +} // rptui +//============================================================================ diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx index 7313d2c6989f..7ce45cb06f7a 100644 --- a/reportdesign/source/core/sdr/formatnormalizer.cxx +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -27,6 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#include "precompiled_reportdesign.hxx" #include "formatnormalizer.hxx" #include "RptModel.hxx" @@ -63,6 +64,7 @@ namespace rptui using ::com::sun::star::sdbc::SQLException; using ::com::sun::star::util::XNumberFormatsSupplier; using ::com::sun::star::util::XNumberFormatTypes; + using ::com::sun::star::uno::makeAny; /** === end UNO using === **/ //==================================================================== diff --git a/reportdesign/source/core/sdr/makefile.mk b/reportdesign/source/core/sdr/makefile.mk index 6890ce6b726b..0e65a59f4e0e 100644 --- a/reportdesign/source/core/sdr/makefile.mk +++ b/reportdesign/source/core/sdr/makefile.mk @@ -49,8 +49,8 @@ SLOFILES= $(SLO)$/RptModel.obj \ $(SLO)$/PropertyForward.obj \ $(SLO)$/ReportDrawPage.obj \ $(SLO)$/ReportUndoFactory.obj \ + $(SLO)$/UndoEnv.obj \ $(SLO)$/formatnormalizer.obj - # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index b9133e0cf447..add9ea18b7a8 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -323,6 +323,7 @@ ORptExport::ORptExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt1 UniReference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA )); m_xParaPropMapper = new OSpecialHanldeXMLExportPropertyMapper( xPropMapper); + //m_xParaPropMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); ::rtl::OUString sFamily( GetXMLToken(XML_PARAGRAPH) ); ::rtl::OUString aPrefix( String( 'P' ) ); @@ -947,8 +948,6 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection) AddAttribute(XML_NAMESPACE_FORM, XML_IMAGE_DATA,sTargetLocation); } bExportData = sal_True; - if ( xImage->getScaleImage() ) - AddAttribute(XML_NAMESPACE_REPORT, XML_SCALE, XML_TRUE ); } else if ( xReportDefinition.is() ) { diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx index bd5cf170a5b2..1b81d87a1119 100644 --- a/reportdesign/source/filter/xml/xmlHelper.cxx +++ b/reportdesign/source/filter/xml/xmlHelper.cxx @@ -32,6 +32,7 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/families.hxx> +#include <xmloff/controlpropertyhdl.hxx> #include <connectivity/dbtools.hxx> #include <comphelper/propertysethelper.hxx> #include <comphelper/mediadescriptor.hxx> @@ -101,6 +102,8 @@ const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) ); } break; + case (XML_SD_TYPES_START+34): + pHandler = new xmloff::ImageScaleModeHandler(); default: ; } @@ -137,6 +140,7 @@ UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _ FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), + GMAP( PROPERTY_SCALEMODE,STYLE,REPEAT, (XML_SD_TYPES_START+34)|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), @@ -155,6 +159,7 @@ UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _ FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), + GMAP( PROPERTY_SCALEMODE,STYLE,REPEAT, (XML_SD_TYPES_START+34)|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), @@ -305,7 +310,7 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const ::rtl::OUString& _sSty {PROPERTY_FONTPITCH, static_cast<sal_uInt16>(PROPERTY_FONTPITCH.length), PROPERTY_ID_FONTPITCH, &::getCppuType(&aFont.Pitch) ,PropertyAttribute::BOUND,0}, {PROPERTY_FONTCHARWIDTH, static_cast<sal_uInt16>(PROPERTY_FONTCHARWIDTH.length), PROPERTY_ID_FONTCHARWIDTH, &::getCppuType(&aFont.CharacterWidth),PropertyAttribute::BOUND,0}, {PROPERTY_FONTWEIGHT, static_cast<sal_uInt16>(PROPERTY_FONTWEIGHT.length), PROPERTY_ID_FONTWEIGHT, &::getCppuType(&aFont.Weight) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTSLANT, static_cast<sal_uInt16>(PROPERTY_FONTSLANT.length), PROPERTY_ID_FONTSLANT, &::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARPOSTURE, static_cast<sal_uInt16>(PROPERTY_CHARPOSTURE.length), PROPERTY_ID_FONTSLANT, &::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0}, {PROPERTY_FONTUNDERLINE, static_cast<sal_uInt16>(PROPERTY_FONTUNDERLINE.length), PROPERTY_ID_FONTUNDERLINE, &::getCppuType(&aFont.Underline) ,PropertyAttribute::BOUND,0}, {PROPERTY_CHARSTRIKEOUT, static_cast<sal_uInt16>(PROPERTY_CHARSTRIKEOUT.length), PROPERTY_ID_FONTSTRIKEOUT, &::getCppuType(&aFont.Strikeout) ,PropertyAttribute::BOUND,0}, {PROPERTY_FONTORIENTATION, static_cast<sal_uInt16>(PROPERTY_FONTORIENTATION.length), PROPERTY_ID_FONTORIENTATION, &::getCppuType(&aFont.Orientation) ,PropertyAttribute::BOUND,0}, @@ -338,7 +343,7 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const ::rtl::OUString& _sSty xProp->getPropertyValue(PROPERTY_FONTPITCH) >>= aFont.Pitch; xProp->getPropertyValue(PROPERTY_FONTCHARWIDTH) >>= aFont.CharacterWidth; xProp->getPropertyValue(PROPERTY_FONTWEIGHT) >>= aFont.Weight; - xProp->getPropertyValue(PROPERTY_FONTSLANT) >>= aFont.Slant; + xProp->getPropertyValue(PROPERTY_CHARPOSTURE) >>= aFont.Slant; xProp->getPropertyValue(PROPERTY_FONTUNDERLINE) >>= aFont.Underline; xProp->getPropertyValue(PROPERTY_CHARSTRIKEOUT) >>= aFont.Strikeout; xProp->getPropertyValue(PROPERTY_FONTORIENTATION) >>= aFont.Orientation; @@ -436,8 +441,6 @@ SvXMLTokenMap* OXMLHelper::GetSubDocumentElemTokenMap() }; return new SvXMLTokenMap( aElemTokenMap ); } - - // ----------------------------------------------------------------------------- } // rptxml // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/filter/xml/xmlHelper.hxx b/reportdesign/source/filter/xml/xmlHelper.hxx index dddf4d0345ba..cfb0df81a213 100644 --- a/reportdesign/source/filter/xml/xmlHelper.hxx +++ b/reportdesign/source/filter/xml/xmlHelper.hxx @@ -87,6 +87,7 @@ namespace rptxml static SvXMLTokenMap* GetReportElemTokenMap(); static SvXMLTokenMap* GetSubDocumentElemTokenMap(); + }; // ----------------------------------------------------------------------------- } // rptxml diff --git a/reportdesign/source/filter/xml/xmlImage.cxx b/reportdesign/source/filter/xml/xmlImage.cxx index 7354e5e7e1dd..33c0b58646b2 100644 --- a/reportdesign/source/filter/xml/xmlImage.cxx +++ b/reportdesign/source/filter/xml/xmlImage.cxx @@ -38,9 +38,10 @@ #include "xmlReportElement.hxx" #include "xmlControlProperty.hxx" #include <tools/debug.hxx> +#include <svtools/pathoptions.hxx> #include <comphelper/componentcontext.hxx> -#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> namespace rptxml { @@ -50,24 +51,7 @@ namespace rptxml DBG_NAME( rpt_OXMLImage ) -//-------------------------------------------------------------------- -::rtl::OUString OXMLImage::lcl_doStringsubstitution_nothrow( ::rtl::OUString const& _inout_rURL ) -{ - try - { - Reference< XInterface > xInt = m_rImport.getORB()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution" ) ) ); - Reference< util::XStringSubstitution > xStringSubst(xInt, UNO_QUERY); - - return xStringSubst->substituteVariables( _inout_rURL, true ); - } - catch( const Exception& ) - { - // DBG_UNHANDLED_EXCEPTION(); - } - return ::rtl::OUString(); -} // ----------------------------------------------------------------------------- - OXMLImage::OXMLImage( ORptFilter& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const Reference< XAttributeList > & _xAttrList @@ -96,37 +80,8 @@ OXMLImage::OXMLImage( ORptFilter& rImport, { case XML_TOK_IMAGE_DATA: { - // rtl::OUString sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(inst)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(prog)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(user)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(work)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(home)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(temp)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(path)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(lang)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(langid)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - // - // sTest = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(vlang)")); - // sTest = lcl_doStringsubstitution_nothrow( sTest ); - - sValue = lcl_doStringsubstitution_nothrow( sValue ); + SvtPathOptions aPathOptions; + sValue = aPathOptions.SubstituteVariable(sValue); _xComponent->setImageURL(rImport.GetAbsoluteReference( sValue )); } @@ -135,7 +90,7 @@ OXMLImage::OXMLImage( ORptFilter& rImport, _xComponent->setPreserveIRI(s_sTRUE == sValue); break; case XML_TOK_SCALE: - _xComponent->setScaleImage(s_sTRUE == sValue); + _xComponent->setScaleMode(s_sTRUE == sValue ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ); break; case XML_TOK_DATA_FORMULA: _xComponent->setDataField(ORptFilter::convertFormula(sValue)); diff --git a/reportdesign/source/filter/xml/xmlImage.hxx b/reportdesign/source/filter/xml/xmlImage.hxx index 259b2f8ac8e5..59eb63689f8f 100644 --- a/reportdesign/source/filter/xml/xmlImage.hxx +++ b/reportdesign/source/filter/xml/xmlImage.hxx @@ -42,9 +42,6 @@ namespace rptxml { OXMLImage(const OXMLImage&); void operator =(const OXMLImage&); - - ::rtl::OUString lcl_doStringsubstitution_nothrow( ::rtl::OUString const& _inout_rURL ); - public: OXMLImage( ORptFilter& rImport, sal_uInt16 nPrfx, diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 9c31618b212f..80c2c2d885f6 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/genericpropertyset.hxx> +#include <comphelper/mediadescriptor.hxx> #include <xmloff/ProgressBarHelper.hxx> #include <sfx2/docfile.hxx> #include <com/sun/star/io/XInputStream.hpp> @@ -565,9 +566,16 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) { MAP_LEN( "OldFormat" ), 1, &::getCppuType((const sal_Bool*)0), beans::PropertyAttribute::BOUND, 0 }, { MAP_LEN( "StreamName"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { MAP_LEN("PrivateData"), 0, &::getCppuType( (uno::Reference<XInterface> *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "BaseURI"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "StreamRelPath"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; + ::comphelper::MediaDescriptor aDescriptor(rDescriptor); uno::Reference<beans::XPropertySet> xProp = comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap)); + const ::rtl::OUString sVal( aDescriptor.getUnpackedValueOrDefault(aDescriptor.PROP_DOCUMENTBASEURL(),::rtl::OUString()) ); + xProp->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(sVal)); + const ::rtl::OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),::rtl::OUString()) ); + xProp->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")), uno::makeAny(sHierarchicalDocumentName)); uno::Reference<XComponent> xModel(GetModel(),UNO_QUERY); static const ::rtl::OUString s_sMeta(RTL_CONSTASCII_USTRINGPARAM("meta.xml")); @@ -863,7 +871,7 @@ const SvXMLTokenMap& ORptFilter::GetControlElemTokenMap() const { XML_NAMESPACE_REPORT, XML_REPORT_ELEMENT ,XML_TOK_REPORT_ELEMENT }, { XML_NAMESPACE_REPORT, XML_FORMULA ,XML_TOK_DATA_FORMULA }, { XML_NAMESPACE_REPORT, XML_PRESERVE_IRI ,XML_TOK_PRESERVE_IRI }, - { XML_NAMESPACE_REPORT, XML_SELECT_PAGE ,XML_TOK_SELECT_PAGE }, + { XML_NAMESPACE_REPORT, XML_SELECT_PAGE ,XML_TOK_SELECT_PAGE }, XML_TOKEN_MAP_END }; m_pControlElemTokenMap.reset(new SvXMLTokenMap( aElemTokenMap )); diff --git a/reportdesign/source/inc/stringconstants.hrc b/reportdesign/source/inc/stringconstants.hrc index cc38480a88b9..c9f4c520c863 100644 --- a/reportdesign/source/inc/stringconstants.hrc +++ b/reportdesign/source/inc/stringconstants.hrc @@ -130,7 +130,6 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_FORMATKEY ); DECLARE_CONSTASCII_USTRING(PROPERTY_MAXTEXTLEN ); DECLARE_CONSTASCII_USTRING(PROPERTY_LISTSOURCE ); DECLARE_CONSTASCII_USTRING(PROPERTY_FORMATSSUPPLIER ); -DECLARE_CONSTASCII_USTRING(PROPERTY_SCALEIMAGE ); DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLBORDER ); DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLBORDERCOLOR ); DECLARE_CONSTASCII_USTRING(PROPERTY_BORDER ); @@ -234,11 +233,13 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_PREEVALUATED ); DECLARE_CONSTASCII_USTRING(PROPERTY_DEEPTRAVERSING ); DECLARE_CONSTASCII_USTRING(PROPERTY_MIMETYPE ); DECLARE_CONSTASCII_USTRING(PROPERTY_BACKGROUNDCOLOR ); +DECLARE_CONSTASCII_USTRING(PROPERTY_TEXT ); DECLARE_CONSTASCII_USTRING(PROPERTY_TEXTCOLOR ); DECLARE_CONSTASCII_USTRING(PROPERTY_TEXTLINECOLOR ); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTRELIEF ); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTEMPHASISMARK ); DECLARE_CONSTASCII_USTRING(PROPERTY_ZORDER ); +DECLARE_CONSTASCII_USTRING(PROPERTY_OPAQUE ); DECLARE_CONSTASCII_USTRING(PROPERTY_TRANSFORMATION ); DECLARE_CONSTASCII_USTRING(PROPERTY_CUSTOMSHAPEENGINE ); DECLARE_CONSTASCII_USTRING(PROPERTY_CUSTOMSHAPEDATA ); @@ -251,6 +252,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_ALIGN ); DECLARE_CONSTASCII_USTRING(PROPERTY_TYPE ); DECLARE_CONSTASCII_USTRING(PROPERTY_PRESERVEIRI ); +DECLARE_CONSTASCII_USTRING(PROPERTY_SCALEMODE ); DECLARE_CONSTASCII_USTRING(PROPERTY_LINESTYLE ); DECLARE_CONSTASCII_USTRING(PROPERTY_LINEDASH ); diff --git a/reportdesign/source/inc/uistrings.hrc b/reportdesign/source/inc/uistrings.hrc index c6e4669f6b74..07d5f492ba89 100644 --- a/reportdesign/source/inc/uistrings.hrc +++ b/reportdesign/source/inc/uistrings.hrc @@ -73,6 +73,9 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_FILLGRADIENTNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLHATCHNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLBITMAPNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLSTYLE ); + +DECLARE_CONSTASCII_USTRING(DBTEXTBOXBOUNDCONTENT ); + } #endif // REPORTDESIGN_SHARED_UISTRINGS_HRC diff --git a/reportdesign/source/shared/stringconstants.cxx b/reportdesign/source/shared/stringconstants.cxx index a36dd0a75f58..f0486bf9c92c 100644 --- a/reportdesign/source/shared/stringconstants.cxx +++ b/reportdesign/source/shared/stringconstants.cxx @@ -126,7 +126,6 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FORMATKEY , "FormatKey"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXTEXTLEN , "MaxTextLen"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LISTSOURCE , "ListSource"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FORMATSSUPPLIER , "FormatsSupplier"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SCALEIMAGE , "ScaleImage"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLBORDER , "ControlBorder"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLBORDERCOLOR , "ControlBorderColor"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BORDER , "Border"); @@ -158,7 +157,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTKERNING, "FontKerning"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTNAME, "FontName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTORIENTATION, "CharRotation"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTPITCH, "CharFontPitch"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTSLANT, "CharPosture"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTSLANT, "FontSlant"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARSTRIKEOUT, "CharStrikeout"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTSTRIKEOUT, "FontStrikeout"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTSTYLENAME, "CharFontStyleName"); @@ -230,11 +229,13 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PREEVALUATED, "PreEvaluated"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEEPTRAVERSING, "DeepTraversing"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MIMETYPE, "MimeType"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BACKGROUNDCOLOR, "BackgroundColor"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXT, "Text"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXTCOLOR, "TextColor"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXTLINECOLOR , "TextLineColor"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTRELIEF , "FontRelief"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTEMPHASISMARK, "FontEmphasisMark"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ZORDER, "ZOrder"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ZORDER, "ZOrder"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_OPAQUE, "Opaque"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TRANSFORMATION, "Transformation"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CUSTOMSHAPEENGINE, "CustomShapeEngine"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CUSTOMSHAPEDATA, "CustomShapeData"); @@ -251,6 +252,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINECOLOR , "LineColor"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINETRANSPARENCE, "LineTransparence"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINEWIDTH , "LineWidth"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PRESERVEIRI , "PreserveIRI"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SCALEMODE , "ScaleMode"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARFLASH, "CharFlash"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARESCAPEMENTHEIGHT, "CharEscapementHeight"); diff --git a/reportdesign/source/shared/uistrings.cxx b/reportdesign/source/shared/uistrings.cxx index 2fc710228552..ceee0aea34f0 100644 --- a/reportdesign/source/shared/uistrings.cxx +++ b/reportdesign/source/shared/uistrings.cxx @@ -67,5 +67,7 @@ namespace rptui IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILLHATCHNAME , "FillHatchName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILLBITMAPNAME , "FillBitmapName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILLSTYLE , "FillStyle"); + + IMPLEMENT_CONSTASCII_USTRING(DBTEXTBOXBOUNDCONTENT , "TextBoxBoundContent"); } diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index dba3107fedfd..afc53270754a 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -56,7 +56,7 @@ namespace rptui { const long STD_WIN_SIZE_X = 180; -const long STD_WIN_SIZE_Y = 220; +const long STD_WIN_SIZE_Y = 320; const long LISTBOX_BORDER = 2; @@ -171,6 +171,8 @@ OAddFieldWindow::OAddFieldWindow(Window* pParent ,m_xRowSet(_xRowSet) ,m_aActions(this,ModuleRes(RID_TB_SORTING)) ,m_pListBox(new OAddFieldWindowListBox( this )) + ,m_aFixedLine(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) ) + ,m_aHelpText(this, ModuleRes(ADDFIELD_HELP_FIELD) ) ,m_aInsertButton(this, WB_TABSTOP|WB_CENTER) ,m_nCommandType(0) ,m_bEscapeProcessing(sal_False) @@ -200,6 +202,9 @@ OAddFieldWindow::OAddFieldWindow(Window* pParent m_aInsertButton.SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) ); m_aInsertButton.Show(); + m_aFixedLine.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); + m_aHelpText.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); + SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y)); //Show(); @@ -362,20 +367,41 @@ void OAddFieldWindow::Resize() { FloatingWindow::Resize(); - const Size aSize( GetOutputSizePixel() ); + const Size aWindowSize( GetOutputSizePixel() ); - ////////////////////////////////////////////////////////////////////// - Size aToolbarSize( m_aActions.GetSizePixel() ); const Size aRelated(LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT )); - Point aPos( aRelated.Width(), aToolbarSize.Height() + 2*aRelated.Height()); - Point aToolbarPos( aPos.X(),aRelated.Height()); - Size aLBSize( aSize ); - aLBSize.Width() -= (2*aRelated.Width()); - aLBSize.Height() -= (aRelated.Height() + aPos.Y() ); - - m_aActions.SetPosPixel(Point(aPos.X(),aToolbarPos.Y())); - m_pListBox->SetPosSizePixel( aPos, aLBSize ); + const Size aFixedTextSize(LogicToPixel( Size( FIXEDTEXT_WIDTH, FIXEDTEXT_HEIGHT ), MAP_APPFONT )); + + // ToolBar + Size aToolbarSize( m_aActions.GetSizePixel() ); + Point aToolbarPos( aRelated.Width(), aRelated.Height()); + m_aActions.SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y())); + + Size aLBSize( aWindowSize ); + aLBSize.Width() -= ( 2 * aRelated.Width() ); + + // help text + const Size aHelpTextSize = m_aHelpText.CalcMinimumSize(aLBSize.Width()); + + // ListBox + Point aLBPos( aRelated.Width(), aRelated.Height() + aToolbarSize.Height() + aRelated.Height() ); + + aLBSize.Height() -= aToolbarSize.Height(); // Toolbar + aLBSize.Height() -= (6*aRelated.Height()); // 6 * gap + aLBSize.Height() -= aFixedTextSize.Height(); // fixed line + aLBSize.Height() -= aHelpTextSize.Height(); // help text + m_pListBox->SetPosSizePixel( aLBPos, aLBSize ); + + // FixedLine + Size aFLSize( aLBSize.Width(),aFixedTextSize.Height() ); + Point aFLPos( aRelated.Width(), aLBPos.Y() + aLBSize.Height() + aRelated.Height()); + m_aFixedLine.SetPosSizePixel( aFLPos, aFLSize ); + + // Help text + Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() ); + m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize ); + } // ----------------------------------------------------------------------------- uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const diff --git a/reportdesign/source/ui/dlg/CondFormat.hrc b/reportdesign/source/ui/dlg/CondFormat.hrc index 4446072804c6..474789419e9c 100644 --- a/reportdesign/source/ui/dlg/CondFormat.hrc +++ b/reportdesign/source/ui/dlg/CondFormat.hrc @@ -31,6 +31,7 @@ #define RPTUI_CONDFORMAT_HRC #define CHECKBOX_HEIGHT 8 +#define FIXEDTEXT_WIDTH 60 #define FIXEDTEXT_HEIGHT 8 #define EDIT_WIDTH 75 #define RELATED_CONTROLS 4 diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src index 94c4727fd429..b71df70df707 100644 --- a/reportdesign/source/ui/dlg/CondFormat.src +++ b/reportdesign/source/ui/dlg/CondFormat.src @@ -337,6 +337,9 @@ ImageList IMG_CONDFORMAT_DLG_LCH < "res/commandimagelist/lch_fontdialog.png" ; SID_CHAR_DLG ; > ; }; }; + + + ImageList 31000 { MASKCOLOR; @@ -345,6 +348,7 @@ ImageList 31000 IdCount = 1; }; + ToolBox RID_TB_SORTING { Pos = MAP_APPFONT ( 0,0 ) ; @@ -381,6 +385,7 @@ ToolBox RID_TB_SORTING }; }; }; + ImageList IMG_ADDFIELD_DLG_SC { MASKCOLOR; @@ -391,6 +396,7 @@ ImageList IMG_ADDFIELD_DLG_SC < "res/commandimagelist/sc_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ; }; }; + ImageList IMG_ADDFIELD_DLG_SCH { MASKCOLOR; @@ -401,6 +407,7 @@ ImageList IMG_ADDFIELD_DLG_SCH < "res/commandimagelist/sch_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ; }; }; + ImageList IMG_ADDFIELD_DLG_LC { MASKCOLOR; @@ -411,6 +418,7 @@ ImageList IMG_ADDFIELD_DLG_LC < "res/commandimagelist/lc_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ; }; }; + ImageList IMG_ADDFIELD_DLG_LCH { MASKCOLOR; @@ -421,3 +429,20 @@ ImageList IMG_ADDFIELD_DLG_LCH < "res/commandimagelist/lch_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ; }; }; + +FixedLine ADDFIELD_FL_HELP_SEPARATOR +{ + SVLook = TRUE ; + Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ; + Size = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ; + Text [ en-US ] = "Help"; +}; + +FixedText ADDFIELD_HELP_FIELD +{ + SVLook = TRUE ; + Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ; + Size = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ; + WordBreak = TRUE; + Text [ en-US ] = "Highlight the fields to insert into the selected section of the template, then click Insert or press Enter."; +}; diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index a8b054ce8f2b..2f20d75c3fa4 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -45,6 +45,7 @@ #include <svx/globlmn.hrc> #include <svx/svxids.hrc> +#include <svtools/imgdef.hxx> #include "GroupExchange.hxx" #include "UITools.hxx" @@ -59,6 +60,8 @@ #include <algorithm> #include <boost/bind.hpp> +#include <cppuhelper/bootstrap.hxx> + #define HANDLE_ID 0 #define FIELD_EXPRESSION 1 #define GROUPS_START_LEN 5 @@ -89,8 +92,8 @@ class OFieldExpressionControl : public TContainerListenerBase void fillListBox(const uno::Reference< beans::XPropertySet>& _xDest,long nRow,USHORT nColumnId); BOOL SaveModified(bool _bAppend); - OFieldExpressionControl(const OFieldExpressionControl&); - void operator =(const OFieldExpressionControl&); + OFieldExpressionControl(const OFieldExpressionControl&); // NO COPY + void operator =(const OFieldExpressionControl&); // NO ASSIGN public: OFieldExpressionControl( OGroupsSortingDialog* _pParent,const ResId& _rResId); virtual ~OFieldExpressionControl(); @@ -153,10 +156,13 @@ private: DECL_LINK( AsynchActivate, void* ); DECL_LINK( AsynchDeactivate, void* ); DECL_LINK( DelayedPaste, void* ); - DECL_LINK( DelayedDelete, void* ); DECL_LINK( CBChangeHdl,ComboBox*); void InsertRows( long nRow ); + +public: + DECL_LINK( DelayedDelete, void* ); + }; //======================================================================== // class OFieldExpressionControl @@ -771,7 +777,16 @@ void OFieldExpressionControl::DeleteRows() { DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL); + sal_Bool bIsEditing = IsEditing(); + if (bIsEditing) + { + DeactivateCell(); + } long nIndex = FirstSelectedRow(); + if (nIndex == -1) + { + nIndex = GetCurRow(); + } bool bFirstTime = true; long nOldDataPos = nIndex; @@ -945,8 +960,13 @@ OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent ,OPropertyChangeListener(m_aMutex) ,m_aFL2(this, ModuleRes(FL_SEPARATOR2) ) ,m_aMove(this, ModuleRes(FT_MOVELABEL) ) - ,m_aUp(this, ModuleRes(PB_UP) ) - ,m_aDown(this, ModuleRes(PB_DOWN) ) +/* + ,m_aPB_Up(this, ModuleRes(PB_UP) ) + ,m_aPB_Down(this, ModuleRes(PB_DOWN) ) + ,m_aPB_Delete(this, ModuleRes(PB_DELETE) ) +*/ + ,m_aToolBox(this, ModuleRes(TB_TOOLBOX) ) + ,m_aFL3(this, ModuleRes(FL_SEPARATOR3) ) ,m_aOrder(this, ModuleRes(FT_ORDER) ) ,m_aOrderLst(this, ModuleRes(LST_ORDER) ) @@ -999,11 +1019,12 @@ OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent nMaxTextWidth = ::std::max<sal_Int32>(nTextWidth,nMaxTextWidth); } - Size aSpace = LogicToPixel( Size( UNRELATED_CONTROLS, PAGE_HEIGHT), MAP_APPFONT ); + Size aSize(UNRELATED_CONTROLS, PAGE_HEIGHT); + Size aSpace = LogicToPixel( aSize, MAP_APPFONT ); Size aOutSize(nMaxTextWidth + m_aHeader.GetSizePixel().Width() + 3*aSpace.Width(),aSpace.Height()); SetMinOutputSizePixel(aOutSize); SetOutputSizePixel(aOutSize); - Resize(); +// Resize(); m_pReportListener = new OPropertyChangeMultiplexer(this,m_pController->getReportDefinition().get()); m_pReportListener->addProperty(PROPERTY_COMMAND); @@ -1015,19 +1036,25 @@ OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent //m_aHelpWindow.SetReadOnly(); m_aHelpWindow.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); - m_aUp.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl)); - m_aDown.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl)); + //BTN m_aPB_Up.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl)); + //BTN m_aPB_Down.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl)); + //BTN m_aPB_Delete.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl)); m_pFieldExpression->SetZOrder(&m_aFL2, WINDOW_ZORDER_BEHIND); m_aMove.SetZOrder(m_pFieldExpression, WINDOW_ZORDER_BEHIND); - m_aUp.SetZOrder(&m_aMove, WINDOW_ZORDER_BEHIND); - m_aDown.SetZOrder(&m_aUp, WINDOW_ZORDER_BEHIND); + //BTN m_aPB_Up.SetZOrder(&m_aMove, WINDOW_ZORDER_BEHIND); + //BTN m_aPB_Down.SetZOrder(&m_aPB_Up, WINDOW_ZORDER_BEHIND); // set Hi contrast bitmaps - m_aUp.SetModeImage( ModuleRes(IMG_UP_H),BMP_COLOR_HIGHCONTRAST); - m_aDown.SetModeImage( ModuleRes(IMG_DOWN_H),BMP_COLOR_HIGHCONTRAST); + //BTN m_aPB_Up.SetModeImage( ModuleRes(IMG_UP_H),BMP_COLOR_HIGHCONTRAST); + //BTN m_aPB_Down.SetModeImage( ModuleRes(IMG_DOWN_H),BMP_COLOR_HIGHCONTRAST); + m_aToolBox.SetStyle(m_aToolBox.GetStyle()|WB_LINESPACING); + m_aToolBox.SetSelectHdl(LINK(this, OGroupsSortingDialog, OnFormatAction)); + m_aToolBox.SetImageListProvider(this); + setToolBox(&m_aToolBox); checkButtons(0); + Resize(); FreeResource(); } @@ -1182,9 +1209,13 @@ IMPL_LINK(OGroupsSortingDialog, OnControlFocusLost, Control*, pControl ) return 0L; } // ----------------------------------------------------------------------------- -IMPL_LINK( OGroupsSortingDialog, ClickHdl, ImageButton*, _pButton ) +IMPL_LINK( OGroupsSortingDialog, OnFormatAction, ToolBox*, /*NOTINTERESTEDIN*/ ) +// IMPL_LINK( OGroupsSortingDialog, ClickHdl, ImageButton*, _pButton ) { DBG_CHKTHIS( rpt_OGroupsSortingDialog,NULL); + + USHORT nCommand = m_aToolBox.GetCurItemId(); + if ( m_pFieldExpression ) { long nIndex = m_pFieldExpression->GetCurrRow(); @@ -1195,20 +1226,35 @@ IMPL_LINK( OGroupsSortingDialog, ClickHdl, ImageButton*, _pButton ) aClipboardList.realloc(1); aClipboardList[0] = m_xGroups->getByIndex(nGroupPos); } - if ( _pButton == &m_aUp ) + //BTN if ( _pButton == &m_aPB_Up ) + if ( nCommand == SID_RPT_GROUPSORT_MOVE_UP ) + { --nIndex; - else + } + //BTN if ( _pButton == &m_aPB_Down ) + if ( nCommand == SID_RPT_GROUPSORT_MOVE_DOWN ) + { ++nIndex; - - if ( nIndex >= 0 && aClipboardList.getLength() ) + } + //BTN if ( _pButton == &m_aPB_Delete ) + if ( nCommand == SID_RPT_GROUPSORT_DELETE ) { - m_pFieldExpression->SetNoSelection(); - m_pFieldExpression->moveGroups(aClipboardList,nIndex,sal_False); - m_pFieldExpression->DeactivateCell(); - m_pFieldExpression->GoToRow(nIndex); - //long nCurRow = m_pFieldExpression->GetCurRow(); - m_pFieldExpression->ActivateCell(nIndex, m_pFieldExpression->GetCurColumnId()); - DisplayData(nIndex); + // m_pFieldExpression->DeleteCurrentRow(); + Application::PostUserEvent( LINK(m_pFieldExpression, OFieldExpressionControl, DelayedDelete) ); + // UpdateData( ); + } + else + { + if ( nIndex >= 0 && aClipboardList.getLength() ) + { + m_pFieldExpression->SetNoSelection(); + m_pFieldExpression->moveGroups(aClipboardList,nIndex,sal_False); + m_pFieldExpression->DeactivateCell(); + m_pFieldExpression->GoToRow(nIndex); + //long nCurRow = m_pFieldExpression->GetCurRow(); + m_pFieldExpression->ActivateCell(nIndex, m_pFieldExpression->GetCurColumnId()); + DisplayData(nIndex); + } } } return 1L; @@ -1393,10 +1439,17 @@ void OGroupsSortingDialog::Resize() m_aFL2.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL2.GetSizePixel().Height())); m_aFL3.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL3.GetSizePixel().Height())); - sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aUp.GetSizePixel().Width(); - m_aDown.SetPosPixel(Point(nPos,m_aDown.GetPosPixel().Y())); - nPos -= (m_aUp.GetSizePixel().Width() + LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ).Width()); - m_aUp.SetPosPixel(Point(nPos,m_aUp.GetPosPixel().Y())); +//BTN sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aPB_Up.GetSizePixel().Width(); +//BTN m_aPB_Delete.SetPosPixel(Point(nPos,m_aPB_Delete.GetPosPixel().Y())); +//BTN +//BTN nPos -= (m_aPB_Up.GetSizePixel().Width() + LogicToPixel( Size( UNRELATED_CONTROLS, 0 ), MAP_APPFONT ).Width()); +//BTN m_aPB_Down.SetPosPixel(Point(nPos,m_aPB_Down.GetPosPixel().Y())); +//BTN +//BTN nPos -= (m_aPB_Up.GetSizePixel().Width() + LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ).Width()); +//BTN m_aPB_Up.SetPosPixel(Point(nPos,m_aPB_Up.GetPosPixel().Y())); + sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aToolBox.GetSizePixel().Width(); + m_aToolBox.SetPosPixel(Point(nPos,m_aToolBox.GetPosPixel().Y())); + Point aHelpPos = m_aHelpWindow.GetPosPixel(); m_aHelpWindow.SetSizePixel(Size(aTotalOutputSize.Width() - aHelpPos.X(),aTotalOutputSize.Height() - aHelpPos.Y())); } @@ -1404,10 +1457,86 @@ void OGroupsSortingDialog::Resize() void OGroupsSortingDialog::checkButtons(sal_Int32 _nRow) { sal_Int32 nGroupCount = m_xGroups->getCount(); - sal_Bool bEnable = nGroupCount > 1; - m_aUp.Enable(bEnable && _nRow > 0 ); - m_aDown.Enable(bEnable && _nRow < (m_pFieldExpression->GetRowCount()-1) ); + sal_Int32 nRowCount = m_pFieldExpression->GetRowCount(); + sal_Bool bEnabled = nGroupCount > 1; + + if (bEnabled && _nRow > 0 /* && _nRow < nGroupCount */ ) + { + m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_UP, sal_True); + } + else + { + m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_UP, sal_False); + } + if (bEnabled && _nRow < (nRowCount - 1) /* && _nRow < (nGroupCount - 1) */ ) + { + m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, sal_True); + } + else + { + m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, sal_False); + } + //BTN m_aPB_Up.Enable(bEnable && _nRow > 0 ); + //BTN m_aPB_Down.Enable(bEnable && _nRow < (m_pFieldExpression->GetRowCount()-1) ); + // m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, bEnable && _nRow < (-1) ); + + sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(_nRow); + if ( nGroupPos != NO_GROUP ) + { + sal_Bool bEnableDelete = nGroupCount > 0; + //BTN m_aPB_Delete.Enable(bEnableDelete ); + m_aToolBox.EnableItem(SID_RPT_GROUPSORT_DELETE, bEnableDelete); + } + else + { + //BTN m_aPB_Delete.Enable( sal_False ); + m_aToolBox.EnableItem(SID_RPT_GROUPSORT_DELETE, sal_False); + } } + +ImageList OGroupsSortingDialog::getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const +{ + sal_Int16 nN = IMG_CONDFORMAT_DLG_SC; + sal_Int16 nH = IMG_CONDFORMAT_DLG_SCH; + if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) + { + nN = IMG_CONDFORMAT_DLG_LC; + nH = IMG_CONDFORMAT_DLG_LCH; + } + return ImageList(ModuleRes( _bHiContast ? nH : nN )); +} + +//------------------------------------------------------------------ +void OGroupsSortingDialog::resizeControls(const Size& _rDiff) +{ + // we use large images so we must change them + if ( _rDiff.Width() || _rDiff.Height() ) + { + Point aPos = LogicToPixel( Point( 2*RELATED_CONTROLS , 0), MAP_APPFONT ); + Invalidate(); + } +} + +//------------------------------------------------------------------ +// load the images +ImageList OGroupsSortingDialog::getImageList(vcl::ImageListType _eType) SAL_THROW (( com::sun::star::lang::IllegalArgumentException )) +{ + if (_eType == vcl::HIGHCONTRAST_NO) + { + return ImageList(ModuleRes(IMGLST_GROUPSORT_DLG_SC)); + } + else if (_eType == vcl::HIGHCONTRAST_YES) + { + return ImageList(ModuleRes(IMGLST_GROUPSORT_DLG_SCH)); + } + else + { + throw com::sun::star::lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("High contrast parameter is wrong.")), NULL, 0); + } +} + + + // ============================================================================= } // rptui // ============================================================================= diff --git a/reportdesign/source/ui/dlg/GroupsSorting.hrc b/reportdesign/source/ui/dlg/GroupsSorting.hrc index 323ce579c6c7..24d9a78a1ef9 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.hrc +++ b/reportdesign/source/ui/dlg/GroupsSorting.hrc @@ -53,8 +53,17 @@ #define PB_DOWN (21) #define FL_SEPARATOR2 (22) #define FL_SEPARATOR3 (23) -#define IMG_UP_H (24) -#define IMG_DOWN_H (25) +//BTN #define IMG_UP_H (24) +//BTN #define IMG_DOWN_H (25) +//BTN #define PB_DELETE (26) +#define TB_TOOLBOX (27) + +// #define IMG_GROUPSORT_MOVE_DOWN (28) +// #define IMG_GROUPSORT_MOVE_UP (29) +// #define IMG_GROUPSORT_DELETE (30) +// #define IMG_GROUPSORT_MOVE_DOWN_H (31) +// #define IMG_GROUPSORT_MOVE_UP_H (32) +// #define IMG_GROUPSORT_DELETE_H (33) #define CHECKBOX_HEIGHT 8 diff --git a/reportdesign/source/ui/dlg/GroupsSorting.src b/reportdesign/source/ui/dlg/GroupsSorting.src index 3f7edff1aa61..f7184bdd3b6e 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.src +++ b/reportdesign/source/ui/dlg/GroupsSorting.src @@ -69,23 +69,88 @@ FloatingWindow RID_GROUPS_SORTING { Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 3*UNRELATED_CONTROLS + BROWSER_HEIGHT ) ; Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Move group" ; +// Text [ en-US ] = "Move group" ; + Text [ en-US ] = "Group actions" ; }; - ImageButton PB_UP - { - Pos = MAP_APPFONT ( PAGE_WIDTH - UNRELATED_CONTROLS - 2*14 - RELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT -1 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TabStop = TRUE; - Symbol = IMAGEBUTTON_ARROW_UP ; - }; +// /* +// | PAGE_WIDTH | +// | /-----\ {-------\ /---------\ | +// | unreleated FT_MOVELABEL |PB_UP| unreleated |PB_DOWN| unreleated |PD_DELETE| unreleated | +// | \_____/ \_______/ \_________/ | +// +// Don't set any position here, it will be done in OGroupsSortingDialog::Resize() +// +// Find possible IMAGEBUTTON_* in rscicpx.cxx +// Symbol is vclrsc.hxx +// */ +// ImageButton PB_UP +// { +// Pos = MAP_APPFONT ( PAGE_WIDTH - 3*UNRELATED_CONTROLS - 3*14 - 2*RELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT -1 ) ; +// Size = MAP_APPFONT ( 14 , 14 ) ; +// TabStop = TRUE; +// // Symbol = IMAGEBUTTON_ARROW_UP ; // arrow up +// Symbol = IMAGEBUTTON_SPIN_UP ; // triangle up +// // Symbol = IMAGEBUTTON_FLOAT; +// }; +// +// ImageButton PB_DOWN +// { +// Pos = MAP_APPFONT ( PAGE_WIDTH - 2*UNRELATED_CONTROLS - 2*14 - 2*RELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ; +// Size = MAP_APPFONT ( 14 , 14 ) ; +// TabStop = TRUE; +// // Symbol = IMAGEBUTTON_ARROW_DOWN ; // arrow down +// // Symbol = IMAGEBUTTON_FIRST ; +// Symbol = IMAGEBUTTON_SPIN_DOWN; +// +// }; +// +// ImageButton PB_DELETE +// { +// Pos = MAP_APPFONT ( PAGE_WIDTH - UNRELATED_CONTROLS - 14, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ; +// Size = MAP_APPFONT ( 14 , 14 ) ; +// TabStop = TRUE; +// Symbol = IMAGEBUTTON_CLOSE ; +// }; - ImageButton PB_DOWN + + ToolBox TB_TOOLBOX { - Pos = MAP_APPFONT ( PAGE_WIDTH - UNRELATED_CONTROLS - 14 - RELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TabStop = TRUE; - Symbol = IMAGEBUTTON_ARROW_DOWN ; + Pos = MAP_APPFONT ( PAGE_WIDTH - 4*14 - UNRELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ; + ButtonType = BUTTON_SYMBOL; +// Align = BOXALIGN_TOP; +// HelpId = HID_RPT_CONDFORMAT_TB; + Customize = FALSE; + ItemList = + { + ToolBoxItem + { + Identifier = SID_RPT_GROUPSORT_MOVE_UP ; + // Command = ".uno:ReportGroupMoveUp" ; // default_images/res/commandimages/sc_reportgroupmoveup.png + HelpID = HID_RPT_GROUPSORT_MOVE_UP ; + Text [ en-US ] = "Move up" ; + Checkable = TRUE; +// Disable = TRUE; + }; + ToolBoxItem + { + Identifier = SID_RPT_GROUPSORT_MOVE_DOWN ; + // Command = ".uno:ReportGroupMoveDown" ; + HelpID = HID_RPT_GROUPSORT_MOVE_DOWN ; + Text [ en-US ] = "Move down" ; + Checkable = TRUE; +// Disable = TRUE; + }; + ToolBoxItem + { + Identifier = SID_RPT_GROUPSORT_DELETE ; + // Command = ".uno:ReportGroupDelete" ; + HelpID = HID_RPT_GROUPSORT_DELETE ; + Text [ en-US ] = "~Delete" ; + Checkable = TRUE; +// Disable = TRUE; + }; + }; }; FixedLine FL_SEPARATOR3 @@ -240,14 +305,16 @@ FloatingWindow RID_GROUPS_SORTING WordBreak = TRUE; }; - Image IMG_UP_H - { - ImageBitmap = Bitmap { File = "arrow_move_up_hc" ; }; - }; - Image IMG_DOWN_H - { - ImageBitmap = Bitmap { File = "arrow_move_down_hc" ; }; - }; +//BTN Image IMG_UP_H +//BTN { +//BTN ImageBitmap = Bitmap { File = "arrow_move_up_hc" ; }; +//BTN }; +//BTN Image IMG_DOWN_H +//BTN { +//BTN ImageBitmap = Bitmap { File = "arrow_move_down_hc" ; }; +//BTN }; + + }; String STR_RPT_EXPRESSION @@ -351,3 +418,82 @@ Menu RID_GROUPSROWPOPUPMENU }; }; }; + + +#define DEF_MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } + +#define DEF_IL_GROUPSORT \ +\ + IdList = {\ + SID_RPT_GROUPSORT_MOVE_UP;\ + SID_RPT_GROUPSORT_MOVE_DOWN;\ + SID_RPT_GROUPSORT_DELETE;\ + };\ + IdCount = {\ + 3;\ + } + +ImageList IMGLST_GROUPSORT_DLG_SC +{ + DEF_MASKCOLOR; + prefix = "sc"; + DEF_IL_GROUPSORT ; +}; + +ImageList IMGLST_GROUPSORT_DLG_SCH +{ + DEF_MASKCOLOR; + prefix = "sch"; + DEF_IL_GROUPSORT ; +}; + + +// Image IMG_GROUPSORT_MOVEUP +// { +// ImageBitmap = Bitmap +// { +// File = "reportgroupmoveup"; // reportdesign/res/... +// }; +// DEF_MASKCOLOR; +// }; +// Image IMG_GROUPSORT_MOVEDOWN +// { +// ImageBitmap = Bitmap +// { +// File = "reportgroupmovedown"; +// }; +// DEF_MASKCOLOR; +// }; +// Image IMG_GROUPSORT_DELETE +// { +// ImageBitmap = Bitmap +// { +// File = "reportgroupdelete"; +// }; +// DEF_MASKCOLOR; +// }; +// +// Image IMG_GROUPSORT_MOVEUP_H +// { +// ImageBitmap = Bitmap +// { +// File = "reportgroupmoveup_h"; // reportdesign/res/... +// }; +// DEF_MASKCOLOR; +// }; +// Image IMG_GROUPSORT_MOVEDOWN_H +// { +// ImageBitmap = Bitmap +// { +// File = "reportgroupmovedown_h"; +// }; +// DEF_MASKCOLOR; +// }; +// Image IMG_GROUPSORT_DELETE_H +// { +// ImageBitmap = Bitmap +// { +// File = "reportgroupdelete_h"; +// }; +// DEF_MASKCOLOR; +// }; diff --git a/reportdesign/source/ui/dlg/makefile.mk b/reportdesign/source/ui/dlg/makefile.mk index 483303b7ecca..80b8e870a9cb 100644 --- a/reportdesign/source/ui/dlg/makefile.mk +++ b/reportdesign/source/ui/dlg/makefile.mk @@ -56,6 +56,7 @@ SRC1FILES = \ Navigator.src \ GroupsSorting.src + # ... object files ............................ EXCEPTIONSFILES= \ @@ -69,7 +70,7 @@ EXCEPTIONSFILES= \ $(SLO)$/Navigator.obj \ $(SLO)$/GroupsSorting.obj \ $(SLO)$/Formula.obj - + SLOFILES= \ $(EXCEPTIONSFILES) \ diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx index 511888bcc60d..4940848acc99 100644 --- a/reportdesign/source/ui/inc/AddField.hxx +++ b/reportdesign/source/ui/inc/AddField.hxx @@ -49,6 +49,7 @@ #include "cppuhelper/basemutex.hxx" #include <dbaccess/ToolBoxHelper.hxx> #include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> #include <rtl/ref.hxx> @@ -71,6 +72,8 @@ class OAddFieldWindow :public FloatingWindow ToolBox m_aActions; ::std::auto_ptr<OAddFieldWindowListBox> m_pListBox; + FixedLine m_aFixedLine; + FixedText m_aHelpText; PushButton m_aInsertButton; Link m_aCreateLink; diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx index 0eb633f7b154..683e4cb78a3d 100644 --- a/reportdesign/source/ui/inc/DesignView.hxx +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -234,6 +234,7 @@ namespace rptui // IMarkedSection ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; virtual void markSection(const sal_uInt16 _nPos); /** fills the positions of all collapsed sections. diff --git a/reportdesign/source/ui/inc/FixedTextColor.hxx b/reportdesign/source/ui/inc/FixedTextColor.hxx new file mode 100644 index 000000000000..c80a49a9a557 --- /dev/null +++ b/reportdesign/source/ui/inc/FixedTextColor.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ + +#ifndef INCLUDED_FIXEDTEXTCOLOR_HXX +#define INCLUDED_FIXEDTEXTCOLOR_HXX + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_reportdesign.hxx" + + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/report/XFixedText.hpp> +/** === end UNO includes === **/ + +#include <IReportControllerObserver.hxx> + +//#include <boost/noncopyable.hpp> +#include <vector> + +namespace rptui +{ + class OReportController; + + class FixedTextColor : public IReportControllerObserver + { + const OReportController& m_rReportController; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > getVclWindowPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFixedText >& _xComponent) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > getXControl(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFixedText >& _xFixedText) throw(::com::sun::star::uno::RuntimeException); + + void setPropertyTextColor(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _xVclWindowPeer, sal_Int32 _nFormatKey); + + // sal_Int32 getTextColor(); + + public: + FixedTextColor(const OReportController & _aObserver); + virtual ~FixedTextColor(); + + void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ); + void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + + }; + +} // namespace rptui + + +#endif diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx new file mode 100644 index 000000000000..bc5d406d1e5c --- /dev/null +++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ + +#ifndef INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX +#define INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_reportdesign.hxx" + + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/report/XReportComponent.hpp> +#include <com/sun/star/report/XFormattedField.hpp> +/** === end UNO includes === **/ + +//#include <boost/noncopyable.hpp> +#include <vector> +#include <IReportControllerObserver.hxx> + +namespace rptui +{ + class OReportController; + + class FormattedFieldBeautifier : public IReportControllerObserver + { + const OReportController& m_rReportController; + sal_Int32 m_nTextColor; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > getVclWindowPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent >& _xComponent) throw(::com::sun::star::uno::RuntimeException); + + void setPlaceholderText( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); + void setPlaceholderText( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _xVclWindowPeer, const ::rtl::OUString& _rText ); + + sal_Int32 getTextColor(); + + public: + FormattedFieldBeautifier(const OReportController & _aObserver); + virtual ~FormattedFieldBeautifier(); + + void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ); + void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + }; + +} // namespace rptui + + +#endif diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx index 5a3f69c32175..fc26581ba37d 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -38,6 +38,7 @@ #include <vcl/edit.hxx> #include <vcl/field.hxx> #include <vcl/imagebtn.hxx> +#include <vcl/toolbox.hxx> #include <com/sun/star/report/XGroups.hpp> #include <com/sun/star/report/XGroup.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -49,6 +50,10 @@ #include <vector> +#include <dbaccess/ToolBoxHelper.hxx> + +#include <vcl/ImageListProvider.hxx> + namespace comphelper { class OPropertyChangeMultiplexer; @@ -62,16 +67,22 @@ class OReportController; |* Groups and Sorting dialog |* \************************************************************************/ + class OGroupsSortingDialog : public FloatingWindow , public ::cppu::BaseMutex - , public ::comphelper::OPropertyChangeListener + , public ::comphelper::OPropertyChangeListener + ,public dbaui::OToolBoxHelper + ,public vcl::IImageListProvider { friend class OFieldExpressionControl; FixedLine m_aFL2; FixedText m_aMove; - ImageButton m_aUp; - ImageButton m_aDown; +//BTN ImageButton m_aPB_Up; +//BTN ImageButton m_aPB_Down; +//BTN ImageButton m_aPB_Delete; + ToolBox m_aToolBox; + FixedLine m_aFL3; FixedText m_aOrder; ListBox m_aOrderLst; @@ -100,7 +111,8 @@ private: DECL_LINK( OnControlFocusLost, Control* ); DECL_LINK( OnControlFocusGot, Control* ); DECL_LINK( LBChangeHdl, ListBox* ); - DECL_LINK( ClickHdl, ImageButton* ); +//BTN DECL_LINK( ClickHdl, ImageButton* ); + DECL_LINK( OnFormatAction, ToolBox* ); /** returns the groups @return the groups which now have to check which one changes @@ -171,6 +183,24 @@ public: /* updates the current view */ void UpdateData( ); + + /** will be called when the controls need to be resized. + @param _rDiff + Contains the difference of the old and new toolbox size. + */ + virtual void resizeControls(const Size& _rDiff); + + /** will be called when the image list is needed. + @param _eSymbolsSize + <svtools/imgdef.hxx> + @param _bHiContast + <TRUE/> when in high contrast mode. + */ + virtual ImageList getImageList(sal_Int16 _eSymbolsSize,sal_Bool _bHiContast) const; + + // ImageListProvider interface + virtual ImageList getImageList(vcl::ImageListType) SAL_THROW ((com::sun::star::lang::IllegalArgumentException )); + }; // ============================================================================= } // namespace rptui diff --git a/reportdesign/source/ui/inc/IReportControllerObserver.hxx b/reportdesign/source/ui/inc/IReportControllerObserver.hxx new file mode 100644 index 000000000000..2a51e1a655eb --- /dev/null +++ b/reportdesign/source/ui/inc/IReportControllerObserver.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ + +#ifndef INCLUDED_BEAUTIFIER_HXX +#define INCLUDED_BEAUTIFIER_HXX + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_reportdesign.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +/** === end UNO includes === **/ + +namespace rptui +{ + /* abstract */ class IReportControllerObserver + { + protected: + // IReportControllerObserver(){} + virtual ~IReportControllerObserver() {} + + public: + + virtual void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) = 0; + virtual void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ) = 0; + virtual void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ) = 0; + }; + +} // namespace rptui + +#endif + + diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index 887ae576a035..43e17fcff67e 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -65,7 +65,7 @@ #include <functional> #include <boost/shared_ptr.hpp> #include <com/sun/star/util/XModeSelector.hpp> - +#include "ReportControllerObserver.hxx" class TransferableHelper; class TransferableClipboardListener; @@ -78,6 +78,7 @@ namespace rptui class OReportModel; class OSectionView; class OAddFieldWindow; + class OSectionWindow; typedef ::dbaui::OSingleDocumentController OReportController_BASE; typedef ::cppu::ImplHelper4 < ::com::sun::star::container::XContainerListener @@ -103,6 +104,9 @@ namespace rptui TransferableClipboardListener* m_pClipbordNotifier; /// notifier for changes in the clipboard OGroupsSortingDialog* m_pGroupsFloater; + + OXReportControllerObserver* m_pReportControllerObserver; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> m_xReportDefinition; ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportEngine> m_xReportEngine; ::com::sun::star::uno::Reference < ::com::sun::star::frame::XComponentLoader> m_xFrameLoader; @@ -206,6 +210,16 @@ namespace rptui void executeMethodWithUndo(USHORT _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun); void alignControlsWithUndo(USHORT _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection = false); + /** shrink a section + @param _nUndoStrId the string id of the string which is shown in undo menu + @param _nShrinkId ID of what you would like to shrink. + */ + protected: + void shrinkSectionBottom(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection); + void shrinkSectionTop(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection); + public: + + void shrinkSection(USHORT _nUndoStrId, ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection, sal_Int32 _nShrinkId); /** opens the file open dialog to allow the user to select a image which will be * bound to a newly created image button. @@ -267,9 +281,10 @@ namespace rptui */ void impl_zoom_nothrow(); + private: OReportController(OReportController const&); OReportController& operator =(OReportController const&); - + public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getXFrame(); // open the help agent of report designer at start time @@ -440,6 +455,8 @@ namespace rptui // cppu::OPropertySetHelper virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + private: virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager ); virtual void impl_initialize( ); diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx new file mode 100644 index 000000000000..7d11bf0d0fa8 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ +#ifndef INCLUDED_REPORTCONTROLLEROBSERVER_HXX +#define INCLUDED_REPORTCONTROLLEROBSERVER_HXX + +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/report/XReportDefinition.hpp> +#include <cppuhelper/implbase3.hxx> + +#include <memory> +#include <dllapi.h> +#include <vector> + +// #include <svtools/lstner.hxx> +#include <vcl/svapp.hxx> +#include <tools/link.hxx> + +#include <FormattedFieldBeautifier.hxx> +#include <FixedTextColor.hxx> + +namespace rptui +{ + class OReportController; + class OXReportControllerObserverImpl; + + //======================================================================== + class /* REPORTDESIGN_DLLPUBLIC */ OXReportControllerObserver + : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::container::XContainerListener + , ::com::sun::star::util::XModifyListener + > + /*,public SfxListener*/ + { + + const ::std::auto_ptr<OXReportControllerObserverImpl> m_pImpl; + + FormattedFieldBeautifier m_aFormattedFieldBeautifier; + FixedTextColor m_aFixedTextColor; + + // do not allow copy + OXReportControllerObserver(const OXReportControllerObserver&); + OXReportControllerObserver& operator=(const OXReportControllerObserver&); + +// protected: + + void switchListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, sal_Bool _bStartListening); + + /* virtual */ ~OXReportControllerObserver(); // UNO Object must have private destructor! + + public: + OXReportControllerObserver(const OReportController& _rController); + +// protected: + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + + // XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + + // XModifyListener + virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + + void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + + void AddSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection); + void RemoveSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection ); + + // SfxListener + // virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + /** + Create an object ob OUndoEnvLock locks the undo possibility + As long as in the OUndoEnvLock scope, no undo is possible for manipulated object. + */ + class OEnvLock + { + OXReportControllerObserver& m_rObserver; + public: + OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();} + ~OEnvLock(){ m_rObserver.UnLock(); } + }; + + void Lock(); + void UnLock(); + sal_Bool IsLocked() const; + + void Clear(); + private: + + void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(()); + void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(()); + + // void ModeChanged(); // will be called from 'Notify' + DECL_LINK(SettingsChanged, VclWindowEvent* ); + private: + + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> >::const_iterator getSection(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild>& _xContainer) const; + + }; + +} // namespace rptui + +#endif /* INCLUDED_REPORTCONTROLLEROBSERVER_HXX */ + + diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx index 0cbe48c38203..e406bcf7ccb9 100644 --- a/reportdesign/source/ui/inc/ReportWindow.hxx +++ b/reportdesign/source/ui/inc/ReportWindow.hxx @@ -195,6 +195,7 @@ namespace rptui // IMarkedSection ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; virtual void markSection(const sal_uInt16 _nPos); diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx index 5321103b7c78..4eaf9720abda 100644 --- a/reportdesign/source/ui/inc/ScrollHelper.hxx +++ b/reportdesign/source/ui/inc/ScrollHelper.hxx @@ -189,6 +189,7 @@ namespace rptui // IMarkedSection ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; virtual void markSection(const sal_uInt16 _nPos); diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx index 61ccb17535c3..166bcaeea6af 100644 --- a/reportdesign/source/ui/inc/SectionView.hxx +++ b/reportdesign/source/ui/inc/SectionView.hxx @@ -62,6 +62,19 @@ public: virtual void MakeVisible( const Rectangle& rRect, Window& rWin ); inline OReportSection* getReportSection() const { return m_pSectionWindow; } + + // switch the marked objects to the given layer. + void SetMarkedToLayer( SdrLayerID nLayerNo ); + + // return true when only shapes are marked, otherwise false. + bool OnlyShapesMarked() const; + + /* returns the common layer id of the marked objects, otherwise -1 will be returned. + */ + short GetLayerIdOfMarkedObjects() const; + + // returns true if objects at Drag & Drop is resize not move + bool IsDragResize() const; }; } #endif //_REPORT_SECTIONVIEW_HXX diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx index 9eda50751869..36eee47f83f3 100644 --- a/reportdesign/source/ui/inc/SectionWindow.hxx +++ b/reportdesign/source/ui/inc/SectionWindow.hxx @@ -115,6 +115,7 @@ namespace rptui inline OStartMarker& getStartMarker() { return m_aStartMarker; } inline OReportSection& getReportSection() { return m_aReportSection; } inline OEndMarker& getEndMarker() { return m_aEndMarker; } + inline OViewsWindow* getViewsWindow() { return m_pParent; } void setCollapsed(sal_Bool _bCollapsed); diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx index d277a1abfd63..0b7e2b6230dc 100644 --- a/reportdesign/source/ui/inc/UITools.hxx +++ b/reportdesign/source/ui/inc/UITools.hxx @@ -138,6 +138,9 @@ namespace rptui */ void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,Window*> _rMemFunc); + + const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES = 1; + /** checks whether the given rectangle overlapps another OUnoObject object in that view. * * \param _rRect @@ -145,7 +148,7 @@ namespace rptui * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones * \return the object which is overlapped, otherwise <NULL/> */ - SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL); + SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL, sal_Int16 _nIgnoreType=0); SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj* _pIgnoreList[], int _nIgnoreListLength); diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx index 995b59e7adba..d4e0a720807a 100644 --- a/reportdesign/source/ui/inc/ViewsWindow.hxx +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -260,7 +260,8 @@ namespace rptui /** returns the report section window for the given xsection @param _xSection the section */ - ::boost::shared_ptr<OSectionWindow> getReportSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); + // ::boost::shared_ptr<OSectionWindow> getReportSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; /** checks if the keycode is known by the child windows @param _rCode the keycode diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 511dfbfdf355..95b7cdc3fcea 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -142,6 +142,7 @@ struct PropertyCompare : public ::std::binary_function< beans::Property, ::rtl:: return x.equals(y.Name);// ? true : false; } }; + // ----------------------------------------------------------------------------- ::rtl::OUString lcl_getQuotedFunctionName(const ::rtl::OUString& _sFunction) { @@ -1468,7 +1469,8 @@ void SAL_CALL GeometryHandler::actuatingPropertyChanged(const ::rtl::OUString & { _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD); _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST); - } + } // if ( bEnable ) + m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, _rxInspectorUI, _bFirstTimeInit); } break; case PROPERTY_ID_FORMULALIST: @@ -1855,7 +1857,7 @@ void GeometryHandler::loadDefaultFunctions() { m_aCounterFunction.m_bPreEvaluated = sal_False; m_aCounterFunction.m_bDeepTraversing = sal_False; - m_aCounterFunction.m_sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Counter")); + m_aCounterFunction.m_sName = String(ModuleRes(RID_STR_F_COUNTER)); m_aCounterFunction.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%FunctionName] + 1")); m_aCounterFunction.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:\\[[:alpha:]+([:space:]*[:alnum:]*)*\\][:space:]*\\+[:space:]*[:digit:]*")); m_aCounterFunction.m_sInitialFormula.IsPresent = sal_True; @@ -1873,21 +1875,21 @@ void GeometryHandler::loadDefaultFunctions() aDefault.m_bPreEvaluated = sal_True; - aDefault.m_sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Accumulation")); + aDefault.m_sName = String(ModuleRes(RID_STR_F_ACCUMULATION)); aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column] + [%FunctionName]")); aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:\\[[:alpha:]+([:space:]*[:alnum:]*)*\\][:space:]*\\+[:space:]*\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]")); aDefault.m_sInitialFormula.IsPresent = sal_True; aDefault.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column]")); m_aDefaultFunctions.push_back(aDefault); - aDefault.m_sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Minimum")); + aDefault.m_sName = String(ModuleRes(RID_STR_F_MINIMUM)); aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF([%Column] < [%FunctionName];[%Column];[%FunctionName])")); aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF\\((\\[[:alpha:]+([:space:]*[:alnum:]*)*\\])[:space:]*<[:space:]*(\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]);[:space:]*\\1[:space:]*;[:space:]*\\3[:space:]*\\)")); aDefault.m_sInitialFormula.IsPresent = sal_True; aDefault.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column]")); m_aDefaultFunctions.push_back(aDefault); - aDefault.m_sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum")); + aDefault.m_sName = String(ModuleRes(RID_STR_F_MAXIMUM)); aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF([%Column] > [%FunctionName];[%Column];[%FunctionName])")); aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF\\((\\[[:alpha:]+([:space:]*[:alnum:]*)*\\])[:space:]*>[:space:]*(\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]);[:space:]*\\1[:space:]*;[:space:]*\\3[:space:]*\\)")); aDefault.m_sInitialFormula.IsPresent = sal_True; diff --git a/reportdesign/source/ui/inspection/inspection.src b/reportdesign/source/ui/inspection/inspection.src index 4413058faaac..c13eb2a141c9 100644 --- a/reportdesign/source/ui/inspection/inspection.src +++ b/reportdesign/source/ui/inspection/inspection.src @@ -336,3 +336,19 @@ String RID_STR_MIMETYPE { Text [ en-US ] = "Report Output Format" ; }; +String RID_STR_F_COUNTER +{ + Text [ en-US ] = "Counter" ; +}; +String RID_STR_F_ACCUMULATION +{ + Text [ en-US ] = "Accumulation" ; +}; +String RID_STR_F_MINIMUM +{ + Text [ en-US ] = "Minimum" ; +}; +String RID_STR_F_MAXIMUM +{ + Text [ en-US ] = "Maximum" ; +}; diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index c2f5fee7173b..4a964cf17715 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -951,7 +951,7 @@ void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem } } // ----------------------------------------------------------------------------- -SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects,SdrObject* _pIgnore) +SdrObject* isOver(const Rectangle& _rRect, SdrPage& _rPage, SdrView& _rView, bool _bAllObjects, SdrObject* _pIgnore, sal_Int16 _nIgnoreType) { SdrObject* pOverlappedObj = NULL; SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS); @@ -963,11 +963,21 @@ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _ && (_bAllObjects || !_rView.IsObjMarked(pObjIter)) && dynamic_cast<OUnoObject*>(pObjIter) != NULL ) { + if (_nIgnoreType == ISOVER_IGNORE_CUSTOMSHAPES && pObjIter->GetObjIdentifier() == OBJ_CUSTOMSHAPE) + { + continue; + } + + OUnoObject* pObj = dynamic_cast<OUnoObject*>(pObjIter); + if (pObj != NULL) + { + Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect()); if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) ) pOverlappedObj = pObjIter; } } + } return pOverlappedObj; } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/ui/misc/rptuiservices.cxx b/reportdesign/source/ui/misc/rptuiservices.cxx index 4a96c3ca9647..4ce1a9cde4bf 100644 --- a/reportdesign/source/ui/misc/rptuiservices.cxx +++ b/reportdesign/source/ui/misc/rptuiservices.cxx @@ -71,20 +71,20 @@ cppu::ImplementationEntry entries[] = { }; } -extern "C" void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey) { return cppu::component_getFactoryHelper( implName, serviceManager, registryKey, entries); } -extern "C" void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( char const ** envTypeName, uno_Environment **) { *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" sal_Bool SAL_CALL component_writeInfo( +extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void * serviceManager, void * registryKey) { return cppu::component_writeInfoHelper( diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 342812f1deea..b8da21afa273 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -206,15 +206,15 @@ ODesignView::~ODesignView() } if ( m_pAddField ) { - SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) );
- aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) ); + aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) ); notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); ::std::auto_ptr<Window> aTemp2(m_pAddField); m_pAddField = NULL; } if ( m_pReportExplorer ) { - SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) ); aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) ); notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); ::std::auto_ptr<Window> aTemp2(m_pReportExplorer); @@ -567,7 +567,7 @@ void ODesignView::toggleReportExplorer() OReportController& rReportController = getController(); m_pReportExplorer = new ONavigator(this,rReportController); SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) ); - if ( aDlgOpt.Exists() )
+ if ( aDlgOpt.Exists() ) m_pReportExplorer->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); m_pReportExplorer->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl)); notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::AddWindow)); @@ -600,12 +600,12 @@ void ODesignView::toggleAddField() uno::Reference< report::XSection > xSection = m_pCurrentView->getReportSection()->getSection(); xReport = xSection->getReportDefinition(); } - uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY);
- m_pAddField = new OAddFieldWindow(this,xSet);
+ uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY); + m_pAddField = new OAddFieldWindow(this,xSet); m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) ); - SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) );
- if ( aDlgOpt.Exists() )
- m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) ); + if ( aDlgOpt.Exists() ) + m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); m_pAddField->Update(); m_pAddField->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl)); notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::AddWindow)); @@ -644,6 +644,11 @@ uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() { return m_aScrollWindow.getMarkedSection(nsa); } +//----------------------------------------------------------------------------- +::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +{ + return m_aScrollWindow.getSectionWindow(_xSection); +} // ------------------------------------------------------------------------- void ODesignView::markSection(const sal_uInt16 _nPos) { diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx new file mode 100644 index 000000000000..b4305f26c911 --- /dev/null +++ b/reportdesign/source/ui/report/FixedTextColor.cxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_reportdesign.hxx" + +#include <FixedTextColor.hxx> +#include <com/sun/star/report/XFixedText.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/InvalidateStyle.hpp> + +#include <RptObject.hxx> +#include <RptModel.hxx> +#include <RptPage.hxx> +#include <ViewsWindow.hxx> +#include <ReportSection.hxx> +#include <ReportController.hxx> +#include <uistrings.hrc> +#include <reportformula.hxx> +#include <toolkit/helper/property.hxx> + +#include <tools/color.hxx> // COL_TRANSPARENT +#include <svtools/extcolorcfg.hxx> +#include <unotools/confignode.hxx> + +// DBG_* +#include <tools/debug.hxx> +// DBG_UNHANDLED_EXCEPTION +#include <tools/diagnose_ex.h> + +#include <vcl/svapp.hxx> +#include <vcl/settings.hxx> + +namespace rptui +{ + using namespace ::com::sun::star; + + DBG_NAME(rpt_FixedTextColor) + + FixedTextColor::FixedTextColor(const OReportController& _aController) + :m_rReportController(_aController) + { + DBG_CTOR(rpt_FixedTextColor, NULL); + } + + //-------------------------------------------------------------------- + // sal_Int32 FixedTextColor::getTextColor() + // { + // const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings(); + // BOOL bHighContrast = aStyleSettings.GetHighContrastMode(); + // + // Color aGetFaceColor = aStyleSettings.GetFaceColor(); + // Color aGetCheckedColor = aStyleSettings.GetCheckedColor(); + // Color aGetLightColor = aStyleSettings.GetLightColor(); + // Color aGetLightBorderColor = aStyleSettings.GetLightBorderColor(); + // Color aGetShadowColor = aStyleSettings.GetShadowColor(); + // Color aGetDarkShadowColor = aStyleSettings.GetDarkShadowColor(); + // Color aGetButtonTextColor = aStyleSettings.GetButtonTextColor(); + // Color aGetButtonRolloverTextColor = aStyleSettings.GetButtonRolloverTextColor(); + // Color aGetRadioCheckTextColor = aStyleSettings.GetRadioCheckTextColor(); + // Color aGetGroupTextColor = aStyleSettings.GetGroupTextColor(); + // Color aGetLabelTextColor = aStyleSettings.GetLabelTextColor(); + // Color aGetInfoTextColor = aStyleSettings.GetInfoTextColor(); + // Color aGetWindowColor = aStyleSettings.GetWindowColor(); + // Color aGetWindowTextColor = aStyleSettings.GetWindowTextColor(); + // Color aGetDialogColor = aStyleSettings.GetDialogColor(); + // Color aGetDialogTextColor = aStyleSettings.GetDialogTextColor(); + // Color aGetWorkspaceColor = aStyleSettings.GetWorkspaceColor(); + // Color aGetFieldColor = aStyleSettings.GetFieldColor(); + // Color aGetFieldTextColor = aStyleSettings.GetFieldTextColor(); + // Color aGetFieldRolloverTextColor = aStyleSettings.GetFieldRolloverTextColor(); + // Color aGetActiveColor = aStyleSettings.GetActiveColor(); + // Color aGetActiveColor2 = aStyleSettings.GetActiveColor2(); + // Color aGetActiveTextColor = aStyleSettings.GetActiveTextColor(); + // Color aGetActiveBorderColor = aStyleSettings.GetActiveBorderColor(); + // Color aGetDeactiveColor = aStyleSettings.GetDeactiveColor(); + // Color aGetDeactiveColor2 = aStyleSettings.GetDeactiveColor2(); + // Color aGetDeactiveTextColor = aStyleSettings.GetDeactiveTextColor(); + // Color aGetDeactiveBorderColor = aStyleSettings.GetDeactiveBorderColor(); + // Color aGetHighlightColor = aStyleSettings.GetHighlightColor(); + // Color aGetHighlightTextColor = aStyleSettings.GetHighlightTextColor(); + // Color aGetDisableColor = aStyleSettings.GetDisableColor(); + // Color aGetHelpColor = aStyleSettings.GetHelpColor(); + // Color aGetHelpTextColor = aStyleSettings.GetHelpTextColor(); + // Color aGetMenuColor = aStyleSettings.GetMenuColor(); + // Color aGetMenuBarColor = aStyleSettings.GetMenuBarColor(); + // Color aGetMenuBorderColor = aStyleSettings.GetMenuBorderColor(); + // Color aGetMenuTextColor = aStyleSettings.GetMenuTextColor(); + // Color aGetMenuHighlightColor = aStyleSettings.GetMenuHighlightColor(); + // Color aGetMenuHighlightTextColor = aStyleSettings.GetMenuHighlightTextColor(); + // Color aGetLinkColor = aStyleSettings.GetLinkColor(); + // Color aGetVisitedLinkColor = aStyleSettings.GetVisitedLinkColor(); + // Color aGetHighlightLinkColor = aStyleSettings.GetHighlightLinkColor(); + // Color aGetMonoColor = aStyleSettings.GetMonoColor(); + // Color aGetActiveTabColor = aStyleSettings.GetActiveTabColor(); + // Color aGetInactiveTabColor = aStyleSettings.GetInactiveTabColor(); + // + // Color aWindowColor = aStyleSettings.GetWindowColor(); + // Color aLabelColor = aStyleSettings.GetLabelTextColor(); + // + // // if (m_nTextColor == -1) + // // { + // // svtools::ExtendedColorConfig aConfig; + // // m_nTextColor = aConfig.GetColorValue(CFG_REPORTDESIGNER, DBTEXTBOXBOUNDCONTENT).getColor(); + // // } + // return aLabelColor.GetColor(); + // } + + //-------------------------------------------------------------------- + FixedTextColor::~FixedTextColor() + { + DBG_DTOR(rpt_FixedTextColor,NULL); + } + // ----------------------------------------------------------------------------- + + void FixedTextColor::notifyPropertyChange( const beans::PropertyChangeEvent& _rEvent ) + { + // (void)_rEvent; + uno::Reference< report::XFixedText > xFixedText( _rEvent.Source, uno::UNO_QUERY ); + if ( ! xFixedText.is() ) + { + return; + } + + try + { + uno::Reference< lang::XComponent > xComponent( xFixedText, uno::UNO_QUERY_THROW ); + handle(xComponent); + // uno::Reference<awt::XVclWindowPeer> xVclWindowPeer = getVclWindowPeer(xComponent); + + // setPropertyTextColor(xVclWindowPeer, getTextColor()); + } + catch (uno::Exception e) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + // ----------------------------------------------------------------------------- + void FixedTextColor::setPropertyTextColor(const uno::Reference< awt::XVclWindowPeer >& _xVclWindowPeer, sal_Int32 _nTextColor) + { + _xVclWindowPeer->setProperty(PROPERTY_TEXTCOLOR, uno::makeAny(sal_Int32(_nTextColor))); + } + + // ----------------------------------------------------------------------------- + void FixedTextColor::notifyElementInserted( const uno::Reference< uno::XInterface >& _rxElement ) + { + handle(_rxElement); + } + +// ----------------------------------------------------------------------------- + void FixedTextColor::handle( const uno::Reference< uno::XInterface >& _rxElement ) + { + // (void) _rxElement; + uno::Reference< report::XFixedText > xFixedText( _rxElement, uno::UNO_QUERY ); + if ( ! xFixedText.is() ) + { + return; + } + + try + { + sal_Bool bIsDark = sal_False; + const sal_Int32 nBackColor( xFixedText->getControlBackground() ); + if ((sal_uInt32)nBackColor == COL_TRANSPARENT) + { + uno::Reference <report::XSection> xSection(xFixedText->getParent(), uno::UNO_QUERY_THROW); + + sal_Bool bSectionBackColorIsTransparent = xSection->getBackTransparent(); + if (bSectionBackColorIsTransparent) + { + // Label Transparent, Section Transparent set LabelTextColor + const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings(); + Color aWindowColor = aStyleSettings.GetWindowColor(); + bIsDark = aWindowColor.IsDark(); + } + else + { + com::sun::star::util::Color aColor2 = xSection->getBackColor(); + Color aBackColor(aColor2); + bIsDark = aBackColor.IsDark(); + } + } + else + { + Color aLabelBackColor(nBackColor); + bIsDark = aLabelBackColor.IsDark(); + } + + uno::Reference<awt::XVclWindowPeer> xVclWindowPeer = getVclWindowPeer(xFixedText); + if (bIsDark) + { + const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings(); + Color aLabelTextColor = aStyleSettings.GetLabelTextColor(); + setPropertyTextColor(xVclWindowPeer, aLabelTextColor.GetColor()); + } + else + { + util::Color aLabelColor = xFixedText->getCharColor(); + setPropertyTextColor(xVclWindowPeer, aLabelColor); + } + + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + +// ----------------------------------------------------------------------------- + // XPropertyChangeListener + uno::Reference<awt::XControl> FixedTextColor::getXControl(const uno::Reference< report::XFixedText >& _xFixedText) throw(uno::RuntimeException) + { + + uno::Reference<awt::XControl> xControl; + OReportController *pController = (OReportController *)&m_rReportController; + + ::boost::shared_ptr<OReportModel> pModel = pController->getSdrModel(); + + uno::Reference<report::XSection> xSection(_xFixedText->getSection()); + if ( xSection.is() ) + { + OReportPage *pPage = pModel->getPage(xSection); + ULONG nIndex = pPage->getIndexOf(_xFixedText.get()); + if (nIndex < pPage->GetObjCount() ) + { + SdrObject *pObject = pPage->GetObj(nIndex); + OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject); + if ( pUnoObj ) // this doesn't need to be done for shapes + { + ::boost::shared_ptr<OSectionWindow> pSectionWindow = pController->getSectionWindow(xSection); + if (pSectionWindow != NULL) + { + OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice + OSectionView& aSdrView = aOutputDevice.getSectionView(); // SdrView + xControl = pUnoObj->GetUnoControl(aSdrView, aOutputDevice); + } + } + } + } + return xControl; + } + +// ----------------------------------------------------------------------------- + uno::Reference<awt::XVclWindowPeer> FixedTextColor::getVclWindowPeer(const uno::Reference< report::XFixedText >& _xComponent) throw(uno::RuntimeException) + { + uno::Reference<awt::XVclWindowPeer> xVclWindowPeer; + uno::Reference<awt::XControl> xControl = getXControl(_xComponent); + + xVclWindowPeer = uno::Reference<awt::XVclWindowPeer>( xControl->getPeer(), uno::UNO_QUERY); + + return xVclWindowPeer; + } + + + + +} diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx new file mode 100644 index 000000000000..b0c5922556ab --- /dev/null +++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_reportdesign.hxx" + +#include <FormattedFieldBeautifier.hxx> + +#include <com/sun/star/report/XFormattedField.hpp> +#include <com/sun/star/report/XImageControl.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/InvalidateStyle.hpp> + +#include <RptObject.hxx> +#include <RptModel.hxx> +#include <RptPage.hxx> +#include <ViewsWindow.hxx> +#include <ReportSection.hxx> +#include <ReportController.hxx> +#include <uistrings.hrc> +#include <reportformula.hxx> +#include <toolkit/helper/property.hxx> + +#include <svtools/extcolorcfg.hxx> +#include <unotools/confignode.hxx> + +// DBG_* +#include <tools/debug.hxx> +// DBG_UNHANDLED_EXCEPTION +#include <tools/diagnose_ex.h> + +namespace rptui +{ + using namespace ::com::sun::star; + + DBG_NAME(rpt_FormattedFieldBeautifier) + + //-------------------------------------------------------------------- + FormattedFieldBeautifier::FormattedFieldBeautifier(const OReportController& _aController) + :m_rReportController(_aController) + ,m_nTextColor(-1) + { + DBG_CTOR(rpt_FormattedFieldBeautifier, NULL); + } + + //-------------------------------------------------------------------- + sal_Int32 FormattedFieldBeautifier::getTextColor() + { + if (m_nTextColor == -1) + { + svtools::ExtendedColorConfig aConfig; + m_nTextColor = aConfig.GetColorValue(CFG_REPORTDESIGNER, DBTEXTBOXBOUNDCONTENT).getColor(); + } + return m_nTextColor; + } + + //-------------------------------------------------------------------- + FormattedFieldBeautifier::~FormattedFieldBeautifier() + { + DBG_DTOR(rpt_FormattedFieldBeautifier,NULL); + } + + // ----------------------------------------------------------------------------- + void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< uno::XInterface >& _rxComponent ) + { + ::rtl::OUString sDataField; + uno::Reference< report::XReportComponent > xComponent; + + try + { + // is it a formatted field? + uno::Reference< report::XFormattedField > xFormattedField( _rxComponent, uno::UNO_QUERY ); + if ( xFormattedField.is() ) + { + sDataField = xFormattedField->getDataField(); + xComponent.set( xFormattedField.get() ); + } + else + { + // perhaps an image control? + uno::Reference< report::XImageControl > xImageControl( _rxComponent, uno::UNO_QUERY ); + if ( xImageControl.is() ) + { + sDataField = xImageControl->getDataField(); + xComponent.set( xImageControl.get() ); + } + } + if ( !xComponent.is() ) + return; + + if ( sDataField.getLength() ) + { + ReportFormula aFormula( sDataField ); + sDataField = aFormula.getEqualUndecoratedContent(); + } + + setPlaceholderText( getVclWindowPeer( xComponent ), sDataField ); + } + catch (uno::Exception e) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + // ----------------------------------------------------------------------------- + void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< awt::XVclWindowPeer >& _xVclWindowPeer, const ::rtl::OUString& _rText ) + { + OSL_ENSURE( _xVclWindowPeer.is(), "FormattedFieldBeautifier::setPlaceholderText: invalid peer!" ); + if ( !_xVclWindowPeer.is() ) + throw uno::RuntimeException(); + + // the actual text + _xVclWindowPeer->setProperty(PROPERTY_TEXT, uno::makeAny(_rText)); + // the text color + _xVclWindowPeer->setProperty(PROPERTY_TEXTCOLOR, uno::makeAny(getTextColor())); + // font->italic + uno::Any aFontDescriptor = _xVclWindowPeer->getProperty(PROPERTY_FONTDESCRIPTOR); + awt::FontDescriptor aFontDescriptorStructure; + aFontDescriptor >>= aFontDescriptorStructure; + aFontDescriptorStructure.Slant = ::com::sun::star::awt::FontSlant_ITALIC; + _xVclWindowPeer->setProperty(PROPERTY_FONTDESCRIPTOR, uno::makeAny(aFontDescriptorStructure)); + } + + // ----------------------------------------------------------------------------- + void FormattedFieldBeautifier::notifyPropertyChange( const beans::PropertyChangeEvent& _rEvent ) + { + if ( !_rEvent.PropertyName.equalsAscii( "DataField" ) ) + // not interested in + return; + + setPlaceholderText( _rEvent.Source ); + } + + // ----------------------------------------------------------------------------- + void FormattedFieldBeautifier::handle( const uno::Reference< uno::XInterface >& _rxElement ) + { + setPlaceholderText( _rxElement ); + } + + // ----------------------------------------------------------------------------- + void FormattedFieldBeautifier::notifyElementInserted( const uno::Reference< uno::XInterface >& _rxElement ) + { + handle( _rxElement ); + } + + // ----------------------------------------------------------------------------- + uno::Reference<awt::XVclWindowPeer> FormattedFieldBeautifier::getVclWindowPeer(const uno::Reference< report::XReportComponent >& _xComponent) throw(uno::RuntimeException) + { + uno::Reference<awt::XVclWindowPeer> xVclWindowPeer; + + ::boost::shared_ptr<OReportModel> pModel = const_cast< OReportController& >( m_rReportController ).getSdrModel(); + + uno::Reference<report::XSection> xSection(_xComponent->getSection()); + if ( xSection.is() ) + { + OReportPage *pPage = pModel->getPage(xSection); + ULONG nIndex = pPage->getIndexOf(_xComponent); + if (nIndex < pPage->GetObjCount() ) + { + SdrObject *pObject = pPage->GetObj(nIndex); + OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject); + if ( pUnoObj ) // this doesn't need to be done for shapes + { + // Rectangle aRect = pUnoObj->GetCurrentBoundRect(); + ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_rReportController.getSectionWindow(xSection); + if (pSectionWindow != NULL) + { + OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice + OSectionView& aSdrView = aOutputDevice.getSectionView(); // SdrView + uno::Reference<awt::XControl> xControl = pUnoObj->GetUnoControl(aSdrView, aOutputDevice); + xVclWindowPeer = uno::Reference<awt::XVclWindowPeer>( xControl->getPeer(), uno::UNO_QUERY); + } + } + } + } + return xVclWindowPeer; + } +} diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 63aabbe008af..bb4ed5efae07 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -158,6 +158,8 @@ #include <unotools/confignode.hxx> #include <helpids.hrc> +#include <ReportControllerObserver.hxx> + using namespace ::com::sun::star; using namespace uno; using namespace io; @@ -305,9 +307,14 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon ,m_bChartEnabled(false) ,m_bChartEnabledAsked(false) { + // new Observer + m_pReportControllerObserver = new OXReportControllerObserver(*this); + m_pReportControllerObserver->acquire(); + m_sMode = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal")); DBG_CTOR( rpt_OReportController,NULL); registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZoomValue")),PROPERTY_ID_ZOOMVALUE,beans::PropertyAttribute::BOUND| beans::PropertyAttribute::TRANSIENT,&m_nZoomValue,::getCppuType(reinterpret_cast< sal_Int16*>(NULL))); + } // ----------------------------------------------------------------------------- OReportController::~OReportController() @@ -320,6 +327,7 @@ IMPLEMENT_FORWARD_XINTERFACE2(OReportController,OReportController_BASE,OReportCo // ----------------------------------------------------------------------------- void OReportController::disposing() { + if ( getView() && m_pClipbordNotifier ) { m_pClipbordNotifier->ClearCallbackLink(); @@ -354,6 +362,8 @@ void OReportController::disposing() pSectionWindow->getReportSection().deactivateOle(); getUndoMgr()->Clear(); // clear all undo redo things listen(false); + m_pReportControllerObserver->Clear(); + m_pReportControllerObserver->release(); } catch(uno::Exception&) { @@ -456,11 +466,9 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = pSectionView && pSectionView->GetMarkedObjectCount() > 2; } break; + case SID_ARRANGEMENU: case SID_FRAME_DOWN: case SID_FRAME_UP: - aReturn.bEnabled = sal_False; - break; - case SID_ARRANGEMENU: case SID_FRAME_TO_TOP: case SID_FRAME_TO_BOTTOM: case SID_OBJECT_HEAVEN: @@ -468,29 +476,31 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = isEditable() && m_pMyOwnView->HasSelection(); if ( aReturn.bEnabled ) { - uno::Reference< report::XShape> xShape(m_pMyOwnView->getCurrentControlModel(),uno::UNO_QUERY); - aReturn.bEnabled = xShape.is(); + OSectionView* pSectionView = getCurrentSectionView(); + aReturn.bEnabled = pSectionView && pSectionView->OnlyShapesMarked(); if ( aReturn.bEnabled ) { - OSectionView* pSectionView = getCurrentSectionView(); - if ( pSectionView ) - { - switch(_nId) - { - case SID_OBJECT_HEAVEN: - aReturn.bEnabled = pSectionView->IsToTopPossible(); - break; - case SID_OBJECT_HELL: - aReturn.bEnabled = pSectionView->IsToBtmPossible(); - break; - default: - break; - } - } + if ( SID_OBJECT_HEAVEN == _nId ) + aReturn.bEnabled = pSectionView->GetLayerIdOfMarkedObjects() != RPT_LAYER_FRONT; + else if ( SID_OBJECT_HELL == _nId ) + aReturn.bEnabled = pSectionView->GetLayerIdOfMarkedObjects() != RPT_LAYER_BACK; } } break; + case SID_SECTION_SHRINK: + case SID_SECTION_SHRINK_TOP: + case SID_SECTION_SHRINK_BOTTOM: + { + sal_Int32 nCount = 0; + uno::Reference<report::XSection> xSection = m_pMyOwnView->getCurrentSection(); + if ( xSection.is() ) + { + nCount = xSection->getCount(); + } + aReturn.bEnabled = isEditable() && nCount > 0; + } + break; case SID_OBJECT_ALIGN: case SID_OBJECT_ALIGN_LEFT: case SID_OBJECT_ALIGN_CENTER: @@ -1025,7 +1035,9 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_REDO: case SID_UNDO: { - const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() ); + // const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() ); + // We would like to know if we are in undo mode + const OXUndoEnvironment::OUndoMode aLock( m_aReportModel->GetUndoEnv() ); OReportController_BASE::Execute( _nId, aArgs ); InvalidateAll(); updateFloater(); @@ -1092,6 +1104,16 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_OBJECT_ALIGN_DOWN: alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::BOTTOM,SID_SECTION_ALIGN_DOWN == _nId); break; + + case SID_SECTION_SHRINK_BOTTOM: + case SID_SECTION_SHRINK_TOP: + case SID_SECTION_SHRINK: + { + uno::Reference<report::XSection> xSection = m_pMyOwnView->getCurrentSection(); + shrinkSection(RID_STR_UNDO_SHRINK, xSection, _nId); + } + break; + case SID_SELECTALL: m_pMyOwnView->SelectAll(OBJ_NONE); break; @@ -1656,6 +1678,9 @@ void OReportController::impl_initialize( ) if ( !m_aReportModel ) throw Exception(); + ::comphelper::NamedValueCollection aArgs(getModel()->getArgs()); + setMode(aArgs.getOrDefault("Mode", rtl::OUString::createFromAscii("normal"))); + listen(true); setEditable( !m_aReportModel->IsReadOnly() ); m_xFormatter.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY); @@ -1867,6 +1892,9 @@ void OReportController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:SectionAlignTop", SID_SECTION_ALIGN_UP, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:SectionAlignMiddle", SID_SECTION_ALIGN_MIDDLE, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:SectionAlignBottom", SID_SECTION_ALIGN_DOWN, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:SectionShrink", SID_SECTION_SHRINK, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:SectionShrinkTop", SID_SECTION_SHRINK_TOP, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:SectionShrinkBottom", SID_SECTION_SHRINK_BOTTOM, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:ObjectResize", SID_OBJECT_RESIZING, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:SmallestWidth", SID_OBJECT_SMALLESTWIDTH, CommandGroup::FORMAT ); @@ -2091,6 +2119,7 @@ void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/alignmentbar")) ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/sectionalignmentbar")) ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/resizebar")) + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/sectionshrinkbar")) }; for (size_t i = 0; i< sizeof(s_sMenu)/sizeof(s_sMenu[0]); ++i) { @@ -2124,10 +2153,26 @@ void OReportController::notifyGroupSections(const ContainerEvent& _rEvent,bool _ if ( xGroup->getHeaderOn() ) { groupChange(xGroup,PROPERTY_HEADERON,nGroupPos,_bShow); + if (_bShow) + { + m_pReportControllerObserver->AddSection(xGroup->getHeader()); + } + else + { + m_pReportControllerObserver->RemoveSection(xGroup->getHeader()); + } } if ( xGroup->getFooterOn() ) { groupChange(xGroup,PROPERTY_FOOTERON,nGroupPos,_bShow); + if (_bShow) + { + m_pReportControllerObserver->AddSection(xGroup->getFooter()); + } + else + { + m_pReportControllerObserver->RemoveSection(xGroup->getFooter()); + } } } } @@ -2164,9 +2209,14 @@ void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEven { const USHORT nPosition = m_xReportDefinition->getPageHeaderOn() ? 1 : 0; if ( bShow ) + { m_pMyOwnView->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER,nPosition); + m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportHeader()); + } else + { m_pMyOwnView->removeSection(nPosition); + } } else if ( evt.PropertyName.equals( PROPERTY_REPORTFOOTERON ) ) { @@ -2174,23 +2224,38 @@ void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEven if ( m_xReportDefinition->getPageFooterOn() ) --nPosition; if ( bShow ) + { m_pMyOwnView->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER,nPosition); + m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportFooter()); + } else + { m_pMyOwnView->removeSection(nPosition - 1); + } } else if ( evt.PropertyName.equals( PROPERTY_PAGEHEADERON ) ) { if ( bShow ) + { m_pMyOwnView->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER,0); + m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageHeader()); + } else + { m_pMyOwnView->removeSection(USHORT(0)); + } } else if ( evt.PropertyName.equals( PROPERTY_PAGEFOOTERON ) ) { if ( bShow ) + { m_pMyOwnView->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER); + m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageFooter()); + } else + { m_pMyOwnView->removeSection(m_pMyOwnView->getSectionCount() - 1); + } } else if ( evt.PropertyName.equals( PROPERTY_COMMAND ) || evt.PropertyName.equals( PROPERTY_COMMANDTYPE ) @@ -2286,7 +2351,9 @@ void OReportController::groupChange( const uno::Reference< report::XGroup>& _xGr m_pMyOwnView->addSection(pMemFunSection(&aGroupHelper),sColor,nPosition); } else + { m_pMyOwnView->removeSection(nPosition); + } } } //------------------------------------------------------------------------------ @@ -2493,10 +2560,10 @@ IMPL_LINK( OReportController, EventLstHdl, VclWindowEvent*, _pEvent ) return 1L; } // ----------------------------------------------------------------------------- -void OReportController::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint) +void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHint) { - if (rHint.ISA(DlgEdHint) - && (static_cast< DlgEdHint const & >(rHint).GetKind() + if (_rHint.ISA(DlgEdHint) + && (static_cast< DlgEdHint const & >(_rHint).GetKind() == RPTUI_HINT_SELECTIONCHANGED)) { const sal_Int32 nSelectionCount = m_pMyOwnView->getMarkedObjectCount(); @@ -2510,6 +2577,16 @@ void OReportController::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint) ::boost::bind(&view::XSelectionChangeListener::selectionChanged,_1,boost::cref(aEvent))); } + // if (_rHint.ISA(SfxSimpleHint) + // && (static_cast< SfxSimpleHint const & >(_rHint).GetId() + // == SFX_HINT_COLORS_CHANGED)) + // { + // int dummy = 0; + // } + // if (m_pReportControllerObserver) + // { + // m_pReportControllerObserver->Notify(_rBc, _rHint); + // } } // ----------------------------------------------------------------------------- void OReportController::executeMethodWithUndo(USHORT _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun) @@ -2530,6 +2607,107 @@ void OReportController::alignControlsWithUndo(USHORT _nUndoStrId,sal_Int32 _nCon InvalidateFeature( SID_UNDO ); } // ----------------------------------------------------------------------------- +void OReportController::shrinkSectionBottom(uno::Reference<report::XSection> _xSection) +{ + const sal_Int32 nElements = _xSection->getCount(); + if (nElements == 0) + { + // there are no elements + return; + } + const sal_Int32 nSectionHeight = _xSection->getHeight(); + // sal_Int32 nMinPositionY = nSectionHeight; + sal_Int32 nMaxPositionY = 0; + uno::Reference< report::XReportComponent> xReportComponent; + + // for every component get it's Y-position and compare it to the current Y-position + for (int i=0;i<nElements;i++) + { + xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY); + const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY(); + const sal_Int32 nReportComponentHeight = xReportComponent->getHeight(); + const sal_Int32 nReportComponentPositionYAndHeight = nReportComponentPositionY + nReportComponentHeight; + // nMinPositionY = std::min(nReportComponentPositionY, nMinPositionY); + nMaxPositionY = std::max(nReportComponentPositionYAndHeight, nMaxPositionY); + } + // now we know the minimal Y-Position and maximal Y-Position + + if (nMaxPositionY > (nSectionHeight - 7) ) // Magic Number, we use a little bit less heights for right positioning + { + // the lowest position is already 0 + return; + } + _xSection->setHeight(nMaxPositionY); +} + +void OReportController::shrinkSectionTop(uno::Reference<report::XSection> _xSection) +{ + const sal_Int32 nElements = _xSection->getCount(); + if (nElements == 0) + { + // there are no elements + return; + } + + const sal_Int32 nSectionHeight = _xSection->getHeight(); + sal_Int32 nMinPositionY = nSectionHeight; + // sal_Int32 nMaxPositionY = 0; + uno::Reference< report::XReportComponent> xReportComponent; + + // for every component get it's Y-position and compare it to the current Y-position + for (int i=0;i<nElements;i++) + { + xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY); + const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY(); + // const sal_Int32 nReportComponentHeight = xReportComponent->getHeight(); + // const sal_Int32 nReportComponentPositionYAndHeight = nReportComponentPositionY + nReportComponentHeight; + nMinPositionY = std::min(nReportComponentPositionY, nMinPositionY); + // nMaxPositionY = std::max(nReportComponentPositionYAndHeight, nMaxPositionY); + } + // now we know the minimal Y-Position and maximal Y-Position + if (nMinPositionY == 0) + { + // the lowest position is already 0 + return; + } + for (int i=0;i<nElements;i++) + { + xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY); + const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY(); + const sal_Int32 nNewPositionY = nReportComponentPositionY - nMinPositionY; + xReportComponent->setPositionY(nNewPositionY); + } + const sal_Int32 nNewSectionHeight = nSectionHeight - nMinPositionY; + _xSection->setHeight(nNewSectionHeight); +} + +void OReportController::shrinkSection(USHORT _nUndoStrId, uno::Reference<report::XSection> _xSection, sal_Int32 _nSid) +{ + if ( _xSection.is() ) + { + const String sUndoAction = String((ModuleRes(_nUndoStrId))); + UndoManagerListAction aListAction(m_aUndoManager,sUndoAction); + + if (_nSid == SID_SECTION_SHRINK) + { + shrinkSectionTop(_xSection); + shrinkSectionBottom(_xSection); + } + else if (_nSid == SID_SECTION_SHRINK_TOP) + { + shrinkSectionTop(_xSection); + } + else if (_nSid == SID_SECTION_SHRINK_BOTTOM) + { + shrinkSectionBottom(_xSection); + } + } + + InvalidateFeature( SID_SAVEDOC ); + InvalidateFeature( SID_UNDO ); +} + +// ----------------------------------------------------------------------------- uno::Any SAL_CALL OReportController::getViewData(void) throw( uno::RuntimeException ) { ::osl::MutexGuard aGuard( getMutex() ); @@ -2964,7 +3142,11 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co { pNewControl = SdrObjFactory::MakeNewObject( ReportInventor, _nObjectId, pSectionWindow->getReportSection().getPage(),m_aReportModel.get() ); xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY); - pSectionWindow->getReportSection().createDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diamond")),pNewControl); // TODO: use real custom shape type + ::rtl::OUString sCustomShapeType = m_pMyOwnView->GetInsertObjString(); + if ( !sCustomShapeType.getLength() ) + sCustomShapeType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diamond")); + pSectionWindow->getReportSection().createDefault(sCustomShapeType,pNewControl); + pNewControl->SetLogicRect(Rectangle(3000,500,6000,3500)); // switch height and width } // if ( _nObjectId == OBJ_CUSTOMSHAPE ) else if ( _nObjectId == OBJ_OLE2 || OBJ_DLG_SUBREPORT == _nObjectId ) { @@ -3121,11 +3303,11 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) pSectionWindow[0] = m_pMyOwnView->getMarkedSection(); if ( !pSectionWindow[0] ) - {
- select(uno::makeAny(m_xReportDefinition->getDetail()));
- pSectionWindow[0] = m_pMyOwnView->getMarkedSection();
- if ( !pSectionWindow[0] )
- return;
+ { + select(uno::makeAny(m_xReportDefinition->getDetail())); + pSectionWindow[0] = m_pMyOwnView->getMarkedSection(); + if ( !pSectionWindow[0] ) + return; } uno::Reference<report::XSection> xCurrentSection = m_pMyOwnView->getCurrentSection(); @@ -3451,21 +3633,24 @@ void OReportController::changeZOrder(sal_Int32 _nId) { switch(_nId) { + case SID_FRAME_TO_BOTTOM: + pSectionView->PutMarkedToBtm(); + break; case SID_FRAME_TO_TOP: - pSectionView->MovMarkedToTop(); + pSectionView->PutMarkedToTop(); break; case SID_FRAME_DOWN: + pSectionView->MovMarkedToBtm(); break; case SID_FRAME_UP: + pSectionView->MovMarkedToTop(); break; - case SID_FRAME_TO_BOTTOM: - pSectionView->MovMarkedToBtm(); - break; + case SID_OBJECT_HEAVEN: - pSectionView->PutMarkedToTop(); + pSectionView->SetMarkedToLayer( RPT_LAYER_FRONT ); break; case SID_OBJECT_HELL: - pSectionView->PutMarkedToBtm(); + pSectionView->SetMarkedToLayer( RPT_LAYER_BACK ); break; } } @@ -3497,20 +3682,36 @@ void OReportController::listen(const bool _bAdd) (m_xReportDefinition.get()->*pPropertyListenerAction)( pIter->Name, xUndo ); } + // Add Listeners to UndoEnvironment void (OXUndoEnvironment::*pElementUndoFunction)( const uno::Reference< uno::XInterface >& ) = _bAdd ? &OXUndoEnvironment::AddElement : &OXUndoEnvironment::RemoveElement; (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getStyleFamilies() ); (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getFunctions() ); + // Add Listeners to ReportControllerObserver + OXReportControllerObserver& rObserver = *m_pReportControllerObserver; + // void (OXReportControllerObserver::*pObserverFunction)( const uno::Reference< uno::XInterface >& ) = + // _bAdd ? &OXReportControllerObserver::AddElement : &OXReportControllerObserver::RemoveElement; + + // (rObserver.*pObserverFunction)( m_xReportDefinition->getStyleFamilies() ); + // (rObserver.*pObserverFunction)( m_xReportDefinition->getFunctions() ); + if ( m_xReportDefinition->getPageHeaderOn() && _bAdd ) + { m_pMyOwnView->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER); + rObserver.AddSection(m_xReportDefinition->getPageHeader()); + } if ( m_xReportDefinition->getReportHeaderOn() && _bAdd ) + { m_pMyOwnView->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER); + rObserver.AddSection(m_xReportDefinition->getReportHeader()); + } uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups(); const sal_Int32 nCount = xGroups->getCount(); _bAdd ? xGroups->addContainerListener(&rUndoEnv) : xGroups->removeContainerListener(&rUndoEnv); + _bAdd ? xGroups->addContainerListener(&rObserver) : xGroups->removeContainerListener(&rObserver); for (sal_Int32 i=0;i<nCount ; ++i) { @@ -3521,34 +3722,47 @@ void OReportController::listen(const bool _bAdd) (rUndoEnv.*pElementUndoFunction)( xGroup ); (rUndoEnv.*pElementUndoFunction)( xGroup->getFunctions() ); if ( xGroup->getHeaderOn() && _bAdd ) + { m_pMyOwnView->addSection(xGroup->getHeader(),DBGROUPHEADER); + rObserver.AddSection(xGroup->getHeader()); + } } // for (sal_Int32 i=0;i<nCount ; ++i) if ( _bAdd ) { m_pMyOwnView->addSection(m_xReportDefinition->getDetail(),DBDETAIL); + rObserver.AddSection(m_xReportDefinition->getDetail()); for (sal_Int32 i=nCount;i > 0 ; --i) { uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i-1),uno::UNO_QUERY); if ( xGroup->getFooterOn() ) + { m_pMyOwnView->addSection(xGroup->getFooter(),DBGROUPFOOTER); + rObserver.AddSection(xGroup->getFooter()); + } } if ( m_xReportDefinition->getReportFooterOn() ) + { m_pMyOwnView->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER); + rObserver.AddSection(m_xReportDefinition->getReportFooter()); + } if ( m_xReportDefinition->getPageFooterOn()) + { m_pMyOwnView->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER); - } - - - - _bAdd ? xGroups->addContainerListener(static_cast<XContainerListener*>(this)) - : xGroups->removeContainerListener(static_cast<XContainerListener*>(this)); - _bAdd ? m_xReportDefinition->addModifyListener(static_cast<XModifyListener*>(this)) - : m_xReportDefinition->removeModifyListener(static_cast<XModifyListener*>(this)); + rObserver.AddSection(m_xReportDefinition->getPageFooter()); + } - if ( !_bAdd ) + xGroups->addContainerListener(static_cast<XContainerListener*>(this)); + m_xReportDefinition->addModifyListener(static_cast<XModifyListener*>(this)); + } + else /* ! _bAdd */ + { + rObserver.RemoveSection(m_xReportDefinition->getDetail()); + xGroups->removeContainerListener(static_cast<XContainerListener*>(this)); + m_xReportDefinition->removeModifyListener(static_cast<XModifyListener*>(this)); m_aReportModel->detachController(); + } } // ----------------------------------------------------------------------------- void OReportController::switchReportSection(const sal_Int16 _nId) @@ -3744,14 +3958,17 @@ void OReportController::markSection(const bool _bNext) void OReportController::createDefaultControl(const uno::Sequence< beans::PropertyValue>& _aArgs) { uno::Reference< report::XSection > xSection = m_pMyOwnView->getCurrentSection(); + if ( !xSection.is() ) + xSection = m_xReportDefinition->getDetail(); + if ( xSection.is() ) { const ::rtl::OUString sKeyModifier(RTL_CONSTASCII_USTRINGPARAM("KeyModifier")); const beans::PropertyValue* pIter = _aArgs.getConstArray(); const beans::PropertyValue* pEnd = pIter + _aArgs.getLength(); - const beans::PropertyValue* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyValueCompare(),boost::cref(sKeyModifier))); + const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyValueCompare(),boost::cref(sKeyModifier))); sal_Int16 nKeyModifier = 0; - if ( pFind != pEnd && (pFind->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1 ) + if ( pKeyModifier == pEnd || (pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1 ) { Sequence< PropertyValue > aCreateArgs; m_pMyOwnView->unmarkAllObjects(NULL); @@ -3970,6 +4187,21 @@ void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomSh _rState.bEnabled = isEditable(); _rState.bChecked = m_pMyOwnView->GetInsertObj() == OBJ_CUSTOMSHAPE && m_pMyOwnView->GetInsertObjString().compareToAscii(_pCustomShapeType) == 0; } + +// ----------------------------------------------------------------------------- +::boost::shared_ptr<OSectionWindow> OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +{ + if (m_pMyOwnView) + { + return m_pMyOwnView->getSectionWindow(_xSection); + } + + // throw NullPointerException? + ::boost::shared_ptr<OSectionWindow> pEmpty; + return pEmpty; +} + + // ----------------------------------------------------------------------------- void OReportController::openZoomDialog() { diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx new file mode 100644 index 000000000000..32332b195cb4 --- /dev/null +++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx @@ -0,0 +1,483 @@ +/************************************************************************* + * + * 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: UndoEnv.hxx,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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_reportdesign.hxx" + +#include <ReportControllerObserver.hxx> +#include <ReportController.hxx> +#include <svtools/smplhint.hxx> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <com/sun/star/report/XFormattedField.hpp> +#include <com/sun/star/awt/FontSlant.hpp> +#include <FormattedFieldBeautifier.hxx> + +#include <svx/unopage.hxx> + +// DBG_* +#include <tools/debug.hxx> +// DBG_UNHANDLED_EXCEPTION +#include <tools/diagnose_ex.h> + +namespace rptui +{ + + using namespace ::com::sun::star; + + // const OReportController *& m_pReportController; + +DECLARE_STL_USTRINGACCESS_MAP(bool, AllProperties); +DECLARE_STL_STDKEY_MAP(uno::Reference< beans::XPropertySet >, AllProperties, PropertySetInfoCache); + +class OXReportControllerObserverImpl +{ + OXReportControllerObserverImpl(OXReportControllerObserverImpl&); + void operator =(OXReportControllerObserverImpl&); +public: + const OReportController& m_rReportController; + ::std::vector< uno::Reference< container::XChild> > m_aSections; + ::osl::Mutex m_aMutex; + oslInterlockedCount m_nLocks; + sal_Bool m_bReadOnly; + + OXReportControllerObserverImpl(const OReportController& _rController); + ~OXReportControllerObserverImpl(); +}; + +// ----------------------------------------------------------------------------- + + OXReportControllerObserverImpl::OXReportControllerObserverImpl(const OReportController& _rController) + :m_rReportController(_rController) + ,m_nLocks(0) + ,m_bReadOnly(sal_False) + { + } + + OXReportControllerObserverImpl::~OXReportControllerObserverImpl() + { + } + + // ----------------------------------------------------------------------------- + // ----------------------------------------------------------------------------- + // ----------------------------------------------------------------------------- + + DBG_NAME(rpt_OXReportControllerObserver) + + OXReportControllerObserver::OXReportControllerObserver(const OReportController& _rController) + :m_pImpl(new OXReportControllerObserverImpl(_rController) ) + ,m_aFormattedFieldBeautifier(_rController) + ,m_aFixedTextColor(_rController) + { + DBG_CTOR( rpt_OXReportControllerObserver,NULL); + + Application::AddEventListener(LINK( this, OXReportControllerObserver, SettingsChanged ) ); + } + + OXReportControllerObserver::~OXReportControllerObserver() + { + DBG_CTOR( rpt_OXReportControllerObserver,NULL); + Application::RemoveEventListener(LINK( this, OXReportControllerObserver, SettingsChanged ) ); + } + + // ----------------------------------------------------------------------------- + IMPL_LINK(OXReportControllerObserver, SettingsChanged, VclWindowEvent*, _pEvt) + { + if ( _pEvt ) + { + sal_Int32 nEvent = _pEvt->GetId(); + /* + // just for debug + if (nEvent == VCLEVENT_WINDOW_CHILDCREATED || + nEvent == VCLEVENT_WINDOW_PAINT || + nEvent == VCLEVENT_WINDOW_MOVE || + nEvent == VCLEVENT_WINDOW_RESIZE || + nEvent == VCLEVENT_WINDOW_SHOW || + nEvent == VCLEVENT_WINDOW_MOUSEMOVE || + nEvent == VCLEVENT_WINDOW_FRAMETITLECHANGED || + nEvent == VCLEVENT_WINDOW_HIDE || + nEvent == VCLEVENT_EDIT_MODIFY || + nEvent == VCLEVENT_SCROLLBAR_ENDSCROLL || + nEvent == VCLEVENT_EDIT_SELECTIONCHANGED || + nEvent == VCLEVENT_TABPAGE_INSERTED || + nEvent == VCLEVENT_TABPAGE_REMOVED || + nEvent == VCLEVENT_TOOLBOX_FORMATCHANGED || + nEvent == VCLEVENT_TOOLBOX_ITEMADDED || + nEvent == VCLEVENT_TOOLBOX_ALLITEMCHANGED || + nEvent == VCLEVENT_MENUBARADDED || + nEvent == 1 + ) + { + return 0L; + } + */ + + if (nEvent == VCLEVENT_APPLICATION_DATACHANGED ) + { + DataChangedEvent* pData = reinterpret_cast<DataChangedEvent*>(_pEvt->GetData()); + if ( pData && ((( pData->GetType() == DATACHANGED_SETTINGS ) || + ( pData->GetType() == DATACHANGED_DISPLAY )) && + ( pData->GetFlags() & SETTINGS_STYLE ))) + { + OEnvLock aLock(*this); + + // sal_uInt32 nCount = m_pImpl->m_aSections.size(); + + // send all Section Objects a 'tingle' + // maybe they need a change in format, color, etc + ::std::vector< uno::Reference< container::XChild > >::const_iterator aIter = m_pImpl->m_aSections.begin(); + ::std::vector< uno::Reference< container::XChild > >::const_iterator aEnd = m_pImpl->m_aSections.end(); + for (;aIter != aEnd; aIter++) + { + const uno::Reference<container::XChild> xChild (*aIter); + if (xChild.is()) + { + uno::Reference<report::XSection> xSection(xChild, uno::UNO_QUERY); + if (xSection.is()) + { + const sal_Int32 nCount = xSection->getCount(); + for (sal_Int32 i = 0; i < nCount; ++i) + { + const uno::Any aObj = xSection->getByIndex(i); + uno::Reference < report::XReportComponent > xReportComponent(aObj, uno::UNO_QUERY); + if (xReportComponent.is()) + { + m_aFormattedFieldBeautifier.handle(xReportComponent); + m_aFixedTextColor.handle(xReportComponent); + } + } + } + } + } + } + } + } + + return 0L; + } + + // ----------------------------------------------------------------------------- + void OXReportControllerObserver::switchListening(const uno::Reference< uno::XInterface >& _rxObject, sal_Bool _bStartListening) + { + try + { + uno::Reference< beans::XPropertySet > xProps( _rxObject, uno::UNO_QUERY ); + if ( xProps.is() ) + { + if ( _bStartListening ) + { + xProps->addPropertyChangeListener( ::rtl::OUString(), this ); + } + else + { + xProps->removePropertyChangeListener( ::rtl::OUString(), this ); + } + } + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + // XEventListener + void SAL_CALL OXReportControllerObserver::disposing(const lang::EventObject& e) throw( uno::RuntimeException ) + { + (void) e; + // check if it's an object we have cached informations about + uno::Reference< beans::XPropertySet > xSourceSet(e.Source, uno::UNO_QUERY); + if ( xSourceSet.is() ) + { + uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY); + if ( xSection.is() ) + RemoveSection(xSection); + else + RemoveElement(xSourceSet); + } + } + + void OXReportControllerObserver::Clear() + { + OEnvLock aLock(*this); + // sal_uInt32 nDebugValue = m_pImpl->m_aSections.size(); + m_pImpl->m_aSections.clear(); + } + + // XPropertyChangeListener + void SAL_CALL OXReportControllerObserver::propertyChange(const beans::PropertyChangeEvent& _rEvent) throw(uno::RuntimeException) + { + (void) _rEvent; + ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex ); + + if ( IsLocked() ) + return; + + m_aFormattedFieldBeautifier.notifyPropertyChange(_rEvent); + m_aFixedTextColor.notifyPropertyChange(_rEvent); + } + +// ----------------------------------------------------------------------------- +void OXReportControllerObserver::Lock() +{ + OSL_ENSURE(m_refCount,"Illegal call to dead object!"); + osl_incrementInterlockedCount( &m_pImpl->m_nLocks ); +} +void OXReportControllerObserver::UnLock() +{ + OSL_ENSURE(m_refCount,"Illegal call to dead object!"); + + osl_decrementInterlockedCount( &m_pImpl->m_nLocks ); +} +sal_Bool OXReportControllerObserver::IsLocked() const { return m_pImpl->m_nLocks != 0; } + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::AddSection(const uno::Reference< report::XSection > & _xSection) +{ + OEnvLock aLock(*this); + try + { + uno::Reference<container::XChild> xChild = _xSection.get(); + m_pImpl->m_aSections.push_back(xChild); + uno::Reference< uno::XInterface > xInt(_xSection); + AddElement(xInt); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::RemoveSection(const uno::Reference< report::XSection > & _xSection) +{ + OEnvLock aLock(*this); + try + { + uno::Reference<container::XChild> xChild(_xSection.get()); + m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(), + xChild), m_pImpl->m_aSections.end()); + uno::Reference< uno::XInterface > xInt(_xSection); + RemoveElement(xInt); + } + catch(uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::TogglePropertyListening(const uno::Reference< uno::XInterface > & Element) +{ + // listen at Container + uno::Reference< container::XIndexAccess > xContainer(Element, uno::UNO_QUERY); + if (xContainer.is()) + { + uno::Reference< uno::XInterface > xInterface; + sal_Int32 nCount = xContainer->getCount(); + for(sal_Int32 i = 0;i != nCount;++i) + { + xInterface.set(xContainer->getByIndex( i ),uno::UNO_QUERY); + TogglePropertyListening(xInterface); + } + } + + uno::Reference< beans::XPropertySet > xSet(Element, uno::UNO_QUERY); + if (xSet.is()) + { + if (!m_pImpl->m_bReadOnly) + xSet->addPropertyChangeListener( ::rtl::OUString(), this ); + else + xSet->removePropertyChangeListener( ::rtl::OUString(), this ); + } +} + + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::switchListening( const uno::Reference< container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(()) +{ + OSL_PRECOND( _rxContainer.is(), "OXReportControllerObserver::switchListening: invalid container!" ); + if ( !_rxContainer.is() ) + return; + + try + { + // also handle all children of this element + uno::Reference< uno::XInterface > xInterface; + sal_Int32 nCount = _rxContainer->getCount(); + for(sal_Int32 i = 0;i != nCount;++i) + { + xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY); + if ( _bStartListening ) + AddElement( xInterface ); + else + RemoveElement( xInterface ); + } + + // be notified of any changes in the container elements + uno::Reference< container::XContainer > xSimpleContainer( _rxContainer, uno::UNO_QUERY ); + // OSL_ENSURE( xSimpleContainer.is(), "OXReportControllerObserver::switchListening: how are we expected to be notified of changes in the container?" ); + if ( xSimpleContainer.is() ) + if ( _bStartListening ) + xSimpleContainer->addContainerListener( this ); + else + xSimpleContainer->removeContainerListener( this ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::switchListening( const uno::Reference< uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(()) +{ + OSL_PRECOND( _rxObject.is(), "OXReportControllerObserver::switchListening: how should I listen at a NULL object?" ); + + try + { + if ( !m_pImpl->m_bReadOnly ) + { + uno::Reference< beans::XPropertySet > xProps( _rxObject, uno::UNO_QUERY ); + if ( xProps.is() ) + if ( _bStartListening ) + xProps->addPropertyChangeListener( ::rtl::OUString(), this ); + else + xProps->removePropertyChangeListener( ::rtl::OUString(), this ); + } + + uno::Reference< util::XModifyBroadcaster > xBroadcaster( _rxObject, uno::UNO_QUERY ); + if ( xBroadcaster.is() ) + if ( _bStartListening ) + xBroadcaster->addModifyListener( this ); + else + xBroadcaster->removeModifyListener( this ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------------ +void SAL_CALL OXReportControllerObserver::modified( const lang::EventObject& /*aEvent*/ ) throw (uno::RuntimeException) +{ + // implSetModified(); +} + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::AddElement(const uno::Reference< uno::XInterface >& _rxElement ) +{ + // if ( !IsLocked() ) + // { + m_aFormattedFieldBeautifier.notifyElementInserted(_rxElement); + m_aFixedTextColor.notifyElementInserted(_rxElement); + // } + + // if it's a container, start listening at all elements + uno::Reference< container::XIndexAccess > xContainer( _rxElement, uno::UNO_QUERY ); + if ( xContainer.is() ) + switchListening( xContainer, true ); + + switchListening( _rxElement, true ); +} + +//------------------------------------------------------------------------------ +void OXReportControllerObserver::RemoveElement(const uno::Reference< uno::XInterface >& _rxElement) +{ + switchListening( _rxElement, false ); + + uno::Reference< container::XIndexAccess > xContainer( _rxElement, uno::UNO_QUERY ); + if ( xContainer.is() ) + switchListening( xContainer, false ); +} + +// ----------------------------------------------------------------------------- +::std::vector< uno::Reference< container::XChild> >::const_iterator OXReportControllerObserver::getSection(const uno::Reference<container::XChild>& _xContainer) const +{ + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end(); + if ( _xContainer.is() ) + { + aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer); + + if ( aFind == m_pImpl->m_aSections.end() ) + { + uno::Reference<container::XChild> xParent(_xContainer->getParent(),uno::UNO_QUERY); + aFind = getSection(xParent); + } + } + return aFind; +} +// XContainerListener +//------------------------------------------------------------------------------ +void SAL_CALL OXReportControllerObserver::elementInserted(const container::ContainerEvent& evt) throw(uno::RuntimeException) +{ + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + // neues Object zum lauschen + uno::Reference< uno::XInterface > xIface( evt.Element, uno::UNO_QUERY ); + if ( xIface.is() ) + { + AddElement(xIface); + } +} + +//------------------------------------------------------------------------------ +void SAL_CALL OXReportControllerObserver::elementReplaced(const container::ContainerEvent& evt) throw(uno::RuntimeException) +{ + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + uno::Reference< uno::XInterface > xIface(evt.ReplacedElement,uno::UNO_QUERY); + OSL_ENSURE(xIface.is(), "OXReportControllerObserver::elementReplaced: invalid container notification!"); + RemoveElement(xIface); + + xIface.set(evt.Element,uno::UNO_QUERY); + AddElement(xIface); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OXReportControllerObserver::elementRemoved(const container::ContainerEvent& evt) throw(uno::RuntimeException) +{ + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + uno::Reference< uno::XInterface > xIface( evt.Element, uno::UNO_QUERY ); + if ( xIface.is() ) + { + RemoveElement(xIface); + } +} + + +} // namespace rptui + + + diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index c03f1426533c..2055f1ee5358 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -420,7 +420,7 @@ void OReportSection::Copy(uno::Sequence< beans::NamedValue >& _rAllreadyCopiedOb //---------------------------------------------------------------------------- void OReportSection::MouseButtonDown( const MouseEvent& rMEvt ) { - m_pParent->getViewsWindow()->getView()->setMarked(m_pView,sal_True); + m_pParent->getViewsWindow()->getView()->setMarked(m_pView,sal_True); // mark the section in which is clicked m_pFunc->MouseButtonDown( rMEvt ); Window::MouseButtonDown(rMEvt); } @@ -436,6 +436,7 @@ void OReportSection::MouseButtonUp( const MouseEvent& rMEvt ) void OReportSection::MouseMove( const MouseEvent& rMEvt ) { m_pFunc->MouseMove( rMEvt ); + } //---------------------------------------------------------------------------- void OReportSection::SetGridVisible(BOOL _bVisible) diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx index 3d04b2898669..98dd0d2390a7 100644 --- a/reportdesign/source/ui/report/ReportWindow.cxx +++ b/reportdesign/source/ui/report/ReportWindow.cxx @@ -306,7 +306,7 @@ void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView) //----------------------------------------------------------------------------- void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getReportSection( _xReportComponent ); + ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getSectionWindow( _xReportComponent ); m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView()); } //------------------------------------------------------------------------------ @@ -337,6 +337,11 @@ void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepo { return m_aViewsWindow.getMarkedSection(nsa); } +//----------------------------------------------------------------------------- +::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +{ + return m_aViewsWindow.getSectionWindow(_xSection); +} // ------------------------------------------------------------------------- void OReportWindow::markSection(const sal_uInt16 _nPos) { diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx index 9ab957796c39..c4410ae7f079 100644 --- a/reportdesign/source/ui/report/ScrollHelper.cxx +++ b/reportdesign/source/ui/report/ScrollHelper.cxx @@ -311,6 +311,11 @@ void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report: return m_aReportWindow.getMarkedSection(nsa); } // ------------------------------------------------------------------------- +::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +{ + return m_aReportWindow.getSectionWindow(_xSection); +} +// ------------------------------------------------------------------------- void OScrollWindowHelper::markSection(const sal_uInt16 _nPos) { m_aReportWindow.markSection(_nPos); diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx index 79f0e1d5f502..974c9392d893 100644 --- a/reportdesign/source/ui/report/SectionView.cxx +++ b/reportdesign/source/ui/report/SectionView.cxx @@ -29,21 +29,22 @@ ************************************************************************/ #include "precompiled_reportdesign.hxx" #include "SectionView.hxx" -#ifndef RPT_DESIGNVIEW_HXX #include "DesignView.hxx" -#endif #include <RptPage.hxx> #include <RptObject.hxx> -#ifndef _SVXIDS_HRC +#include <RptDef.hxx> #include <svx/svxids.hrc> -#endif +#include <svx/svddrgmt.hxx> #include <vcl/scrbar.hxx> #include "ReportSection.hxx" #include "ReportWindow.hxx" - +#include "uistrings.hrc" +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> namespace rptui { + using namespace ::com::sun::star; TYPEINIT1( OSectionView, SdrView ); //---------------------------------------------------------------------------- @@ -178,7 +179,99 @@ void OSectionView::ObjectRemovedInAliveMode( const SdrObject* _pObject ) } } } + +// ----------------------------------------------------------------------------- +void OSectionView::SetMarkedToLayer( SdrLayerID _nLayerNo ) +{ + if (AreObjectsMarked()) + { + // #i11702# use SdrUndoObjectLayerChange for undo + // STR_UNDO_SELATTR is "Attributes" - should use a different text later + BegUndo( ); + + const SdrMarkList& rMark = GetMarkedObjectList(); + ULONG nCount = rMark.GetMarkCount(); + for (ULONG i=0; i<nCount; i++) + { + SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj(); + if ( pObj->ISA(OCustomShape) ) + { + AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), _nLayerNo) ); + pObj->SetLayer( _nLayerNo ); + OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj); + try + { + pBaseObj->getReportComponent()->setPropertyValue(PROPERTY_OPAQUE,uno::makeAny(_nLayerNo == RPT_LAYER_FRONT)); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + + EndUndo(); + + // #84073# check mark list now instead of later in a timer + CheckMarked(); + MarkListHasChanged(); + } +} // ----------------------------------------------------------------------------- +bool OSectionView::OnlyShapesMarked() const +{ + const SdrMarkList& rMark = GetMarkedObjectList(); + const ULONG nCount = rMark.GetMarkCount(); + if ( !nCount ) + return false; + ULONG i=0; + for (; i<nCount; i++) + { + SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj(); + if ( !pObj->ISA(OCustomShape) ) + { + break; + } + } // for (ULONG i=0; i<nCount; i++) + return i == nCount; +} + +bool OSectionView::IsDragResize() const +{ + const SdrDragMethod* pDragMethod = GetDragMethod(); + if (pDragMethod) + { + bool bMoveOnly = pDragMethod->getMoveOnly(); + if (bMoveOnly == false) + { + // current marked components will be resized + return true; + } + } + return false; +} + +// ----------------------------------------------------------------------------- +short OSectionView::GetLayerIdOfMarkedObjects() const +{ + short nRet = SHRT_MAX; + const SdrMarkList &rMrkList = GetMarkedObjectList(); + for ( USHORT i = 0; i < rMrkList.GetMarkCount(); ++i ) + { + const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); + if ( nRet == SHRT_MAX ) + nRet = pObj->GetLayer(); + else if ( nRet != pObj->GetLayer() ) + { + nRet = -1; + break; + } + } + if ( nRet == SHRT_MAX ) + nRet = -1; + return nRet; +} + //============================================================================ } // rptui //============================================================================ diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index f51074e14d6f..42ceaaea5eba 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -28,6 +28,7 @@ * ************************************************************************/ #include "precompiled_reportdesign.hxx" + #include "ViewsWindow.hxx" #include "ScrollHelper.hxx" #include "UndoActions.hxx" @@ -436,6 +437,26 @@ void OViewsWindow::Paste() pMarkedSection->getReportSection().Paste(aCopies,true); } } +// --------------------------------------------------------------------------- +::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const +{ + OSL_ENSURE(_xSection.is(),"Section is NULL!"); + + ::boost::shared_ptr<OSectionWindow> pSectionWindow; + TSectionsMap::const_iterator aIter = m_aSections.begin(); + TSectionsMap::const_iterator aEnd = m_aSections.end(); + for (; aIter != aEnd ; ++aIter) + { + if ((*aIter)->getReportSection().getSection() == _xSection) + { + pSectionWindow = (*aIter); + break; + } + } + + return pSectionWindow; +} + //---------------------------------------------------------------------------- ::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const { @@ -548,6 +569,7 @@ void OViewsWindow::unmarkAllObjects(OSectionView* _pSectionView) } } //----------------------------------------------------------------------------- +/* ::boost::shared_ptr<OSectionWindow> OViewsWindow::getReportSection(const uno::Reference< report::XSection >& _xSection) { OSL_ENSURE(_xSection.is(),"Section is NULL!"); @@ -564,6 +586,7 @@ void OViewsWindow::unmarkAllObjects(OSectionView* _pSectionView) } // for (; aIter != aEnd ; ++aIter) return pRet; } +*/ // ----------------------------------------------------------------------- void OViewsWindow::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint) { @@ -681,7 +704,7 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor bFirst = false; m_pParent->setMarked(xSection,_bMark); } - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getReportSection(xSection); + ::boost::shared_ptr<OSectionWindow> pSectionWindow = getSectionWindow(xSection); if ( pSectionWindow ) { SvxShape* pShape = SvxShape::getImplementation( *pIter ); @@ -1140,6 +1163,7 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi OSL_TRACE("BegDragObj createInvisible Objects\n" ); int nViewCount = 0; Point aNewObjPos(0,0); + Point aLeftTop = Point(SAL_MAX_INT32, SAL_MAX_INT32); for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter) { OReportSection& rReportSection = (*aIter)->getReportSection(); @@ -1157,17 +1181,21 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi { Rectangle aRect( pObj->GetCurrentBoundRect() ); aRect.Move(0, aNewObjPos.Y()); + + aLeftTop.X() = ::std::min( aRect.Left(), aLeftTop.X() ); + aLeftTop.Y() = ::std::min( aRect.Top(), aLeftTop.Y() ); + OSL_TRACE("BegDragObj createInvisible X:%d Y:%d on View #%d\n", aRect.Left(), aRect.Top(), nViewCount ); BegDragObj_createInvisibleObjectAtPosition(aRect, rView); // calculate the clickpoint - const sal_Int32 nDeltaX = abs(aRect.Left() - aAbsolutePnt.X()); - const sal_Int32 nDeltaY = abs(aRect.Top() - aAbsolutePnt.Y()); - if (m_aDragDelta.X() > nDeltaX) - m_aDragDelta.X() = nDeltaX; - if (m_aDragDelta.Y() > nDeltaY) - m_aDragDelta.Y() = nDeltaY; +// const sal_Int32 nDeltaX = abs(aRect.Left() - aAbsolutePnt.X()); +// const sal_Int32 nDeltaY = abs(aRect.Top() - aAbsolutePnt.Y()); +// if (m_aDragDelta.X() > nDeltaX) +// m_aDragDelta.X() = nDeltaX; +// if (m_aDragDelta.Y() > nDeltaY) +// m_aDragDelta.Y() = nDeltaY; } } } @@ -1183,6 +1211,11 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi // aNewObjPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height(); } + const sal_Int32 nDeltaX = abs(aLeftTop.X() - aAbsolutePnt.X()); + const sal_Int32 nDeltaY = abs(aLeftTop.Y() - aAbsolutePnt.Y()); + m_aDragDelta.X() = nDeltaX; + m_aDragDelta.Y() = nDeltaY; + Point aNewPos = aAbsolutePnt; // for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter) // { @@ -1294,7 +1327,8 @@ OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pS for (; nCount && (_rPnt.Y() < 0); --nCount) { OReportSection& rReportSection = (*aIter)->getReportSection(); - _rPnt.Y() += rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height(); + const sal_Int32 nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height(); + _rPnt.Y() += nHeight; if ( (nCount -1) > 0 && (_rPnt.Y() < 0) ) --aIter; } @@ -1341,7 +1375,9 @@ void OViewsWindow::EndDragObj(BOOL _bControlKeyPressed, const OSectionView* _pSe Point aNewPos = _aPnt; OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aNewPos); - if (!_bControlKeyPressed && _pSection != pInSection) + if (!_bControlKeyPressed && + (_pSection && ( _pSection->IsDragResize() == false ) ) && /* Not in resize mode */ + _pSection != pInSection) { EndDragObj_removeInvisibleObjects(); @@ -1377,25 +1413,38 @@ void OViewsWindow::EndDragObj(BOOL _bControlKeyPressed, const OSectionView* _pSe const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN); const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width; + if ( aNewPos.X() < nLeftMargin ) + aNewPos.X() = nLeftMargin; + if ( aNewPos.Y() < 0 ) + aNewPos.Y() = 0; + Point aPrevious; for (; pIter != pEnd; ++pIter) { - uno::Sequence< uno::Reference<util::XCloneable> > aClones; + uno::Sequence< uno::Reference<report::XReportComponent> > aClones; pIter->Value >>= aClones; - uno::Reference<util::XCloneable>* pColIter = aClones.getArray(); - const uno::Reference<util::XCloneable>* pColEnd = pColIter + aClones.getLength(); + uno::Reference<report::XReportComponent>* pColIter = aClones.getArray(); + const uno::Reference<report::XReportComponent>* pColEnd = pColIter + aClones.getLength(); + + // move the cloned Components to new positions for (; pColIter != pColEnd; ++pColIter) { - uno::Reference< report::XReportComponent> xRC(*pColIter,uno::UNO_QUERY); + uno::Reference< report::XReportComponent> xRC(*pColIter); aPrevious = VCLPoint(xRC->getPosition()); - awt::Size aSize = xRC->getSize(); + if ( aNewPos.X() < nLeftMargin ) + { aNewPos.X() = nLeftMargin; + } else if ( (aNewPos.X() + aSize.Width) > (nPaperWidth - nRightMargin) ) + { aNewPos.X() = nPaperWidth - nRightMargin - aSize.Width; + } if ( aNewPos.Y() < 0 ) + { aNewPos.Y() = 0; + } if ( aNewPos.X() < 0 ) { aSize.Width += aNewPos.X(); @@ -1405,6 +1454,7 @@ void OViewsWindow::EndDragObj(BOOL _bControlKeyPressed, const OSectionView* _pSe xRC->setPosition(AWTPoint(aNewPos)); if ( (pColIter+1) != pColEnd ) { + // bring aNewPos to the position of the next object uno::Reference< report::XReportComponent> xRCNext(*(pColIter + 1),uno::UNO_QUERY); Point aNextPosition = VCLPoint(xRCNext->getPosition()); aNewPos += (aNextPosition - aPrevious); @@ -1423,6 +1473,7 @@ void OViewsWindow::EndDragObj(BOOL _bControlKeyPressed, const OSectionView* _pSe ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction( FALSE ) ); EndDragObj_removeInvisibleObjects(); } + m_aDragDelta = Point(SAL_MAX_INT32, SAL_MAX_INT32); } // ----------------------------------------------------------------------------- void OViewsWindow::EndAction() @@ -1444,6 +1495,7 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection,bo { aHdlPos = pHdl->GetPos(); } + TSectionsMap::iterator aIter/* = m_aSections.begin() */; TSectionsMap::iterator aEnd = m_aSections.end(); @@ -1493,12 +1545,70 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection,bo SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl(); if ( pCurrentHdl ) { - aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos; + if ( aRealMousePos.Y() > 0 ) + aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos; } rReportSection.getSectionView().MovAction ( aRealMousePos ); const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height(); aRealMousePos.Y() -= nSectionHeight; } + +#if 0 +#if OSL_DEBUG_LEVEL > 0 + // TEST TEST TEST TEST + // Ich versuche gerade rauszubekommen, ob ich ein Object bewege oder nur resize. + // TEST TEST TEST TEST + + for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter) + { + OReportSection& rReportSection = (*aIter)->getReportSection(); + OSectionView& rView = rReportSection.getSectionView(); + if ( rView.AreObjectsMarked() ) + { + rView.SortMarkedObjects(); + const sal_uInt32 nCount = rView.GetMarkedObjectCount(); + for (sal_uInt32 i=0; i < nCount; ++i) + { + const SdrMark* pM = rView.GetSdrMarkByIndex(i); + SdrObject* pObj = pM->GetMarkedSdrObj(); + (void)pObj; + + int dummy = 0; + (void)dummy; + } + } + + /* + OReportSection& rReportSection = (*aIter)->getReportSection(); + OSectionView& rView = rReportSection.getSectionView(); + const SdrHdlList& rHdlList = rView.GetHdlList(); + SdrHdl* pHdl2 = rHdlList.GetFocusHdl(); + + if ( pHdl2 != 0 ) + { + SdrHdlKind eKind = pHdl->GetKind(); + int dummy = 0; + switch(eKind) + { + case HDL_UPLFT: // Oben links + case HDL_UPPER: // Oben + case HDL_UPRGT: // Oben rechts + case HDL_LEFT: // Links + case HDL_RIGHT: // Rechts + case HDL_LWLFT: // Unten links + case HDL_LOWER: // Unten + case HDL_LWRGT: // Unten rechts + dummy = 1; + break; + default: + dummy = 0; + } + } + */ + } + // TEST TEST TEST TEST +#endif +#endif } // ----------------------------------------------------------------------------- BOOL OViewsWindow::IsAction() const diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx index dd67851d20bc..2f460f37b638 100644 --- a/reportdesign/source/ui/report/dlgedfunc.cxx +++ b/reportdesign/source/ui/report/dlgedfunc.cxx @@ -544,7 +544,10 @@ void DlgEdFunc::checkMovementAllowed(const MouseEvent& rMEvt) if ( m_pParent->getSectionWindow()->getViewsWindow()->IsDragObj() ) { if ( isRectangleHit(rMEvt) ) + { + // there is an other component under use, break action m_pParent->getSectionWindow()->getViewsWindow()->BrkAction(); + } // object was dragged Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) ); if (m_bSelectionMode) @@ -559,6 +562,14 @@ void DlgEdFunc::checkMovementAllowed(const MouseEvent& rMEvt) { aPnt.Y() = 0; } + if (m_rView.IsDragResize()) + { + // we resize the object don't resize to above sections + if ( aPnt.Y() < 0 ) + { + aPnt.Y() = 0; + } + } m_pParent->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed, &m_rView, aPnt ); } m_pParent->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage(); @@ -626,7 +637,7 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt) ::ResizeRect(aNewRect,rDragStat.GetRef1(),rDragStat.GetXFact(),rDragStat.GetYFact()); - SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter); + SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter, ISOVER_IGNORE_CUSTOMSHAPES); bIsSetPoint = pObjOverlapped ? true : false; if (pObjOverlapped && !m_bSelectionMode) { @@ -683,9 +694,24 @@ BOOL DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt ) return TRUE; SdrViewEvent aVEvt; + sal_Int16 nId = m_rView.GetCurrentObjIdentifier(); + const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); - if( eHit != SDRHIT_UNMARKEDOBJECT ) +// eHit == SDRHIT_UNMARKEDOBJECT under the mouse cursor is a unmarked object + + if (eHit == SDRHIT_UNMARKEDOBJECT && + nId != OBJ_CUSTOMSHAPE) + { + // there is an object under the mouse cursor, but not a customshape + // rtl::OUString suWasN = m_rView.getInsertObjString(); + // rtl::OUString suWasN2 = m_pParent->getSectionWindow()->getViewsWindow()->GetInsertObjString(); + + m_pParent->getSectionWindow()->getViewsWindow()->BrkAction(); + return FALSE; + } + + if( eHit != SDRHIT_UNMARKEDOBJECT || nId == OBJ_CUSTOMSHAPE) { // if no action, create object if ( !m_pParent->getSectionWindow()->getViewsWindow()->IsAction() ) @@ -700,8 +726,10 @@ BOOL DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt ) else { if( !rMEvt.IsShift() ) + { + // shift key pressed? m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL); - + } m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos,&m_rView ); } @@ -777,7 +805,7 @@ BOOL DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt ) { if ( DlgEdFunc::MouseMove(rMEvt ) ) return TRUE; - const Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) ); + Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) ); if ( m_rView.IsCreateObj() ) { @@ -788,6 +816,14 @@ BOOL DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt ) bool bIsSetPoint = false; if ( m_rView.IsAction() ) { + if ( m_rView.IsDragResize() ) + { + // we resize the object don't resize to above sections + if ( aPos.Y() < 0 ) + { + aPos.Y() = 0; + } + } bIsSetPoint = setMovementPointer(rMEvt); ForceScroll(aPos); m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPos,&m_rView, m_rView.GetDragMethod() == NULL, false); @@ -893,7 +929,7 @@ BOOL DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt ) if ( DlgEdFunc::MouseMove(rMEvt ) ) return TRUE; - const Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) ); + Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) ); bool bIsSetPoint = false; if ( m_rView.IsAction() ) // Drag Mode @@ -902,10 +938,29 @@ BOOL DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt ) ForceScroll(aPnt); if (m_rView.GetDragMethod()==NULL) { + // create a selection m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, true, false); } else { + if ( m_rView.IsDragResize() ) + { + // we resize the object don't resize to above sections + if ( aPnt.Y() < 0 ) + { + aPnt.Y() = 0; + } + // grow section if it is under the current section +// else +// { +// const Size& aSectionSize = m_rView->GetSizePixel(); +// if ( aPnt.Y() > aSectionSize.Height() ) +// { +// aPnt.Y() = aSectionSize.Height(); +// } +// } + } + // drag or resize an object bool bControlKey = rMEvt.IsMod1(); m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, false, bControlKey); } diff --git a/reportdesign/source/ui/report/makefile.mk b/reportdesign/source/ui/report/makefile.mk index cb3c8c9ad159..f1739f1b7137 100644 --- a/reportdesign/source/ui/report/makefile.mk +++ b/reportdesign/source/ui/report/makefile.mk @@ -48,6 +48,9 @@ IMGLST_SRS=$(SRS)$/$(TARGET).srs SLOFILES =\ $(SLO)$/SectionWindow.obj \ $(SLO)$/ReportController.obj \ + $(SLO)$/ReportControllerObserver.obj \ + $(SLO)$/FormattedFieldBeautifier.obj \ + $(SLO)$/FixedTextColor.obj \ $(SLO)$/ReportSection.obj \ $(SLO)$/SectionView.obj \ $(SLO)$/ViewsWindow.obj \ diff --git a/reportdesign/source/ui/report/report.src b/reportdesign/source/ui/report/report.src index 884fac8842b1..628161ef61ce 100644 --- a/reportdesign/source/ui/report/report.src +++ b/reportdesign/source/ui/report/report.src @@ -441,6 +441,7 @@ Menu RID_MENU_REPORT { Separator = TRUE; }; + MenuItem { Identifier = SID_OBJECT_RESIZING ; @@ -491,6 +492,49 @@ Menu RID_MENU_REPORT }; }; }; + + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = SID_SECTION_SHRINK_MENU ; + Command = ".uno:SectionShrinkMenu" ; + HelpID = SID_SECTION_SHRINK_MENU ; + Text [ en-US ] = "Section" ; + Text [ x-comment ] = " "; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_SECTION_SHRINK ; + Command = ".uno:SectionShrink" ; + HelpID = SID_SECTION_SHRINK ; + Text [ en-US ] = "Shrink" ; + Text [ x-comment ] = " "; + }; + MenuItem + { + Identifier = SID_SECTION_SHRINK_TOP ; + Command = ".uno:SectionShrinkTop" ; + HelpID = SID_SECTION_SHRINK_TOP ; + Text [ en-US ] = "Shrink from top" ; + Text [ x-comment ] = " "; + }; + MenuItem + { + Identifier = SID_SECTION_SHRINK_BOTTOM ; + Command = ".uno:SectionShrinkBottom" ; + HelpID = SID_SECTION_SHRINK_BOTTOM ; + Text [ en-US ] = "Shrink from bottom" ; + Text [ x-comment ] = " "; + }; + }; + }; + }; MenuItem { Separator = TRUE; @@ -629,6 +673,10 @@ String RID_ERR_NO_OBJECTS { Text [ en-US ] = "The report can not be executed unless at least one object has been inserted."; }; +String RID_STR_UNDO_SHRINK +{ + Text [ en-US ] = "Shrink Section"; +}; String RID_STR_DETAIL { Text [ en-US ] = "Detail"; @@ -653,4 +701,3 @@ String RID_STR_INSERT { Text [ en-US ] = "Insert"; }; - |