LibreOffice Module xmloff (master) 1
elementimport.cxx
Go to the documentation of this file.
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#include "elementimport.hxx"
21#include <utility>
22#include <xmloff/xmlimp.hxx>
24#include "strings.hxx"
25#include "callbacks.hxx"
27#include "eventimport.hxx"
28#include <xmloff/txtstyli.hxx>
29#include "formenums.hxx"
30#include <xmloff/xmltoken.hxx>
34
35#include <com/sun/star/uno/XComponentContext.hpp>
36#include <com/sun/star/text/XText.hpp>
37#include <com/sun/star/util/XCloneable.hpp>
38#include <com/sun/star/util/Duration.hpp>
39#include <com/sun/star/form/FormComponentType.hpp>
40#include <com/sun/star/awt/ImagePosition.hpp>
41#include <com/sun/star/beans/XMultiPropertySet.hpp>
42#include <com/sun/star/beans/XPropertyContainer.hpp>
43#include <com/sun/star/beans/PropertyAttribute.hpp>
44
46#include <tools/urlobj.hxx>
48#include <rtl/strbuf.hxx>
49#include <sal/log.hxx>
51#include <comphelper/types.hxx>
53#include <o3tl/string_view.hxx>
54
55#include <algorithm>
56
57namespace xmloff
58{
59
60 using namespace ::xmloff::token;
61 using namespace ::com::sun::star;
62 using namespace ::com::sun::star::uno;
63 using namespace ::com::sun::star::awt;
64 using namespace ::com::sun::star::container;
65 using namespace ::com::sun::star::beans;
66 using namespace ::com::sun::star::script;
67 using namespace ::com::sun::star::lang;
68 using namespace ::com::sun::star::form;
69 using namespace ::com::sun::star::xml;
70 using namespace ::com::sun::star::xml::sax;
71 using namespace ::com::sun::star::util;
72 using namespace ::com::sun::star::text;
73 using namespace ::comphelper;
74 using ::com::sun::star::xml::sax::XAttributeList;
75
76#define PROPID_VALUE 1
77#define PROPID_CURRENT_VALUE 2
78#define PROPID_MIN_VALUE 3
79#define PROPID_MAX_VALUE 4
80
81 namespace {
82
83 struct PropertyValueLess
84 {
85 bool operator()(const PropertyValue& _rLeft, const PropertyValue& _rRight)
86 {
87 return _rLeft.Name < _rRight.Name;
88 }
89 };
90
91 }
92
93 //= OElementNameMap
94 std::map<sal_Int32, OControlElement::ElementType> OElementNameMap::s_sElementTranslations2;
95
97 {
99 sal_Int32 nAsInt = static_cast<sal_Int32>(e);
100 _e = static_cast<OControlElement::ElementType>( ++nAsInt );
101 return _e;
102 }
103
105 {
106 if ( s_sElementTranslations2.empty() )
107 { // initialize
110 }
111 auto aPos = s_sElementTranslations2.find(nElement & TOKEN_MASK);
112 if (s_sElementTranslations2.end() != aPos)
113 return aPos->second;
114
115 return UNKNOWN;
116 }
117
118 //= OElementImport
120 const Reference< XNameContainer >& _rxParentContainer)
121 :OPropertyImport(_rImport)
122 ,m_rFormImport(_rImport)
123 ,m_rEventManager(_rEventManager)
124 ,m_pStyleElement( nullptr )
125 ,m_xParentContainer(_rxParentContainer)
126 ,m_bImplicitGenericAttributeHandling( true )
127 {
128 OSL_ENSURE(m_xParentContainer.is(), "OElementImport::OElementImport: invalid parent container!");
129 }
130
132 {
133 }
134
136 {
137 return OUString();
138 }
139
140 void OElementImport::startFastElement(sal_Int32 nElement, const Reference< css::xml::sax::XFastAttributeList >& _rxAttrList)
141 {
142 ENTER_LOG_CONTEXT( "xmloff::OElementImport - importing one element" );
143
144 const OUString sControlImplementation = _rxAttrList->getOptionalValue( XML_ELEMENT(FORM, XML_CONTROL_IMPLEMENTATION) );
145
146 // retrieve the service name
147 if ( !sControlImplementation.isEmpty() )
148 {
149 OUString sOOoImplementationName;
150 const sal_uInt16 nImplPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName( sControlImplementation, &sOOoImplementationName );
151 m_sServiceName = ( nImplPrefix == XML_NAMESPACE_OOO ) ? sOOoImplementationName : sControlImplementation;
152 }
153
154 if ( m_sServiceName.isEmpty() )
156
157 // create the object *now*. This allows setting properties in the various handleAttribute methods.
158 // (Though currently not all code is migrated to this pattern, most attributes are still handled
159 // by remembering the value (via implPushBackPropertyValue), and setting the correct property value
160 // later (in OControlImport::StartElement).)
162 if ( m_xElement.is() )
163 m_xInfo = m_xElement->getPropertySetInfo();
164
165 // call the base class
166 OPropertyImport::startFastElement( nElement, _rxAttrList );
167 }
168
169 css::uno::Reference< css::xml::sax::XFastContextHandler > OElementImport::createFastChildContext(
170 sal_Int32 nElement,
171 const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList )
172 {
173 if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
175
176 return OPropertyImport::createFastChildContext(nElement, _rxAttrList);
177 }
178
180 {
181 OSL_ENSURE(m_xElement.is(), "OElementImport::EndElement: invalid element created!");
182 if (!m_xElement.is())
183 return;
184
185 // apply the non-generic properties
187
188 // set the generic properties
190
191 // set the style properties
192 if ( m_pStyleElement && m_xElement.is() )
193 {
194 Reference< XPropertySet > xPropTranslation =
195 new OGridColumnPropertyTranslator( Reference< XMultiPropertySet >( m_xElement, UNO_QUERY ) );
196 const_cast< XMLTextStyleContext* >( m_pStyleElement )->FillPropertySet( xPropTranslation );
197
198 const OUString sNumberStyleName = m_pStyleElement->GetDataStyleName( );
199 if ( !sNumberStyleName.isEmpty() )
200 // the style also has a number (sub) style
201 m_rContext.applyControlNumberStyle( m_xElement, sNumberStyleName );
202 }
203
204 // insert the element into the parent container
205 if (m_sName.isEmpty())
206 {
207 OSL_FAIL("OElementImport::EndElement: did not find a name attribute!");
209 }
210
211 if (m_xParentContainer.is())
212 m_xParentContainer->insertByName(m_sName, Any(m_xElement));
213
215 }
216
218 {
219 if ( m_aValues.empty() )
220 return;
221
222 // set all the properties we collected
223#if OSL_DEBUG_LEVEL > 0
224 // check if the object has all the properties
225 // (We do this in the non-pro version only. Doing it all the time would be too much expensive)
226 if ( m_xInfo.is() )
227 {
228 for ( const auto& rCheck : m_aValues )
229 {
230 OSL_ENSURE(m_xInfo->hasPropertyByName(rCheck.Name),
231 OStringBuffer("OElementImport::implApplySpecificProperties: read a property (" +
232 OUStringToOString(rCheck.Name, RTL_TEXTENCODING_ASCII_US) +
233 ") which does not exist on the element!").getStr());
234 }
235 }
236#endif
237
238 // set the properties
239 const Reference< XMultiPropertySet > xMultiProps(m_xElement, UNO_QUERY);
240 bool bSuccess = false;
241 if (xMultiProps.is())
242 {
243 // translate our properties so that the XMultiPropertySet can handle them
244
245 // sort our property value array so that we can use it in a setPropertyValues
246 ::std::sort( m_aValues.begin(), m_aValues.end(), PropertyValueLess());
247
248 // the names
249 Sequence< OUString > aNames(m_aValues.size());
250 OUString* pNames = aNames.getArray();
251 // the values
252 Sequence< Any > aValues(m_aValues.size());
253 Any* pValues = aValues.getArray();
254 // copy
255
256 for ( const auto& rPropValues : m_aValues )
257 {
258 *pNames = rPropValues.Name;
259 *pValues = rPropValues.Value;
260 ++pNames;
261 ++pValues;
262 }
263
264 try
265 {
266 xMultiProps->setPropertyValues(aNames, aValues);
267 bSuccess = true;
268 }
269 catch(const Exception&)
270 {
271 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
272 OSL_FAIL("OElementImport::implApplySpecificProperties: could not set the properties (using the XMultiPropertySet)!");
273 }
274 }
275
276 if (bSuccess)
277 return;
278
279 // no XMultiPropertySet or setting all properties at once failed
280 for ( const auto& rPropValues : m_aValues )
281 {
282 // this try/catch here is expensive, but because this is just a fallback which should normally not be
283 // used it's acceptable this way ...
284 try
285 {
286 m_xElement->setPropertyValue(rPropValues.Name, rPropValues.Value);
287 }
288 catch(const Exception&)
289 {
290 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
291 OSL_FAIL(OStringBuffer("OElementImport::implApplySpecificProperties: could not set the property \"" +
292 OUStringToOString(rPropValues.Name, RTL_TEXTENCODING_ASCII_US) +
293 "\"!").getStr());
294 }
295 }
296 }
297
299 {
300 if ( m_aGenericValues.empty() )
301 return;
302
303 Reference< XPropertyContainer > xDynamicProperties( m_xElement, UNO_QUERY );
304
305 // PropertyValueArray::iterator aEnd = m_aGenericValues.end();
306 for ( auto& rPropValues : m_aGenericValues )
307 {
308 // check property type for numeric types before setting
309 // the property
310 try
311 {
312 // if such a property does not yet exist at the element, create it if necessary
313 const bool bExistentProperty = m_xInfo->hasPropertyByName( rPropValues.Name );
314 if ( !bExistentProperty )
315 {
316 if ( !xDynamicProperties.is() )
317 {
318 SAL_WARN( "xmloff", "OElementImport::implApplyGenericProperties: encountered an unknown property ("
319 << rPropValues.Name << "), but component is no PropertyBag!");
320 continue;
321 }
322
323 xDynamicProperties->addProperty(
324 rPropValues.Name,
325 PropertyAttribute::BOUND | PropertyAttribute::REMOVABLE,
326 rPropValues.Value
327 );
328
329 // re-fetch the PropertySetInfo
330 m_xInfo = m_xElement->getPropertySetInfo();
331 }
332
333 // determine the type of the value (source for the following conversion)
334 TypeClass eValueTypeClass = rPropValues.Value.getValueTypeClass();
335 const bool bValueIsSequence = TypeClass_SEQUENCE == eValueTypeClass;
336 if ( bValueIsSequence )
337 {
338 uno::Type aSimpleType( getSequenceElementType( rPropValues.Value.getValueType() ) );
339 eValueTypeClass = aSimpleType.getTypeClass();
340 }
341
342 // determine the type of the property (target for the following conversion)
343 const Property aProperty( m_xInfo->getPropertyByName( rPropValues.Name ) );
344 TypeClass ePropTypeClass = aProperty.Type.getTypeClass();
345 const bool bPropIsSequence = TypeClass_SEQUENCE == ePropTypeClass;
346 if( bPropIsSequence )
347 {
348 uno::Type aSimpleType( ::comphelper::getSequenceElementType( aProperty.Type ) );
349 ePropTypeClass = aSimpleType.getTypeClass();
350 }
351
352 if ( bPropIsSequence != bValueIsSequence )
353 {
354 OSL_FAIL( "OElementImport::implImportGenericProperties: either both value and property should be a sequence, or none of them!" );
355 continue;
356 }
357
358 if ( bValueIsSequence )
359 {
360 Sequence< Any > aXMLValueList;
361 rPropValues.Value >>= aXMLValueList;
362 // just skip this part if empty sequence
363 if (!aXMLValueList.getLength())
364 continue;
365
366 Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
367
368 SAL_WARN_IF( eValueTypeClass != TypeClass_ANY, "xmloff",
369 "OElementImport::implApplyGenericProperties: only ANYs should have been imported as generic list property!" );
370 // (OPropertyImport should produce only Sequencer< Any >, since it cannot know the real type
371
372 SAL_WARN_IF( ePropTypeClass != TypeClass_SHORT, "xmloff",
373 "OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!" );
374
375
376 std::transform(std::cbegin(aXMLValueList), std::cend(aXMLValueList), aPropertyValueList.getArray(),
377 [](const Any& rXMLValue) -> sal_Int16 {
378 // only value sequences of numeric types implemented so far.
379 double nVal( 0 );
380 OSL_VERIFY( rXMLValue >>= nVal );
381 return static_cast< sal_Int16 >( nVal );
382 });
383
384 rPropValues.Value <<= aPropertyValueList;
385 }
386 else if ( ePropTypeClass != eValueTypeClass )
387 {
388 switch ( eValueTypeClass )
389 {
390 case TypeClass_DOUBLE:
391 {
392 double nVal = 0;
393 rPropValues.Value >>= nVal;
394 switch( ePropTypeClass )
395 {
396 case TypeClass_BYTE:
397 rPropValues.Value <<= static_cast< sal_Int8 >( nVal );
398 break;
399 case TypeClass_SHORT:
400 rPropValues.Value <<= static_cast< sal_Int16 >( nVal );
401 break;
402 case TypeClass_UNSIGNED_SHORT:
403 rPropValues.Value <<= static_cast< sal_uInt16 >( nVal );
404 break;
405 case TypeClass_LONG:
406 case TypeClass_ENUM:
407 rPropValues.Value <<= static_cast< sal_Int32 >( nVal );
408 break;
409 case TypeClass_UNSIGNED_LONG:
410 rPropValues.Value <<= static_cast< sal_uInt32 >( nVal );
411 break;
412 case TypeClass_UNSIGNED_HYPER:
413 rPropValues.Value <<= static_cast< sal_uInt64 >( nVal );
414 break;
415 case TypeClass_HYPER:
416 rPropValues.Value <<= static_cast< sal_Int64 >( nVal );
417 break;
418 default:
419 OSL_FAIL( "OElementImport::implImportGenericProperties: unsupported value type!" );
420 break;
421 }
422 }
423 break;
424 default:
425 OSL_FAIL( "OElementImport::implImportGenericProperties: non-double values not supported!" );
426 break;
427 }
428 }
429
430 m_xElement->setPropertyValue( rPropValues.Name, rPropValues.Value );
431 }
432 catch(const Exception&)
433 {
434 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
435 OSL_FAIL(OStringBuffer("OElementImport::EndElement: could not set the property \"" +
436 OUStringToOString(rPropValues.Name, RTL_TEXTENCODING_ASCII_US) +
437 "\"!").getStr());
438 }
439 }
440 }
441
443 {
444 // no optimization here. If this method gets called, the XML stream did not contain a name for the
445 // element, which is a heavy error. So in this case we don't care for performance
446 static constexpr OUStringLiteral sUnnamedName = u"unnamed";
447 OSL_ENSURE(m_xParentContainer.is(), "OElementImport::implGetDefaultName: no parent container!");
448 if (!m_xParentContainer.is())
449 return sUnnamedName;
450 Sequence< OUString > aNames = m_xParentContainer->getElementNames();
451
452 for (sal_Int32 i=0; i<32768; ++i) // the limit is nearly arbitrary...
453 {
454 // assemble the new name (suggestion)
455 OUString sReturn = sUnnamedName + OUString::number(i);
456 // check the existence (this is the bad performance part...)
457 if (comphelper::findValue(aNames, sReturn) == -1)
458 // not found the name
459 return sReturn;
460 }
461 OSL_FAIL("OElementImport::implGetDefaultName: did not find a free name!");
462 return sUnnamedName;
463 }
464
465 PropertyGroups::const_iterator OElementImport::impl_matchPropertyGroup( const PropertyGroups& i_propertyGroups ) const
466 {
467 ENSURE_OR_RETURN( m_xInfo.is(), "OElementImport::impl_matchPropertyGroup: no property set info!", i_propertyGroups.end() );
468
469 return std::find_if(i_propertyGroups.cbegin(), i_propertyGroups.cend(), [&](const PropertyDescriptionList& rGroup) {
470 return std::all_of(rGroup.cbegin(), rGroup.cend(), [&](const PropertyDescription* prop) {
471 return m_xInfo->hasPropertyByName( prop->propertyName );
472 });
473 });
474 }
475
476 bool OElementImport::tryGenericAttribute( sal_Int32 nElement, const OUString& _rValue )
477 {
478 // the generic approach (which I hope all props will be migrated to, on the medium term): property handlers
480 if ( attribute.attributeToken != XML_TOKEN_INVALID )
481 {
482 PropertyGroups propertyGroups;
483 metadata::getPropertyGroupList( attribute, propertyGroups );
484 const PropertyGroups::const_iterator pos = impl_matchPropertyGroup( propertyGroups );
485 if ( pos == propertyGroups.end() )
486 return false;
487
488 do
489 {
490 const PropertyDescriptionList& rProperties( *pos );
491 const PropertyDescription* first = *rProperties.begin();
492 if ( !first )
493 {
494 SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property description!" );
495 break;
496 }
497
498 const PPropertyHandler handler = (*first->factory)( first->propertyId );
499 if ( !handler )
500 {
501 SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property handler!" );
502 break;
503 }
504
505 PropertyValues aValues;
506 for ( const auto& propDesc : rProperties )
507 {
508 aValues[ propDesc->propertyId ] = Any();
509 }
510 if ( handler->getPropertyValues( _rValue, aValues ) )
511 {
512 for ( const auto& propDesc : rProperties )
513 {
514 implPushBackPropertyValue( propDesc->propertyName, aValues[ propDesc->propertyId ] );
515 }
516 }
517 }
518 while ( false );
519
520 // handled
521 return true;
522 }
523 return false;
524 }
525
526 bool OElementImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
527 {
528 auto nLocal = nElement & TOKEN_MASK;
529 if ( nLocal == XML_CONTROL_IMPLEMENTATION )
530 // ignore this, it has already been handled in OElementImport::StartElement
531 return true;
532
533 if ( nLocal == XML_NAME )
534 {
535 if ( m_sName.isEmpty() )
536 // remember the name for later use in EndElement
537 m_sName = _rValue;
538 return true;
539 }
540
541 // maybe it's the style attribute?
542 if ( nLocal == XML_TEXT_STYLE_NAME )
543 {
544 const SvXMLStyleContext* pStyleContext = m_rContext.getStyleElement( _rValue );
545 OSL_ENSURE( pStyleContext, "OElementImport::handleAttribute: do not know the style!" );
546 // remember the element for later usage.
547 m_pStyleElement = dynamic_cast<const XMLTextStyleContext*>( pStyleContext );
548 return true;
549 }
550
551 if ( m_bImplicitGenericAttributeHandling )
552 if ( tryGenericAttribute( nElement, _rValue ) )
553 return true;
554
555 // let the base class handle it
556 return OPropertyImport::handleAttribute( nElement, _rValue);
557 }
558
559 Reference< XPropertySet > OElementImport::createElement()
560 {
561 Reference< XPropertySet > xReturn;
562 if (!m_sServiceName.isEmpty())
563 {
564 Reference< XComponentContext > xContext = m_rFormImport.getGlobalContext().GetComponentContext();
565 Reference< XInterface > xPure = xContext->getServiceManager()->createInstanceWithContext(m_sServiceName, xContext);
566 OSL_ENSURE(xPure.is(),
567 OStringBuffer("OElementImport::createElement: service factory gave me no object (service name: " +
568 OUStringToOString(m_sServiceName, RTL_TEXTENCODING_ASCII_US) +
569 ")!").getStr());
570 xReturn.set(xPure, UNO_QUERY);
571 }
572 else
573 OSL_FAIL("OElementImport::createElement: no service name to create an element!");
574
575 return xReturn;
576 }
577
578 void OElementImport::registerEvents(const Sequence< ScriptEventDescriptor >& _rEvents)
579 {
580 OSL_ENSURE(m_xElement.is(), "OElementImport::registerEvents: no element to register events for!");
581 m_rEventManager.registerEvents(m_xElement, _rEvents);
582 }
583
584 void OElementImport::simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const char* _pAttributeDefault)
585 {
586 OSL_ENSURE( m_xInfo.is(), "OPropertyImport::simulateDefaultedAttribute: the component should be more gossipy about it's properties!" );
587
588 if ( !m_xInfo.is() || m_xInfo->hasPropertyByName( _rPropertyName ) )
589 {
590 if ( !encounteredAttribute( nElement ) )
591 OSL_VERIFY( handleAttribute( XML_ELEMENT(FORM, (nElement & TOKEN_MASK)), OUString::createFromAscii( _pAttributeDefault ) ) );
592 }
593 }
594
595 //= OControlImport
596 OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
597 const Reference< XNameContainer >& _rxParentContainer)
598 :OElementImport(_rImport, _rEventManager, _rxParentContainer)
599 ,m_eElementType(OControlElement::UNKNOWN)
600 {
602 }
603
604 OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
605 const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
606 :OElementImport(_rImport, _rEventManager, _rxParentContainer)
607 ,m_eElementType(_eType)
608 {
610 }
611
613 {
614 const char* pServiceName = nullptr;
615 switch ( m_eElementType )
616 {
619 case OControlElement::PASSWORD: pServiceName = "com.sun.star.form.component.TextField"; break;
620 case OControlElement::FILE: pServiceName = "com.sun.star.form.component.FileControl"; break;
621 case OControlElement::FORMATTED_TEXT: pServiceName = "com.sun.star.form.component.FormattedField"; break;
622 case OControlElement::FIXED_TEXT: pServiceName = "com.sun.star.form.component.FixedText"; break;
623 case OControlElement::COMBOBOX: pServiceName = "com.sun.star.form.component.ComboBox"; break;
624 case OControlElement::LISTBOX: pServiceName = "com.sun.star.form.component.ListBox"; break;
625 case OControlElement::BUTTON: pServiceName = "com.sun.star.form.component.CommandButton"; break;
626 case OControlElement::IMAGE: pServiceName = "com.sun.star.form.component.ImageButton"; break;
627 case OControlElement::CHECKBOX: pServiceName = "com.sun.star.form.component.CheckBox"; break;
628 case OControlElement::RADIO: pServiceName = "com.sun.star.form.component.RadioButton"; break;
629 case OControlElement::FRAME: pServiceName = "com.sun.star.form.component.GroupBox"; break;
630 case OControlElement::IMAGE_FRAME: pServiceName = "com.sun.star.form.component.DatabaseImageControl"; break;
631 case OControlElement::HIDDEN: pServiceName = "com.sun.star.form.component.HiddenControl"; break;
632 case OControlElement::GRID: pServiceName = "com.sun.star.form.component.GridControl"; break;
633 case OControlElement::VALUERANGE: pServiceName = "com.sun.star.form.component.ScrollBar"; break;
634 case OControlElement::TIME: pServiceName = "com.sun.star.form.component.TimeField"; break;
635 case OControlElement::DATE: pServiceName = "com.sun.star.form.component.DateField"; break;
636 default: break;
637 }
638 if ( pServiceName != nullptr )
639 return OUString::createFromAscii( pServiceName );
640 return OUString();
641 }
642
643 void OControlImport::addOuterAttributes(const Reference< XFastAttributeList >& _rxOuterAttribs)
644 {
645 OSL_ENSURE(!m_xOuterAttributes.is(), "OControlImport::addOuterAttributes: already have these attributes!");
646 m_xOuterAttributes = _rxOuterAttribs;
647 }
648
649 bool OControlImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
650 {
651 static sal_Int32 nLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeToken(BAFlags::LinkedCell);
652
653 if ((nElement & TOKEN_MASK) == XML_ID)
654 { // it's the control id
656 {
657 m_sControlId = _rValue;
658 }
659 else if (IsTokenInNamespace(nElement, XML_NAMESPACE_FORM))
660 {
661 if (m_sControlId.isEmpty())
662 {
663 m_sControlId = _rValue;
664 }
665 }
666 return true;
667 }
668
669 if ( (nElement & TOKEN_MASK) == nLinkedCellAttributeName )
670 { // it's the address of a spreadsheet cell
671 m_sBoundCellAddress = _rValue;
672 return true;
673 }
674
675 if ( nElement == XML_ELEMENT(XFORMS, XML_BIND ) )
676 {
677 m_sBindingID = _rValue;
678 return true;
679 }
680
681 if ( nElement == XML_ELEMENT(FORM, XML_XFORMS_LIST_SOURCE) )
682 {
683 m_sListBindingID = _rValue;
684 return true;
685 }
686
687 if ( nElement == XML_ELEMENT(FORM, XML_XFORMS_SUBMISSION)
688 || nElement == XML_ELEMENT(XFORMS, XML_SUBMISSION) )
689 {
690 m_sSubmissionID = _rValue;
691 return true;
692 }
693
694 if ( OElementImport::tryGenericAttribute( nElement, _rValue ) )
695 return true;
696
697 static const sal_Int32 nValueAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Value);
698 static const sal_Int32 nCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentValue);
699 static const sal_Int32 nMinValueAttributeName = OAttributeMetaData::getSpecialAttributeToken(SCAFlags::MinValue);
700 static const sal_Int32 nMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeToken(SCAFlags::MaxValue);
701 static const sal_Int32 nRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeToken( SCAFlags::RepeatDelay );
702
703 sal_Int32 nHandle = -1;
704 if ( (nElement & TOKEN_MASK) == nValueAttributeName )
706 else if ( (nElement & TOKEN_MASK) == nCurrentValueAttributeName )
708 else if ( (nElement & TOKEN_MASK) == nMinValueAttributeName )
710 else if ( (nElement & TOKEN_MASK) == nMaxValueAttributeName )
712 if ( nHandle != -1 )
713 {
714 // for the moment, simply remember the name and the value
715 PropertyValue aProp;
716 aProp.Name = SvXMLImport::getNameFromToken(nElement);
717 aProp.Handle = nHandle;
718 aProp.Value <<= _rValue;
719 m_aValueProperties.push_back(aProp);
720 return true;
721 }
722
723 if ( (nElement & TOKEN_MASK) == nRepeatDelayAttributeName )
724 {
725 util::Duration aDuration;
726 if (::sax::Converter::convertDuration(aDuration, _rValue))
727 {
728 PropertyValue aProp;
729 aProp.Name = PROPERTY_REPEAT_DELAY;
730 sal_Int32 const nMS =
731 ((aDuration.Hours * 60 + aDuration.Minutes) * 60
732 + aDuration.Seconds) * 1000 + aDuration.NanoSeconds/1000000;
733 aProp.Value <<= nMS;
734
736 }
737 return true;
738 }
739
740 return OElementImport::handleAttribute( nElement, _rValue );
741 }
742
743 void OControlImport::startFastElement(sal_Int32 nElement, const Reference< css::xml::sax::XFastAttributeList >& _rxAttrList)
744 {
745 css::uno::Reference< css::xml::sax::XFastAttributeList > xMergedAttributes;
746 if( m_xOuterAttributes.is() )
747 {
748 // merge the attribute lists, our own one
750 // and the ones of our enclosing element
751 xMerger->add(m_xOuterAttributes);
752 xMergedAttributes = xMerger.get();
753 }
754 else
755 {
756 xMergedAttributes = _rxAttrList;
757 }
758
759 // let the base class handle all the attributes
760 OElementImport::startFastElement(nElement, xMergedAttributes);
761
762 if ( m_aValueProperties.empty() || !m_xElement.is())
763 return;
764
765 // get the property set info
766 if (!m_xInfo.is())
767 {
768 OSL_FAIL("OControlImport::StartElement: no PropertySetInfo!");
769 return;
770 }
771
772 OUString pValueProperty;
773 OUString pCurrentValueProperty;
774 OUString pMinValueProperty;
775 OUString pMaxValueProperty;
776
777 bool bRetrievedValues = false;
778 bool bRetrievedValueLimits = false;
779
780 // get the class id of our element
781 sal_Int16 nClassId = FormComponentType::CONTROL;
782 m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
783
784 // translate the value properties we collected in handleAttributes
785 for ( auto& rValueProps : m_aValueProperties )
786 {
787 bool bSuccess = false;
788 switch (rValueProps.Handle)
789 {
790 case PROPID_VALUE:
792 {
793 // get the property names
794 if (!bRetrievedValues)
795 {
796 getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty);
797 if ( pCurrentValueProperty.isEmpty() && pValueProperty.isEmpty() )
798 {
799 SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value property names!" );
800 break;
801 }
802
803 bRetrievedValues = true;
804 }
805 if ( PROPID_VALUE == rValueProps.Handle && pValueProperty.isEmpty() )
806 {
807 SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a value property!");
808 break;
809 }
810
811 if ( PROPID_CURRENT_VALUE == rValueProps.Handle && pCurrentValueProperty.isEmpty() )
812 {
813 SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a current-value property!");
814 break;
815 }
816
817 // transfer the name
818 if (PROPID_VALUE == rValueProps.Handle)
819 rValueProps.Name = pValueProperty;
820 else
821 rValueProps.Name = pCurrentValueProperty;
822 bSuccess = true;
823 }
824 break;
825 case PROPID_MIN_VALUE:
826 case PROPID_MAX_VALUE:
827 {
828 // get the property names
829 if (!bRetrievedValueLimits)
830 {
831 getValueLimitPropertyNames(nClassId, pMinValueProperty, pMaxValueProperty);
832 if ( pMinValueProperty.isEmpty() || pMaxValueProperty.isEmpty() )
833 {
834 SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value limit property names!" );
835 break;
836 }
837
838 bRetrievedValueLimits = true;
839 }
840 OSL_ENSURE((PROPID_MIN_VALUE != rValueProps.Handle) || !pMinValueProperty.isEmpty(),
841 "OControlImport::StartElement: the control does not have a value property!");
842 OSL_ENSURE((PROPID_MAX_VALUE != rValueProps.Handle) || !pMaxValueProperty.isEmpty(),
843 "OControlImport::StartElement: the control does not have a current-value property!");
844
845 // transfer the name
846 if (PROPID_MIN_VALUE == rValueProps.Handle)
847 rValueProps.Name = pMinValueProperty;
848 else
849 rValueProps.Name = pMaxValueProperty;
850 bSuccess = true;
851 }
852 break;
853 }
854
855 if ( !bSuccess )
856 continue;
857
858 // translate the value
860 // add the property to the base class' array
861 implPushBackPropertyValue(rValueProps);
862 }
863
864 }
865
866 void OControlImport::implTranslateValueProperty(const Reference< XPropertySetInfo >& _rxPropInfo,
867 PropertyValue& _rPropValue)
868 {
869 OSL_ENSURE(_rxPropInfo->hasPropertyByName(_rPropValue.Name),
870 "OControlImport::implTranslateValueProperty: invalid property name!");
871
872 // retrieve the type of the property
873 Property aProp = _rxPropInfo->getPropertyByName(_rPropValue.Name);
874 // the untranslated string value as read in handleAttribute
875 OUString sValue;
876 bool bSuccess = _rPropValue.Value >>= sValue;
877 OSL_ENSURE(bSuccess, "OControlImport::implTranslateValueProperty: supposed to be called with non-translated string values!");
878
879 if (TypeClass_ANY == aProp.Type.getTypeClass())
880 {
881 // we have exactly 2 properties where this type class is allowed:
883 _rPropValue.Name != PROPERTY_EFFECTIVE_VALUE
884 && _rPropValue.Name != PROPERTY_EFFECTIVE_DEFAULT, "xmloff",
885 "OControlImport::implTranslateValueProperty: invalid property type/name combination, Any and " << _rPropValue.Name);
886
887 // Both properties are allowed to have a double or a string value,
888 // so first try to convert the string into a number
889 double nValue;
891 _rPropValue.Value <<= nValue;
892 else
893 _rPropValue.Value <<= sValue;
894 }
895 else
896 _rPropValue.Value = PropertyConversion::convertString(aProp.Type, sValue);
897 }
898
899 void OControlImport::endFastElement(sal_Int32 nElement)
900 {
901 OSL_ENSURE(m_xElement.is(), "OControlImport::EndElement: invalid control!");
902 if ( !m_xElement.is() )
903 return;
904
905 // register our control with its id
906 if (!m_sControlId.isEmpty())
908 // it's allowed to have no control id. In this case we're importing a column
909
910 // one more pre-work to do:
911 // when we set default values, then by definition the respective value is set
912 // to this default value, too. This means if the sequence contains for example
913 // a DefaultText value, then the Text will be affected by this, too.
914 // In case the Text is not part of the property sequence (or occurs _before_
915 // the DefaultText, which can happen for other value/default-value property names),
916 // this means that the Text (the value property) is incorrectly imported.
917
918 bool bRestoreValuePropertyValue = false;
919 Any aValuePropertyValue;
920
921 sal_Int16 nClassId = FormComponentType::CONTROL;
922 try
923 {
924 // get the class id of our element
925 m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
926 }
927 catch( const Exception& )
928 {
929 TOOLS_WARN_EXCEPTION("xmloff.forms",
930 "caught an exception while retrieving the class id!");
931 }
932
933 OUString pValueProperty;
934 OUString pDefaultValueProperty;
935 getRuntimeValuePropertyNames(m_eElementType, nClassId, pValueProperty, pDefaultValueProperty);
936 if ( !pDefaultValueProperty.isEmpty() && !pValueProperty.isEmpty() )
937 {
938 bool bNonDefaultValuePropertyValue = false;
939 // is the "value property" part of the sequence?
940
941 // look up this property in our sequence
942 for ( const auto& rCheck : m_aValues )
943 {
944 if ( rCheck.Name == pDefaultValueProperty )
945 bRestoreValuePropertyValue = true;
946 else if ( rCheck.Name == pValueProperty )
947 {
948 bNonDefaultValuePropertyValue = true;
949 // we need to restore the value property we found here, nothing else
950 aValuePropertyValue = rCheck.Value;
951 }
952 }
953
954 if ( bRestoreValuePropertyValue && !bNonDefaultValuePropertyValue )
955 {
956 // found it -> need to remember (and restore) the "value property value", which is not set explicitly
957 try
958 {
959 aValuePropertyValue = m_xElement->getPropertyValue( pValueProperty );
960 }
961 catch( const Exception& )
962 {
964 "xmloff.forms",
965 "caught an exception while retrieving the current value property!");
966 }
967 }
968 }
969
970 // let the base class set all the values
972
973 // restore the "value property value", if necessary
974 if ( bRestoreValuePropertyValue && !pValueProperty.isEmpty() )
975 {
976 try
977 {
978 m_xElement->setPropertyValue( pValueProperty, aValuePropertyValue );
979 }
980 catch( const Exception& )
981 {
982 TOOLS_WARN_EXCEPTION("xmloff.forms",
983 "caught an exception while restoring the value property!");
984 }
985 }
986
987 // the external cell binding, if applicable
988 if ( m_xElement.is() && !m_sBoundCellAddress.isEmpty() )
990
991 // XForms binding, if applicable
992 if ( m_xElement.is() && !m_sBindingID.isEmpty() )
994
995 // XForms list binding, if applicable
996 if ( m_xElement.is() && !m_sListBindingID.isEmpty() )
998
999 // XForms submission, if applicable
1000 if ( m_xElement.is() && !m_sSubmissionID.isEmpty() )
1002 }
1003
1004 void OControlImport::doRegisterCellValueBinding( const OUString& _rBoundCellAddress )
1005 {
1006 OSL_PRECOND( m_xElement.is(), "OControlImport::doRegisterCellValueBinding: invalid element!" );
1007 OSL_PRECOND( !_rBoundCellAddress.isEmpty(),
1008 "OControlImport::doRegisterCellValueBinding: invalid address!" );
1009
1010 m_rContext.registerCellValueBinding( m_xElement, _rBoundCellAddress );
1011 }
1012
1013 void OControlImport::doRegisterXFormsValueBinding( const OUString& _rBindingID )
1014 {
1015 OSL_PRECOND( m_xElement.is(), "need element" );
1016 OSL_PRECOND( !_rBindingID.isEmpty(), "binding ID is not valid" );
1017
1019 }
1020
1021 void OControlImport::doRegisterXFormsListBinding( const OUString& _rBindingID )
1022 {
1023 OSL_PRECOND( m_xElement.is(), "need element" );
1024 OSL_PRECOND( !_rBindingID.isEmpty(), "binding ID is not valid" );
1025
1027 }
1028
1029 void OControlImport::doRegisterXFormsSubmission( const OUString& _rSubmissionID )
1030 {
1031 OSL_PRECOND( m_xElement.is(), "need element" );
1032 OSL_PRECOND( !_rSubmissionID.isEmpty(), "binding ID is not valid" );
1033
1035 }
1036
1037 Reference< XPropertySet > OControlImport::createElement()
1038 {
1039 const Reference<XPropertySet> xPropSet = OElementImport::createElement();
1040 if ( xPropSet.is() )
1041 {
1042 m_xInfo = xPropSet->getPropertySetInfo();
1043 if ( m_xInfo.is() && m_xInfo->hasPropertyByName(PROPERTY_ALIGN) )
1044 {
1045 Any aValue;
1046 xPropSet->setPropertyValue(PROPERTY_ALIGN,aValue);
1047 }
1048 }
1049 return xPropSet;
1050 }
1051
1052 //= OImagePositionImport
1054 const Reference< XNameContainer >& _rxParentContainer,
1056 :OControlImport( _rImport, _rEventManager, _rxParentContainer, _eType )
1057 ,m_nImagePosition( -1 )
1058 ,m_nImageAlign( 0 )
1059 ,m_bHaveImagePosition( false )
1060 {
1061 }
1062
1064 const OUString& _rValue )
1065 {
1066 static const sal_Int32 s_nImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::ImageData);
1067
1068 if ( (nElement & TOKEN_MASK) == s_nImageDataAttributeName)
1069 {
1070 m_xGraphic = m_rContext.getGlobalContext().loadGraphicByURL(_rValue);
1071 return true;
1072 }
1073 else if ( (nElement & TOKEN_MASK) == XML_IMAGE_POSITION )
1074 {
1076 cppu::UnoType<decltype(m_nImagePosition)>::get(),
1077 _rValue, aImagePositionMap
1078 ) >>= m_nImagePosition );
1079 m_bHaveImagePosition = true;
1080 return true;
1081 }
1082 else if ( (nElement & TOKEN_MASK) == XML_IMAGE_ALIGN )
1083 {
1085 cppu::UnoType<decltype(m_nImageAlign)>::get(),
1086 _rValue, aImageAlignMap
1087 ) >>= m_nImageAlign );
1088 return true;
1089 }
1090
1091 return OControlImport::handleAttribute( nElement, _rValue );
1092 }
1093
1094 void OImagePositionImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1095 {
1096 OControlImport::startFastElement( nElement, _rxAttrList );
1097
1098 if (m_xGraphic.is())
1099 {
1100 PropertyValue aGraphicProperty;
1101 aGraphicProperty.Name = PROPERTY_GRAPHIC;
1102 aGraphicProperty.Value <<= m_xGraphic;
1103 implPushBackPropertyValue(aGraphicProperty);
1104 }
1105 if ( !m_bHaveImagePosition )
1106 return;
1107
1108 sal_Int16 nUnoImagePosition = ImagePosition::Centered;
1109 if ( m_nImagePosition >= 0 )
1110 {
1111 OSL_ENSURE( ( m_nImagePosition <= 3 ) && ( m_nImageAlign >= 0 ) && ( m_nImageAlign < 3 ),
1112 "OImagePositionImport::StartElement: unknown image align and/or position!" );
1113 nUnoImagePosition = m_nImagePosition * 3 + m_nImageAlign;
1114 }
1115
1116 PropertyValue aImagePosition;
1117 aImagePosition.Name = PROPERTY_IMAGE_POSITION;
1118 aImagePosition.Value <<= nUnoImagePosition;
1119 implPushBackPropertyValue( aImagePosition );
1120 }
1121
1122 //= OReferredControlImport
1124 OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
1125 const Reference< XNameContainer >& _rxParentContainer )
1126 :OControlImport(_rImport, _rEventManager, _rxParentContainer)
1127 {
1128 }
1129
1130 void OReferredControlImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1131 {
1132 OControlImport::startFastElement(nElement, _rxAttrList);
1133
1134 // the base class should have created the control, so we can register it
1135 if ( !m_sReferringControls.isEmpty() )
1137 }
1138
1140 const OUString& _rValue)
1141 {
1142 static const sal_Int32 s_nReferenceAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::For);
1143 if ((nElement & TOKEN_MASK) == s_nReferenceAttributeName)
1144 {
1145 m_sReferringControls = _rValue;
1146 return true;
1147 }
1148 return OControlImport::handleAttribute(nElement, _rValue);
1149 }
1150
1151 //= OPasswordImport
1153 const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
1154 :OControlImport(_rImport, _rEventManager, _rxParentContainer, _eType)
1155 {
1156 }
1157
1158 bool OPasswordImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
1159 {
1160 static const sal_Int32 s_nEchoCharAttributeName = OAttributeMetaData::getSpecialAttributeToken(SCAFlags::EchoChar);
1161 if ((nElement & TOKEN_MASK) == s_nEchoCharAttributeName)
1162 {
1163 // need a special handling for the EchoChar property
1164 PropertyValue aEchoChar;
1165 aEchoChar.Name = PROPERTY_ECHOCHAR;
1166 OSL_ENSURE(_rValue.getLength() == 1, "OPasswordImport::handleAttribute: invalid echo char attribute!");
1167 // we ourself should not have written values other than of length 1
1168 if (_rValue.getLength() >= 1)
1169 aEchoChar.Value <<= static_cast<sal_Int16>(_rValue[0]);
1170 else
1171 aEchoChar.Value <<= sal_Int16(0);
1172 implPushBackPropertyValue(aEchoChar);
1173 return true;
1174 }
1175 return OControlImport::handleAttribute(nElement, _rValue);
1176 }
1177
1178 //= ORadioImport
1180 const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
1181 :OImagePositionImport( _rImport, _rEventManager, _rxParentContainer, _eType )
1182 {
1183 }
1184
1185 bool ORadioImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
1186 {
1187 // need special handling for the State & CurrentState properties:
1188 // they're stored as booleans, but expected to be int16 properties
1189 static const sal_Int32 nCurrentSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentSelected);
1190 static const sal_Int32 nSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Selected);
1191 if ( (nElement & TOKEN_MASK) == nCurrentSelectedAttributeName
1192 || (nElement & TOKEN_MASK) == nSelectedAttributeName
1193 )
1194 {
1196 assert(pProperty && "ORadioImport::handleAttribute: invalid property map!");
1197 if (pProperty)
1198 {
1199 const Any aBooleanValue( PropertyConversion::convertString(pProperty->aPropertyType, _rValue, pProperty->pEnumMap) );
1200
1201 // create and store a new PropertyValue
1202 PropertyValue aNewValue;
1203 aNewValue.Name = pProperty->sPropertyName;
1204 aNewValue.Value <<= static_cast<sal_Int16>(::cppu::any2bool(aBooleanValue));
1205
1206 implPushBackPropertyValue(aNewValue);
1207 }
1208 return true;
1209 }
1210 return OImagePositionImport::handleAttribute( nElement, _rValue );
1211 }
1212
1213 //= OURLReferenceImport
1215 const Reference< XNameContainer >& _rxParentContainer,
1217 :OImagePositionImport(_rImport, _rEventManager, _rxParentContainer, _eType)
1218 {
1219 }
1220
1221 bool OURLReferenceImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
1222 {
1223 static const sal_Int32 s_nTargetLocationAttributeName = OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::TargetLocation );
1224 static const sal_Int32 s_nImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::ImageData );
1225
1226 // need to make the URL absolute if
1227 // * it's the image-data attribute
1228 // * it's the target-location attribute, and we're dealing with an object which has the respective property
1229 bool bMakeAbsolute =
1230 (nElement & TOKEN_MASK) == s_nImageDataAttributeName
1231 || ( (nElement & TOKEN_MASK) == s_nTargetLocationAttributeName
1234 )
1235 );
1236
1237 if (bMakeAbsolute && !_rValue.isEmpty())
1238 {
1239 OUString sAdjustedValue = _rValue;
1240 if ((nElement & TOKEN_MASK) != s_nImageDataAttributeName)
1241 sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
1242 return OImagePositionImport::handleAttribute( nElement, sAdjustedValue );
1243 }
1244
1245 return OImagePositionImport::handleAttribute( nElement, _rValue );
1246 }
1247
1248 //= OButtonImport
1250 const Reference< XNameContainer >& _rxParentContainer,
1252 :OURLReferenceImport(_rImport, _rEventManager, _rxParentContainer, _eType)
1253 {
1255 }
1256
1257 void OButtonImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1258 {
1259 OURLReferenceImport::startFastElement(nElement, _rxAttrList);
1260
1261 // handle the target-frame attribute
1263 }
1264
1265 //= OValueRangeImport
1267 const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType )
1268 :OControlImport( _rImport, _rEventManager, _rxParentContainer, _eType )
1269 ,m_nStepSizeValue( 1 )
1270 {
1271
1272 }
1273
1274 bool OValueRangeImport::handleAttribute( sal_Int32 nElement, const OUString& _rValue )
1275 {
1277 {
1279 return true;
1280 }
1281 return OControlImport::handleAttribute( nElement, _rValue );
1282 }
1283
1284 void OValueRangeImport::startFastElement( sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList )
1285 {
1286 OControlImport::startFastElement( nElement, _rxAttrList );
1287
1288 if ( m_xInfo.is() )
1289 {
1290 if ( m_xInfo->hasPropertyByName( PROPERTY_SPIN_INCREMENT ) )
1291 m_xElement->setPropertyValue( PROPERTY_SPIN_INCREMENT, Any( m_nStepSizeValue ) );
1292 else if ( m_xInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
1293 m_xElement->setPropertyValue( PROPERTY_LINE_INCREMENT, Any( m_nStepSizeValue ) );
1294 }
1295 }
1296
1297 //= OTextLikeImport
1299 const Reference< XNameContainer >& _rxParentContainer,
1301 :OControlImport(_rImport, _rEventManager, _rxParentContainer, _eType)
1302 ,m_bEncounteredTextPara( false )
1303 {
1305 }
1306
1307 css::uno::Reference< css::xml::sax::XFastContextHandler > OTextLikeImport::createFastChildContext(
1308 sal_Int32 nElement,
1309 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
1310 {
1311 if ( nElement == XML_ELEMENT(TEXT, XML_P) )
1312 {
1314 "OTextLikeImport::CreateChildContext: text paragraphs in a non-text-area?" );
1315
1317 {
1318 Reference< XText > xTextElement( m_xElement, UNO_QUERY );
1319 if ( xTextElement.is() )
1320 {
1321 rtl::Reference < XMLTextImportHelper > xTextImportHelper( m_rContext.getGlobalContext().GetTextImport() );
1322
1323 if ( !m_xCursor.is() )
1324 {
1325 m_xOldCursor = xTextImportHelper->GetCursor();
1326 m_xCursor = xTextElement->createTextCursor();
1327
1328 if ( m_xCursor.is() )
1329 xTextImportHelper->SetCursor( m_xCursor );
1330 }
1331 if ( m_xCursor.is() )
1332 {
1334 return xTextImportHelper->CreateTextChildContext( m_rContext.getGlobalContext(), nElement, xAttrList );
1335 }
1336 }
1337 else
1338 {
1339 // in theory, we could accumulate all the text portions (without formatting),
1340 // and set it as Text property at the model ...
1341 }
1342 }
1343 }
1344
1345 return OControlImport::createFastChildContext( nElement, xAttrList );
1346 }
1347
1348 void OTextLikeImport::startFastElement(sal_Int32 nElement, const Reference< css::xml::sax::XFastAttributeList >& _rxAttrList)
1349 {
1350 OControlImport::startFastElement(nElement, _rxAttrList);
1351
1352 // handle the convert-empty-to-null attribute, whose default is different from the property default
1353 // unfortunately, different classes are imported by this class ('cause they're represented by the
1354 // same XML element), though not all of them know this property.
1355 // So we have to do a check ...
1356 if (m_xElement.is() && m_xInfo.is() && m_xInfo->hasPropertyByName(PROPERTY_EMPTY_IS_NULL) )
1358 }
1359
1360 namespace {
1361
1362 struct EqualHandle
1363 {
1364 const sal_Int32 m_nHandle;
1365 explicit EqualHandle( sal_Int32 _nHandle ) : m_nHandle( _nHandle ) { }
1366
1367 bool operator()( const PropertyValue& _rProp )
1368 {
1369 return _rProp.Handle == m_nHandle;
1370 }
1371 };
1372
1373 }
1374
1376 {
1378 return;
1379
1380 // In case the text is written in the text:p elements, we need to ignore what we read as
1381 // current-value attribute, since it's redundant.
1382 // fortunately, OElementImport tagged the value property with the PROPID_CURRENT_VALUE
1383 // handle, so we do not need to determine the name of our value property here
1384 // (normally, it should be "Text", since no other controls than the edit field should
1385 // have the text:p elements)
1386 PropertyValueArray::iterator aValuePropertyPos = ::std::find_if(
1387 m_aValues.begin(),
1388 m_aValues.end(),
1389 EqualHandle( PROPID_CURRENT_VALUE )
1390 );
1391 if ( aValuePropertyPos != m_aValues.end() )
1392 {
1393 OSL_ENSURE( aValuePropertyPos->Name == PROPERTY_TEXT, "OTextLikeImport::EndElement: text:p was present, but our value property is *not* 'Text'!" );
1394 if ( aValuePropertyPos->Name == PROPERTY_TEXT )
1395 {
1396 m_aValues.erase(aValuePropertyPos);
1397 }
1398 }
1399
1400 // additionally, we need to set the "RichText" property of our element to sal_True
1401 // (the presence of the text:p is used as indicator for the value of the RichText property)
1402 bool bHasRichTextProperty = false;
1403 if ( m_xInfo.is() )
1404 bHasRichTextProperty = m_xInfo->hasPropertyByName( PROPERTY_RICH_TEXT );
1405 OSL_ENSURE( bHasRichTextProperty, "OTextLikeImport::EndElement: text:p, but no rich text control?" );
1406 if ( bHasRichTextProperty )
1407 m_xElement->setPropertyValue( PROPERTY_RICH_TEXT, Any( true ) );
1408 // Note that we do *not* set the RichText property (in case our element has one) to sal_False here
1409 // since this is the default of this property, anyway.
1410 }
1411
1412 namespace {
1413
1414 struct EqualName
1415 {
1416 const OUString & m_sName;
1417 explicit EqualName( const OUString& _rName ) : m_sName( _rName ) { }
1418
1419 bool operator()( const PropertyValue& _rProp )
1420 {
1421 return _rProp.Name == m_sName;
1422 }
1423 };
1424
1425 }
1426
1428 {
1429 // In OpenOffice.org 2.0, we changed the implementation of the css.form.component.TextField (the model of a text field control),
1430 // so that it now uses another default control. So if we encounter a text field where the *old* default
1431 // control property is writing, we are not allowed to use it
1432 PropertyValueArray::iterator aDefaultControlPropertyPos = ::std::find_if(
1433 m_aValues.begin(),
1434 m_aValues.end(),
1435 EqualName( "DefaultControl" )
1436 );
1437 if ( aDefaultControlPropertyPos != m_aValues.end() )
1438 {
1439 OUString sDefaultControl;
1440 OSL_VERIFY( aDefaultControlPropertyPos->Value >>= sDefaultControl );
1441 if ( sDefaultControl == "stardiv.one.form.control.Edit" )
1442 {
1443 // complete remove this property value from the array. Today's "default value" of the "DefaultControl"
1444 // property is sufficient
1445 m_aValues.erase(aDefaultControlPropertyPos);
1446 }
1447 }
1448 }
1449
1450 void OTextLikeImport::endFastElement(sal_Int32 nElement)
1451 {
1454
1455 // let the base class do the stuff
1457
1458 // some cleanups
1459 rtl::Reference < XMLTextImportHelper > xTextImportHelper( m_rContext.getGlobalContext().GetTextImport() );
1460 if ( m_xCursor.is() )
1461 {
1462 // delete the newline which has been imported erroneously
1463 // TODO (fs): stole this code somewhere - why don't we fix the text import??
1464 m_xCursor->gotoEnd( false );
1465 m_xCursor->goLeft( 1, true );
1466 m_xCursor->setString( OUString() );
1467
1468 // reset cursor
1469 xTextImportHelper->ResetCursor();
1470 }
1471
1472 if ( m_xOldCursor.is() )
1473 xTextImportHelper->SetCursor( m_xOldCursor );
1474
1475 }
1476
1477 //= OListAndComboImport
1479 const Reference< XNameContainer >& _rxParentContainer,
1481 :OControlImport(_rImport, _rEventManager, _rxParentContainer, _eType)
1482 ,m_nEmptyListItems( 0 )
1483 ,m_nEmptyValueItems( 0 )
1484 ,m_bEncounteredLSAttrib( false )
1485 ,m_bLinkWithIndexes( false )
1486 {
1489 }
1490
1491 css::uno::Reference< css::xml::sax::XFastContextHandler > OListAndComboImport::createFastChildContext(
1492 sal_Int32 nElement,
1493 const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList )
1494 {
1495 // is it the "option" sub tag of a listbox ?
1496 if ((nElement & TOKEN_MASK) == XML_OPTION)
1497 return new OListOptionImport(GetImport(), this);
1498
1499 // is it the "item" sub tag of a combobox ?
1500 if ((nElement & TOKEN_MASK) == XML_ITEM)
1501 return new OComboItemImport(GetImport(), this);
1502
1503 // everything else
1504 return OControlImport::createFastChildContext(nElement, _rxAttrList);
1505 }
1506
1507 void OListAndComboImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1508 {
1509 m_bLinkWithIndexes = false;
1510
1511 OControlImport::startFastElement(nElement, _rxAttrList);
1512
1514 {
1515 // for the auto-completion
1516 // the attribute default does not equal the property default, so in case we did not read this attribute,
1517 // we have to simulate it
1519
1520 // same for the convert-empty-to-null attribute, which's default is different from the property default
1522 }
1523 }
1524
1526 {
1527 // append the list source property the properties sequence of our importer
1528 // the string item list
1529 PropertyValue aItemList;
1530 aItemList.Name = PROPERTY_STRING_ITEM_LIST;
1532 implPushBackPropertyValue(aItemList);
1533
1535 {
1536 OSL_ENSURE((m_aListSource.size() + m_nEmptyListItems) == (m_aValueList.size() + m_nEmptyValueItems),
1537 "OListAndComboImport::EndElement: inconsistence between labels and values!");
1538
1540 {
1541 // the value sequence
1542 PropertyValue aValueList;
1543 aValueList.Name = PROPERTY_LISTSOURCE;
1544 aValueList.Value <<= comphelper::containerToSequence(m_aValueList);
1545 implPushBackPropertyValue(aValueList);
1546 }
1547
1548 // the select sequence
1549 PropertyValue aSelected;
1550 aSelected.Name = PROPERTY_SELECT_SEQ;
1552 implPushBackPropertyValue(aSelected);
1553
1554 // the default select sequence
1555 PropertyValue aDefaultSelected;
1556 aDefaultSelected.Name = PROPERTY_DEFAULT_SELECT_SEQ;
1557 aDefaultSelected.Value <<= comphelper::containerToSequence(m_aDefaultSelectedSeq);
1558 implPushBackPropertyValue(aDefaultSelected);
1559 }
1560
1562
1563 // the external list source, if applicable
1564 if ( m_xElement.is() && !m_sCellListSource.isEmpty() )
1566 }
1567
1568 void OListAndComboImport::doRegisterCellValueBinding( const OUString& _rBoundCellAddress )
1569 {
1570 OUString sBoundCellAddress( _rBoundCellAddress );
1571 if ( m_bLinkWithIndexes )
1572 {
1573 // This is a HACK. We register a string which is no valid address, but allows
1574 // (somewhere else) to determine that a non-standard binding should be created.
1575 // This hack is acceptable for OOo 1.1.1, since the file format for value
1576 // bindings of form controls is to be changed afterwards, anyway.
1577 sBoundCellAddress += ":index";
1578 }
1579
1580 OControlImport::doRegisterCellValueBinding( sBoundCellAddress );
1581 }
1582
1583 bool OListAndComboImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
1584 {
1585 static const sal_Int32 nListSourceAttributeName = OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ListSource);
1586 if ( (nElement & TOKEN_MASK) == nListSourceAttributeName )
1587 {
1588 PropertyValue aListSource;
1589 aListSource.Name = PROPERTY_LISTSOURCE;
1590
1591 // it's the ListSource attribute
1594 {
1595 aListSource.Value <<= _rValue;
1596 }
1597 else
1598 {
1599 // a listbox which has a list-source attribute must have a list-source-type of something
1600 // not equal to ValueList.
1601 // In this case, the list-source value is simply the one and only element of the ListSource property.
1602 Sequence<OUString> aListSourcePropValue { _rValue };
1603 aListSource.Value <<= aListSourcePropValue;
1604 }
1605
1606 implPushBackPropertyValue( aListSource );
1607 return true;
1608 }
1609
1611 {
1612 m_sCellListSource = _rValue;
1613 return true;
1614 }
1615
1617 {
1618 sal_Int16 nLinkageType = 0;
1621 _rValue,
1623 ) >>= nLinkageType;
1624
1625 m_bLinkWithIndexes = ( nLinkageType != 0 );
1626 return true;
1627 }
1628
1629 return OControlImport::handleAttribute(nElement, _rValue);
1630 }
1631
1632 void OListAndComboImport::implPushBackLabel(const OUString& _rLabel)
1633 {
1634 OSL_ENSURE(!m_nEmptyListItems, "OListAndComboImport::implPushBackValue: label list is already done!");
1635 if (!m_nEmptyListItems)
1636 m_aListSource.push_back(_rLabel);
1637 }
1638
1639 void OListAndComboImport::implPushBackValue(const OUString& _rValue)
1640 {
1641 OSL_ENSURE(!m_nEmptyValueItems, "OListAndComboImport::implPushBackValue: value list is already done!");
1642 if (!m_nEmptyValueItems)
1643 {
1644 OSL_ENSURE( !m_bEncounteredLSAttrib, "OListAndComboImport::implPushBackValue: invalid structure! Did you save this document with a version prior SRC641 m?" );
1645 // We already had the list-source attribute, which means that the ListSourceType is
1646 // not ValueList, which means that the ListSource should contain only one string in
1647 // the first element of the sequence
1648 // All other values in the file are invalid
1649
1650 m_aValueList.push_back( _rValue );
1651 }
1652 }
1653
1655 {
1657 }
1658
1660 {
1662 }
1663
1665 {
1666 OSL_ENSURE((m_aListSource.size() + m_nEmptyListItems) == (m_aValueList.size() + m_nEmptyValueItems),
1667 "OListAndComboImport::implSelectCurrentItem: inconsistence between labels and values!");
1668
1669 sal_Int16 nItemNumber = static_cast<sal_Int16>(m_aListSource.size() - 1 + m_nEmptyListItems);
1670 m_aSelectedSeq.push_back(nItemNumber);
1671 }
1672
1674 {
1675 OSL_ENSURE((m_aListSource.size() + m_nEmptyListItems) == (m_aValueList.size() + m_nEmptyValueItems),
1676 "OListAndComboImport::implDefaultSelectCurrentItem: inconsistence between labels and values!");
1677
1678 sal_Int16 nItemNumber = static_cast<sal_Int16>(m_aListSource.size() - 1 + m_nEmptyListItems);
1679 m_aDefaultSelectedSeq.push_back(nItemNumber);
1680 }
1681
1682 //= OListOptionImport
1684 OListAndComboImportRef _xListBox)
1685 :SvXMLImportContext(_rImport)
1686 ,m_xListBoxImport(std::move(_xListBox))
1687 {
1688 }
1689
1690 void OListOptionImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1691 {
1692 // the label and the value
1693 const sal_Int32 nLabelAttribute = (nElement & ~TOKEN_MASK) | XML_LABEL;
1694 const sal_Int32 nValueAttribute = (nElement & ~TOKEN_MASK) | XML_VALUE;
1695
1696 // the label attribute
1697 OUString sValue = _rxAttrList->getOptionalValue(nLabelAttribute);
1698 bool bNonexistentAttribute = !_rxAttrList->hasAttribute(nLabelAttribute);
1699
1700 if (bNonexistentAttribute)
1701 m_xListBoxImport->implEmptyLabelFound();
1702 else
1703 m_xListBoxImport->implPushBackLabel( sValue );
1704
1705 // the value attribute
1706 sValue = _rxAttrList->getOptionalValue(nValueAttribute);
1707 bNonexistentAttribute = !_rxAttrList->hasAttribute(nValueAttribute);
1708
1709 if (bNonexistentAttribute)
1710 m_xListBoxImport->implEmptyValueFound();
1711 else
1712 m_xListBoxImport->implPushBackValue( sValue );
1713
1714 // the current-selected and selected
1715 const sal_Int32 nSelectedAttribute = (nElement & ~TOKEN_MASK) | OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentSelected);
1716 const sal_Int32 nDefaultSelectedAttribute = (nElement & ~TOKEN_MASK) | OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Selected);
1717
1718 // propagate the selected flag
1719 bool bSelected(false);
1720 (void)::sax::Converter::convertBool(bSelected,
1721 _rxAttrList->getOptionalValue(nSelectedAttribute));
1722 if (bSelected)
1723 m_xListBoxImport->implSelectCurrentItem();
1724
1725 // same for the default selected
1726 bool bDefaultSelected(false);
1727 (void)::sax::Converter::convertBool(bDefaultSelected,
1728 _rxAttrList->getOptionalValue(nDefaultSelectedAttribute));
1729 if (bDefaultSelected)
1730 m_xListBoxImport->implDefaultSelectCurrentItem();
1731 }
1732
1733 //= OComboItemImport
1735 OListAndComboImportRef _xListBox)
1736 :SvXMLImportContext(_rImport)
1737 ,m_xListBoxImport(std::move(_xListBox))
1738 {
1739 }
1740
1741 void OComboItemImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1742 {
1743 const sal_Int32 nLabelAttributeName = (nElement & ~TOKEN_MASK) |
1745 m_xListBoxImport->implPushBackLabel(_rxAttrList->getOptionalValue(nLabelAttributeName));
1746 }
1747
1748 //= OColumnWrapperImport
1750 IEventAttacherManager& _rEventManager, sal_Int32 /*nElement*/,
1751 const Reference< XNameContainer >& _rxParentContainer)
1752 :SvXMLImportContext(_rImport.getGlobalContext())
1753 ,m_xParentContainer(_rxParentContainer)
1754 ,m_rFormImport(_rImport)
1755 ,m_rEventManager(_rEventManager)
1756 {
1757 }
1758 css::uno::Reference< css::xml::sax::XFastContextHandler > OColumnWrapperImport::createFastChildContext(
1759 sal_Int32 nElement,
1760 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
1761 {
1763 if (pReturn)
1764 {
1765 OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!");
1767 }
1768 return pReturn;
1769 }
1770 void OColumnWrapperImport::startFastElement(sal_Int32 /*nElement*/, const Reference< XFastAttributeList >& _rxAttrList)
1771 {
1772 OSL_ENSURE(!m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: already have the cloned list!");
1773
1774 // clone the attributes
1775 Reference< XCloneable > xCloneList(_rxAttrList, UNO_QUERY_THROW);
1776 m_xOwnAttributes.set(xCloneList->createClone(), UNO_QUERY_THROW);
1777 }
1778
1780 sal_Int32 /*nElement*/,
1782 {
1783 OSL_ENSURE( (OControlElement::TEXT == _eType)
1784 || (OControlElement::TEXT_AREA == _eType)
1785 || (OControlElement::FORMATTED_TEXT == _eType)
1786 || (OControlElement::CHECKBOX == _eType)
1787 || (OControlElement::LISTBOX == _eType)
1788 || (OControlElement::COMBOBOX == _eType)
1789 || (OControlElement::TIME == _eType)
1790 || (OControlElement::DATE == _eType),
1791 "OColumnWrapperImport::implCreateChildContext: invalid or unrecognized sub element!");
1792
1793 switch (_eType)
1794 {
1798
1801
1806
1807 default:
1809 }
1810 }
1811
1812 //= OGridImport
1814 const Reference< XNameContainer >& _rxParentContainer,
1816 :OControlImport(_rImport, _rEventManager, _rxParentContainer)
1817 {
1818 setElementType(_eType);
1819 }
1820
1821 css::uno::Reference< css::xml::sax::XFastContextHandler > OGridImport::createFastChildContext(
1822 sal_Int32 nElement,
1823 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
1824 {
1825 // maybe it's a sub control
1826 if ((nElement & TOKEN_MASK) == XML_COLUMN)
1827 {
1828 if (m_xMeAsContainer.is())
1829 return new OColumnWrapperImport(m_rFormImport, *this, nElement, m_xMeAsContainer);
1830 else
1831 {
1832 OSL_FAIL("OGridImport::CreateChildContext: don't have an element!");
1833 return nullptr;
1834 }
1835 }
1836
1837 return OControlImport::createFastChildContext(nElement, xAttrList);
1838 }
1839
1840 void OGridImport::endFastElement(sal_Int32 nElement)
1841 {
1843
1844 // now that we have all children, attach the events
1845 css::uno::Reference< css::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, css::uno::UNO_QUERY);
1846 if (xIndexContainer.is())
1848 }
1849
1850 css::uno::Reference< css::beans::XPropertySet > OGridImport::createElement()
1851 {
1852 // let the base class create the object
1853 css::uno::Reference< css::beans::XPropertySet > xReturn = OControlImport::createElement();
1854 if (!xReturn.is())
1855 return xReturn;
1856
1857 // ensure that the object is a XNameContainer (we strongly need this for inserting child elements)
1858 m_xMeAsContainer.set(xReturn, css::uno::UNO_QUERY);
1859 if (!m_xMeAsContainer.is())
1860 {
1861 OSL_FAIL("OContainerImport::createElement: invalid element (no XNameContainer) created!");
1862 xReturn.clear();
1863 }
1864
1865 return xReturn;
1866 }
1867
1868 //= OFormImport
1870 const Reference< XNameContainer >& _rxParentContainer)
1871 :OElementImport(_rImport, _rEventManager, _rxParentContainer)
1872 {
1874 }
1875
1876 css::uno::Reference< css::xml::sax::XFastContextHandler > OFormImport::createFastChildContext(
1877 sal_Int32 nElement,
1878 const uno::Reference< xml::sax::XFastAttributeList>& _rxAttrList )
1879 {
1880 auto nToken = (nElement & TOKEN_MASK);
1881 if( nToken == XML_FORM )
1882 return new OFormImport( m_rFormImport, *this, m_xMeAsContainer);
1883 else if ( nToken == XML_CONNECTION_RESOURCE )
1884 return new OXMLDataSourceImport(GetImport(), _rxAttrList, m_xElement);
1885 else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) ||
1887 return OElementImport::createFastChildContext( nElement, _rxAttrList );
1888 else
1889 {
1891 switch (eType)
1892 {
1898 return new OGridImport(m_rFormImport, *this, m_xMeAsContainer, eType);
1907 return new OButtonImport( m_rFormImport, *this, m_xMeAsContainer, eType );
1909 return new ORadioImport(m_rFormImport, *this, m_xMeAsContainer, eType);
1917 default:
1919 }
1920 }
1921 }
1922
1923 void OFormImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList)
1924 {
1926 OElementImport::startFastElement(nElement, _rxAttrList);
1927
1928 // handle the target-frame attribute
1930 }
1931
1932 void OFormImport::endFastElement(sal_Int32 nElement)
1933 {
1935
1936 // now that we have all children, attach the events
1937 css::uno::Reference< css::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, css::uno::UNO_QUERY);
1938 if (xIndexContainer.is())
1940
1942 }
1943
1944 css::uno::Reference< css::beans::XPropertySet > OFormImport::createElement()
1945 {
1946 // let the base class create the object
1947 css::uno::Reference< css::beans::XPropertySet > xReturn = OElementImport::createElement();
1948 if (!xReturn.is())
1949 return xReturn;
1950
1951 // ensure that the object is a XNameContainer (we strongly need this for inserting child elements)
1952 m_xMeAsContainer.set(xReturn, css::uno::UNO_QUERY);
1953 if (!m_xMeAsContainer.is())
1954 {
1955 OSL_FAIL("OContainerImport::createElement: invalid element (no XNameContainer) created!");
1956 xReturn.clear();
1957 }
1958
1959 return xReturn;
1960 }
1961
1962 bool OFormImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue)
1963 {
1964 // handle the master/details field attributes (they're way too special to let the OPropertyImport handle them)
1965 static const sal_Int32 s_nMasterFieldsAttributeName = OAttributeMetaData::getFormAttributeToken(faMasterFields);
1966 static const sal_Int32 s_nDetailFieldsAttributeName = OAttributeMetaData::getFormAttributeToken(faDetailFields);
1967
1968 if ( (nElement & TOKEN_MASK) == s_nMasterFieldsAttributeName)
1969 {
1971 return true;
1972 }
1973
1974 if ( (nElement & TOKEN_MASK) == s_nDetailFieldsAttributeName)
1975 {
1977 return true;
1978 }
1979
1980 return OElementImport::handleAttribute(nElement, _rValue);
1981 }
1982
1983 void OFormImport::implTranslateStringListProperty(const OUString& _rPropertyName, const OUString& _rValue)
1984 {
1985 PropertyValue aProp;
1986 aProp.Name = _rPropertyName;
1987
1988 Sequence< OUString > aList;
1989
1990 // split up the value string
1991 if (!_rValue.isEmpty())
1992 {
1993 // For the moment, we build a vector instead of a Sequence. It's easier to handle because of its
1994 // push_back method
1995 ::std::vector< OUString > aElements;
1996 // estimate the number of tokens
1997 sal_Int32 nEstimate = 0, nLength = _rValue.getLength();
1998 const sal_Unicode* pChars = _rValue.getStr();
1999 for (sal_Int32 i=0; i<nLength; ++i, ++pChars)
2000 if (*pChars == ',')
2001 ++nEstimate;
2002 aElements.reserve(nEstimate + 1);
2003 // that's the worst case. If the string contains the separator character _quoted_, we reserved too much...
2004
2005 sal_Int32 nElementStart = 0;
2006 sal_Int32 nNextSep = 0;
2007 do
2008 {
2009 // extract the current element
2011 _rValue, nElementStart);
2012 if (-1 == nNextSep)
2013 nNextSep = nLength;
2014 std::u16string_view sElement = _rValue.subView(nElementStart, nNextSep - nElementStart);
2015
2016 size_t nElementLength = sElement.size();
2017 // when writing the sequence, we quoted the single elements with " characters
2018 OSL_ENSURE( o3tl::starts_with(sElement, u"\"") && o3tl::ends_with(sElement, u"\""),
2019 "OFormImport::implTranslateStringListProperty: invalid quoted element name.");
2020 sElement = sElement.substr(1, nElementLength - 2);
2021
2022 aElements.push_back(OUString(sElement));
2023
2024 // switch to the next element
2025 nElementStart = 1 + nNextSep;
2026 }
2027 while (nElementStart < nLength);
2028
2029 aList = Sequence< OUString >(aElements.data(), aElements.size());
2030 }
2031 else
2032 {
2033 OSL_FAIL("OFormImport::implTranslateStringListProperty: invalid value (empty)!");
2034 }
2035
2036 aProp.Value <<= aList;
2037
2038 // add the property to the base class' array
2040 }
2041 //= OXMLDataSourceImport
2043 SvXMLImport& _rImport
2044 ,const Reference< css::xml::sax::XFastAttributeList > & _xAttrList
2045 ,const css::uno::Reference< css::beans::XPropertySet >& _xElement) :
2046 SvXMLImportContext( _rImport)
2047 {
2048 for( auto& aIter : sax_fastparser::castToFastAttributeList(_xAttrList) )
2049 {
2050 if ( aIter.getToken() ==
2052 {
2053 OUString sValue = aIter.toString();
2054 sValue = _rImport.GetAbsoluteReference(sValue);
2055 INetURLObject aURL(sValue);
2056 if ( aURL.GetProtocol() == INetProtocol::File )
2057 _xElement->setPropertyValue(PROPERTY_DATASOURCENAME,Any(sValue));
2058 else
2059 _xElement->setPropertyValue(PROPERTY_URL,Any(sValue)); // the url is the "sdbc:" string
2060 break;
2061 }
2062 else
2063 SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
2064 }
2065 }
2066
2068 {
2069 return "com.sun.star.form.component.Form";
2070 }
2071
2072} // namespace xmloff
2073
2074/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
const OUString & GetDataStyleName() const
Definition: txtstyli.hxx:82
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
static sal_Int32 indexOfComma(std::u16string_view rStr, sal_Int32 nPos)
static bool convertBool(bool &rBool, std::u16string_view rString)
const AttributeAssignment * getAttributeTranslation(sal_Int32 nAttributeToken)
return the AttributeAssignment which corresponds to the given attribute
static sal_Int32 getFormAttributeToken(FormAttributes _eAttrib)
retrieves the name of an attribute of a form xml representation
static sal_Int32 getCommonControlAttributeToken(CCAFlags _nId)
calculates the xml attribute representation of a common control attribute.
static sal_Int32 getDatabaseAttributeToken(DAFlags _nId)
calculates the xml attribute representation of a database attribute.
static sal_Int32 getSpecialAttributeToken(SCAFlags _nId)
calculates the xml attribute representation of a special attribute.
static sal_Int32 getBindingAttributeToken(BAFlags _nId)
calculates the xml attribute representation of a binding attribute.
A specialized version of the <type>OControlImport</type> class, which handles the target frame for im...
OButtonImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
helper class importing a single grid column (without the <form:column> element wrapping the column).
OControlImport * implCreateChildContext(sal_Int32 nElement, OControlElement::ElementType _eType)
OColumnWrapperImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, sal_Int32 nElement, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer)
IEventAttacherManager & m_rEventManager
OFormLayerXMLImport_Impl & m_rFormImport
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
css::uno::Reference< css::xml::sax::XFastAttributeList > m_xOwnAttributes
css::uno::Reference< css::container::XNameContainer > m_xParentContainer
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &) override
OListAndComboImportRef m_xListBoxImport
OComboItemImport(SvXMLImport &_rImport, OListAndComboImportRef _xListBox)
helper for translating between control types and XML tags
static sal_Int32 getElementToken(ElementType _eType)
retrieves the tag name to be used to describe a control of the given type
helper class for importing the description of a single control
OUString m_sSubmissionID
name of a submission (xforms:submission attribute)
static void implTranslateValueProperty(const css::uno::Reference< css::beans::XPropertySetInfo > &_rxPropInfo, css::beans::PropertyValue &_rPropValue)
OUString m_sListBindingID
name of a list binding (form:xforms-list-source attribute)
void doRegisterXFormsValueBinding(const OUString &)
register the given XForms binding
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual css::uno::Reference< css::beans::XPropertySet > createElement() override
create the (uninitialized) element which is to represent the read data
css::uno::Reference< css::xml::sax::XFastAttributeList > m_xOuterAttributes
void setElementType(OControlElement::ElementType _eType)
void doRegisterXFormsSubmission(const OUString &)
register the given XForms submission
OUString m_sBoundCellAddress
the address of the calc cell which the control model should be bound to, if applicable
virtual OUString determineDefaultServiceName() const override
void addOuterAttributes(const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxOuterAttribs)
virtual void doRegisterCellValueBinding(const OUString &_rBoundCellAddress)
registers the given cell address as value binding address for our element
OControlElement::ElementType m_eElementType
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
OUString m_sBindingID
name of a value binding (xforms:bind attribute)
PropertyValueArray m_aValueProperties
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
OControlImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer)
void doRegisterXFormsListBinding(const OUString &)
register the given XForms list binding
void setEvents(const css::uno::Reference< css::container::XIndexAccess > &_rxContainer)
implements common behaviour for importing forms, controls and columns
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
PropertyGroups::const_iterator impl_matchPropertyGroup(const PropertyGroups &i_propertyGroups) const
virtual css::uno::Reference< css::beans::XPropertySet > createElement()
create the (uninitialized) element which is to represent the read data
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
css::uno::Reference< css::container::XNameContainer > m_xParentContainer
the parent container to insert the new element into
virtual ~OElementImport() override
OElementImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer)
ctor
bool tryGenericAttribute(sal_Int32 nElement, const OUString &_rValue)
to be called from within handleAttribute, checks whether the given attribute is covered by our generi...
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
css::uno::Reference< css::beans::XPropertySet > m_xElement
the element we're creating. Valid after StartElement
OFormLayerXMLImport_Impl & m_rFormImport
OUString implGetDefaultName() const
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
void disableImplicitGenericAttributeHandling()
controls whether |handleAttribute| implicitly calls |tryGenericAttribute|, or whether the derived cla...
const XMLTextStyleContext * m_pStyleElement
virtual OUString determineDefaultServiceName() const
void simulateDefaultedAttribute(sal_Int32 nElement, const OUString &_rPropertyName, const char *_pAttributeDefault)
can be used to handle properties where the attribute default and the property default differ.
static ElementType getElementType(sal_Int32 nToken)
static std::map< sal_Int32, ElementType > s_sElementTranslations2
css::uno::Reference< css::container::XNameContainer > m_xMeAsContainer
virtual css::uno::Reference< css::beans::XPropertySet > createElement() override
create the (uninitialized) element which is to represent the read data
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
virtual OUString determineDefaultServiceName() const override
OFormImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer)
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
void implTranslateStringListProperty(const OUString &_rPropertyName, const OUString &_rValue)
void registerControlReferences(const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rReferringControls)
OAttribute2Property & getAttributeMap()
Definition: layerimport.hxx:95
void registerCellRangeListSource(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rCellRangeAddress)
void applyControlNumberStyle(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rControlNumberStyleName)
void registerXFormsSubmission(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rSubmissionID)
void registerCellValueBinding(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rCellAddress)
void registerXFormsListBinding(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rBindingID)
void registerXFormsValueBinding(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel, const OUString &_rBindingID)
void registerControlId(const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rId)
helper class importing a single <form:grid> element
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
OGridImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
css::uno::Reference< css::container::XNameContainer > m_xMeAsContainer
virtual css::uno::Reference< css::beans::XPropertySet > createElement() override
create the (uninitialized) element which is to represent the read data
OImagePositionImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
css::uno::Reference< css::graphic::XGraphic > m_xGraphic
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
A specialized version of the <type>OControlImport</type> class, which handles attributes / sub elemen...
std::vector< sal_Int16 > m_aDefaultSelectedSeq
void implPushBackLabel(const OUString &_rLabel)
bool m_bEncounteredLSAttrib
number of empty value items encountered during reading
std::vector< sal_Int16 > m_aSelectedSeq
void implPushBackValue(const OUString &_rValue)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
virtual void doRegisterCellValueBinding(const OUString &_rBoundCellAddress) override
registers the given cell address as value binding address for our element
sal_Int32 m_nEmptyValueItems
number of empty list items encountered during reading
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
std::vector< OUString > m_aValueList
std::vector< OUString > m_aListSource
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &) override
sal_Int32 m_nEmptyListItems
the cell range which acts as list source for the control
OListAndComboImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
<TRUE> if and only if we should use a cell value binding which exchanges the selection index (instead...
OListOptionImport(SvXMLImport &_rImport, OListAndComboImportRef _xListBox)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &) override
OListAndComboImportRef m_xListBoxImport
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
OPasswordImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
Helper class for importing property values.
PropertyValueArray m_aValues
void implPushBackPropertyValue(const css::beans::PropertyValue &_rProp)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
void enableTrackAttributes()
enables the tracking of the encountered attributes
PropertyValueArray m_aGenericValues
OFormLayerXMLImport_Impl & m_rContext
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
ORadioImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
OReferredControlImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer)
A specialized version of the <type>OControlImport</type> class, which handles text like controls whic...
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
css::uno::Reference< css::text::XTextCursor > m_xCursor
css::uno::Reference< css::text::XTextCursor > m_xOldCursor
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
OTextLikeImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
a specialized version of the <type>OControlImport</type> class, which is able to handle attributes wh...
OURLReferenceImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
static void getRuntimeValuePropertyNames(OControlElement::ElementType _eType, sal_Int16 _nFormComponentType, OUString &_rpValuePropertyName, OUString &_rpDefaultValuePropertyName)
calculate the names of the properties which, at runtime, are used for value and default value.
static void getValueLimitPropertyNames(sal_Int16 _nFormComponentType, OUString &_rpMinValuePropertyName, OUString &_rpMaxValuePropertyName)
calculate the property names for the min-value and the max-value attribute.
static void getValuePropertyNames(OControlElement::ElementType _eType, sal_Int16 _nFormComponentType, OUString &_rpCurrentValuePropertyName, OUString &_rpValuePropertyName)
calculate the property names for the current-value and the value attribute.
A specialized version of the <type>OControlImport</type> class, which imports the value-range element...
virtual bool handleAttribute(sal_Int32 nElement, const OUString &_rValue) override
handle one single attribute.
OValueRangeImport(OFormLayerXMLImport_Impl &_rImport, IEventAttacherManager &_rEventManager, const css::uno::Reference< css::container::XNameContainer > &_rxParentContainer, OControlElement::ElementType _eType)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &_rxAttrList) override
OXMLDataSourceImport(SvXMLImport &_rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, const css::uno::Reference< css::beans::XPropertySet > &_xElement)
static css::uno::Any convertString(const css::uno::Type &_rExpectedType, const OUString &_rReadCharacters, const SvXMLEnumMapEntry< EnumT > *_pEnumMap=nullptr)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ENSURE_OR_RETURN(c, m, r)
#define DBG_UNHANDLED_EXCEPTION(...)
URL aURL
Reference< XContent > m_xParentContainer
float u
const OUString & m_sName
#define PROPID_CURRENT_VALUE
#define PROPID_MIN_VALUE
#define PROPID_VALUE
const sal_Int32 m_nHandle
#define PROPID_MAX_VALUE
Reference< beans::XPropertySetInfo > m_xInfo
UNKNOWN
DocumentType eType
sal_Int16 nValue
@ AutoCompletion
@ ConvertEmpty
@ ListLinkingType
@ ListCellRange
@ TargetLocation
@ CurrentSelected
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define LEAVE_LOG_CONTEXT()
Definition: logging.hxx:53
#define ENTER_LOG_CONTEXT(name)
Definition: logging.hxx:52
@ Exception
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
Type getSequenceElementType(const Type &_rSequenceType)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
FORM
ElementType
int i
constexpr OUStringLiteral first
constexpr bool ends_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
void getPropertyGroupList(const AttributeDescription &i_attribute, PropertyGroups &o_propertyGroups)
retrieves all known property groups which are mapped to the given attribute
AttributeDescription getAttributeDescription(sal_Int32 nAttributeToken)
retrieves the attribute descriptor for the attribute given by namespace prefix and attribute name
Handling of tokens in XML:
@ XML_CONNECTION_RESOURCE
Definition: xmltoken.hxx:2374
@ XML_CONTROL_IMPLEMENTATION
Definition: xmltoken.hxx:2741
@ XML_XFORMS_LIST_SOURCE
Definition: xmltoken.hxx:3123
constexpr OUStringLiteral PROPERTY_SPIN_INCREMENT
Definition: strings.hxx:129
constexpr OUStringLiteral PROPERTY_ECHOCHAR
Definition: strings.hxx:29
constexpr OUStringLiteral PROPERTY_SELECT_SEQ
Definition: strings.hxx:80
::std::vector< PropertyDescriptionList > PropertyGroups
constexpr OUStringLiteral PROPERTY_DETAILFIELDS
Definition: strings.hxx:105
constexpr OUStringLiteral PROPERTY_TARGETFRAME
Definition: strings.hxx:34
constexpr OUStringLiteral PROPERTY_GRAPHIC
Definition: strings.hxx:32
::std::map< PropertyId, css::uno::Any > PropertyValues
constexpr OUStringLiteral PROPERTY_CLASSID
Definition: strings.hxx:28
constexpr OUStringLiteral PROPERTY_LINE_INCREMENT
Definition: strings.hxx:122
const OControlElement::ElementType & operator++(OControlElement::ElementType &_e)
constexpr OUStringLiteral PROPERTY_URL
Definition: strings.hxx:101
const SvXMLEnumMapEntry< sal_uInt16 > aImageAlignMap[]
Definition: formenums.cxx:173
constexpr OUStringLiteral PROPERTY_DEFAULT_SELECT_SEQ
Definition: strings.hxx:79
constexpr OUStringLiteral PROPERTY_EFFECTIVE_DEFAULT
Definition: strings.hxx:99
const SvXMLEnumMapEntry< sal_Int16 > aImagePositionMap[]
Definition: formenums.cxx:164
constexpr OUStringLiteral PROPERTY_REPEAT_DELAY
Definition: strings.hxx:124
constexpr OUStringLiteral PROPERTY_RICH_TEXT
Definition: strings.hxx:143
constexpr OUStringLiteral PROPERTY_TEXT
Definition: strings.hxx:97
constexpr OUStringLiteral PROPERTY_LISTSOURCE
Definition: strings.hxx:68
::std::vector< const PropertyDescription * > PropertyDescriptionList
constexpr OUStringLiteral PROPERTY_EFFECTIVE_VALUE
Definition: strings.hxx:98
const SvXMLEnumMapEntry< sal_Int16 > aListLinkageMap[]
Definition: formenums.cxx:145
constexpr OUStringLiteral PROPERTY_EMPTY_IS_NULL
Definition: strings.hxx:66
constexpr OUStringLiteral PROPERTY_STRING_ITEM_LIST
Definition: strings.hxx:77
constexpr OUStringLiteral PROPERTY_MASTERFIELDS
Definition: strings.hxx:104
constexpr OUStringLiteral PROPERTY_DATASOURCENAME
Definition: strings.hxx:49
constexpr OUStringLiteral PROPERTY_ALIGN
Definition: strings.hxx:108
constexpr OUStringLiteral PROPERTY_AUTOCOMPLETE
Definition: strings.hxx:72
constexpr OUStringLiteral PROPERTY_IMAGE_POSITION
Definition: strings.hxx:134
sal_Int32 attribute
DefTokenId nToken
sal_Int32 nHandle
const SvXMLEnumMapEntry< sal_uInt16 > * pEnumMap
const Reference< XComponentContext > & m_rContext
TEXT
sal_uInt16 sal_Unicode
signed char sal_Int8
size_t pos
Reference< xml::input::XElement > m_xElement
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:98
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:105
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:95
constexpr sal_uInt16 XML_NAMESPACE_FORM
constexpr sal_uInt16 XML_NAMESPACE_XML
constexpr sal_uInt16 XML_NAMESPACE_OOO
sal_Int32 nLength
Definition: xmltoken.cxx:38