22#include <com/sun/star/lang/NullPointerException.hpp>
23#include <com/sun/star/lang/IllegalArgumentException.hpp>
25#include <osl/diagnose.h>
50 OUString sPropertyName;
52 SetPropertyValue( OUString _aPropertyName,
const Any& _rValue ) : sPropertyName(
std::move( _aPropertyName )), rValue( _rValue ) { }
53 void operator()(
const Reference< XPropertyHandler >& _rHandler )
55 _rHandler->setPropertyValue( sPropertyName, rValue );
60 template <
class BagType >
61 void putIntoBag(
const Sequence< typename BagType::value_type >& _rArray, BagType& _rBag )
63 std::copy( _rArray.begin(), _rArray.end(),
64 std::insert_iterator< BagType >( _rBag, _rBag.begin() ) );
68 template <
class BagType >
69 void copyBagToArray(
const BagType& _rBag, Sequence< typename BagType::value_type >& _rArray )
71 _rArray.realloc( _rBag.size() );
72 std::copy( _rBag.begin(), _rBag.end(), _rArray.getArray() );
88 ,m_aSlaveHandlers (
std::move(_rSlaveHandlers) )
90 ,m_bSupportedPropertiesAreKnown ( false )
93 throw IllegalArgumentException();
97 Reference< XPropertyChangeListener > xMeMyselfAndI(
this );
100 if ( !slaveHandler.is() )
101 throw NullPointerException();
102 slaveHandler->addPropertyChangeListener( xMeMyselfAndI );
115 slaveHandler->inspect( _rxIntrospectee );
137 return m_aSlaveHandlers[0]->convertToPropertyValue( _rPropertyName, _rControlValue );
144 return m_aSlaveHandlers[0]->convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType );
154 PropertyState eState = PropertyState_DIRECT_VALUE;
158 Any aPrimaryValue = xPrimary->getPropertyValue( _rPropertyName );
159 eState = xPrimary->getPropertyState( _rPropertyName );
162 PropertyState eSecondaryState = PropertyState_DIRECT_VALUE;
169 eSecondaryState = (*loop)->getPropertyState( _rPropertyName );
172 Any aSecondaryValue( (*loop)->getPropertyValue( _rPropertyName ) );
174 if ( ( PropertyState_AMBIGUOUS_VALUE == eSecondaryState )
175 || ( aPrimaryValue != aSecondaryValue )
178 eState = PropertyState_AMBIGUOUS_VALUE;
220 putIntoBag( (*loop)->getSupportedProperties(), aThisRound );
225 std::insert_iterator< PropertyBag >( aIntersection, aIntersection.begin() ),
PropertyLessByName() );
238 if ( !bIsComposable )
254 Sequence< OUString >& _rUnion )
256 std::set< OUString > aUnitedBag;
258 Sequence< OUString > aThisRound;
259 for (
auto const& handler : _rHandlers)
261 aThisRound = (handler.get()->*pGetter)();
262 putIntoBag( aThisRound, aUnitedBag );
265 copyBagToArray( aUnitedBag, _rUnion );
274 Sequence< OUString > aSuperseded;
285 Sequence< OUString > aActuating;
292 const Reference< XPropertyControlFactory >& _rxControlFactory )
295 return m_aSlaveHandlers[0]->describePropertyLine( _rPropertyName, _rxControlFactory );
308 if ( !_rxInspectorUI.is() )
309 throw NullPointerException();
326 case InteractiveSelectionResult_Cancelled:
330 case InteractiveSelectionResult_Success:
331 case InteractiveSelectionResult_Pending:
332 OSL_FAIL(
"PropertyComposer::onInteractivePropertySelection: no chance to forward the new value to the other handlers!" );
340 eResult = InteractiveSelectionResult_Cancelled;
343 case InteractiveSelectionResult_ObtainedValue:
349 OSL_FAIL(
"OPropertyBrowserController::onInteractivePropertySelection: unknown result value!" );
361 "PropertyComposer::impl_ensureUIRequestComposer: somebody's changing the horse "
362 "in the mid of the race!");
371 if ( !_rxInspectorUI.is() )
372 throw NullPointerException();
385 for (
const auto & aThisHandlersActuatingProp : aThisHandlersActuatingProps)
387 if ( aThisHandlersActuatingProp == _rActuatingPropertyName )
389 slaveHandler->actuatingPropertyChanged( _rActuatingPropertyName, _rNewValue, _rOldValue,
407 for (
auto const& slaveHandler : m_aSlaveHandlers)
409 slaveHandler->removePropertyChangeListener(
this );
410 slaveHandler->dispose();
415 if (m_pUIRequestComposer)
416 m_pUIRequestComposer->dispose();
417 m_pUIRequestComposer.reset();
427 PropertyChangeEvent aTranslatedEvent( evt );
450 for ( PropertyComposer::HandlerArray::const_iterator loop =
m_aSlaveHandlers.begin();
455 if ( !(*loop)->suspend( _bSuspend ) )
465 (*loop)->suspend(
false );
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
helper class composing requests to a ->XObjectInspectorUI interface, coming from multiple sources
implements an <type>XPropertyHandler</type> which composes its information from a set of other proper...
std::unique_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer
virtual void SAL_CALL inspect(const css::uno::Reference< css::uno::XInterface > &_rxIntrospectee) override
bool m_bSupportedPropertiesAreKnown
virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString &_rPropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory) override
virtual sal_Bool SAL_CALL isComposable(const OUString &_rPropertyName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override
HandlerArray m_aSlaveHandlers
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &_rPropertyName) override
std::vector< css::uno::Reference< css::inspection::XPropertyHandler > > HandlerArray
virtual css::uno::Any SAL_CALL convertToPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rControlValue) override
virtual void SAL_CALL setPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override
bool impl_isSupportedProperty_nothrow(const OUString &_rPropertyName)
checks whether a given property exists in <member>m_aSupportedProperties</member>
PropertyBag m_aSupportedProperties
virtual void SAL_CALL actuatingPropertyChanged(const OUString &_rActuatingPropertyName, const css::uno::Any &_rNewValue, const css::uno::Any &_rOldValue, const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI, sal_Bool _bFirstTimeInit) override
virtual void SAL_CALL addPropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener) override
void impl_ensureUIRequestComposer(const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI)
ensures that m_pUIRequestComposer exists
PropertyChangeListeners m_aPropertyListeners
virtual void SAL_CALL removePropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener) override
virtual bool hasPropertyByName(const OUString &_rName) override
virtual css::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const OUString &_rPropertyName, sal_Bool _bPrimary, css::uno::Any &_rData, const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI) override
virtual void SAL_CALL disposing() override
virtual sal_Bool SAL_CALL suspend(sal_Bool _bSuspend) override
virtual css::uno::Any SAL_CALL convertToControlValue(const OUString &_rPropertyName, const css::uno::Any &_rPropertyValue, const css::uno::Type &_rControlValueType) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &_rPropertyName) override
PropertyComposer(std::vector< css::uno::Reference< css::inspection::XPropertyHandler > > &&_rSlaveHandlers)
constructs an <type>XPropertyHandler</type> which composes its information from a set of other proper...
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getSupportedProperties() override
#define DBG_UNHANDLED_EXCEPTION(...)
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > check(dp_misc::DescriptionInfoset const &infoset)
a property handler for any virtual string properties
IMPLEMENT_FORWARD_XCOMPONENT(GenericPropertyHandler, GenericPropertyHandler_Base)
static void uniteStringArrays(const PropertyComposer::HandlerArray &_rHandlers, Sequence< OUString >(SAL_CALL XPropertyHandler::*pGetter)(), Sequence< OUString > &_rUnion)
std::set< css::beans::Property, PropertyLessByName > PropertyBag
::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler, css::beans::XPropertyChangeListener > PropertyComposer_Base
void clearContainer(CONTAINER &_rContainer)