f50b72ed6c
...instead of just WID. For example when loading caolan/sdrobject_getmergeditemset_null_ptr_dereference.sample (from the crashtestdata files) under UBSan, > #4 0x00007fffeeacde54 in SvxItemPropertySet::getPropertyValue(SfxItemPropertySimpleEntry const*) const (this=0x607001a356d0, pMap=0x604000ec2e60) at /home/sbergman/lo/core/editeng/source/uno/unoipset.cxx:219 > #5 0x00007fffda713cb9 in SvxShape::_getPropertyValue(rtl::OUString const&) (this=0x6150015d7980, PropertyName="CharUnderlineColor") at /home/sbergman/lo/core/svx/source/unodraw/unoshape.cxx:1775 > #6 0x00007fffda70dbe9 in SvxShape::getPropertyValue(rtl::OUString const&) (this=0x6150015d7980, PropertyName="CharUnderlineColor") at /home/sbergman/lo/core/svx/source/unodraw/unoshape.cxx:1721 > #7 0x00007fffda713f3e in non-virtual thunk to SvxShape::getPropertyValue(rtl::OUString const&) () at /home/sbergman/lo/core/instdir/program/libsvxcorelo.so > #8 0x00007fff19e8cfa6 in SwXShape::_getPropAtAggrObj(rtl::OUString const&) (this=0x610000183540, _rPropertyName="CharUnderlineColor") at /home/sbergman/lo/core/sw/source/core/unocore/unodraw.cxx:1735 > #9 0x00007fff19e8b511 in SwXShape::getPropertyValue(rtl::OUString const&) (this=0x610000183540, rPropertyName="CharUnderlineColor") at /home/sbergman/lo/core/sw/source/core/unocore/unodraw.cxx:1665 [...] would first store an Any with value sal_Int32 -1 (representing an RGBA 255/255/255/255 color) in aCombineList for property CharUnderlineColor with WID = EE_CHAR_UNDERLINE = 4027 and member-ID = MID_TL_COLOR = 2, but then read back out that Any for property CharUnderline with the same WID but member-ID = MID_TL_STYLE = 1 and use it at > include/svl/eitem.hxx:47:20: runtime error: load of value 4294967295, which is not a valid value for type 'FontLineStyle' > #0 in SfxEnumItem<FontLineStyle>::SetValue(FontLineStyle) at include/svl/eitem.hxx:47:20 > #1 in SvxTextLineItem::PutValue(com::sun:⭐:uno::Any const&, unsigned char) at editeng/source/items/textitem.cxx:1016:13 > #2 in SvxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const*, com::sun:⭐:uno::Any const&, SfxItemSet&, bool) at editeng/source/uno/unoipset.cxx:178:19 > #3 in SvxItemPropertySet_setPropertyValue(SfxItemPropertySimpleEntry const*, com::sun:⭐:uno::Any const&, SfxItemSet&) at svx/source/unodraw/unoshape.cxx:4119:5 > #4 in SvxItemPropertySet_ObtainSettingsFromPropertySet(SvxItemPropertySet const&, SfxItemSet&, com::sun:⭐:uno::Reference<com::sun:⭐🫘:XPropertySet> const&, SfxItemPropertyMap const*) at svx/source/unodraw/unoshape.cxx:638:29 > #5 in SvxShape::ObtainSettingsFromPropertySet(SvxItemPropertySet const&) at svx/source/unodraw/unoshape.cxx:656:9 > #6 in SvxShape::Create(SdrObject*, SvxDrawPage*) at svx/source/unodraw/unoshape.cxx:413:5 > #7 in SvxShapeText::Create(SdrObject*, SvxDrawPage*) at svx/source/unodraw/unoshape.cxx:3867:15 > #8 in SvxDrawPage::add(com::sun:⭐:uno::Reference<com::sun:⭐:drawing::XShape> const&) at svx/source/unodraw/unopage.cxx:234:13 > #9 in SwXDrawPage::add(com::sun:⭐:uno::Reference<com::sun:⭐:drawing::XShape> const&) at sw/source/core/unocore/unodraw.cxx:597:19 > #10 in SwXShape::attach(com::sun:⭐:uno::Reference<com::sun:⭐:text::XTextRange> const&) at sw/source/core/unocore/unodraw.cxx:2056:22 [...] Change-Id: Ic0cf34440507c768b13d1b5b957425d6a43271ac Reviewed-on: https://gerrit.libreoffice.org/74635 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
73 lines
3.3 KiB
C++
73 lines
3.3 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_EDITENG_UNOIPSET_HXX
|
|
#define INCLUDED_EDITENG_UNOIPSET_HXX
|
|
|
|
#include <editeng/editengdllapi.h>
|
|
#include <svl/itemprop.hxx>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace com::sun::star::beans { class XPropertySetInfo; }
|
|
|
|
class SfxItemSet;
|
|
struct SvxIDPropertyCombine;
|
|
|
|
class EDITENG_DLLPUBLIC SvxItemPropertySet
|
|
{
|
|
SfxItemPropertyMap m_aPropertyMap;
|
|
mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo;
|
|
::std::vector< std::unique_ptr<SvxIDPropertyCombine> > aCombineList;
|
|
SfxItemPool& mrItemPool;
|
|
|
|
public:
|
|
SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool );
|
|
~SvxItemPropertySet();
|
|
|
|
SvxItemPropertySet& operator=( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround
|
|
SvxItemPropertySet( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround
|
|
|
|
// Methods, which work directly with the ItemSet
|
|
static css::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues );
|
|
static void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const css::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues );
|
|
|
|
// Methods that use Any instead
|
|
css::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const;
|
|
void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const css::uno::Any& rVal ) const;
|
|
|
|
bool AreThereOwnUsrAnys() const { return ! aCombineList.empty(); }
|
|
css::uno::Any* GetUsrAnyForID(SfxItemPropertySimpleEntry const & entry) const;
|
|
void AddUsrAnyForID(const css::uno::Any& rAny, SfxItemPropertySimpleEntry const & entry);
|
|
void ClearAllUsrAny();
|
|
|
|
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const;
|
|
const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;}
|
|
const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString &rName) const;
|
|
};
|
|
|
|
/** converts the given any with a metric to 100th/mm if needed */
|
|
EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, css::uno::Any & rMetric ) throw();
|
|
|
|
/** converts the given any with a metric from 100th/mm to the given metric if needed */
|
|
EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, css::uno::Any & rMetric ) throw();
|
|
|
|
#endif // INCLUDED_EDITENG_UNOIPSET_HXX
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|