5f7a3126fc
Added a counter for SfxItemSet usages, similar to the already added one for SfxPoolItems to allow quick info about evtl. problems/drawbacks of changes. Replaced enum SfxItemKind in favour of settable boolean flags directly at SfxPoolItem. These are organized as bitfield, do not need more space as the enum and allow to be set separately and multiple ones at the same time. Flags for PoolDefault/StaticDefault/DeleteOnIdle use this now and are quickly accessible booleans. It is not a problem that theoretically the flags for PoolDefault/StaticDefault could now both be set - this is internal to SfxItem stuff and not accessible from normal code, so can be managed. Added for debug build a bitfield boolean m_bDeleted that will be set in the SfxPoolItem destructor. Of course it's usability will depend on the freed space not yet being re-used, but will hopefully help in the debugger to detect reasons for failure (would have helped at least me before). Added for replacement of virtual method IsVoidItem() another bitfield bool m_bIsVoidItem that is set in the constructors of SfxVoidItem. Also had to add some constructors to do that which were defaulted before. This is mainly because the base class SfxPoolItem does *not* have a copy-constructor that copies the members (flags/RefCnt/WhichID) and we should keep that 'indirect reset' when Cloning. isVoidItem() is now a simple boolean member access - the bitfield does the needed masking. This spares one entry in the virtual function table of SfxPoolItem which is derived more than 500 times. Used the results of the experiment at https://gerrit.libreoffice.org/c/core/+/156774 to change some accesses to IsVoidItem() to use SfxItemState instead. This is for preparation of splitting up the two usages of SfxVoidItems, see commit text in the experiment. If this shows problems in the future those six places documented there may have to be changed back to use the new isVoidItem(), but should also check the ptr this time to be non-zero. Removed SFX_ITEMS_SPECIAL that is no more used anywhere. Change-Id: Ib687ca2362d72a4651c75aee0c67029088f68947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156805 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
51 lines
1.9 KiB
C++
51 lines
1.9 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#ifndef INCLUDED_SVL_VOIDITEM_HXX
|
|
#define INCLUDED_SVL_VOIDITEM_HXX
|
|
|
|
#include <svl/poolitem.hxx>
|
|
|
|
class SVL_DLLPUBLIC SfxVoidItem final : public SfxPoolItem
|
|
{
|
|
public:
|
|
static SfxPoolItem* CreateDefault();
|
|
|
|
explicit SfxVoidItem(sal_uInt16 nWhich);
|
|
SfxVoidItem(const SfxVoidItem& rCopy);
|
|
SfxVoidItem(SfxVoidItem&& rOrig);
|
|
virtual ~SfxVoidItem() override;
|
|
|
|
SfxVoidItem& operator=(SfxVoidItem const&) = delete; // due to SfxPoolItem
|
|
SfxVoidItem& operator=(SfxVoidItem&&) = delete; // due to SfxPoolItem
|
|
|
|
virtual bool operator==(const SfxPoolItem&) const override;
|
|
|
|
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
|
|
MapUnit ePresMetric, OUString& rText,
|
|
const IntlWrapper&) const override;
|
|
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
|
|
|
|
// create a copy of itself
|
|
virtual SfxVoidItem* Clone(SfxItemPool* pPool = nullptr) const override;
|
|
};
|
|
|
|
#endif
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|