19#include <PropertyForward.hxx>
20#include <com/sun/star/beans/PropertyAttribute.hpp>
32 ,
const Reference< XPropertySet>& _xDest
36 ,m_aNameMap(
std::move(_aNameMap))
41 osl_atomic_increment(&m_refCount);
42 OSL_ENSURE(
m_xDest.is(),
"Dest is NULL!");
43 OSL_ENSURE(
m_xSource.is(),
"Source is NULL!");
48 m_xDestInfo =
m_xDest->getPropertySetInfo();
49 m_xSourceInfo =
m_xSource->getPropertySetInfo();
52 ::comphelper::copyProperties(m_xDest,m_xSource);
53 for (
const auto& [rName, rPropConv] : m_aNameMap)
55 Property aProp = m_xSourceInfo->getPropertyByName(rName);
56 if (0 == (aProp.Attributes & PropertyAttribute::READONLY))
58 Any aValue = _xDest->getPropertyValue(rPropConv.first);
59 if ( 0 != (aProp.Attributes & PropertyAttribute::MAYBEVOID) || aValue.hasValue() )
60 _xSource->setPropertyValue(rName, rPropConv.second->operator()(rPropConv.first, aValue));
66 ::comphelper::copyProperties(m_xSource,m_xDest);
67 for (
const auto& [rName, rPropConv] : m_aNameMap)
68 _xDest->setPropertyValue(rPropConv.first, rPropConv.second->operator()(rPropConv.first, _xSource->getPropertyValue(rName)));
77 osl_atomic_decrement(&m_refCount);
80OPropertyMediator::~OPropertyMediator()
84void SAL_CALL OPropertyMediator::propertyChange(
const PropertyChangeEvent& evt )
93 bool bDest = (evt.Source ==
m_xDest);
96 if ( xProp.is() && xPropInfo.is() )
98 if ( xPropInfo->hasPropertyByName(evt.PropertyName) )
99 xProp->setPropertyValue(evt.PropertyName,evt.NewValue);
102 TPropertyNamePair::const_iterator aFind = m_aNameMap.find(evt.PropertyName);
104 if ( aFind != m_aNameMap.end() )
105 sPropName = aFind->second.first;
108 aFind = ::std::find_if(
111 [&evt] (
const TPropertyNamePair::value_type& namePair) {
112 return namePair.second.first == evt.PropertyName;
114 if ( aFind != m_aNameMap.end() )
115 sPropName = aFind->first;
117 if (aFind != m_aNameMap.end() && !sPropName.isEmpty() && xPropInfo->hasPropertyByName(sPropName))
118 xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue));
145void SAL_CALL OPropertyMediator::disposing(
const css::lang::EventObject& )
151void SAL_CALL OPropertyMediator::disposing()
155 m_xSourceInfo.clear();
160void OPropertyMediator::stopListening()
163 m_xSource->removePropertyChangeListener(OUString(),
this);
165 m_xDest->removePropertyChangeListener(OUString(),
this);
168void OPropertyMediator::startListening()
171 m_xSource->addPropertyChangeListener(OUString(),
this);
173 m_xDest->addPropertyChangeListener(OUString(),
this);
const Reference< XParameters > m_xDest
const Reference< XRow > m_xSource
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
::cppu::WeakImplHelper< css::beans::XPropertyChangeListener > OPropertyForward_Base
std::map< OUString, TPropertyConverter > TPropertyNamePair
constexpr OUStringLiteral PROPERTY_CHARUNDERLINE
constexpr OUStringLiteral PROPERTY_FONTDESCRIPTOR
constexpr OUStringLiteral PROPERTY_CHARFONTPITCH
constexpr OUStringLiteral PROPERTY_CHARWEIGHT
constexpr OUStringLiteral PROPERTY_CHARROTATION
constexpr OUStringLiteral PROPERTY_CHARFONTFAMILY
constexpr OUStringLiteral PROPERTY_CHARHEIGHT
constexpr OUStringLiteral PROPERTY_CHARFONTCHARSET
constexpr OUStringLiteral PROPERTY_CHARWORDMODE
constexpr OUStringLiteral PROPERTY_CHARPOSTURE
constexpr OUStringLiteral PROPERTY_CHARSCALEWIDTH
constexpr OUStringLiteral PROPERTY_CHARFONTSTYLENAME
constexpr OUStringLiteral PROPERTY_CHARSTRIKEOUT
constexpr OUStringLiteral PROPERTY_CHARFONTNAME