27#include <com/sun/star/form/FormButtonType.hpp>
28#include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
29#include <com/sun/star/inspection/XObjectInspectorUI.hpp>
30#include <com/sun/star/lang/NullPointerException.hpp>
55 :
EFormsHelper( _rMutex, _rxIntrospectee, _rxContextDocument )
58 "SubmissionHelper::SubmissionHelper: you should not have instantiated me!" );
63 const Reference< frame::XModel >& _rxContextDocument )
70 Reference< submission::XSubmissionSupplier > xSubmissionSupp( _rxControlModel, UNO_QUERY );
71 if ( xSubmissionSupp.is() )
100 return "com.sun.star.comp.extensions.SubmissionPropertyHandler";
106 return {
"com.sun.star.form.inspection.SubmissionPropertyHandler" };
112 ::osl::MutexGuard aGuard(
m_aMutex );
115 OSL_ENSURE(
m_pHelper,
"SubmissionPropertyHandler::getPropertyValue: inconsistency!");
125 Reference< submission::XSubmissionSupplier > xSubmissionSupp(
m_xComponent, UNO_QUERY );
126 OSL_ENSURE( xSubmissionSupp.is(),
"SubmissionPropertyHandler::getPropertyValue: this should never happen ..." );
128 Reference< submission::XSubmission > xSubmission;
129 if ( xSubmissionSupp.is() )
130 xSubmission = xSubmissionSupp->getSubmission( );
131 aReturn <<= xSubmission;
137 FormButtonType
eType = FormButtonType_PUSH;
139 if ( (
eType != FormButtonType_PUSH ) && (
eType != FormButtonType_SUBMIT ) )
140 eType = FormButtonType_PUSH;
146 OSL_FAIL(
"SubmissionPropertyHandler::getPropertyValue: cannot handle this property!" );
161 ::osl::MutexGuard aGuard(
m_aMutex );
164 OSL_ENSURE(
m_pHelper,
"SubmissionPropertyHandler::setPropertyValue: inconsistency!");
173 Reference< submission::XSubmission > xSubmission;
174 OSL_VERIFY( _rValue >>= xSubmission );
176 Reference< submission::XSubmissionSupplier > xSubmissionSupp(
m_xComponent, UNO_QUERY );
177 OSL_ENSURE( xSubmissionSupp.is(),
"SubmissionPropertyHandler::setPropertyValue: this should never happen ..." );
179 if ( xSubmissionSupp.is() )
181 xSubmissionSupp->setSubmission( xSubmission );
192 OSL_FAIL(
"SubmissionPropertyHandler::setPropertyValue: cannot handle this id!" );
204 ::osl::MutexGuard aGuard(
m_aMutex );
206 return Sequence< OUString >();
215 ::osl::MutexGuard aGuard(
m_aMutex );
217 return Sequence< OUString >();
237 DBG_ASSERT( xDocument.is(),
"SubmissionPropertyHandler::onNewComponent: no document!" );
260 return Sequence< Property >();
266 const Reference< XPropertyControlFactory >& _rxControlFactory )
268 ::osl::MutexGuard aGuard(
m_aMutex );
269 if ( !_rxControlFactory.is() )
270 throw NullPointerException();
274 std::vector< OUString > aListEntries;
287 aListEntries.resize( 2 );
292 OSL_FAIL(
"SubmissionPropertyHandler::describePropertyLine: cannot handle this id!" );
293 return LineDescriptor();
296 LineDescriptor aDescriptor;
298 aDescriptor.DisplayName =
m_pInfoService->getPropertyTranslation( nPropId );
299 aDescriptor.Category =
"General";
307 if ( !_rxInspectorUI.is() )
308 throw NullPointerException();
310 ::osl::MutexGuard aGuard(
m_aMutex );
313 "SubmissionPropertyHandler::actuatingPropertyChanged: inconsistency!");
316 switch ( nActuatingPropId )
320 FormButtonType
eType = FormButtonType_PUSH;
321 OSL_VERIFY( _rNewValue >>=
eType );
327 OSL_FAIL(
"SubmissionPropertyHandler::actuatingPropertyChanged: cannot handle this id!" );
334 ::osl::MutexGuard aGuard(
m_aMutex );
339 "SubmissionPropertyHandler::convertToPropertyValue: we have no SupportedProperties!");
341 return aPropertyValue;
343 OUString sControlValue;
344 OSL_VERIFY( _rControlValue >>= sControlValue );
352 aPropertyValue <<= xSubmission;
361 aEnumConversion->getValueFromDescription( sControlValue, aPropertyValue );
366 OSL_FAIL(
"SubmissionPropertyHandler::convertToPropertyValue: cannot handle this id!" );
369 return aPropertyValue;
375 ::osl::MutexGuard aGuard(
m_aMutex );
380 "SubmissionPropertyHandler::convertToControlValue: we have no SupportedProperties!");
382 return aControlValue;
384 OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING,
385 "SubmissionPropertyHandler::convertToControlValue: all our controls should use strings for value exchange!" );
392 Reference< XPropertySet > xSubmission( _rPropertyValue, UNO_QUERY );
393 if ( xSubmission.is() )
403 aControlValue <<= aEnumConversion->getDescriptionForValue( _rPropertyValue );
408 OSL_FAIL(
"SubmissionPropertyHandler::convertToControlValue: cannot handle this id!" );
411 return aControlValue;
424extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
426 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any>
const&)
PropertiesInfo aProperties
friend friend class OPropertyChangeMultiplexer
mutable::osl::Mutex m_aMutex
an implementation of the IPropertyEnumRepresentation
static OUString getHelpURL(std::u16string_view)
PropertyHandler implementation which additionally supports XServiceInfo.
static css::uno::Reference< css::inspection::XPropertyControl > createListBoxControl(const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory, std::vector< OUString > &&_rInitialListEntries, bool _bReadOnlyControl, bool _bSorted)
creates an <member scope="css::inspection">PropertyControlType::ListBox</member>-type control and fil...
std::unique_ptr< OPropertyInfoService > m_pInfoService
access to property meta data
virtual void onNewComponent()
called when XPropertyHandler::inspect has been called, and we thus have a new component to inspect
void firePropertyChange(const OUString &_rPropName, PropertyId _nPropId, const css::uno::Any &_rOldValue, const css::uno::Any &_rNewValue)
fires the change in a property value to our listener (if any)
PropertyId impl_getPropertyId_throwUnknownProperty(const OUString &_rPropertyName) const
retrieves the property id for a given property name
css::uno::Reference< css::beans::XPropertySet > m_xComponent
the component we're inspecting
PropertyId impl_getPropertyId_throwRuntime(const OUString &_rPropertyName) const
retrieves the property id for a given property name
void impl_setContextDocumentModified_nothrow() const
marks the context document as modified
css::uno::Reference< css::frame::XModel > impl_getContextDocument_nothrow() const
returns the value of the ContextDocument property in the ComponentContext which was used to create th...
void implAddPropertyDescription(std::vector< css::beans::Property > &_rProperties, const OUString &_rPropertyName, const css::uno::Type &_rType, sal_Int16 _nAttribs=0) const
adds a Property, given by name only, to a given vector of Properties
SubmissionHelper(osl::Mutex &_rMutex, const css::uno::Reference< css::beans::XPropertySet > &_rxIntrospectee, const css::uno::Reference< css::frame::XModel > &_rxContextDocument)
static bool canTriggerSubmissions(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxContextDocument)
determines whether the given control model is able to trigger submissions
a property handler for any virtual string properties
virtual css::uno::Sequence< css::beans::Property > doDescribeSupportedProperties() const 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 convertToPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rControlValue) override
SubmissionPropertyHandler(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
rtl::Reference<::comphelper::OPropertyChangeMultiplexer > m_xPropChangeMultiplexer
virtual void SAL_CALL setPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rValue) override
std::unique_ptr< SubmissionHelper > m_pHelper
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &_rPropertyName) override
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) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~SubmissionPropertyHandler() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override
virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvent) override
virtual void onNewComponent() override
called when XPropertyHandler::inspect has been called, and we thus have a new component to inspect
virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString &_rPropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory) override
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
a property handler for any virtual string properties
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * extensions_propctrlr_SubmissionPropertyHandler_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)