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