merge CntUnencodedStringItem into SfxStringItem

which simplifies the hierarhcy.
We never allocate such a thing, we always allocate subclasses, and it
has no real meaning by itself.

Change-Id: Ie6b716c9ea6ca0efe0ae4f39ac345608c45534f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171890
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-08-15 10:24:28 +02:00
parent 6ab0c616d7
commit fb282d552f
16 changed files with 92 additions and 181 deletions

View file

@ -116,7 +116,6 @@ CntByteItem::Clone(SfxItemPool*) const
CntInt32Item::Clone(SfxItemPool*) const
CntUInt16Item::Clone(SfxItemPool*) const
CntUInt32Item::Clone(SfxItemPool*) const
CntUnencodedStringItem::Clone(SfxItemPool*) const
CodeCompleteDataCache::Clear()
CodeCompleteDataCache::InsertGlobalVar(rtl::OUString const&, rtl::OUString const&)
CodeCompleteDataCache::InsertLocalVar(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&)

View file

@ -229,7 +229,6 @@ CntByteItem::GetPresentation(SfxItemPresentation, MapUnit, MapUnit, rtl::OUStrin
CntInt32Item::Clone(SfxItemPool*) const
CntUInt16Item::Clone(SfxItemPool*) const
CntUInt32Item::Clone(SfxItemPool*) const
CntUnencodedStringItem::Clone(SfxItemPool*) const
CodeCompleteOptions::CodeCompleteOptions()
CodeCompleteOptions::IsAutoCloseParenthesisOn()
CodeCompleteOptions::IsAutoCloseQuotesOn()

View file

@ -2508,8 +2508,6 @@ include/svl/poolitem.hxx:113
enum SfxItemType CntUInt16ItemType
include/svl/poolitem.hxx:114
enum SfxItemType CntUInt32ItemType
include/svl/poolitem.hxx:115
enum SfxItemType CntUnencodedStringItemType
include/svl/poolitem.hxx:116
enum SfxItemType DatabaseMapItemType
include/svl/poolitem.hxx:117

View file

@ -345,7 +345,6 @@
#include <sot/sotdllapi.h>
#include <svl/SfxBroadcaster.hxx>
#include <svl/cjkoptions.hxx>
#include <svl/custritm.hxx>
#include <svl/eitem.hxx>
#include <svl/hint.hxx>
#include <svl/intitem.hxx>

View file

@ -1,63 +0,0 @@
/* -*- 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_CUSTRITM_HXX
#define INCLUDED_SVL_CUSTRITM_HXX
#include <svl/svldllapi.h>
#include <svl/poolitem.hxx>
#include <cassert>
#include <utility>
class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem
{
OUString m_aValue;
public:
CntUnencodedStringItem(sal_uInt16 which, SfxItemType eItemType = SfxItemType::CntUnencodedStringItemType)
: SfxPoolItem(which, eItemType)
{}
CntUnencodedStringItem(sal_uInt16 which, OUString aTheValue, SfxItemType eItemType = SfxItemType::CntUnencodedStringItemType):
SfxPoolItem(which, eItemType), m_aValue(std::move(aTheValue))
{}
virtual bool operator ==(const SfxPoolItem & rItem) const override;
virtual bool GetPresentation(SfxItemPresentation,
MapUnit, MapUnit,
OUString & rText,
const IntlWrapper&) const override;
virtual bool QueryValue(css::uno::Any& rVal,
sal_uInt8 nMemberId = 0) const override;
virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
virtual CntUnencodedStringItem* Clone(SfxItemPool * = nullptr) const override;
const OUString & GetValue() const { return m_aValue; }
void SetValue(const OUString & rTheValue) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_aValue = rTheValue; }
};
#endif // INCLUDED_SVL_CUSTRITM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -111,7 +111,6 @@ enum class SfxItemType : sal_uInt16 {
CntInt32ItemType,
CntUInt16ItemType,
CntUInt32ItemType,
CntUnencodedStringItemType,
DatabaseMapItemType,
DbuTypeCollectionItemType,
DriverPoolingSettingsItemType,

View file

@ -16,31 +16,47 @@
* 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_STRITEM_HXX
#define INCLUDED_SVL_STRITEM_HXX
#pragma once
#include <svl/svldllapi.h>
#include <svl/custritm.hxx>
#include <svl/poolitem.hxx>
#include <cassert>
#include <utility>
class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem
class SVL_DLLPUBLIC SfxStringItem: public SfxPoolItem
{
public:
static SfxPoolItem* CreateDefault();
SfxStringItem(sal_uInt16 which = 0, SfxItemType eItemType = SfxItemType::SfxStringItemType)
: CntUnencodedStringItem(which, eItemType) {}
: SfxPoolItem(which, eItemType) {}
SfxStringItem(sal_uInt16 which, const OUString & rValue, SfxItemType eItemType = SfxItemType::SfxStringItemType):
CntUnencodedStringItem(which, rValue, eItemType) {}
SfxPoolItem(which, eItemType), m_aValue(rValue) {}
virtual bool operator ==(const SfxPoolItem & rItem) const override;
virtual bool GetPresentation(SfxItemPresentation,
MapUnit, MapUnit,
OUString & rText,
const IntlWrapper&) const override;
virtual bool QueryValue(css::uno::Any& rVal,
sal_uInt8 nMemberId = 0) const override;
virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
virtual SfxStringItem* Clone(SfxItemPool * = nullptr) const override;
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
const OUString & GetValue() const { return m_aValue; }
void SetValue(const OUString & rTheValue) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_aValue = rTheValue; }
private:
OUString m_aValue;
};
#endif // INCLUDED_SVL_STRITEM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -371,7 +371,6 @@
#include <svl/SfxBroadcaster.hxx>
#include <svl/cenumitm.hxx>
#include <svl/cintitem.hxx>
#include <svl/custritm.hxx>
#include <svl/eitem.hxx>
#include <svl/hint.hxx>
#include <svl/intitem.hxx>

View file

@ -5613,7 +5613,6 @@ include/svl/cenumitm.hxx
include/svl/cintitem.hxx
include/svl/cryptosign.hxx
include/svl/ctloptions.hxx
include/svl/custritm.hxx
include/svl/documentlockfile.hxx
include/svl/eitem.hxx
include/svl/filenotation.hxx
@ -10978,7 +10977,6 @@ svl/source/items/IndexedStyleSheets.cxx
svl/source/items/aeitem.cxx
svl/source/items/cenumitm.cxx
svl/source/items/cintitem.cxx
svl/source/items/custritm.cxx
svl/source/items/flagitem.cxx
svl/source/items/globalnameitem.cxx
svl/source/items/ilstitem.cxx

View file

@ -336,7 +336,7 @@
<Type Name="SfxEnumItem &lt; * &gt;">
<DisplayString>{{which={m_nWhich,x}}} {m_nValue}</DisplayString>
</Type>
<Type Name="CntUnencodedStringItem">
<Type Name="SfxStringItem">
<DisplayString>{{which={m_nWhich,x}}} {m_aValue}</DisplayString>
</Type>
<Type Name="SfxUnoAnyItem">

View file

@ -116,7 +116,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/filepicker/pickerhistory \
svl/source/items/cenumitm \
svl/source/items/cintitem \
svl/source/items/custritm \
svl/source/items/flagitem \
svl/source/items/globalnameitem \
svl/source/items/globalpool \

View file

@ -1,71 +0,0 @@
/* -*- 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 .
*/
#include <com/sun/star/uno/Any.hxx>
#include <osl/diagnose.h>
#include <unotools/intlwrapper.hxx>
#include <svl/custritm.hxx>
// virtual
bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
{
assert(SfxPoolItem::operator==(rItem));
return m_aValue
== static_cast< const CntUnencodedStringItem * >(&rItem)->
m_aValue;
}
// virtual
bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, MapUnit,
MapUnit, OUString & rText,
const IntlWrapper&) const
{
rText = m_aValue;
return true;
}
// virtual
bool CntUnencodedStringItem::QueryValue(css::uno::Any& rVal, sal_uInt8) const
{
rVal <<= m_aValue;
return true;
}
// virtual
bool CntUnencodedStringItem::PutValue(const css::uno::Any& rVal,
sal_uInt8)
{
OUString aTheValue;
if (rVal >>= aTheValue)
{
m_aValue = aTheValue;
return true;
}
OSL_FAIL("CntUnencodedStringItem::PutValue(): Wrong type");
return false;
}
// virtual
CntUnencodedStringItem* CntUnencodedStringItem::Clone(SfxItemPool *) const
{
return new CntUnencodedStringItem(*this);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -229,31 +229,30 @@
// class SvxRsidItem : public SfxUInt32Item
// class SdrGrafGamma100Item : public SfxUInt32Item
// class SwTableBoxNumFormat : public SfxUInt32Item
//class CntUnencodedStringItem: public SfxPoolItem
// class SfxStringItem: public CntUnencodedStringItem
// class SvxPageModelItem : public SfxStringItem
// class SfxDocumentInfoItem : public SfxStringItem
// class SvxPostItAuthorItem: public SfxStringItem
// class SvxPostItDateItem: public SfxStringItem
// class SvxPostItTextItem: public SfxStringItem
// class SvxPostItIdItem: public SfxStringItem
// class SdrMeasureFormatStringItem: public SfxStringItem
// class NameOrIndex : public SfxStringItem
// class XFillBitmapItem : public NameOrIndex
// class XColorItem : public NameOrIndex
// class XFillColorItem : public XColorItem
// class XFormTextShadowColorItem : public XColorItem
// class XLineColorItem : public XColorItem
// class XSecondaryFillColorItem : public XColorItem
// class XFillGradientItem : public NameOrIndex
// class XFillFloatTransparenceItem : public XFillGradientItem
// class XFillHatchItem : public NameOrIndex
// class XLineDashItem : public NameOrIndex
// class XLineEndItem : public NameOrIndex
// class XLineStartItem : public NameOrIndex
// class SfxScriptOrganizerItem : public SfxStringItem
// class SdrLayerNameItem: public SfxStringItem
// class SwNumRuleItem : public SfxStringItem
//class SfxStringItem: public SfxPoolItem
// class SvxPageModelItem : public SfxStringItem
// class SfxDocumentInfoItem : public SfxStringItem
// class SvxPostItAuthorItem: public SfxStringItem
// class SvxPostItDateItem: public SfxStringItem
// class SvxPostItTextItem: public SfxStringItem
// class SvxPostItIdItem: public SfxStringItem
// class SdrMeasureFormatStringItem: public SfxStringItem
// class NameOrIndex : public SfxStringItem
// class XFillBitmapItem : public NameOrIndex
// class XColorItem : public NameOrIndex
// class XFillColorItem : public XColorItem
// class XFormTextShadowColorItem : public XColorItem
// class XLineColorItem : public XColorItem
// class XSecondaryFillColorItem : public XColorItem
// class XFillGradientItem : public NameOrIndex
// class XFillFloatTransparenceItem : public XFillGradientItem
// class XFillHatchItem : public NameOrIndex
// class XLineDashItem : public NameOrIndex
// class XLineEndItem : public NameOrIndex
// class XLineStartItem : public NameOrIndex
// class SfxScriptOrganizerItem : public SfxStringItem
// class SdrLayerNameItem: public SfxStringItem
// class SwNumRuleItem : public SfxStringItem
//class SfxBoolItem : public SfxPoolItem
// class SvxAutoKernItem : public SfxBoolItem
// class SvxBlinkItem : public SfxBoolItem

View file

@ -19,6 +19,48 @@
#include <svl/stritem.hxx>
#include <libxml/xmlwriter.h>
#include <com/sun/star/uno/Any.hxx>
#include <osl/diagnose.h>
#include <unotools/intlwrapper.hxx>
// virtual
bool SfxStringItem::GetPresentation(SfxItemPresentation, MapUnit,
MapUnit, OUString & rText,
const IntlWrapper&) const
{
rText = m_aValue;
return true;
}
// virtual
bool SfxStringItem::QueryValue(css::uno::Any& rVal, sal_uInt8) const
{
rVal <<= m_aValue;
return true;
}
// virtual
bool SfxStringItem::PutValue(const css::uno::Any& rVal,
sal_uInt8)
{
OUString aTheValue;
if (rVal >>= aTheValue)
{
m_aValue = aTheValue;
return true;
}
OSL_FAIL("CntUnencodedStringItem::PutValue(): Wrong type");
return false;
}
// virtual
bool SfxStringItem::operator ==(const SfxPoolItem & rItem) const
{
assert(SfxPoolItem::operator==(rItem));
return m_aValue
== static_cast< const SfxStringItem * >(&rItem)->
m_aValue;
}
// virtual
SfxStringItem* SfxStringItem::Clone(SfxItemPool *) const

View file

@ -434,7 +434,6 @@
#include <svl/broadcast.hxx>
#include <svl/cenumitm.hxx>
#include <svl/cintitem.hxx>
#include <svl/custritm.hxx>
#include <svl/eitem.hxx>
#include <svl/grabbagitem.hxx>
#include <svl/hint.hxx>

View file

@ -309,7 +309,6 @@
#include <svl/broadcast.hxx>
#include <svl/cenumitm.hxx>
#include <svl/cintitem.hxx>
#include <svl/custritm.hxx>
#include <svl/eitem.hxx>
#include <svl/hint.hxx>
#include <svl/intitem.hxx>