21#include <com/sun/star/lang/XComponent.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <osl/diagnose.h>
27#include <svx/svxids.hrc>
39 m_xPropertySet(
std::move( xPropertySet )),
40 m_rItemPool( rItemPool )
83 assert(!pRanges.
empty());
87 for(
const auto& rPair : pRanges)
89 sal_uInt16 nBeg = rPair.first;
90 sal_uInt16 nEnd = rPair.second;
92 OSL_ASSERT( nBeg <= nEnd );
93 for( sal_uInt16 nWhich = nBeg; nWhich <= nEnd; ++nWhich )
104 if( pItem->PutValue(
m_xPropertySet->getPropertyValue( aProperty.first ),
108 pItem->SetWhich(nWhich);
109 rOutItemSet.
Put( std::move(pItem) );
112 catch(
const beans::UnknownPropertyException & )
116 catch(
const uno::Exception & )
128 catch(
const uno::Exception & )
140 OSL_FAIL(
"ItemConverter: Unhandled special item found!" );
146 OSL_FAIL(
"ItemConverter: Unhandled special item found!" );
154 bool bItemsChanged =
false;
165 pItem->QueryValue( aValue, aProperty.second );
169 if( aValue !=
m_xPropertySet->getPropertyValue( aProperty.first ))
172 bItemsChanged =
true;
175 catch(
const beans::UnknownPropertyException & )
179 catch(
const uno::Exception & )
186 bItemsChanged =
ApplySpecialItem( pItem->Which(), rItemSet ) || bItemsChanged;
191 return bItemsChanged;
203 if ((nSourceItemState == SfxItemState::SET) &&
204 (rDestSet.
GetItemState(nWhich,
true, &pPoolItem) == SfxItemState::SET))
206 if (rSourceSet.
Get(nWhich) != rDestSet.
Get(nWhich))
208 if( nWhich != SID_CHAR_DLG_PREVIEW_STRING )
214 else if( nSourceItemState == SfxItemState::DONTCARE )
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const WhichRangesContainer & GetRanges() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void InvalidateItem(sal_uInt16 nWhich)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
virtual const WhichRangesContainer & GetWhichPairs() const =0
implement this method to provide an array of which-ranges
void resetPropertySet(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
sets a new property set, that you get with GetPropertySet().
virtual void FillItemSet(SfxItemSet &rOutItemSet) const
applies all properties that can be mapped to items into the given item set.
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
virtual bool ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet &rItemSet)
for items that can not be mapped directly to a property.
std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId
static void InvalidateUnequalItems(SfxItemSet &rDestSet, const SfxItemSet &rSourceSet)
Invalidates all items in rDestSet, that are set (state SfxItemState::SET) in both item sets (rDestSet...
css::uno::Reference< css::beans::XPropertySet > m_xPropertySet
SfxItemPool & GetItemPool() const
Returns the pool.
virtual void _disposing(const css::lang::EventObject &rSource) override
virtual bool GetItemProperty(tWhichIdType nWhichId, tPropertyNameWithMemberId &rOutProperty) const =0
implement this method to return a Property object for a given which id.
virtual bool ApplyItemSet(const SfxItemSet &rItemSet)
applies all properties that are results of a conversion from all items in rItemSet to the internal XP...
ItemConverter(css::uno::Reference< css::beans::XPropertySet > xPropertySet, SfxItemPool &rItemPool)
Construct an item converter that uses the given property set for reading/writing converted items.
virtual void FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet &rOutItemSet) const
for items that can not be mapped directly to a property.
SfxItemSet CreateEmptyItemSet() const
creates an empty item set using the given pool or a common pool if empty (see GetItemPool) and allowi...
virtual ~ItemConverter() override
void stopAllComponentListening()
void startComponentListening(const css::uno::Reference< css::lang::XComponent > &_rxComp)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
bool empty() const noexcept