office-gobmx/include/sfx2
Armin Le Grand (allotropia) b8e393686c ITEM: Remove suspicious extra-Which in ::Put
The ::Put methods at SfxItemSet had an extra WhichID
parameter that was not really documented, but I would
guess often asked why it exists: An extra WhichID, just
called 'nWhich' (which makes things NOT clearer). That
is 'strange' since the Item given to be put already
internally has a WhichID, so why a 2nd one?

If you were really interested and read all that code
(no, no comments on that anywhere) you might know
that this a kind of 'Target-WhichID' under which
the Item shall be put to the ItemSet. Since this
is unclear for most people it is even dangerous and
explains why so many code places just hand over the
WhichID requsted from the Item that already gets
handed over.

To make it short: I removed that. For the 19 places
where this was really needed I added a new method
besides ::Put called ::PutAsTargetWhich that takes that
extra WhichID (now called TargetWhich) and takes the
needed actions. These are quite some because that may
be combined with the bPassingOwnership flag, see new
SfxItemSet::PutImplAsTargetWhich method.

This makes usage of ItemSets/Items less dangerous. It
also simplifies and thus makes safer the central helpers
implCreateItemEntry/implCleanupItemEntry which have some
less cases to handle.

Debugged the failing UnitTests showed that there is
an incarnate Item != SfxVoidItem that causes problems.
I checked for errors in the change, but no luck.
Afterr some time I found out that a ::Clone
implementation caused the problem: These need to
also copy the WichID of the original, but the
SfxFrameItem failed to do so. This did not cause
problems in the former version because
implCreateItemEntry was designed to set a missing/
different WhichID.
I corrected that in SfxFrameItem, also removed not
needed costructor that caused that. Also added a
SAL_WARN and a correction in implCreateItemEntry.
I could have added an assert (did so for running
local UnitTests), but should be enough.

NOTE: When hunting for Items except SfxVoidItem
that get crerated using a WhichID '0' i learned
that this indeed happens: There are some (5) calls
to SfxRequest::SetReturnValue that incarnate an
SfxBoolItem with WhichID '0' (ZERO). This is not
good and I think about how to change that...

Change-Id: I9854a14cdc42d1cc19c7b9df65ce74147d680825
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162124
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-01-17 01:56:01 +01:00
..
devtools
notebookbar
sidebar cool#7492 sfx2 lok: set language/locale on async sidebar update 2024-01-11 12:06:52 +01:00
AccessibilityCheck.hxx
AccessibilityIssue.hxx tdf#43784 tdf#158114 sw accessibility: check missing linked graphic 2023-11-08 21:16:59 +01:00
app.hxx
basedlgs.hxx
bindings.hxx cool#7492 sfx2 lok: fix bad view id / statusbar string on async binding update 2024-01-08 08:27:18 +01:00
brokenpackageint.hxx
chalign.hxx
charwin.hxx
childwin.hxx tdf#153690 Prevent invisible dialogs in Calc Full Screen 2023-12-21 21:17:42 +01:00
classificationhelper.hxx
ctrlitem.hxx
dialoghelper.hxx
digitalsignatures.hxx
dinfdlg.hxx
dispatch.hxx Remove DeleteItemOnIdlex 2023-12-21 21:13:55 +01:00
dllapi.h
docfac.hxx
docfile.hxx tdf#105844 package,sfx2: wholesome ODF package wrapping encryption 2023-12-07 09:28:38 +01:00
docfilt.hxx
docinf.hxx
docinsert.hxx
dockwin.hxx
docmacromode.hxx default to ignoring libreoffice special-purpose protocols in calc hyperlink 2023-11-09 13:29:50 +01:00
docstoragemodifylistener.hxx
doctempl.hxx
DocumentMetadataAccess.hxx
DocumentSigner.hxx
event.hxx
evntconf.hxx
fcontnr.hxx
filedlghelper.hxx
flatpak.hxx
frame.hxx ITEM: Remove suspicious extra-Which in ::Put 2024-01-17 01:56:01 +01:00
frmdescr.hxx
frmhtml.hxx
frmhtmlw.hxx
groupid.hxx
htmlmode.hxx
infobar.hxx
inputdlg.hxx cid#1545222 COPY_INSTEAD_OF_MOVE 2023-12-19 09:42:03 +01:00
ipclient.hxx
linkmgr.hxx
linksrc.hxx
listview.hxx
lnkbase.hxx
lokcallback.hxx
lokcomponenthelpers.hxx
LokControlHandler.hxx
lokhelper.hxx loplugin:unusedfields 2024-01-16 07:43:00 +01:00
mailmodelapi.hxx
Metadatable.hxx
mieclip.hxx
minfitem.hxx
module.hxx
msg.hxx
msgpool.hxx
namedcolor.hxx
navigat.hxx
new.hxx
newstyle.hxx
objface.hxx
objitem.hxx
objsh.hxx Related: tdf#104718 Use package repair request and behavior 2023-11-29 06:23:33 +01:00
opengrf.hxx
pageids.hxx
passwd.hxx tdf#157518: enforce password policy on sfx2/ui/password.ui 2023-11-15 23:05:49 +01:00
printer.hxx
printopt.hxx
progress.hxx
QuerySaveDocument.hxx
request.hxx Remove DeleteItemOnIdlex 2023-12-21 21:13:55 +01:00
safemode.hxx
sfxbasecontroller.hxx
sfxbasemodel.hxx tdf#146619 Recheck include/ with find-unneeded-includes --noexclude 2023-12-24 12:14:14 +01:00
sfxdlg.hxx
sfxhelp.hxx
sfxhtml.hxx
sfxmodelfactory.hxx
sfxresid.hxx
sfxsids.hrc tdf#156925 Add Color Scheme selector to the Basic IDE 2024-01-08 19:13:38 +01:00
sfxstatuslistener.hxx
sfxuno.hxx
shell.hxx Remove DeleteItemOnIdlex 2023-12-21 21:13:55 +01:00
signaturestate.hxx
stbitem.hxx
strings.hrc Related: tdf#104718 Use package repair request and behavior 2023-11-29 06:23:33 +01:00
styfitem.hxx
styledlg.hxx
StyleManager.hxx
StylePreviewRenderer.hxx
tabdlg.hxx
tbxctrl.hxx
templatedlg.hxx
templatedlglocalview.hxx
templatelocalview.hxx
templateproperties.hxx
templdlg.hxx
thumbnailview.hxx tdf#158404 Start Center: remove ability to do multiselections 2023-12-04 20:16:06 +01:00
thumbnailviewitem.hxx Resolves tdf#158084 - Start Center hover color 2023-11-14 13:26:53 +01:00
toolbarids.hxx
tplpitem.hxx
userinputinterception.hxx
viewfac.hxx
viewfrm.hxx
viewsh.hxx tdf#158686 sw floattable: fix print preview crash 2023-12-18 18:13:54 +01:00
watermarkitem.hxx
weldutils.hxx
XmlIdRegistry.hxx
zoomitem.hxx