LibreOffice Module xmloff (master)  1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
xmloff::OElementImport Class Reference

implements common behaviour for importing forms, controls and columns More...

#include <elementimport.hxx>

Inheritance diagram for xmloff::OElementImport:
[legend]
Collaboration diagram for xmloff::OElementImport:
[legend]

Public Member Functions

 OElementImport (OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, sal_uInt16 _nPrefix, const OUString &_rName, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer)
 ctor More...
 
virtual ~OElementImport () override
 
- Public Member Functions inherited from xmloff::OPropertyImport
 OPropertyImport (OFormLayerXMLImport_Impl &_rImport, sal_uInt16 _nPrefix, const OUString &_rName)
 
virtual void Characters (const OUString &_rChars) override
 This method is called for all characters that are contained in the current element. More...
 
- Public Member Functions inherited from SvXMLImportContext
bool IsPrefixFilledIn () const
 
sal_uInt16 GetPrefix () const
 
const OUString & GetLocalName () const
 
 SvXMLImportContext (SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName)
 A contexts constructor does anything that is required if an element starts. More...
 
 SvXMLImportContext (SvXMLImport &rImport)
 
virtual ~SvXMLImportContext ()
 A contexts destructor does anything that is required if an element ends. More...
 
virtual void SAL_CALL startFastElement (sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
 
virtual void SAL_CALL startUnknownElement (const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
 
virtual void SAL_CALL endFastElement (sal_Int32 Element) override
 
virtual void SAL_CALL endUnknownElement (const OUString &Namespace, const OUString &Name) override
 
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext (sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
 
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext (const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
 
virtual void SAL_CALL characters (const OUString &aChars) override
 
virtual css::uno::Any SAL_CALL queryInterface (const css::uno::Type &aType) final override
 
virtual void SAL_CALL acquire () final override throw ()
 
virtual void SAL_CALL release () final override throw ()
 
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes () final override
 
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId () final override
 

Protected Member Functions

virtual void StartElement (const css::uno::Reference< css::xml::sax::XAttributeList > &_rxAttrList) override
 StartElement is called after a context has been constructed and before an elements context is parsed. More...
 
virtual SvXMLImportContextRef CreateChildContext (sal_uInt16 _nPrefix, const OUString &_rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &_rxAttrList) override
 Create a children element context. More...
 
virtual void EndElement () override
 EndElement is called before a context will be destructed, but after an elements context has been parsed. More...
 
virtual bool handleAttribute (sal_uInt16 _nNamespaceKey, const OUString &_rLocalName, const OUString &_rValue) override
 handle one single attribute. More...
 
virtual void registerEvents (const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rEvents) override
 
virtual css::uno::Reference< css::beans::XPropertySetcreateElement ()
 create the (uninitialized) element which is to represent the read data More...
 
void simulateDefaultedAttribute (const char *_pAttributeName, const OUString &_rPropertyName, const char *_pAttributeDefault)
 can be used to handle properties where the attribute default and the property default differ. More...
 
bool tryGenericAttribute (sal_uInt16 _nNamespaceKey, const OUString &_rLocalName, const OUString &_rValue)
 to be called from within handleAttribute, checks whether the given attribute is covered by our generic attribute handler mechanisms More...
 
void disableImplicitGenericAttributeHandling ()
 controls whether |handleAttribute| implicitly calls |tryGenericAttribute|, or whether the derived class must do this explicitly at a suitable place in its own |handleAttribute| More...
 
- Protected Member Functions inherited from xmloff::OPropertyImport
bool encounteredAttribute (const OUString &_rAttributeName) const
 determine if the element imported by the object had a given attribute. More...
 
void enableTrackAttributes ()
 enables the tracking of the encountered attributes More...
 
void implPushBackPropertyValue (const css::beans::PropertyValue &_rProp)
 
void implPushBackPropertyValue (const OUString &_rName, const css::uno::Any &_rValue)
 
void implPushBackGenericPropertyValue (const css::beans::PropertyValue &_rProp)
 
- Protected Member Functions inherited from SvXMLImportContext
SvXMLImportGetImport ()
 
const SvXMLImportGetImport () const
 
- Protected Member Functions inherited from xmloff::IEventAttacher
 ~IEventAttacher ()
 

Protected Attributes

OUString m_sServiceName
 
OUString m_sName
 
OFormLayerXMLImport_Implm_rFormImport
 
IEventAttacherManagerm_rEventManager
 
const XMLTextStyleContextm_pStyleElement
 
css::uno::Reference< css::container::XNameContainer > m_xParentContainer
 the parent container to insert the new element into More...
 
css::uno::Reference< css::beans::XPropertySetm_xElement
 the element we're creating. Valid after StartElement More...
 
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo
 
bool m_bImplicitGenericAttributeHandling
 
- Protected Attributes inherited from xmloff::OPropertyImport
PropertyValueArray m_aValues
 
PropertyValueArray m_aGenericValues
 
std::set< OUString > m_aEncounteredAttributes
 
OFormLayerXMLImport_Implm_rContext
 
bool m_bTrackAttributes
 

Private Member Functions

OUString implGetDefaultName () const
 
void implApplyGenericProperties ()
 
void implApplySpecificProperties ()
 
PropertyGroups::const_iterator impl_matchPropertyGroup (const PropertyGroups &i_propertyGroups) const
 
virtual OUString determineDefaultServiceName () const
 

Additional Inherited Members

- Protected Types inherited from xmloff::OPropertyImport
typedef ::std::vector< css::beans::PropertyValue > PropertyValueArray
 

Detailed Description

implements common behaviour for importing forms, controls and columns

Definition at line 66 of file elementimport.hxx.

Constructor & Destructor Documentation

xmloff::OElementImport::OElementImport ( OFormLayerXMLImport_Impl _rImport,
IEventAttacherManager _rEventManager,
sal_uInt16  _nPrefix,
const OUString &  _rName,
const css::uno::Reference< css::container::XNameContainer > &  _rxParentContainer 
)

ctor

Parameters
_rImportthe importer
_rEventManagerthe event attacher manager for the control being imported
_nPrefixthe namespace prefix
_rNamethe element name
_rAttributeMapthe attribute map to be used for translating attributes into properties
_rxParentContainerthe container in which the new element should be inserted

Definition at line 117 of file elementimport.cxx.

References m_xParentContainer, and m_xParentContainer.

xmloff::OElementImport::~OElementImport ( )
overridevirtual

Definition at line 129 of file elementimport.cxx.

Member Function Documentation

SvXMLImportContextRef xmloff::OElementImport::CreateChildContext ( sal_uInt16  nPrefix,
const OUString &  rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > &  xAttrList 
)
overrideprotectedvirtual
Reference< XPropertySet > xmloff::OElementImport::createElement ( )
protectedvirtual

create the (uninitialized) element which is to represent the read data

The default implementation uses <member>m_xORB</member> to create an object with <member>m_sServiceName</member>.

Reimplemented in xmloff::OFormImport, xmloff::OGridImport, and xmloff::OControlImport.

Definition at line 552 of file elementimport.cxx.

References SvXMLImport::GetComponentContext(), xmloff::OFormLayerXMLImport_Impl::getGlobalContext(), m_rFormImport, m_sServiceName, and OUStringToOString().

Referenced by xmloff::OControlImport::createElement(), xmloff::OFormImport::createElement(), and StartElement().

OUString xmloff::OElementImport::determineDefaultServiceName ( ) const
privatevirtual

Reimplemented in xmloff::OFormImport, and xmloff::OControlImport.

Definition at line 133 of file elementimport.cxx.

Referenced by StartElement().

void xmloff::OElementImport::disableImplicitGenericAttributeHandling ( )
inlineprotected

controls whether |handleAttribute| implicitly calls |tryGenericAttribute|, or whether the derived class must do this explicitly at a suitable place in its own |handleAttribute|

Definition at line 158 of file elementimport.hxx.

void xmloff::OElementImport::EndElement ( )
overrideprotectedvirtual

EndElement is called before a context will be destructed, but after an elements context has been parsed.

It may be used for actions that require virtual methods. The default is to do nothing.

Reimplemented from SvXMLImportContext.

Reimplemented in xmloff::OFormImport, xmloff::OGridImport, xmloff::OListAndComboImport, xmloff::OTextLikeImport, and xmloff::OControlImport.

Definition at line 178 of file elementimport.cxx.

References xmloff::OFormLayerXMLImport_Impl::applyControlNumberStyle(), XMLTextStyleContext::GetDataStyleName(), implApplyGenericProperties(), implApplySpecificProperties(), implGetDefaultName(), LEAVE_LOG_CONTEXT, m_pStyleElement, xmloff::OPropertyImport::m_rContext, m_sName, m_xElement, m_xParentContainer, and makeAny().

Referenced by xmloff::OControlImport::EndElement(), and xmloff::OFormImport::EndElement().

bool xmloff::OElementImport::handleAttribute ( sal_uInt16  _nNamespaceKey,
const OUString &  _rLocalName,
const OUString &  _rValue 
)
overrideprotectedvirtual

handle one single attribute.

This is called for every attribute of the element. This class' implementation checks if the attribute describes a property, if so, it is added to <member>m_aValues</member>.

All non-property attributes should be handled in derived classes.

Parameters
_nNamespaceKeykey of the namespace used in the attribute
_rLocalNamelocal (relative to the namespace) attribute name
_rValueattribute value

Reimplemented from xmloff::OPropertyImport.

Reimplemented in xmloff::OFormImport, xmloff::OListAndComboImport, xmloff::OValueRangeImport, xmloff::OURLReferenceImport, xmloff::ORadioImport, xmloff::OPasswordImport, xmloff::OReferredControlImport, xmloff::OImagePositionImport, and xmloff::OControlImport.

Definition at line 520 of file elementimport.cxx.

References xmloff::OFormLayerXMLImport_Impl::getStyleElement(), xmloff::OPropertyImport::handleAttribute(), xmloff::token::IsXMLToken(), m_bImplicitGenericAttributeHandling, m_pStyleElement, xmloff::OPropertyImport::m_rContext, m_sName, tryGenericAttribute(), xmloff::token::XML_CONTROL_IMPLEMENTATION, xmloff::token::XML_NAME, and xmloff::token::XML_TEXT_STYLE_NAME.

Referenced by xmloff::OControlImport::handleAttribute(), xmloff::OFormImport::handleAttribute(), and simulateDefaultedAttribute().

PropertyGroups::const_iterator xmloff::OElementImport::impl_matchPropertyGroup ( const PropertyGroups i_propertyGroups) const
private

Definition at line 459 of file elementimport.cxx.

References ENSURE_OR_RETURN, and m_xInfo.

Referenced by tryGenericAttribute().

void xmloff::OElementImport::implApplyGenericProperties ( )
private
void xmloff::OElementImport::implApplySpecificProperties ( )
private
OUString xmloff::OElementImport::implGetDefaultName ( ) const
private

Definition at line 436 of file elementimport.cxx.

References comphelper::findValue(), i, and m_xParentContainer.

Referenced by EndElement().

void xmloff::OElementImport::registerEvents ( const css::uno::Sequence< css::script::ScriptEventDescriptor > &  _rEvents)
overrideprotectedvirtual
void xmloff::OElementImport::simulateDefaultedAttribute ( const char *  _pAttributeName,
const OUString &  _rPropertyName,
const char *  _pAttributeDefault 
)
protected

can be used to handle properties where the attribute default and the property default differ.

In such case, if the property had the attribute default upon writing, nothing is read, so upon reading, the property is still at its own default (which is not the attribute default).

This method, if told the attribute and the property, and the (implied) attribute default, sets the property value as if the attribute was encountered.

See also
encounteredAttribute

Definition at line 575 of file elementimport.cxx.

References xmloff::OPropertyImport::encounteredAttribute(), handleAttribute(), m_xInfo, and XML_NAMESPACE_FORM.

Referenced by xmloff::OButtonImport::StartElement(), xmloff::OTextLikeImport::StartElement(), xmloff::OListAndComboImport::StartElement(), and xmloff::OFormImport::StartElement().

void xmloff::OElementImport::StartElement ( const css::uno::Reference< css::xml::sax::XAttributeList > &  xAttrList)
overrideprotectedvirtual
bool xmloff::OElementImport::tryGenericAttribute ( sal_uInt16  _nNamespaceKey,
const OUString &  _rLocalName,
const OUString &  _rValue 
)
protected

Member Data Documentation

bool xmloff::OElementImport::m_bImplicitGenericAttributeHandling
protected

Definition at line 90 of file elementimport.hxx.

Referenced by handleAttribute().

const XMLTextStyleContext* xmloff::OElementImport::m_pStyleElement
protected

Definition at line 77 of file elementimport.hxx.

Referenced by EndElement(), and handleAttribute().

IEventAttacherManager& xmloff::OElementImport::m_rEventManager
protected

Definition at line 75 of file elementimport.hxx.

Referenced by registerEvents().

OFormLayerXMLImport_Impl& xmloff::OElementImport::m_rFormImport
protected
OUString xmloff::OElementImport::m_sName
protected

Definition at line 73 of file elementimport.hxx.

Referenced by EndElement(), and handleAttribute().

OUString xmloff::OElementImport::m_sServiceName
protected

Definition at line 72 of file elementimport.hxx.

Referenced by createElement(), and StartElement().

css::uno::Reference< css::beans::XPropertySet > xmloff::OElementImport::m_xElement
protected
css::uno::Reference< css::beans::XPropertySetInfo > xmloff::OElementImport::m_xInfo
protected
css::uno::Reference< css::container::XNameContainer > xmloff::OElementImport::m_xParentContainer
protected

the parent container to insert the new element into

Definition at line 82 of file elementimport.hxx.

Referenced by EndElement(), implGetDefaultName(), and OElementImport().


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