LCOV - code coverage report
Current view: top level - xmloff/source/forms - elementimport.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 23 52.2 %
Date: 2014-11-03 Functions: 15 48 31.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_XMLOFF_SOURCE_FORMS_ELEMENTIMPORT_HXX
      21             : #define INCLUDED_XMLOFF_SOURCE_FORMS_ELEMENTIMPORT_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <map>
      26             : 
      27             : #include "propertyimport.hxx"
      28             : #include "controlelement.hxx"
      29             : #include "valueproperties.hxx"
      30             : #include "eventimport.hxx"
      31             : #include "logging.hxx"
      32             : #include "property_description.hxx"
      33             : 
      34             : #include <com/sun/star/text/XTextCursor.hpp>
      35             : #include <com/sun/star/container/XNameContainer.hpp>
      36             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      37             : #include <com/sun/star/form/XGridColumnFactory.hpp>
      38             : #include <com/sun/star/script/XEventAttacherManager.hpp>
      39             : 
      40             : class XMLTextStyleContext;
      41             : namespace xmloff
      42             : {
      43             : 
      44             :     class OFormLayerXMLImport_Impl;
      45             : 
      46             :     //= OElementNameMap
      47             :     const OControlElement::ElementType& operator ++(OControlElement::ElementType& _e);
      48             : 
      49             :     /** helper class which allows fast translation of xml tag names into element types.
      50             :     */
      51             :     class OElementNameMap : public OControlElement
      52             :     {
      53             :     protected:
      54             :         typedef std::map<OUString, ElementType> MapString2Element;
      55             :         static MapString2Element    s_sElementTranslations;
      56             : 
      57             :     protected:
      58             :         OElementNameMap() { }
      59             : 
      60             :     public:
      61             :         static ElementType getElementType(const OUString& _rName);
      62             :     };
      63             : 
      64             :     //= OElementImport
      65             :     /** implements common behaviour for importing forms, controls and columns
      66             :     */
      67             :     class OElementImport
      68             :                 :public OPropertyImport
      69             :                 ,public IEventAttacher
      70             :                 ,public OStackedLogging
      71             :     {
      72             :     protected:
      73             :         OUString             m_sServiceName;     // the service name as extracted from the service-name attribute
      74             :         OUString             m_sName;            // the name of the object (redundant, already contained in the base class' array)
      75             :         OFormLayerXMLImport_Impl&   m_rFormImport;      // the form import context
      76             :         IEventAttacherManager&      m_rEventManager;    // the event attacher manager
      77             : 
      78             :         const XMLTextStyleContext*  m_pStyleElement;    // the XML element which describes the style we encountered
      79             :                                                         // while reading our element
      80             : 
      81             :         /// the parent container to insert the new element into
      82             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
      83             :                                     m_xParentContainer;
      84             : 
      85             :         /// the element we're creating. Valid after StartElement
      86             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
      87             :                                     m_xElement;
      88             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
      89             :                                     m_xInfo;
      90             : 
      91             :         bool                        m_bImplicitGenericAttributeHandling;
      92             : 
      93             :     public:
      94             :         /** ctor
      95             :             @param _rImport
      96             :                 the importer
      97             :             @param _rEventManager
      98             :                 the event attacher manager for the control being imported
      99             :             @param _nPrefix
     100             :                 the namespace prefix
     101             :             @param _rName
     102             :                 the element name
     103             :             @param _rAttributeMap
     104             :                 the attribute map to be used for translating attributes into properties
     105             :             @param _rxParentContainer
     106             :                 the container in which the new element should be inserted
     107             :         */
     108             :         OElementImport(
     109             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
     110             :             sal_uInt16 _nPrefix, const OUString& _rName,
     111             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
     112             :         );
     113             :         virtual ~OElementImport();
     114             : 
     115             :     protected:
     116             :         // SvXMLImportContext overridables
     117             :         virtual void StartElement(
     118             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     119             :         virtual SvXMLImportContext* CreateChildContext(
     120             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     121             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     122             :         virtual void    EndElement() SAL_OVERRIDE;
     123             : 
     124             :         // OPropertyImport overridables
     125             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     126             :             const OUString& _rLocalName,
     127             :             const OUString& _rValue) SAL_OVERRIDE;
     128             : 
     129             :         // IEventAttacher
     130             :         virtual void registerEvents(
     131             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
     132             :             ) SAL_OVERRIDE;
     133             : 
     134             :         /** create the (uninitialized) element which is to represent the read data
     135             : 
     136             :             <p>The default implementation uses <member>m_xORB</member> to create a object with <member>m_sServiceName</member>.
     137             :         */
     138             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     139             :                         createElement();
     140             : 
     141             :     protected:
     142             :         /** can be used to handle properties where the attribute default and the property default differ.
     143             :             <p>In such case, if the property had the attribute default upon writing, nothing is read, so upon reading,
     144             :             the property is still at it's own default (which is not the attribute default).<p/>
     145             :             <p>This method, if told the attribute and the property, and the (implied) attribute default, sets the
     146             :             property value as if the attribute was encountered.</p>
     147             :             @see encounteredAttribute
     148             :         */
     149             :         void        simulateDefaultedAttribute(const sal_Char* _pAttributeName, const OUString& _rPropertyName, const sal_Char* _pAttributeDefault);
     150             : 
     151             :         /** to be called from within handleAttribute, checks whether the given attribute is covered by our generic
     152             :             attribute handler mechanisms
     153             :         */
     154             :         bool        tryGenericAttribute( sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue );
     155             : 
     156             :         /** controls whether |handleAttribute| implicitly calls |tryGenericAttribute|, or whether the derived class
     157             :             must do this explicitly at a suitable place in its own |handleAttribute|
     158             :         */
     159          58 :         void        disableImplicitGenericAttributeHandling() { m_bImplicitGenericAttributeHandling = false; }
     160             : 
     161             :     private:
     162             :         OUString implGetDefaultName() const;
     163             :         void implApplyGenericProperties();
     164             :         void implApplySpecificProperties();
     165             : 
     166             :         /** sets the style properties which have been read for the element (if any)
     167             :         */
     168             :         void implSetStyleProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
     169             : 
     170             :         PropertyGroups::const_iterator impl_matchPropertyGroup( const PropertyGroups& i_propertyGroups ) const;
     171             : 
     172             :         virtual OUString determineDefaultServiceName() const;
     173             :     };
     174             : 
     175             :     //= OControlImport
     176             :     /** helper class for importing the description of a single control
     177             :     */
     178          58 :     class OControlImport
     179             :                 :public OElementImport
     180             :                 ,public OValuePropertiesMetaData
     181             :     {
     182             :     protected:
     183             :         OUString                 m_sControlId;
     184             :         OControlElement::ElementType    m_eElementType;
     185             : 
     186             :         PropertyValueArray              m_aValueProperties;
     187             :         // the value properties (value, current-value, min-value, max-value) require some special
     188             :         // handling
     189             : 
     190             :         // we fake the attributes our base class gets: we add the attributes of the outer wrapper
     191             :         // element which encloses us
     192             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >
     193             :                                         m_xOuterAttributes;
     194             : 
     195             :         /** the address of the calc cell which the control model should be bound to,
     196             :             if applicable
     197             :         */
     198             :         OUString                 m_sBoundCellAddress;
     199             : 
     200             :         /** name of a value binding (xforms:bind attribute) */
     201             :         OUString                 m_sBindingID;
     202             : 
     203             :         /** name of a list binding (form:xforms-list-source attribute) */
     204             :         OUString                 m_sListBindingID;
     205             : 
     206             :         /** name of a submission (xforms:submission attribute) */
     207             :         OUString                 m_sSubmissionID;
     208             : 
     209             :     protected:
     210             :         // for use by derived classes only
     211             :         OControlImport(
     212             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
     213             :             sal_uInt16 _nPrefix, const OUString& _rName,
     214             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
     215             :             );
     216             : 
     217             :     public:
     218             :         OControlImport(
     219             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
     220             :             sal_uInt16 _nPrefix, const OUString& _rName,
     221             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     222             :             OControlElement::ElementType _eType
     223             :         );
     224             : 
     225             :         // SvXMLImportContext overridables
     226             :         virtual void StartElement(
     227             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     228             :         virtual void    EndElement() SAL_OVERRIDE;
     229             : 
     230             :         // OPropertyImport overridables
     231             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     232             :             const OUString& _rLocalName,
     233             :             const OUString& _rValue) SAL_OVERRIDE;
     234             : 
     235             :         void addOuterAttributes(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs);
     236             : 
     237             :     protected:
     238           0 :         void setElementType(OControlElement::ElementType _eType) { m_eElementType = _eType; }
     239             : 
     240             :     protected:
     241             :         void implTranslateValueProperty(
     242             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >& _rxPropInfo,
     243             :             ::com::sun::star::beans::PropertyValue& /* [in/out] */ _rPropValue);
     244             : 
     245             :         virtual OUString determineDefaultServiceName() const SAL_OVERRIDE;
     246             : 
     247             :         /** registers the given cell address as value binding address for our element
     248             : 
     249             :             <p>The default implementation simply calls registerCellValueBinding at our import
     250             :             context, but you may want to override this behaviour.</p>
     251             : 
     252             :             @param _rBoundCellAddress
     253             :                 the cell address to register for our element. Must not be <NULL/>.
     254             :             @precond
     255             :                 we have a valid element (m_xElement)
     256             :         */
     257             :         virtual void doRegisterCellValueBinding( const OUString& _rBoundCellAddress );
     258             : 
     259             :         /** register the given XForms binding */
     260             :         virtual void doRegisterXFormsValueBinding( const OUString& );
     261             : 
     262             :         /** register the given XForms list binding */
     263             :         virtual void doRegisterXFormsListBinding( const OUString& );
     264             : 
     265             :         /** register the given XForms submission */
     266             :         virtual void doRegisterXFormsSubmission( const OUString& );
     267             : 
     268             :     protected:
     269             : 
     270             :         // OElementImport overridables
     271             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     272             :                         createElement() SAL_OVERRIDE;
     273             :     };
     274             : 
     275             :     // TODO:
     276             :     // this whole mechanism doesn't scale. Instead of deriving even more classes for every new attribute,
     277             :     // we should have dedicated attribute handlers
     278             :     // The rest of xmloff implements it this way - why don't we do, too?
     279             : 
     280             :     //= OImagePositionImport
     281          56 :     class OImagePositionImport : public OControlImport
     282             :     {
     283             :         sal_Int16   m_nImagePosition;
     284             :         sal_Int16   m_nImageAlign;
     285             :         bool    m_bHaveImagePosition;
     286             : 
     287             :     public:
     288             :         OImagePositionImport(
     289             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     290             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     291             :             OControlElement::ElementType _eType
     292             :         );
     293             : 
     294             :     protected:
     295             :         // SvXMLImportContext overridables
     296             :         virtual void StartElement(
     297             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     298             : 
     299             :         // OPropertyImport overridables
     300             :         virtual bool    handleAttribute( sal_uInt16 _nNamespaceKey,
     301             :             const OUString& _rLocalName,
     302             :             const OUString& _rValue
     303             :        ) SAL_OVERRIDE;
     304             :     };
     305             : 
     306             :     //= OReferredControlImport
     307           0 :     class OReferredControlImport : public OControlImport
     308             :     {
     309             :     protected:
     310             :         OUString m_sReferringControls;   // the list of ids of controls referring to the one being imported
     311             : 
     312             :     public:
     313             :         OReferredControlImport(
     314             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     315             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     316             :             OControlElement::ElementType _eType
     317             :         );
     318             : 
     319             :         // SvXMLImportContext overridables
     320             :         virtual void StartElement(
     321             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     322             : 
     323             :         // OPropertyImport overridables
     324             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     325             :             const OUString& _rLocalName,
     326             :             const OUString& _rValue) SAL_OVERRIDE;
     327             :     };
     328             : 
     329             :     //= OPasswordImport
     330           0 :     class OPasswordImport : public OControlImport
     331             :     {
     332             :     public:
     333             :         OPasswordImport(
     334             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     335             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     336             :             OControlElement::ElementType _eType
     337             :         );
     338             : 
     339             :         // OPropertyImport overridables
     340             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     341             :             const OUString& _rLocalName,
     342             :             const OUString& _rValue) SAL_OVERRIDE;
     343             :     };
     344             : 
     345             :     //= ORadioImport
     346          20 :     class ORadioImport : public OImagePositionImport
     347             :     {
     348             :     public:
     349             :         ORadioImport(
     350             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     351             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     352             :             OControlElement::ElementType _eType
     353             :         );
     354             : 
     355             :     protected:
     356             :         // OPropertyImport overridables
     357             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     358             :             const OUString& _rLocalName,
     359             :             const OUString& _rValue) SAL_OVERRIDE;
     360             :     };
     361             : 
     362             :     //= OURLReferenceImport
     363             :     /** a specialized version of the <type>OControlImport</type> class, which is able
     364             :         to handle attributes which denote URLs (and stored relative)
     365             :     */
     366          26 :     class OURLReferenceImport : public OImagePositionImport
     367             :     {
     368             :     public:
     369             :         OURLReferenceImport(
     370             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     371             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     372             :             OControlElement::ElementType _eType
     373             :         );
     374             : 
     375             :     protected:
     376             :         // OPropertyImport overridables
     377             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     378             :             const OUString& _rLocalName,
     379             :             const OUString& _rValue) SAL_OVERRIDE;
     380             :     };
     381             : 
     382             :     //= OButtonImport
     383             :     /** A specialized version of the <type>OControlImport</type> class, which handles
     384             :         the target frame for image and command buttons
     385             :     */
     386          52 :     class OButtonImport : public OURLReferenceImport
     387             :     {
     388             :     public:
     389             :         OButtonImport(
     390             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     391             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     392             :             OControlElement::ElementType _eType
     393             :         );
     394             : 
     395             :     protected:
     396             :         // SvXMLImportContext overridables
     397             :         virtual void StartElement(
     398             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     399             :     };
     400             : 
     401             :     //= OValueRangeImport
     402             :     /** A specialized version of the <type>OControlImport</type> class, which imports
     403             :         the value-range elements
     404             :     */
     405           0 :     class OValueRangeImport : public OControlImport
     406             :     {
     407             :     private:
     408             :         sal_Int32   m_nStepSizeValue;
     409             : 
     410             :     public:
     411             :         OValueRangeImport(
     412             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     413             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     414             :             OControlElement::ElementType _eType
     415             :         );
     416             : 
     417             :     protected:
     418             :         // SvXMLImportContext overridables
     419             :         virtual void StartElement(
     420             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList ) SAL_OVERRIDE;
     421             : 
     422             :         // OPropertyImport overridables
     423             :         virtual bool    handleAttribute( sal_uInt16 _nNamespaceKey,
     424             :             const OUString& _rLocalName,
     425             :             const OUString& _rValue ) SAL_OVERRIDE;
     426             :     };
     427             : 
     428             :     //= OTextLikeImport
     429             :     /** A specialized version of the <type>OControlImport</type> class, which handles
     430             :         text like controls which have the convert-empty-to-null attribute</p>
     431             :     */
     432          24 :     class OTextLikeImport : public OControlImport
     433             :     {
     434             :     private:
     435             :         ::com::sun::star::uno::Reference< com::sun::star::text::XTextCursor >   m_xCursor;
     436             :         ::com::sun::star::uno::Reference< com::sun::star::text::XTextCursor >   m_xOldCursor;
     437             :         bool                                                                    m_bEncounteredTextPara;
     438             : 
     439             :     public:
     440             :         OTextLikeImport(
     441             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     442             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     443             :             OControlElement::ElementType _eType
     444             :         );
     445             : 
     446             :         // SvXMLImportContext overridables
     447             :         virtual void StartElement(
     448             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     449             :         virtual SvXMLImportContext* CreateChildContext(
     450             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     451             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     452             :         virtual void    EndElement() SAL_OVERRIDE;
     453             : 
     454             :     private:
     455             :         void    adjustDefaultControlProperty();
     456             :         void    removeRedundantCurrentValue();
     457             :     };
     458             : 
     459             :     //= OListAndComboImport
     460             :     /** A specialized version of the <type>OControlImport</type> class, which handles
     461             :         attributes / sub elements which are special to list and combo boxes
     462             :     */
     463           0 :     class OListAndComboImport : public OControlImport
     464             :     {
     465             :         friend class OListOptionImport;
     466             :         friend class OComboItemImport;
     467             : 
     468             :     protected:
     469             :         ::com::sun::star::uno::Sequence< OUString >
     470             :                         m_aListSource;
     471             :         ::com::sun::star::uno::Sequence< OUString >
     472             :                         m_aValueList;
     473             : 
     474             :         ::com::sun::star::uno::Sequence< sal_Int16 >
     475             :                         m_aSelectedSeq;
     476             :         ::com::sun::star::uno::Sequence< sal_Int16 >
     477             :                         m_aDefaultSelectedSeq;
     478             : 
     479             :         OUString m_sCellListSource;      /// the cell range which acts as list source for the control
     480             : 
     481             :         sal_Int32       m_nEmptyListItems;      /// number of empty list items encountered during reading
     482             :         sal_Int32       m_nEmptyValueItems;     /// number of empty value items encountered during reading
     483             : 
     484             :         bool        m_bEncounteredLSAttrib;
     485             :         bool        m_bLinkWithIndexes;     /** <TRUE/> if and only if we should use a cell value binding
     486             :                                                     which exchanges the selection index (instead of the selection text
     487             :                                                 */
     488             : 
     489             :     public:
     490             :         OListAndComboImport(
     491             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     492             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     493             :             OControlElement::ElementType _eType
     494             :         );
     495             : 
     496             :         // SvXMLImportContext overridables
     497             :         virtual void StartElement(
     498             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     499             :         virtual SvXMLImportContext* CreateChildContext(
     500             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     501             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     502             :         virtual void    EndElement() SAL_OVERRIDE;
     503             : 
     504             :         // OPropertyImport overridables
     505             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     506             :             const OUString& _rLocalName,
     507             :             const OUString& _rValue) SAL_OVERRIDE;
     508             : 
     509             :         // OControlImport ovrridables
     510             :         virtual void doRegisterCellValueBinding( const OUString& _rBoundCellAddress ) SAL_OVERRIDE;
     511             : 
     512             :     protected:
     513             :         void implPushBackLabel(const OUString& _rLabel);
     514             :         void implPushBackValue(const OUString& _rValue);
     515             : 
     516             :         void implEmptyLabelFound();
     517             :         void implEmptyValueFound();
     518             : 
     519             :         void implSelectCurrentItem();
     520             :         void implDefaultSelectCurrentItem();
     521             :     };
     522             :     typedef tools::SvRef<OListAndComboImport> OListAndComboImportRef;
     523             : 
     524             :     //= OListOptionImport
     525             :     /** helper class for importing a single &lt;form:option&gt; element.
     526             :     */
     527           0 :     class OListOptionImport
     528             :                 :public SvXMLImportContext
     529             :     {
     530             :         OListAndComboImportRef  m_xListBoxImport;
     531             : 
     532             :     public:
     533             :         OListOptionImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName,
     534             :             const OListAndComboImportRef& _rListBox);
     535             : 
     536             :         virtual void StartElement(
     537             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     538             :     };
     539             : 
     540             :     //= OComboItemImport
     541             :     /** helper class for importing a single &lt;form:item&gt; element.
     542             :     */
     543           0 :     class OComboItemImport
     544             :                 :public SvXMLImportContext
     545             :     {
     546             :         OListAndComboImportRef  m_xListBoxImport;
     547             : 
     548             :     public:
     549             :         OComboItemImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName,
     550             :             const OListAndComboImportRef& _rListBox);
     551             : 
     552             :     protected:
     553             :         // SvXMLImportContext overridables
     554             :         virtual void StartElement(
     555             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     556             :     };
     557             : 
     558             :     //= OContainerImport
     559             :     // BASE must be a derivee of OElementImport
     560             :     template <class BASE>
     561          18 :     class OContainerImport
     562             :                 :public BASE
     563             :                 ,public ODefaultEventAttacherManager
     564             :     {
     565             :     protected:
     566             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
     567             :                         m_xMeAsContainer;
     568             :         OUString m_sWrapperElementName;
     569             : 
     570             :     protected:
     571          18 :         OContainerImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     572             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     573             :                 const sal_Char* _pWrapperElementName)
     574             :             :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
     575          18 :             ,m_sWrapperElementName(OUString::createFromAscii(_pWrapperElementName))
     576             :         {
     577          18 :         }
     578             : 
     579             :         // SvXMLImportContext overridables
     580             :         virtual SvXMLImportContext* CreateChildContext(
     581             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     582             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
     583             :         virtual void EndElement();
     584             : 
     585             :     protected:
     586             :         // OElementImport overridables
     587             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     588             :                         createElement();
     589             : 
     590             :         // create the child context for the given control type
     591             :         virtual SvXMLImportContext* implCreateControlWrapper(
     592             :             sal_uInt16 _nPrefix, const OUString& _rLocalName) = 0;
     593             :     };
     594             : 
     595             :     //= OColumnImport
     596             :     /** helper class importing a single grid column (without the &lt;form:column&gt; element wrapping
     597             :         the column).
     598             : 
     599             :         <p>BASE (the template argument) must be a derivee of OControlImport</p>
     600             :     */
     601             :     template <class BASE>
     602           0 :     class OColumnImport : public BASE
     603             :     {
     604             :     protected:
     605             :         ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridColumnFactory >
     606             :                     m_xColumnFactory;
     607             : 
     608             :     public:
     609             :         OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     610             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     611             :                 OControlElement::ElementType _eType);
     612             : 
     613             :     protected:
     614             :         // OElementImport overridables
     615             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     616             :                         createElement();
     617             :     };
     618             : 
     619             :     //= OColumnWrapperImport
     620           0 :     class OColumnWrapperImport : public SvXMLImportContext
     621             :     {
     622             :     protected:
     623             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >
     624             :                                 m_xOwnAttributes;
     625             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
     626             :                                 m_xParentContainer;
     627             :         OFormLayerXMLImport_Impl&   m_rFormImport;
     628             :         IEventAttacherManager&  m_rEventManager;
     629             : 
     630             :     public:
     631             :         OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     632             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer);
     633             : 
     634             :         // SvXMLImportContext overridables
     635             :         virtual SvXMLImportContext* CreateChildContext(
     636             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     637             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     638             :         virtual void StartElement(
     639             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     640             :     protected:
     641             :         OControlImport* implCreateChildContext(
     642             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     643             :             OControlElement::ElementType _eType);
     644             :     };
     645             : 
     646             :     //= OGridImport
     647             :     typedef OContainerImport< OControlImport >  OGridImport_Base;
     648             :     /** helper class importing a single &lt;form:grid&gt; element
     649             :     */
     650           0 :     class OGridImport : public OGridImport_Base
     651             :     {
     652             :     public:
     653             :         OGridImport(
     654             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     655             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     656             :             OControlElement::ElementType _eType);
     657             : 
     658             :     protected:
     659             :         // OContainerImport overridables
     660             :         virtual SvXMLImportContext* implCreateControlWrapper(
     661             :             sal_uInt16 _nPrefix, const OUString& _rLocalName) SAL_OVERRIDE;
     662             :     };
     663             : 
     664             :     //= OFormImport
     665             :     typedef OContainerImport< OElementImport >  OFormImport_Base;
     666             :     /** helper class importing a single &lt;form:form&gt; element
     667             :     */
     668          36 :     class OFormImport : public OFormImport_Base
     669             :     {
     670             :     public:
     671             :         OFormImport(
     672             :             OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
     673             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
     674             :         );
     675             : 
     676             :     protected:
     677             :         // SvXMLImportContext overridables
     678             :         virtual SvXMLImportContext* CreateChildContext(
     679             :             sal_uInt16 _nPrefix, const OUString& _rLocalName,
     680             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     681             :         virtual void    StartElement(
     682             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) SAL_OVERRIDE;
     683             :         virtual void    EndElement() SAL_OVERRIDE;
     684             : 
     685             :         // OContainerImport overridables
     686             :         virtual SvXMLImportContext* implCreateControlWrapper(
     687             :             sal_uInt16 _nPrefix, const OUString& _rLocalName) SAL_OVERRIDE;
     688             : 
     689             :         // OPropertyImport overridables
     690             :         virtual bool    handleAttribute(sal_uInt16 _nNamespaceKey,
     691             :             const OUString& _rLocalName,
     692             :             const OUString& _rValue) SAL_OVERRIDE;
     693             : 
     694             :         OControlImport* implCreateChildContext(
     695             :                 sal_uInt16 _nPrefix, const OUString& _rLocalName,
     696             :                 OControlElement::ElementType _eType );
     697             : 
     698             :         void implTranslateStringListProperty(const OUString& _rPropertyName, const OUString& _rValue);
     699             :     };
     700             : 
     701             :     //= OXMLDataSourceImport
     702           0 :     class OXMLDataSourceImport : public SvXMLImportContext
     703             :     {
     704             :     public:
     705             :         OXMLDataSourceImport( SvXMLImport& _rImport
     706             :                     ,sal_uInt16 nPrfx
     707             :                     ,const OUString& rLName
     708             :                     ,const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList
     709             :                     ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xElement);
     710             :     };
     711             : 
     712             : #define _INCLUDING_FROM_ELEMENTIMPORT_HXX_
     713             : #include "elementimport_impl.hxx"
     714             : #undef _INCLUDING_FROM_ELEMENTIMPORT_HXX_
     715             : 
     716             : }   // namespace xmloff
     717             : 
     718             : #endif // INCLUDED_XMLOFF_SOURCE_FORMS_ELEMENTIMPORT_HXX
     719             : 
     720             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10