Update ooo320-m1
[ooovba.git] / xmloff / source / forms / elementimport.hxx
blobce6540cd6912df068c2c2a42e6d287e103da4ffc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: elementimport.hxx,v $
10 * $Revision: 1.31 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLOFF_FORMS_ELEMENTIMPORT_HXX_
32 #define _XMLOFF_FORMS_ELEMENTIMPORT_HXX_
34 #include "propertyimport.hxx"
35 #include "controlelement.hxx"
36 #include "valueproperties.hxx"
38 /** === begin UNO includes === **/
39 #include <com/sun/star/text/XTextCursor.hpp>
40 #include <com/sun/star/container/XNameContainer.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/form/XGridColumnFactory.hpp>
43 #include <com/sun/star/script/XEventAttacherManager.hpp>
44 /** === end UNO includes === **/
45 #include <comphelper/stl_types.hxx>
46 #include "eventimport.hxx"
47 #include "logging.hxx"
49 class XMLTextStyleContext;
50 //.........................................................................
51 namespace xmloff
53 //.........................................................................
55 class IControlIdMap;
56 class OFormLayerXMLImport_Impl;
58 //=====================================================================
59 //= OElementNameMap
60 //=====================================================================
61 const OControlElement::ElementType& operator ++(OControlElement::ElementType& _e);
63 /** helper class which allows fast translation of xml tag names into element types.
65 class OElementNameMap : public OControlElement
67 protected:
68 DECLARE_STL_USTRINGACCESS_MAP( ElementType, MapString2Element );
69 static MapString2Element s_sElementTranslations;
71 protected:
72 OElementNameMap() { }
74 public:
75 static ElementType getElementType(const ::rtl::OUString& _rName);
78 //=====================================================================
79 //= OElementImport
80 //=====================================================================
81 /** implements common behaviour for importing forms, controls and columns
83 class OElementImport
84 :public OPropertyImport
85 ,public IEventAttacher
86 ,public OStackedLogging
88 protected:
89 ::rtl::OUString m_sServiceName; // the service name as extracted from the service-name attribute
90 ::rtl::OUString m_sName; // the name of the object (redundant, already contained in the base class' array)
91 OFormLayerXMLImport_Impl& m_rFormImport; // the form import context
92 IEventAttacherManager& m_rEventManager; // the event attacher manager
94 const XMLTextStyleContext* m_pStyleElement; // the XML element which describes the style we encountered
95 // while reading our element
97 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
98 m_xParentContainer;
99 // the parent container to insert the new element into
101 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
102 m_xInfo;
103 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
104 m_xElement; // the element we're creating. Valid after StartElement
106 public:
107 /** ctor
108 @param _rImport
109 the importer
110 @param _rEventManager
111 the event attacher manager for the control beeing imported
112 @param _nPrefix
113 the namespace prefix
114 @param _rName
115 the element name
116 @param _rAttributeMap
117 the attribute map to be used for translating attributes into properties
118 @param _rxParentContainer
119 the container in which the new element should be inserted
121 OElementImport(
122 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
123 sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
124 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
126 virtual ~OElementImport();
128 protected:
129 // SvXMLImportContext overridables
130 virtual void StartElement(
131 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
132 virtual SvXMLImportContext* CreateChildContext(
133 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
134 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
135 virtual void EndElement();
137 // OPropertyImport overridables
138 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
139 const ::rtl::OUString& _rLocalName,
140 const ::rtl::OUString& _rValue);
142 // IEventAttacher
143 virtual void registerEvents(
144 const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
147 /** create the (uninitialized) element which is to represent the read data
149 <p>The default implementation uses <member>m_xORB</member> to create a object with <member>m_sServiceName</member>.
151 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
152 createElement();
154 protected:
155 /** can be used to handle properties where the attribute default and the property default differ.
156 <p>In such case, if the property had the attribute default upon writing, nothing is read, so upon reading,
157 the property is still at it's own default (which is not the attribute default).<p/>
158 <p>This method, if told the attribute and the property, and the (implied) attribute default, sets the
159 property value as if the attribute was encountered.</p>
160 @see encounteredAttribute
162 void simulateDefaultedAttribute(const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName, const sal_Char* _pAttributeDefault);
164 private:
165 ::rtl::OUString implGetDefaultName() const;
166 void implImportGenericProperties();
168 /** sets the style properties which have been read for the element (if any)
170 void implSetStyleProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
173 //=====================================================================
174 //= OControlImport
175 //=====================================================================
176 /** helper class for importing the description of a single control
178 class OControlImport
179 :public OElementImport
180 ,public OValuePropertiesMetaData
182 protected:
183 ::rtl::OUString m_sControlId;
184 OControlElement::ElementType m_eElementType;
186 PropertyValueArray m_aValueProperties;
187 // the value properties (value, current-value, min-value, max-value) require some special
188 // handling
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;
195 /** the address of the calc cell which the control model should be bound to,
196 if applicable
198 ::rtl::OUString m_sBoundCellAddress;
200 /** name of a value binding (xforms:bind attribute) */
201 ::rtl::OUString m_sBindingID;
203 /** name of a list binding (form:xforms-list-source attribute) */
204 ::rtl::OUString m_sListBindingID;
206 /** name of a submission (xforms:submission attribute) */
207 ::rtl::OUString m_sSubmissionID;
209 protected:
210 // for use by derived classes only
211 OControlImport(
212 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
213 sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
214 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
217 public:
218 OControlImport(
219 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
220 sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
221 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
222 OControlElement::ElementType _eType
225 // SvXMLImportContext overridables
226 virtual void StartElement(
227 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
228 virtual void EndElement();
230 // OPropertyImport overridables
231 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
232 const ::rtl::OUString& _rLocalName,
233 const ::rtl::OUString& _rValue);
235 void addOuterAttributes(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs);
237 protected:
238 void setElementType(OControlElement::ElementType _eType) { m_eElementType = _eType; }
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);
245 /** registers the given cell address as value binding address for our element
247 <p>The default implementation simply calls registerCellValueBinding at our import
248 context, but you may want to override this behaviour.</p>
250 @param _rBoundCellAddress
251 the cell address to register for our element. Must not be <NULL/>.
252 @precond
253 we have a valid element (m_xElement)
255 virtual void doRegisterCellValueBinding( const ::rtl::OUString& _rBoundCellAddress );
257 /** register the given XForms binding */
258 virtual void doRegisterXFormsValueBinding( const ::rtl::OUString& );
260 /** register the given XForms list binding */
261 virtual void doRegisterXFormsListBinding( const ::rtl::OUString& );
263 /** register the given XForms submission */
264 virtual void doRegisterXFormsSubmission( const ::rtl::OUString& );
266 protected:
267 //added by BerryJia for fixing bug102407 2002-11-5
268 // OElementImport overridables
269 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
270 createElement();
274 // TODO:
275 // this whole mechanism doesn't scale. Instead of deriving even more classes for every new attribute,
276 // we should have dedicated attribute handlers
277 // The rest of xmloff implements it this way - why don't we do, too?
279 //=====================================================================
280 //= OImagePositionImport
281 //=====================================================================
282 class OImagePositionImport : public OControlImport
284 sal_Int16 m_nImagePosition;
285 sal_Int16 m_nImageAlign;
286 sal_Bool m_bHaveImagePosition;
288 public:
289 OImagePositionImport(
290 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
291 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
292 OControlElement::ElementType _eType
295 protected:
296 // SvXMLImportContext overridables
297 virtual void StartElement(
298 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
300 // OPropertyImport overridables
301 virtual void handleAttribute( sal_uInt16 _nNamespaceKey,
302 const ::rtl::OUString& _rLocalName,
303 const ::rtl::OUString& _rValue
307 //=====================================================================
308 //= OReferredControlImport
309 //=====================================================================
310 class OReferredControlImport : public OControlImport
312 protected:
313 ::rtl::OUString m_sReferringControls; // the list of ids of controls referring to the one beeing imported
315 public:
316 OReferredControlImport(
317 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
318 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
319 OControlElement::ElementType _eType
322 // SvXMLImportContext overridables
323 virtual void StartElement(
324 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
326 // OPropertyImport overridables
327 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
328 const ::rtl::OUString& _rLocalName,
329 const ::rtl::OUString& _rValue);
332 //=====================================================================
333 //= OPasswordImport
334 //=====================================================================
335 class OPasswordImport : public OControlImport
337 public:
338 OPasswordImport(
339 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
340 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
341 OControlElement::ElementType _eType
344 // OPropertyImport overridables
345 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
346 const ::rtl::OUString& _rLocalName,
347 const ::rtl::OUString& _rValue);
350 //=====================================================================
351 //= ORadioImport
352 //=====================================================================
353 class ORadioImport : public OImagePositionImport
355 public:
356 ORadioImport(
357 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
358 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
359 OControlElement::ElementType _eType
362 protected:
363 // OPropertyImport overridables
364 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
365 const ::rtl::OUString& _rLocalName,
366 const ::rtl::OUString& _rValue);
369 //=====================================================================
370 //= OURLReferenceImport
371 //=====================================================================
372 /** a specialized version of the <type>OControlImport</type> class, which is able
373 to handle attributes which denote URLs (and stored relative)
375 class OURLReferenceImport : public OImagePositionImport
377 public:
378 OURLReferenceImport(
379 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
380 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
381 OControlElement::ElementType _eType
384 protected:
385 // OPropertyImport overridables
386 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
387 const ::rtl::OUString& _rLocalName,
388 const ::rtl::OUString& _rValue);
391 //=====================================================================
392 //= OButtonImport
393 //=====================================================================
394 /** A specialized version of the <type>OControlImport</type> class, which handles
395 the target frame for image and command buttons
397 class OButtonImport : public OURLReferenceImport
399 public:
400 OButtonImport(
401 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
402 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
403 OControlElement::ElementType _eType
406 protected:
407 // SvXMLImportContext overridables
408 virtual void StartElement(
409 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
412 //=====================================================================
413 //= OValueRangeImport
414 //=====================================================================
415 /** A specialized version of the <type>OControlImport</type> class, which imports
416 the value-range elements
418 class OValueRangeImport : public OControlImport
420 private:
421 sal_Int32 m_nStepSizeValue;
423 public:
424 OValueRangeImport(
425 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
426 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
427 OControlElement::ElementType _eType
430 protected:
431 // SvXMLImportContext overridables
432 virtual void StartElement(
433 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList );
435 // OPropertyImport overridables
436 virtual void handleAttribute( sal_uInt16 _nNamespaceKey,
437 const ::rtl::OUString& _rLocalName,
438 const ::rtl::OUString& _rValue );
441 //=====================================================================
442 //= OTextLikeImport
443 //=====================================================================
444 /** A specialized version of the <type>OControlImport</type> class, which handles
445 text like controls which have the convert-empty-to-null attribute</p>
447 class OTextLikeImport : public OControlImport
449 private:
450 ::com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > m_xCursor;
451 ::com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > m_xOldCursor;
452 bool m_bEncounteredTextPara;
454 public:
455 OTextLikeImport(
456 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
457 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
458 OControlElement::ElementType _eType
461 // SvXMLImportContext overridables
462 virtual void StartElement(
463 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
464 virtual SvXMLImportContext* CreateChildContext(
465 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
466 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
467 virtual void EndElement();
469 private:
470 void adjustDefaultControlProperty();
471 void removeRedundantCurrentValue();
474 //=====================================================================
475 //= OListAndComboImport
476 //=====================================================================
477 /** A specialized version of the <type>OControlImport</type> class, which handles
478 attributes / sub elements which are special to list and combo boxes
480 class OListAndComboImport : public OControlImport
482 friend class OListOptionImport;
483 friend class OComboItemImport;
485 protected:
486 ::com::sun::star::uno::Sequence< ::rtl::OUString >
487 m_aListSource;
488 ::com::sun::star::uno::Sequence< ::rtl::OUString >
489 m_aValueList;
491 ::com::sun::star::uno::Sequence< sal_Int16 >
492 m_aSelectedSeq;
493 ::com::sun::star::uno::Sequence< sal_Int16 >
494 m_aDefaultSelectedSeq;
496 ::rtl::OUString m_sCellListSource; /// the cell range which acts as list source for the control
498 sal_Int32 m_nEmptyListItems; /// number of empty list items encountered during reading
499 sal_Int32 m_nEmptyValueItems; /// number of empty value items encountered during reading
501 sal_Bool m_bEncounteredLSAttrib;
502 sal_Bool m_bLinkWithIndexes; /** <TRUE/> if and only if we should use a cell value binding
503 which exchanges the selection index (instead of the selection text
506 public:
507 OListAndComboImport(
508 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
509 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
510 OControlElement::ElementType _eType
513 // SvXMLImportContext overridables
514 virtual void StartElement(
515 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
516 virtual SvXMLImportContext* CreateChildContext(
517 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
518 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
519 virtual void EndElement();
521 // OPropertyImport overridables
522 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
523 const ::rtl::OUString& _rLocalName,
524 const ::rtl::OUString& _rValue);
526 // OControlImport ovrridables
527 virtual void doRegisterCellValueBinding( const ::rtl::OUString& _rBoundCellAddress );
529 protected:
530 void implPushBackLabel(const ::rtl::OUString& _rLabel);
531 void implPushBackValue(const ::rtl::OUString& _rValue);
533 void implEmptyLabelFound();
534 void implEmptyValueFound();
536 void implSelectCurrentItem();
537 void implDefaultSelectCurrentItem();
539 SV_DECL_IMPL_REF(OListAndComboImport);
541 //=====================================================================
542 //= OListOptionImport
543 //=====================================================================
544 /** helper class for importing a single &lt;form:option&gt; element.
546 class OListOptionImport
547 :public SvXMLImportContext
549 OListAndComboImportRef m_xListBoxImport;
551 public:
552 OListOptionImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
553 const OListAndComboImportRef& _rListBox);
555 virtual void StartElement(
556 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
559 //=====================================================================
560 //= OComboItemImport
561 //=====================================================================
562 /** helper class for importing a single &lt;form:item&gt; element.
564 class OComboItemImport
565 :public SvXMLImportContext
567 OListAndComboImportRef m_xListBoxImport;
569 public:
570 OComboItemImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
571 const OListAndComboImportRef& _rListBox);
573 protected:
574 // SvXMLImportContext overridables
575 virtual void StartElement(
576 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
579 //=====================================================================
580 //= OContainerImport
581 //=====================================================================
582 // BASE must be a derivee of OElementImport
583 template <class BASE>
584 class OContainerImport
585 :public BASE
586 ,public ODefaultEventAttacherManager
588 protected:
589 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
590 m_xMeAsContainer;
591 ::rtl::OUString m_sWrapperElementName;
593 protected:
594 OContainerImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
595 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
596 const sal_Char* _pWrapperElementName)
597 :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
598 ,m_sWrapperElementName(::rtl::OUString::createFromAscii(_pWrapperElementName))
602 // SvXMLImportContext overridables
603 virtual SvXMLImportContext* CreateChildContext(
604 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
605 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
606 virtual void EndElement();
608 protected:
609 // OElementImport overridables
610 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
611 createElement();
613 // create the child context for the given control type
614 virtual SvXMLImportContext* implCreateControlWrapper(
615 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName) = 0;
618 //=====================================================================
619 //= OColumnImport
620 //=====================================================================
621 /** helper class importing a single grid column (without the &lt;form:column&gt; element wrapping
622 the column).
624 <p>BASE (the template argument) must be a derivee of OControlImport</p>
626 template <class BASE>
627 class OColumnImport : public BASE
629 protected:
630 ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridColumnFactory >
631 m_xColumnFactory;
633 public:
634 OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
635 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
636 OControlElement::ElementType _eType);
638 protected:
639 // OElementImport overridables
640 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
641 createElement();
644 //=====================================================================
645 //= OColumnWrapperImport
646 //=====================================================================
647 class OColumnWrapperImport : public SvXMLImportContext
649 protected:
650 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >
651 m_xOwnAttributes;
652 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
653 m_xParentContainer;
654 OFormLayerXMLImport_Impl& m_rFormImport;
655 IEventAttacherManager& m_rEventManager;
657 public:
658 OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
659 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer);
661 // SvXMLImportContext overridables
662 virtual SvXMLImportContext* CreateChildContext(
663 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
664 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
665 virtual void StartElement(
666 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
667 protected:
668 OControlImport* implCreateChildContext(
669 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
670 OControlElement::ElementType _eType);
673 //=====================================================================
674 //= OGridImport
675 //=====================================================================
676 typedef OContainerImport< OControlImport > OGridImport_Base;
677 /** helper class importing a single &lt;form:grid&gt; element
679 class OGridImport : public OGridImport_Base
681 public:
682 OGridImport(
683 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
684 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
685 OControlElement::ElementType _eType);
687 protected:
688 // OContainerImport overridables
689 virtual SvXMLImportContext* implCreateControlWrapper(
690 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName);
693 //=====================================================================
694 //= OFormImport
695 //=====================================================================
696 typedef OContainerImport< OElementImport > OFormImport_Base;
697 /** helper class importing a single &lt;form:form&gt; element
699 class OFormImport : public OFormImport_Base
701 public:
702 OFormImport(
703 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
704 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
707 protected:
708 // SvXMLImportContext overridables
709 virtual SvXMLImportContext* CreateChildContext(
710 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
711 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
712 virtual void StartElement(
713 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
714 virtual void EndElement();
716 // OContainerImport overridables
717 virtual SvXMLImportContext* implCreateControlWrapper(
718 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName);
720 // OPropertyImport overridables
721 virtual void handleAttribute(sal_uInt16 _nNamespaceKey,
722 const ::rtl::OUString& _rLocalName,
723 const ::rtl::OUString& _rValue);
725 OControlImport* implCreateChildContext(
726 sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
727 OControlElement::ElementType _eType );
730 void implTranslateStringListProperty(const ::rtl::OUString& _rPropertyName, const ::rtl::OUString& _rValue);
733 //=====================================================================
734 //= OXMLDataSourceImport
735 //=====================================================================
736 class OXMLDataSourceImport : public SvXMLImportContext
738 public:
739 OXMLDataSourceImport( SvXMLImport& _rImport
740 ,sal_uInt16 nPrfx
741 ,const ::rtl::OUString& rLName
742 ,const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList
743 ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xElement);
746 #define _INCLUDING_FROM_ELEMENTIMPORT_HXX_
747 #include "elementimport_impl.hxx"
748 #undef _INCLUDING_FROM_ELEMENTIMPORT_HXX_
750 //.........................................................................
751 } // namespace xmloff
752 //.........................................................................
754 #endif // _XMLOFF_FORMS_ELEMENTIMPORT_HXX_