LibreOffice Module extensions (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
pcr::EFormsHelper Class Reference

#include <eformshelper.hxx>

Inheritance diagram for pcr::EFormsHelper:
[legend]
Collaboration diagram for pcr::EFormsHelper:
[legend]

Public Types

enum  ModelElementType {
  Submission ,
  Binding
}
 types of sub-elements of a model More...
 

Public Member Functions

 EFormsHelper (::osl::Mutex &_rMutex, const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const css::uno::Reference< css::frame::XModel > &_rxContextDocument)
 
void registerBindingListener (const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxBindingListener)
 registers a listener to be notified when any aspect of the binding changes. More...
 
void revokeBindingListener (const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxBindingListener)
 revokes the binding listener which has previously been registered More...
 
bool canBindToDataType (sal_Int32 _nDataType=-1) const
 checks whether it's possible to bind the control model to a given XSD data type More...
 
bool canBindToAnyDataType () const
 checks whether the control model can be bound to any XSD data type More...
 
bool isListEntrySink () const
 checks whether the control model is a source for list entries, as supplied by XML data bindings More...
 
void getFormModelNames (std::vector< OUString > &_rModelNames) const
 retrieves the names of all XForms models in the document the control lives in More...
 
void getBindingNames (const OUString &_rModelName, std::vector< OUString > &_rBindingNames) const
 retrieves the names of all bindings for a given model More...
 
css::uno::Reference< css::xforms::XModel > getFormModelByName (const OUString &_rModelName) const
 retrieves the XForms model (within the control model's document) with the given name More...
 
css::uno::Reference< css::xforms::XModel > getCurrentFormModel () const
 retrieves the model which the active binding of the control model belongs to More...
 
OUString getCurrentFormModelName () const
 retrieves the name of the model which the active binding of the control model belongs to More...
 
css::uno::Reference< css::beans::XPropertySetgetCurrentBinding () const
 retrieves the binding instance which is currently attached to the control model More...
 
OUString getCurrentBindingName () const
 retrieves the name of the binding instance which is currently attached to the control model More...
 
void setBinding (const css::uno::Reference< css::beans::XPropertySet > &_rxBinding)
 sets a new binding at the control model More...
 
css::uno::Reference< css::form::binding::XListEntrySource > getCurrentListSourceBinding () const
 retrieves the binding instance which is currently used as list source for the control model More...
 
void setListSourceBinding (const css::uno::Reference< css::form::binding::XListEntrySource > &_rxListSource)
 sets a new list source at the control model More...
 
css::uno::Reference< css::beans::XPropertySetgetOrCreateBindingForModel (const OUString &_rTargetModel, const OUString &_rBindingName) const
 retrieves a given binding for a given model, or creates a new one More...
 
css::uno::Reference< css::beans::XPropertySetgetModelElementFromUIName (const ModelElementType _eType, const OUString &_rUIName) const
 retrieves the submission object for an UI name More...
 
void getAllElementUINames (const ModelElementType _eType, std::vector< OUString > &_rElementNames, bool _bPrepentEmptyEntry)
 retrieves the UI names of all elements of all models in our document More...
 

Static Public Member Functions

static bool isEForm (const css::uno::Reference< css::frame::XModel > &_rxContextDocument)
 determines whether the given document is an eForm More...
 
static OUString getModelElementUIName (const ModelElementType _eType, const css::uno::Reference< css::beans::XPropertySet > &_rxElement)
 retrieves the name of a model's sub-element, as to be shown in the UI More...
 

Protected Member Functions

void firePropertyChanges (const css::uno::Reference< css::beans::XPropertySet > &_rxOldProps, const css::uno::Reference< css::beans::XPropertySet > &_rxNewProps, std::set< OUString > &_rFilter) const
 
void firePropertyChange (const OUString &_rName, const css::uno::Any &_rOldValue, const css::uno::Any &_rNewValue) const
 fires a change in a single property, if the property value changed, and if we have a listener interested in property changes More...
 

Protected Attributes

css::uno::Reference< css::beans::XPropertySetm_xControlModel
 
css::uno::Reference< css::form::binding::XBindableValue > m_xBindableControl
 
css::uno::Reference< css::xforms::XFormsSupplier > m_xDocument
 
PropertyChangeListeners m_aPropertyListeners
 
MapStringToPropertySet m_aSubmissionUINames
 
MapStringToPropertySet m_aBindingUINames
 

Private Member Functions

void impl_switchBindingListening_throw (bool _bDoListening, const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener)
 
css::uno::Reference< css::beans::XPropertySetimplGetOrCreateBinding (const OUString &_rTargetModel, const OUString &_rBindingName) const
 implementation for both <member>getOrCreateBindingForModel</member> More...
 
void impl_toggleBindingPropertyListening_throw (bool _bDoListen, const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxConcreteListenerOrNull)
 
 EFormsHelper (const EFormsHelper &)=delete
 
EFormsHelperoperator= (const EFormsHelper &)=delete
 

Detailed Description

Definition at line 48 of file eformshelper.hxx.

Member Enumeration Documentation

◆ ModelElementType

types of sub-elements of a model

Enumerator
Submission 
Binding 

Definition at line 177 of file eformshelper.hxx.

Constructor & Destructor Documentation

◆ EFormsHelper() [1/2]

pcr::EFormsHelper::EFormsHelper ( ::osl::Mutex &  _rMutex,
const css::uno::Reference< css::beans::XPropertySet > &  _rxControlModel,
const css::uno::Reference< css::frame::XModel > &  _rxContextDocument 
)

◆ EFormsHelper() [2/2]

pcr::EFormsHelper::EFormsHelper ( const EFormsHelper )
privatedelete

Member Function Documentation

◆ canBindToAnyDataType()

bool pcr::EFormsHelper::canBindToAnyDataType ( ) const
inline

checks whether the control model can be bound to any XSD data type

Definition at line 110 of file eformshelper.hxx.

References canBindToDataType().

◆ canBindToDataType()

bool pcr::EFormsHelper::canBindToDataType ( sal_Int32  _nDataType = -1) const

checks whether it's possible to bind the control model to a given XSD data type

Parameters
_nDataTypethe data type which should be bound. If this is -1, <TRUE> is returned if the control model can be bound to any data type.

Definition at line 102 of file eformshelper.cxx.

References Exception, PROPERTY_CLASSID, SERVICE_COMPONENT_FORMATTEDFIELD, and TOOLS_WARN_EXCEPTION.

Referenced by canBindToAnyDataType().

◆ firePropertyChange()

void pcr::EFormsHelper::firePropertyChange ( const OUString &  _rName,
const css::uno::Any &  _rOldValue,
const css::uno::Any &  _rNewValue 
) const
protected

fires a change in a single property, if the property value changed, and if we have a listener interested in property changes

Definition at line 699 of file eformshelper.cxx.

References aEvent, Exception, and TOOLS_WARN_EXCEPTION.

Referenced by pcr::XSDValidationHelper::setValidatingDataTypeByName().

◆ firePropertyChanges()

void pcr::EFormsHelper::firePropertyChanges ( const css::uno::Reference< css::beans::XPropertySet > &  _rxOldProps,
const css::uno::Reference< css::beans::XPropertySet > &  _rxNewProps,
std::set< OUString > &  _rFilter 
) const
protected

◆ getAllElementUINames()

void pcr::EFormsHelper::getAllElementUINames ( const ModelElementType  _eType,
std::vector< OUString > &  _rElementNames,
bool  _bPrepentEmptyEntry 
)

retrieves the UI names of all elements of all models in our document

Parameters
_eTypethe type of elements for which the names should be retrieved
_rElementNamesthe array of element names
See also
getModelElementUIName
getModelElementFromUIName

Definition at line 635 of file eformshelper.cxx.

References Any, Exception, i, PROPERTY_MODEL, TOOLS_WARN_EXCEPTION, and xModel.

◆ getBindingNames()

void pcr::EFormsHelper::getBindingNames ( const OUString &  _rModelName,
std::vector< OUString > &  _rBindingNames 
) const

retrieves the names of all bindings for a given model

See also
getFormModelNames

Definition at line 316 of file eformshelper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xModel.

◆ getCurrentBinding()

Reference< XPropertySet > pcr::EFormsHelper::getCurrentBinding ( ) const

retrieves the binding instance which is currently attached to the control model

Definition at line 395 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

Referenced by pcr::XSDValidationHelper::getValidatingDataTypeName(), and pcr::XSDValidationHelper::setValidatingDataTypeByName().

◆ getCurrentBindingName()

OUString pcr::EFormsHelper::getCurrentBindingName ( ) const

retrieves the name of the binding instance which is currently attached to the control model

Definition at line 413 of file eformshelper.cxx.

References Exception, PROPERTY_BINDING_ID, and TOOLS_WARN_EXCEPTION.

◆ getCurrentFormModel()

Reference< xforms::XModel > pcr::EFormsHelper::getCurrentFormModel ( ) const

retrieves the model which the active binding of the control model belongs to

Definition at line 359 of file eformshelper.cxx.

References Exception, PROPERTY_MODEL, TOOLS_WARN_EXCEPTION, and xModel.

Referenced by pcr::XSDValidationHelper::getDataTypeRepository().

◆ getCurrentFormModelName()

OUString pcr::EFormsHelper::getCurrentFormModelName ( ) const

retrieves the name of the model which the active binding of the control model belongs to

Definition at line 378 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

◆ getCurrentListSourceBinding()

Reference< XListEntrySource > pcr::EFormsHelper::getCurrentListSourceBinding ( ) const

retrieves the binding instance which is currently used as list source for the control model

See also
isListEntrySink

Definition at line 430 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

◆ getFormModelByName()

Reference< xforms::XModel > pcr::EFormsHelper::getFormModelByName ( const OUString &  _rModelName) const

retrieves the XForms model (within the control model's document) with the given name

Definition at line 341 of file eformshelper.cxx.

References Exception, m_xDocument, and TOOLS_WARN_EXCEPTION.

Referenced by pcr::XSDValidationHelper::getDataTypeRepository().

◆ getFormModelNames()

void pcr::EFormsHelper::getFormModelNames ( std::vector< OUString > &  _rModelNames) const

retrieves the names of all XForms models in the document the control lives in

Definition at line 291 of file eformshelper.cxx.

References Exception, m_xDocument, and TOOLS_WARN_EXCEPTION.

◆ getModelElementFromUIName()

Reference< XPropertySet > pcr::EFormsHelper::getModelElementFromUIName ( const ModelElementType  _eType,
const OUString &  _rUIName 
) const

retrieves the submission object for an UI name

Note that <member>getAllElementUINames</member> must have been called before, for the given element type

See also
getModelElementUIName
getAllElementUINames

Definition at line 625 of file eformshelper.cxx.

References pos.

◆ getModelElementUIName()

OUString pcr::EFormsHelper::getModelElementUIName ( const ModelElementType  _eType,
const css::uno::Reference< css::beans::XPropertySet > &  _rxElement 
)
static

retrieves the name of a model's sub-element, as to be shown in the UI

See also
getModelElementFromUIName
getAllElementUINames

Definition at line 599 of file eformshelper.cxx.

References Exception, PROPERTY_MODEL, TOOLS_WARN_EXCEPTION, and xModel.

Referenced by pcr::EFormsPropertyHandler::convertToControlValue(), and pcr::SubmissionPropertyHandler::convertToControlValue().

◆ getOrCreateBindingForModel()

Reference< XPropertySet > pcr::EFormsHelper::getOrCreateBindingForModel ( const OUString &  _rTargetModel,
const OUString &  _rBindingName 
) const

retrieves a given binding for a given model, or creates a new one

Parameters
_rTargetModelthe name of the model to create a binding for. Must not be empty
_rBindingNamethe name of the binding to retrieve. If the model denoted by <arg>_rTargetModel</arg> does not have a binding with this name, a new binding is created and returned.

Definition at line 490 of file eformshelper.cxx.

◆ impl_switchBindingListening_throw()

void pcr::EFormsHelper::impl_switchBindingListening_throw ( bool  _bDoListening,
const css::uno::Reference< css::beans::XPropertyChangeListener > &  _rxListener 
)
private

Definition at line 212 of file eformshelper.cxx.

◆ impl_toggleBindingPropertyListening_throw()

void pcr::EFormsHelper::impl_toggleBindingPropertyListening_throw ( bool  _bDoListen,
const css::uno::Reference< css::beans::XPropertyChangeListener > &  _rxConcreteListenerOrNull 
)
private

◆ implGetOrCreateBinding()

Reference< XPropertySet > pcr::EFormsHelper::implGetOrCreateBinding ( const OUString &  _rTargetModel,
const OUString &  _rBindingName 
) const
private

implementation for both <member>getOrCreateBindingForModel</member>

Definition at line 497 of file eformshelper.cxx.

References Any, DBG_UNHANDLED_EXCEPTION, Exception, pcr::PcrRes(), PROPERTY_BINDING_ID, and xModel.

◆ isEForm()

bool pcr::EFormsHelper::isEForm ( const css::uno::Reference< css::frame::XModel > &  _rxContextDocument)
static

determines whether the given document is an eForm

If this method returns <FALSE>, you cannot instantiate an EFormsHelper with this document, since none of its functionality will be available then.

Definition at line 84 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

Referenced by pcr::SubmissionHelper::canTriggerSubmissions(), pcr::EFormsPropertyHandler::onNewComponent(), and pcr::XSDValidationPropertyHandler::onNewComponent().

◆ isListEntrySink()

bool pcr::EFormsHelper::isListEntrySink ( ) const

checks whether the control model is a source for list entries, as supplied by XML data bindings

Definition at line 196 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

◆ operator=()

EFormsHelper & pcr::EFormsHelper::operator= ( const EFormsHelper )
privatedelete

◆ registerBindingListener()

void pcr::EFormsHelper::registerBindingListener ( const css::uno::Reference< css::beans::XPropertyChangeListener > &  _rxBindingListener)

registers a listener to be notified when any aspect of the binding changes.

The listener will be registered at the current binding of the control model. If the binding changes (see <method>setBinding</method>), the listener will be revoked from the old binding, registered at the new binding, and for all properties which differ between both bindings, the listener will be notified.

See also
revokeBindingListener

Definition at line 231 of file eformshelper.cxx.

◆ revokeBindingListener()

void pcr::EFormsHelper::revokeBindingListener ( const css::uno::Reference< css::beans::XPropertyChangeListener > &  _rxBindingListener)

revokes the binding listener which has previously been registered

See also
registerBindingListener

Definition at line 285 of file eformshelper.cxx.

◆ setBinding()

void pcr::EFormsHelper::setBinding ( const css::uno::Reference< css::beans::XPropertySet > &  _rxBinding)

sets a new binding at the control model

Definition at line 464 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

◆ setListSourceBinding()

void pcr::EFormsHelper::setListSourceBinding ( const css::uno::Reference< css::form::binding::XListEntrySource > &  _rxListSource)

sets a new list source at the control model

See also
isListEntrySink

Definition at line 448 of file eformshelper.cxx.

References Exception, and TOOLS_WARN_EXCEPTION.

Member Data Documentation

◆ m_aBindingUINames

MapStringToPropertySet pcr::EFormsHelper::m_aBindingUINames
protected

Definition at line 62 of file eformshelper.hxx.

◆ m_aPropertyListeners

PropertyChangeListeners pcr::EFormsHelper::m_aPropertyListeners
protected

Definition at line 58 of file eformshelper.hxx.

◆ m_aSubmissionUINames

MapStringToPropertySet pcr::EFormsHelper::m_aSubmissionUINames
protected

Definition at line 60 of file eformshelper.hxx.

◆ m_xBindableControl

css::uno::Reference< css::form::binding::XBindableValue > pcr::EFormsHelper::m_xBindableControl
protected

Definition at line 54 of file eformshelper.hxx.

◆ m_xControlModel

css::uno::Reference< css::beans::XPropertySet > pcr::EFormsHelper::m_xControlModel
protected

◆ m_xDocument

css::uno::Reference< css::xforms::XFormsSupplier > pcr::EFormsHelper::m_xDocument
protected

Definition at line 56 of file eformshelper.hxx.


The documentation for this class was generated from the following files: