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