LibreOffice Module xmloff (master) 1
elementexport.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 "elementexport.hxx"
21
22#include "strings.hxx"
23#include <utility>
25#include "eventexport.hxx"
26#include "formenums.hxx"
27#include "formcellbinding.hxx"
30
31#include <com/sun/star/text/XText.hpp>
32#include <com/sun/star/lang/XServiceInfo.hpp>
33#include <com/sun/star/io/XPersistObject.hpp>
34#include <com/sun/star/util/Duration.hpp>
35#include <com/sun/star/form/FormComponentType.hpp>
36#include <com/sun/star/form/FormSubmitEncoding.hpp>
37#include <com/sun/star/form/FormSubmitMethod.hpp>
38#include <com/sun/star/sdb/CommandType.hpp>
39#include <com/sun/star/form/NavigationBarMode.hpp>
40#include <com/sun/star/form/TabulatorCycle.hpp>
41#include <com/sun/star/form/FormButtonType.hpp>
42#include <com/sun/star/awt/ScrollBarOrientation.hpp>
43#include <com/sun/star/awt/VisualEffect.hpp>
44#include <com/sun/star/form/ListSourceType.hpp>
45#include <com/sun/star/awt/ImagePosition.hpp>
46
48#include <tools/gen.hxx>
49#include <xmloff/txtprmap.hxx>
50#include <com/sun/star/form/binding/XBindableValue.hpp>
51#include <com/sun/star/form/binding/XListEntrySink.hpp>
52#include <tools/urlobj.hxx>
53#include <xmloff/xmlexp.hxx>
56#include <xmloff/xmluconv.hxx>
57#include <xmloff/xmltoken.hxx>
58#include <xmloff/maptype.hxx>
59#include <tools/time.hxx>
62#include <sal/macros.h>
63#include <sal/log.hxx>
64
65#include <algorithm>
66#include <string_view>
67
68namespace xmloff
69{
70
71 #if OSL_DEBUG_LEVEL > 0
72 #define RESET_BIT( bitfield, bit ) \
73 bitfield = bitfield & ~bit
74 #else
75 #define RESET_BIT( bitfield, bit )
76 #endif
77
78 using namespace ::xmloff::token;
79 using namespace ::com::sun::star;
80 using namespace ::com::sun::star::uno;
81 using namespace ::com::sun::star::sdb;
82 using namespace ::com::sun::star::awt;
83 using namespace ::com::sun::star::form;
84 using namespace ::com::sun::star::lang;
85 using namespace ::com::sun::star::beans;
86 using namespace ::com::sun::star::container;
87 using namespace ::com::sun::star::script;
88 using namespace ::com::sun::star::io;
89 using namespace ::com::sun::star::table;
90 using namespace ::com::sun::star::text;
91 using namespace ::com::sun::star::form::binding;
92
93 //= OElementExport
94 OElementExport::OElementExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps,
95 const Sequence< ScriptEventDescriptor >& _rEvents)
96 :OPropertyExport(_rContext, _rxProps)
97 ,m_aEvents(_rEvents)
98 {
99 }
100
102 {
103 }
104
106 {
107 // collect some general information about the element
108 examine();
109
110 // first add the attributes necessary for the element
112
113 // add the attributes
115
116 // start the XML element
118
119 // the sub elements (mostly control type dependent)
121
123 }
124
126 {
127 // nothing to do here
128 }
129
131 {
132 // nothing to do here
133 }
134
136 {
137 // the properties which where not exported 'til now
139
140 // the script:events sub tags
141 exportEvents();
142 }
143
144 void OElementExport::implStartElement(const char* _pName)
145 {
146 m_pXMLElement = std::make_unique<SvXMLElementExport>(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, true, true);
147 }
148
150 {
151 m_pXMLElement.reset();
152 }
153
155 {
156 Reference< XPersistObject > xPersistence(m_xProps, UNO_QUERY);
157 if (!xPersistence.is())
158 {
159 OSL_FAIL("OElementExport::exportServiceNameAttribute: no XPersistObject!");
160 return;
161 }
162
163 OUString sServiceName = xPersistence->getServiceName();
164 // we don't want to write the old service name directly: it's a name used for compatibility reasons, but
165 // as we start some kind of new file format here (with this xml export), we don't care about
166 // compatibility ...
167 // So we translate the old persistence service name into new ones, if possible
168
169 OUString sToWriteServiceName = sServiceName;
170#define CHECK_N_TRANSLATE( name ) \
171 else if (sServiceName == SERVICE_PERSISTENT_COMPONENT_##name) \
172 sToWriteServiceName = SERVICE_##name
173
175 {
176 // special handling for the edit field: we have two controls using this as persistence service name
177 sToWriteServiceName = SERVICE_EDIT;
178 Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
179 if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD))
180 sToWriteServiceName = SERVICE_FORMATTEDFIELD;
181 }
188 CHECK_N_TRANSLATE( COMMANDBUTTON );
190 CHECK_N_TRANSLATE( GRID );
192 CHECK_N_TRANSLATE( FILECONTROL );
195 CHECK_N_TRANSLATE( NUMERICFIELD );
198 CHECK_N_TRANSLATE( HIDDENCONTROL );
199 CHECK_N_TRANSLATE( IMAGECONTROL );
201#if OSL_DEBUG_LEVEL > 0
202 Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
203 OSL_ENSURE(xSI.is() && xSI->supportsService(sToWriteServiceName),
204 "OElementExport::exportServiceNameAttribute: wrong service name translation!");
205
206#endif
207 sToWriteServiceName =
209 XML_NAMESPACE_OOO, sToWriteServiceName );
210
211 // now write this
215 sToWriteServiceName);
216 }
217
219 {
220 if (!m_aEvents.hasElements())
221 // nothing to do
222 return;
223
224 Reference< XNameReplace > xWrapper = new OEventDescriptorMapper(m_aEvents);
226 }
227
228 //= OControlExport
229 OControlExport::OControlExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl,
230 OUString _sControlId, OUString _sReferringControls,
231 const Sequence< ScriptEventDescriptor >& _rEvents)
232 :OElementExport(_rContext, _rxControl, _rEvents)
233 ,m_sControlId(std::move(_sControlId))
234 ,m_sReferringControls(std::move(_sReferringControls))
235 ,m_nClassId(FormComponentType::CONTROL)
236 ,m_eType( UNKNOWN )
237 ,m_nIncludeCommon(CCAFlags::NONE)
238 ,m_nIncludeDatabase(DAFlags::NONE)
239 ,m_nIncludeSpecial(SCAFlags::NONE)
240 ,m_nIncludeEvents(EAFlags::NONE)
241 ,m_nIncludeBindings(BAFlags::NONE)
242 {
243 OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
244 }
245
247 {
248 // the control id
250 {
255 );
256 #if OSL_DEBUG_LEVEL > 0
257 // reset the bit for later checking
259 #endif
260 }
261
262 // the service name
264 {
266 #if OSL_DEBUG_LEVEL > 0
267 // reset the bit for later checking
269 #endif
270 }
271 }
272
274 {
275 // the control id
277 {
278 OSL_ENSURE(!m_sControlId.isEmpty(), "OControlExport::exportInnerAttributes: have no control id for the control!");
281 #if OSL_DEBUG_LEVEL > 0
282 // reset the bit for later checking
284 #endif
285 }
286
287 // "new-style" properties ...
289
290 // common control attributes
292
293 // common database attributes
295
296 // attributes related to external bindings
298
299 // attributes special to the respective control type
301
302 // add the style references to the attributes
304 }
305
307 {
309 }
310
312 {
313 // for the upcoming exportRemainingProperties:
314 // if a control has the LabelControl property, this is not stored with the control itself, but instead with
315 // the control which is referenced by this property. As the base class' exportRemainingProperties doesn't
316 // know anything about this, we need to prevent that it tries to export this property
318
319 // if it's a control supporting XText, then we need to declare all text-related properties
320 // as "already exported". This prevents them from being exported as generic "form:property"-tags.
321 // *If* we would export them this way, they would be completely superfluous, and sometimes even
322 // disastrous, since they may, at import time, override paragraph properties which already have
323 // been set before
324 Reference< XText > xControlText( m_xProps, UNO_QUERY );
325 if ( xControlText.is() )
326 {
328 while ( !pCharAttributeProperties->IsEnd() )
329 {
330 exportedProperty( pCharAttributeProperties->getApiName() );
331 ++pCharAttributeProperties;
332 }
333
335 while ( !pParaAttributeProperties->IsEnd() )
336 {
337 exportedProperty( pParaAttributeProperties->getApiName() );
338 ++pParaAttributeProperties;
339 }
340
341 // the RichText property is not exported. The presence of the text:p element
342 // will be used - upon reading - as indicator for the value of the RichText property
344
345 // strange thing: paragraphs support both a CharStrikeout and a CharCrossedOut property
346 // The former is a short/enum value, the latter a boolean. The former has a real meaning
347 // (the strikeout type), the latter hasn't. But, when the CharCrossedOut is exported and
348 // later on imported, it overwrites anything which has previously been imported for
349 // CharStrikeout.
350 // #i27729#
351 exportedProperty( "CharCrossedOut" );
352 }
353
354 if ( m_eType == LISTBOX )
355 {
356 // will be exported in exportListSourceAsElements:
359
360 // will not be exported in a generic way. Either exportListSourceAsElements cares
361 // for them, or we don't need them
366 }
367 if ( m_eType == COMBOBOX )
369
370 // let the base class export the remaining properties and the events
372
373 // special sub tags for some controls
374 switch (m_eType)
375 {
376 case LISTBOX:
377 // don't export the list entries if the are not provided by the user, but obtained implicitly
378 // from other sources
379 // #i26944#
382 break;
383 case GRID:
384 { // a grid control requires us to store all columns as sub elements
385 Reference< XIndexAccess > xColumnContainer(m_xProps, UNO_QUERY);
386 OSL_ENSURE(xColumnContainer.is(), "OControlExport::exportSubTags: a grid control which is no IndexAccess?!!");
387 if (xColumnContainer.is())
388 m_rContext.exportCollectionElements(xColumnContainer);
389 }
390 break;
391 case COMBOBOX:
392 { // a combox box description has sub elements: the items
393 DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< OUString > );
394
395 // don't export the list entries if the are not provided by the user, but obtained implicitly
396 // from other sources
397 // #i26944#
399 {
400 // get the item list
401 Sequence< OUString > aListItems;
402 m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aListItems;
403 // loop through it and write the sub elements
404 for (const auto& rListItem : std::as_const(aListItems))
405 {
410 rListItem);
411 SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "item", true, true);
412 }
413 }
414 }
415 break;
416
417 case TEXT_AREA:
418 {
419 // if we act as rich text control, we need to export some text:p elements
420 if ( xControlText.is() )
421 {
422 bool bActingAsRichText = false;
423 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_RICH_TEXT ) )
424 {
425 OSL_VERIFY(m_xProps->getPropertyValue( PROPERTY_RICH_TEXT ) >>= bActingAsRichText );
426 }
427
428 if ( bActingAsRichText )
429 m_rContext.getGlobalContext().GetTextParagraphExport()->exportText( xControlText );
430 }
431 }
432 break;
433 default:
434 // nothing do to
435 break;
436 }
437 }
438
440 {
441 const Sequence< Property > aProperties = m_xPropertyInfo->getProperties();
442 for ( auto const & prop : aProperties )
443 {
444 try
445 {
446 // see if this property can already be handled with an IPropertyHandler (which, on the long
447 // term, should be the case for most, if not all, properties)
448 const PropertyDescription* propDescription = metadata::getPropertyDescription( prop.Name );
449 if ( propDescription == nullptr )
450 continue;
451
452 // let the factory provide the concrete handler. Note that caching, if desired, is the task
453 // of the factory
454 PPropertyHandler handler = (*propDescription->factory)( propDescription->propertyId );
455 if ( !handler )
456 {
457 SAL_WARN( "xmloff.forms", "OControlExport::exportGenericHandlerAttributes: invalid property handler provided by the factory!" );
458 continue;
459 }
460
461 // that's a property which has a direct mapping to an attribute
462 if ( !shouldExportProperty( prop.Name ) )
463 // TODO: in the future, we surely need a more sophisticated approach to this, involving the property
464 // handler, or the property description
465 {
466 exportedProperty( prop.Name );
467 continue;
468 }
469
470 const Any propValue = m_xProps->getPropertyValue( prop.Name );
471 OUString attributeValue = handler->getAttributeValue( propValue );
472
474 propDescription->attribute.namespacePrefix,
475 token::GetXMLToken( propDescription->attribute.attributeToken ),
476 attributeValue
477 );
478
479 exportedProperty( prop.Name );
480 }
481 catch( const Exception& )
482 {
483 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
484 }
485 }
486 }
487
489 {
490 size_t i=0;
491
492 // I decided to handle all the properties here with some static arrays describing the property-attribute
493 // relations. This leads to somewhat ugly code :), but the only alternative I can think of right now
494 // would require maps and O(log n) searches, which seems somewhat expensive as this code is used
495 // very frequently.
496
497 // the extra indents for the respective blocks are to ensure that there is no copy'n'paste error, using
498 // map identifiers from the wrong block
499
500 // some string properties
501 {
502 // the attribute ids of all properties which are expected to be of type string
503 static const CCAFlags nStringPropertyAttributeIds[] =
504 {
506 };
507 // the names of all properties which are expected to be of type string
508 static const rtl::OUStringConstExpr aStringPropertyNames[] =
509 {
511 };
512 OSL_ENSURE( std::size(aStringPropertyNames) ==
513 std::size(nStringPropertyAttributeIds),
514 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
515
516 for (i=0; i<std::size(nStringPropertyAttributeIds); ++i)
517 if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
518 {
520 OAttributeMetaData::getCommonControlAttributeNamespace(nStringPropertyAttributeIds[i]),
521 OAttributeMetaData::getCommonControlAttributeName(nStringPropertyAttributeIds[i]),
522 aStringPropertyNames[i]
523 );
524 #if OSL_DEBUG_LEVEL > 0
525 // reset the bit for later checking
526 m_nIncludeCommon = m_nIncludeCommon & ~nStringPropertyAttributeIds[i];
527 #endif
528 }
529 }
530
531 // some boolean properties
532 {
533 static const CCAFlags nBooleanPropertyAttributeIds[] =
534 { // attribute flags
536 };
537 static const rtl::OUStringConstExpr pBooleanPropertyNames[] =
538 { // property names
543 };
544 static const BoolAttrFlags nBooleanPropertyAttrFlags[] =
545 { // attribute defaults
547 };
548 #if OSL_DEBUG_LEVEL > 0
549 static const sal_Int32 nIdCount = std::size(nBooleanPropertyAttributeIds);
550 static const sal_Int32 nNameCount = std::size(pBooleanPropertyNames);
551 static const sal_Int32 nFlagsCount = std::size(nBooleanPropertyAttrFlags);
552 OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
553 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
554 #endif
555 for (i=0; i<std::size(nBooleanPropertyAttributeIds); ++i)
556 if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
557 {
559 OAttributeMetaData::getCommonControlAttributeNamespace(nBooleanPropertyAttributeIds[i]),
560 OAttributeMetaData::getCommonControlAttributeName(nBooleanPropertyAttributeIds[i]),
561 pBooleanPropertyNames[i],
562 nBooleanPropertyAttrFlags[i]);
563 #if OSL_DEBUG_LEVEL > 0
564 // reset the bit for later checking
565 m_nIncludeCommon = m_nIncludeCommon & ~nBooleanPropertyAttributeIds[i];
566 #endif
567 }
568 }
569
570 // some integer properties
571 {
572 // now the common handling
573 static const CCAFlags nIntegerPropertyAttributeIds[] =
574 { // attribute flags
576 };
577 static const rtl::OUStringConstExpr pIntegerPropertyNames[] =
578 { // property names
580 };
581 static const sal_Int16 nIntegerPropertyAttrDefaults[] =
582 { // attribute defaults
583 5, 0
584 };
585
588
589 #if OSL_DEBUG_LEVEL > 0
590 static const sal_Int32 nIdCount = std::size(nIntegerPropertyAttributeIds);
591 static const sal_Int32 nNameCount = std::size(pIntegerPropertyNames);
592 static const sal_Int32 nDefaultCount = std::size(nIntegerPropertyAttrDefaults);
593 OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
594 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
595 #endif
596 for (i=0; i<std::size(nIntegerPropertyAttributeIds); ++i)
597 if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
598 {
600 OAttributeMetaData::getCommonControlAttributeNamespace(nIntegerPropertyAttributeIds[i]),
601 OAttributeMetaData::getCommonControlAttributeName(nIntegerPropertyAttributeIds[i]),
602 pIntegerPropertyNames[i],
603 nIntegerPropertyAttrDefaults[i]);
604 #if OSL_DEBUG_LEVEL > 0
605 // reset the bit for later checking
606 m_nIncludeCommon = m_nIncludeCommon & ~nIntegerPropertyAttributeIds[i];
607 #endif
608 }
609
610 }
611
612 // some enum properties
613 {
615 {
621 FormButtonType_PUSH);
622 #if OSL_DEBUG_LEVEL > 0
623 // reset the bit for later checking
625 #endif
626 }
628 {
634 ScrollBarOrientation::HORIZONTAL
635 );
636 #if OSL_DEBUG_LEVEL > 0
637 // reset the bit for later checking
639 #endif
640 }
641
643 {
649 VisualEffect::LOOK3D
650 );
651 #if OSL_DEBUG_LEVEL > 0
652 // reset the bit for later checking
654 #endif
655 }
656 }
657
658 // some properties which require a special handling
659
660 // the target frame
662 {
664 #if OSL_DEBUG_LEVEL > 0
665 // reset the bit for later checking
667 #endif
668 }
669
670 // max text length
672 {
673 // normally, the respective property would be "MaxTextLen"
674 // However, if the model has a property "PersistenceMaxTextLength", then we prefer this
675
676 // determine the name of the property to export
677 OUString sTextLenPropertyName( PROPERTY_MAXTEXTLENGTH );
678 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_PERSISTENCE_MAXTEXTLENGTH ) )
679 sTextLenPropertyName = PROPERTY_PERSISTENCE_MAXTEXTLENGTH;
680
681 // export it
685 sTextLenPropertyName,
686 0
687 );
688
689 // in either way, both properties count as "exported"
692
693 #if OSL_DEBUG_LEVEL > 0
694 // reset the bit for later checking
696 #endif
697 }
698
700 {
702 #if OSL_DEBUG_LEVEL > 0
703 // reset the bit for later checking
704 m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::TargetLocation;
705 #endif
706 }
707
708 // OJ #99721#
710 {
712 #if OSL_DEBUG_LEVEL > 0
713 // reset the bit for later checking
715 #endif
716 }
717
718 // the for attribute
719 // the target frame
721 {
722 if (!m_sReferringControls.isEmpty())
723 { // there is at least one control referring to the one we're handling currently
728 }
729 #if OSL_DEBUG_LEVEL > 0
730 // reset the bit for later checking
732 #endif
733 }
734
736 {
737 OUString pCurrentValuePropertyName;
738 OUString pValuePropertyName;
739
740 // get the property names
741 getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName);
742
743 // add the attributes if necessary and possible
744 if (!pCurrentValuePropertyName.isEmpty() && (CCAFlags::CurrentValue & m_nIncludeCommon))
745 {
746 static const OUString pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue);
747 // don't export the current-value if this value originates from a data binding
748 // #i26944#
750 exportedProperty( pCurrentValuePropertyName );
751 else
752 {
753 static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::CurrentValue);
755 nCurrentValueAttributeNamespaceKey,
756 pCurrentValueAttributeName,
757 pCurrentValuePropertyName
758 );
759 }
760 }
761
762 if (!pValuePropertyName.isEmpty() && (CCAFlags::Value & m_nIncludeCommon))
763 {
764 static const OUString pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value);
765 static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Value);
767 nValueAttributeNamespaceKey,
768 pValueAttributeName,
769 pValuePropertyName);
770 }
771
772 OSL_ENSURE((pValuePropertyName.isEmpty()) == (CCAFlags::NONE == (CCAFlags::Value & m_nIncludeCommon)),
773 "OControlExport::exportCommonControlAttributes: no property found for the value attribute!");
774 OSL_ENSURE((pCurrentValuePropertyName.isEmpty()) == (CCAFlags::NONE == (CCAFlags::CurrentValue & m_nIncludeCommon)),
775 "OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!");
776
777 #if OSL_DEBUG_LEVEL > 0
778 // reset the bit for later checking
780 #endif
781 }
782
783 OSL_ENSURE(CCAFlags::NONE == m_nIncludeCommon,
784 "OControlExport::exportCommonControlAttributes: forgot some flags!");
785 // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
786 // be 0 now ...
787 }
788
790 {
791#if OSL_DEBUG_LEVEL > 0
792 DAFlags nIncludeDatabase = m_nIncludeDatabase;
793#endif
794 // the only string property: DataField
796 {
801 RESET_BIT( nIncludeDatabase, DAFlags::DataField );
802 }
803
804 // InputRequired
806 {
812 );
813 RESET_BIT( nIncludeDatabase, DAFlags::InputRequired );
814 }
815
816 // the only int16 property: BoundColumn
818 {
823 0,
824 true);
825 RESET_BIT( nIncludeDatabase, DAFlags::BoundColumn );
826 }
827
828 // ConvertEmptyToNull
830 {
836 );
837 RESET_BIT( nIncludeDatabase, DAFlags::ConvertEmpty );
838 }
839
840 // the only enum property: ListSourceType
842 {
848 ListSourceType_VALUELIST
849 );
850 RESET_BIT( nIncludeDatabase, DAFlags::ListSource_TYPE );
851 }
852
854 {
856 RESET_BIT( nIncludeDatabase, DAFlags::ListSource );
857 }
858
859#if OSL_DEBUG_LEVEL > 0
860 OSL_ENSURE(DAFlags::NONE == nIncludeDatabase,
861 "OControlExport::exportDatabaseAttributes: forgot some flags!");
862 // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
863 // be 0 now ...
864#endif
865 }
866
868 {
869#if OSL_DEBUG_LEVEL > 0
870 BAFlags nIncludeBinding = m_nIncludeBindings;
871#endif
872
874 {
876 #if OSL_DEBUG_LEVEL > 0
877 // reset the bit for later checking
878 nIncludeBinding = nIncludeBinding & ~BAFlags( BAFlags::LinkedCell | BAFlags::ListLinkingType );
879 #endif
880 }
881
883 {
885 #if OSL_DEBUG_LEVEL > 0
886 // reset the bit for later checking
887 nIncludeBinding = nIncludeBinding & ~BAFlags::ListCellRange;
888 #endif
889 }
890
892 {
894 #if OSL_DEBUG_LEVEL > 0
895 // reset the bit for later checking
896 nIncludeBinding = nIncludeBinding & ~BAFlags::XFormsBind;
897 #endif
898 }
899
901 {
903 #if OSL_DEBUG_LEVEL > 0
904 // reset the bit for later checking
905 nIncludeBinding = nIncludeBinding & ~BAFlags::XFormsListBind;
906 #endif
907 }
908
910 {
912 #if OSL_DEBUG_LEVEL > 0
913 // reset the bit for later checking
914 nIncludeBinding = nIncludeBinding & ~BAFlags::XFormsSubmission;
915 #endif
916 }
917
918 #if OSL_DEBUG_LEVEL > 0
919 OSL_ENSURE( BAFlags::NONE == nIncludeBinding,
920 "OControlExport::exportBindingAttributes: forgot some flags!");
921 // in the debug version, we should have removed every bit we handled from the mask, so it should
922 // be 0 now ...
923 #endif
924 }
925
927 {
928 sal_Int32 i=0;
929
930 // the boolean properties
931 {
932 static const SCAFlags nBooleanPropertyAttributeIds[] =
933 { // attribute flags
936 };
937 static const rtl::OUStringConstExpr pBooleanPropertyNames[] =
938 { // property names
944 };
945 static const sal_Int32 nIdCount = std::size(nBooleanPropertyAttributeIds);
946 #if OSL_DEBUG_LEVEL > 0
947 static const sal_Int32 nNameCount = std::size(pBooleanPropertyNames);
948 OSL_ENSURE((nIdCount == nNameCount),
949 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
950 #endif
951 const SCAFlags* pAttributeId = nBooleanPropertyAttributeIds;
952 for ( i = 0; i < nIdCount; ++i, ++pAttributeId )
953 {
954 if ( *pAttributeId & m_nIncludeSpecial)
955 {
959 pBooleanPropertyNames[i],
961 );
962 #if OSL_DEBUG_LEVEL > 0
963 // reset the bit for later checking
964 m_nIncludeSpecial = m_nIncludeSpecial & ~*pAttributeId;
965 #endif
966 }
967 }
968 }
969
970 // the integer properties
971 {
972 static const SCAFlags nIntegerPropertyAttributeIds[] =
973 { // attribute flags
975 };
976 static const rtl::OUStringConstExpr pIntegerPropertyNames[] =
977 { // property names
979 };
980 static const sal_Int32 nIntegerPropertyAttrDefaults[] =
981 { // attribute defaults (XML defaults, not runtime defaults!)
982 10
983 };
984
985 static const sal_Int32 nIdCount = std::size( nIntegerPropertyAttributeIds );
986 #if OSL_DEBUG_LEVEL > 0
987 static const sal_Int32 nNameCount = std::size( pIntegerPropertyNames );
988 OSL_ENSURE( ( nIdCount == nNameCount ),
989 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
990 static const sal_Int32 nDefaultCount = std::size( nIntegerPropertyAttrDefaults );
991 OSL_ENSURE( ( nIdCount == nDefaultCount ),
992 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" );
993 #endif
994 for ( i = 0; i < nIdCount; ++i )
995 if ( nIntegerPropertyAttributeIds[i] & m_nIncludeSpecial )
996 {
998 OAttributeMetaData::getSpecialAttributeNamespace( nIntegerPropertyAttributeIds[i] ),
999 OAttributeMetaData::getSpecialAttributeName( nIntegerPropertyAttributeIds[i] ),
1000 pIntegerPropertyNames[i],
1001 nIntegerPropertyAttrDefaults[i]
1002 );
1003 #if OSL_DEBUG_LEVEL > 0
1004 // reset the bit for later checking
1005 m_nIncludeSpecial = m_nIncludeSpecial & ~nIntegerPropertyAttributeIds[i];
1006 #endif
1007 }
1008
1010 {
1011 OUString sPropertyName;
1012 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
1013 sPropertyName = PROPERTY_LINE_INCREMENT;
1014 else if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_SPIN_INCREMENT ) )
1015 sPropertyName = PROPERTY_SPIN_INCREMENT;
1016 else
1017 OSL_FAIL( "OControlExport::exportSpecialAttributes: not property which can be mapped to step-size attribute!" );
1018
1019 if ( !sPropertyName.isEmpty() )
1023 sPropertyName,
1024 1
1025 );
1026
1027 #if OSL_DEBUG_LEVEL > 0
1028 // reset the bit for later checking
1030 #endif
1031 }
1032
1033 }
1034
1035 // the enum properties
1036 {
1038 {
1045 #if OSL_DEBUG_LEVEL > 0
1046 // reset the bit for later checking
1048 #endif
1049 }
1050
1052 {
1059 #if OSL_DEBUG_LEVEL > 0
1060 // reset the bit for later checking
1062 #endif
1063 }
1064 }
1065
1066 // some properties which require a special handling
1067 // the repeat delay
1068 {
1070 {
1072
1073 sal_Int32 nRepeatDelay = 0;
1074 m_xProps->getPropertyValue( PROPERTY_REPEAT_DELAY ) >>= nRepeatDelay;
1076 aTime.MakeTimeFromMS( nRepeatDelay );
1077 util::Duration aDuration;
1078 aDuration.Hours = aTime.GetHour();
1079 aDuration.Minutes = aTime.GetMin();
1080 aDuration.Seconds = aTime.GetSec();
1081 aDuration.NanoSeconds = (nRepeatDelay % 1000) * 1000000;
1082
1083 OUStringBuffer buf;
1084 ::sax::Converter::convertDuration(buf, aDuration);
1087 ,buf.makeStringAndClear());
1088
1090
1091 #if OSL_DEBUG_LEVEL > 0
1092 // reset the bit for later checking
1094 #endif
1095 }
1096 }
1097
1098 // the EchoChar property needs special handling, cause it's a Int16, but must be stored as one-character-string
1099 {
1101 {
1103 sal_Int16 nValue(0);
1104 m_xProps->getPropertyValue(PROPERTY_ECHO_CHAR) >>= nValue;
1105 if (nValue)
1106 {
1107 OUString sCharacter(reinterpret_cast<const sal_Unicode*>(&nValue), 1);
1111 sCharacter);
1112 }
1114 #if OSL_DEBUG_LEVEL > 0
1115 // reset the bit for later checking
1117 #endif
1118 }
1119 }
1120
1121 // the string properties
1122 {
1123 static const SCAFlags nStringPropertyAttributeIds[] =
1124 { // attribute flags
1126 };
1127 static const rtl::OUStringConstExpr pStringPropertyNames[] =
1128 { // property names
1130 };
1131
1132 static const sal_Int32 nIdCount = std::size( nStringPropertyAttributeIds );
1133 #if OSL_DEBUG_LEVEL > 0
1134 static const sal_Int32 nNameCount = std::size( pStringPropertyNames );
1135 OSL_ENSURE( ( nIdCount == nNameCount ),
1136 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
1137 #endif
1138 for ( i = 0; i < nIdCount; ++i )
1139 if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial )
1140 {
1142 OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ),
1143 OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ),
1144 OUString(pStringPropertyNames[i])
1145 );
1146 #if OSL_DEBUG_LEVEL > 0
1147 // reset the bit for later checking
1148 m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i];
1149 #endif
1150 }
1151 }
1152
1154 {
1155 // need to export the min value and the max value as attributes
1156 // It depends on the real type (FormComponentType) of the control, which properties hold these
1157 // values
1158 OUString pMinValuePropertyName;
1159 OUString pMaxValuePropertyName;
1160 getValueLimitPropertyNames(m_nClassId, pMinValuePropertyName, pMaxValuePropertyName);
1161
1162 OSL_ENSURE((pMinValuePropertyName.isEmpty()) == (SCAFlags::NONE == (SCAFlags::MinValue & m_nIncludeSpecial)),
1163 "OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
1164 OSL_ENSURE((pMaxValuePropertyName.isEmpty()) == (SCAFlags::NONE == (SCAFlags::MaxValue & m_nIncludeSpecial)),
1165 "OControlExport::exportCommonControlAttributes: no property found for the max value attribute!");
1166
1167 // add the two attributes
1168 static const OUString pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MinValue);
1169 static const OUString pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MaxValue);
1170 static const sal_uInt16 nMinValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::MinValue);
1171 static const sal_uInt16 nMaxValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::MaxValue);
1172
1173 if (!pMinValuePropertyName.isEmpty() && (SCAFlags::MinValue & m_nIncludeSpecial))
1175 nMinValueNamespaceKey,
1176 pMinValueAttributeName,
1177 pMinValuePropertyName);
1178
1179 if (!pMaxValuePropertyName.isEmpty() && (SCAFlags::MaxValue & m_nIncludeSpecial))
1181 nMaxValueNamespaceKey,
1182 pMaxValueAttributeName,
1183 pMaxValuePropertyName);
1184 #if OSL_DEBUG_LEVEL > 0
1185 // reset the bit for later checking
1187 #endif
1188 }
1189
1191 {
1194 }
1195
1196 OSL_ENSURE(SCAFlags::NONE == m_nIncludeSpecial,
1197 "OControlExport::exportSpecialAttributes: forgot some flags!");
1198 // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
1199 // be 0 now ...
1200 }
1201
1203 {
1204 OUString sListSource;
1205 Any aListSource = m_xProps->getPropertyValue( PROPERTY_LISTSOURCE );
1206 if ( !( aListSource >>= sListSource ) )
1207 {
1208 Sequence< OUString > aListSourceSequence;
1209 aListSource >>= aListSourceSequence;
1210 if ( aListSourceSequence.hasElements() )
1211 sListSource = aListSourceSequence[ 0 ];
1212 }
1213 return sListSource;
1214 }
1215
1217 {
1218 // DAFlags::ListSource needs some special handling
1220
1221 OUString sListSource = getScalarListSourceValue();
1222 if ( !sListSource.isEmpty() )
1223 { // the ListSource property needs to be exported as attribute, and it is not empty
1227 sListSource);
1228 }
1229
1231 }
1232
1233 void OControlExport::getSequenceInt16PropertyAsSet(const OUString& _rPropertyName, Int16Set& _rOut)
1234 {
1235 Sequence< sal_Int16 > aValueSequence;
1236 DBG_CHECK_PROPERTY(_rPropertyName, Sequence< sal_Int16 >);
1237 m_xProps->getPropertyValue(_rPropertyName) >>= aValueSequence;
1238
1239 for (const auto& rValue : std::as_const(aValueSequence))
1240 _rOut.insert(rValue);
1241 }
1242
1244 {
1245 // the string lists
1246 Sequence< OUString > aItems, aValues;
1247 DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< OUString > );
1248 m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aItems;
1249
1250 DBG_CHECK_PROPERTY( PROPERTY_LISTSOURCE, Sequence< OUString > );
1252 m_xProps->getPropertyValue(PROPERTY_LISTSOURCE) >>= aValues;
1253 // if we exported the list source as attribute, we do not repeat it as sub elements
1254
1255 // the selection lists
1256 Int16Set aSelection, aDefaultSelection;
1259
1260 // the string for "true"
1261 OUString sTrue;
1262 OUStringBuffer sBuffer;
1263 ::sax::Converter::convertBool(sBuffer, true);
1264 sTrue = sBuffer.makeStringAndClear();
1265
1266 // loop through both lists ('til the maximum of both lengths)
1267 const OUString* pItems = aItems.getConstArray();
1268 const OUString* pValues = aValues.getConstArray();
1269
1270 sal_Int32 nItems = aItems.getLength();
1271 sal_Int32 nValues = aValues.getLength();
1272
1273 sal_Int16 nMaxLen = static_cast<sal_Int16>(std::max(nItems, nValues));
1274
1275 for (sal_Int16 i=0; i<nMaxLen; ++i )
1276 {
1278 if (i < nItems)
1279 {
1280 // there is an item at this position
1284 *pItems);
1285 ++pItems;
1286 }
1287 if (i < nValues)
1288 {
1289 // there is a value at this position
1293 *pValues);
1294 ++pValues;
1295 }
1296
1297 Int16Set::const_iterator aSelectedPos = aSelection.find(i);
1298 if (aSelection.end() != aSelectedPos)
1299 { // the item at this position is selected
1303 sTrue
1304 );
1305 aSelection.erase(aSelectedPos);
1306 }
1307
1308 Int16Set::const_iterator aDefaultSelectedPos = aDefaultSelection.find(i);
1309 if (aDefaultSelection.end() != aDefaultSelectedPos)
1310 { // the item at this position is selected as default
1314 sTrue
1315 );
1316 aDefaultSelection.erase(aDefaultSelectedPos);
1317 }
1318 SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", true, true);
1319 }
1320
1321 // There may be more "selected" or "default-selected" items than there are in the lists in real,
1322 // so we need to store some additional "form:option" items which have no name and no label, but
1323 // one or both of the selected flags.
1324 // 21.05.2001 - 85388 - frank.schoenheit@germany.sun.com
1325
1326 if (aSelection.empty() && aDefaultSelection.empty())
1327 return;
1328
1329 sal_Int16 nLastSelected = -1;
1330 if ( !aSelection.empty() )
1331 nLastSelected = *(--aSelection.end());
1332
1333 sal_Int16 nLastDefaultSelected = -1;
1334 if ( !aDefaultSelection.empty() )
1335 nLastDefaultSelected = *(--aDefaultSelection.end());
1336
1337 // the maximum element in both sets
1338 sal_Int16 nLastReferredEntry = std::max(nLastSelected, nLastDefaultSelected);
1339 OSL_ENSURE(nLastReferredEntry >= nMaxLen, "OControlExport::exportListSourceAsElements: inconsistence!");
1340 // if the maximum (selected or default selected) entry number is less than the maximum item count
1341 // in both lists, the entry number should have been removed from the set
1342
1343 for (sal_Int16 i=nMaxLen; i<=nLastReferredEntry; ++i)
1344 {
1345 if (aSelection.end() != aSelection.find(i))
1346 { // the (not existent) item at this position is selected
1350 sTrue
1351 );
1352 }
1353
1354 if (aDefaultSelection.end() != aDefaultSelection.find(i))
1355 { // the (not existent) item at this position is selected as default
1359 sTrue
1360 );
1361 }
1362 SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", true, true);
1363 }
1364 }
1365
1366 void OControlExport::implStartElement(const char* _pName)
1367 {
1368 // before we let the base class start it's outer element, we add a wrapper element
1369 const char *pOuterElementName = getOuterXMLElementName();
1370 if (pOuterElementName)
1371 m_pOuterElement = std::make_unique<SvXMLElementExport>(
1374 pOuterElementName, true,
1375 true);
1376
1377 // add the attributes for the inner element
1379
1380 // and start the inner element
1382 }
1383
1385 {
1386 // end the inner element
1388
1389 // end the outer element if it exists
1390 m_pOuterElement.reset();
1391 }
1392
1394 {
1395 return nullptr;
1396 }
1397
1399 {
1400 return getElementName(m_eType);
1401 }
1402
1404 {
1407 "OControlExport::examine: called me twice? Not initialized?" );
1408
1409 // get the class id to decide which kind of element we need in the XML stream
1410 m_nClassId = FormComponentType::CONTROL;
1412 m_xProps->getPropertyValue(PROPERTY_CLASSID) >>= m_nClassId;
1413 bool knownType = false;
1414 switch (m_nClassId)
1415 {
1416 case FormComponentType::DATEFIELD:
1417 m_eType = DATE;
1418 knownType = true;
1419 [[fallthrough]];
1420 case FormComponentType::TIMEFIELD:
1421 if ( !knownType )
1422 {
1423 m_eType = TIME;
1424 knownType = true;
1425 }
1427 [[fallthrough]];
1428 case FormComponentType::NUMERICFIELD:
1429 case FormComponentType::CURRENCYFIELD:
1430 case FormComponentType::PATTERNFIELD:
1431 if ( !knownType )
1432 {
1434 knownType = true;
1435 }
1436 [[fallthrough]];
1437 case FormComponentType::TEXTFIELD:
1438 { // it's some kind of edit. To know which type we need further investigation
1439
1440 if ( !knownType )
1441 {
1442 // check if it's a formatted field
1443 if (m_xPropertyInfo->hasPropertyByName(PROPERTY_FORMATKEY))
1444 {
1446 }
1447 else
1448 {
1449 // all other controls are represented by an ordinary edit control, but which XML control type
1450 // it is depends on the current values of some properties
1451
1452 // if the EchoChar string is not empty, it is a password field
1453 sal_Int16 nEchoChar = 0;
1454 if (m_xPropertyInfo->hasPropertyByName(PROPERTY_ECHOCHAR))
1455 // grid columns do not have this property...
1456 m_xProps->getPropertyValue(PROPERTY_ECHOCHAR) >>= nEchoChar;
1457 if (nEchoChar)
1458 {
1459 m_eType = PASSWORD;
1461 }
1462 else
1463 {
1464 // if the MultiLine property is sal_True, it is a TextArea
1465 bool bMultiLine = false;
1466 if (m_xPropertyInfo->hasPropertyByName(PROPERTY_MULTILINE))
1467 // grid columns do not have this property...
1468 bMultiLine = ::cppu::any2bool(m_xProps->getPropertyValue(PROPERTY_MULTILINE));
1469
1470 if ( bMultiLine )
1472 else
1473 // the only case left is represented by a Text element
1474 m_eType = TEXT;
1475 }
1476 }
1477 }
1478
1479 // attributes which are common to all the types:
1480 // common attributes
1484
1485 if ( ( m_nClassId != FormComponentType::DATEFIELD )
1486 && ( m_nClassId != FormComponentType::TIMEFIELD )
1487 )
1488 // date and time field values are handled differently nowadays
1490
1491 // database attributes
1493
1494 // event attributes
1496
1497 // only text and pattern fields have a ConvertEmptyToNull property
1498 if ( ( m_nClassId == FormComponentType::TEXTFIELD )
1499 || ( m_nClassId == FormComponentType::PATTERNFIELD )
1500 )
1502
1503 // all controls but the file control fields have a readonly property
1504 if ( m_nClassId != FormComponentType::FILECONTROL )
1506
1507 // a text field has a max text len
1508 if ( m_nClassId == FormComponentType::TEXTFIELD )
1510
1511 // max and min values and validation:
1512 if (FORMATTED_TEXT == m_eType)
1513 { // in general all controls represented as formatted-text have these props
1514 if ( FormComponentType::PATTERNFIELD != m_nClassId ) // except the PatternField
1516
1517 if (FormComponentType::TEXTFIELD != m_nClassId)
1518 // and the FormattedField does not have a validation flag
1520 }
1521
1522 // if it's not a password field or rich text control, the CurrentValue needs to be stored, too
1523 if ( ( PASSWORD != m_eType )
1524 && ( DATE != m_eType )
1525 && ( TIME != m_eType )
1526 )
1527 {
1529 }
1530 }
1531 break;
1532
1533 case FormComponentType::FILECONTROL:
1534 m_eType = FILE;
1540 break;
1541
1542 case FormComponentType::FIXEDTEXT:
1549 break;
1550
1551 case FormComponentType::COMBOBOX:
1552 m_eType = COMBOBOX;
1560 break;
1561
1562 case FormComponentType::LISTBOX:
1563 m_eType = LISTBOX;
1570 // check if we need to export the ListSource as attribute
1571 {
1572 // for a list box, if the ListSourceType is VALUE_LIST, no ListSource is stored, but instead
1573 // a sequence of pairs which is build from the StringItemList and the ValueList
1574 ListSourceType eListSourceType = ListSourceType_VALUELIST;
1575 bool bSuccess =
1576 m_xProps->getPropertyValue(PROPERTY_LISTSOURCETYPE) >>= eListSourceType;
1577 OSL_ENSURE(bSuccess, "OControlExport::examineControl: could not retrieve the ListSourceType!");
1578 if (ListSourceType_VALUELIST != eListSourceType)
1579 {
1581 }
1582 }
1583
1584 break;
1585
1586 case FormComponentType::COMMANDBUTTON:
1587 m_eType = BUTTON;
1590 [[fallthrough]];
1591 case FormComponentType::IMAGEBUTTON:
1592 if (BUTTON != m_eType)
1593 {
1594 // not coming from the previous case
1595 m_eType = IMAGE;
1596 }
1602 break;
1603
1604 case FormComponentType::CHECKBOX:
1605 m_eType = CHECKBOX;
1607 [[fallthrough]];
1608 case FormComponentType::RADIOBUTTON:
1612 if (CHECKBOX != m_eType)
1613 { // not coming from the previous case
1614 m_eType = RADIO;
1616 }
1617 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
1619 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
1623 break;
1624
1625 case FormComponentType::GROUPBOX:
1626 m_eType = FRAME;
1631 break;
1632
1633 case FormComponentType::IMAGECONTROL:
1640 break;
1641
1642 case FormComponentType::HIDDENCONTROL:
1643 m_eType = HIDDEN;
1646 break;
1647
1648 case FormComponentType::GRIDCONTROL:
1649 m_eType = GRID;
1654 break;
1655
1656 case FormComponentType::SCROLLBAR:
1657 case FormComponentType::SPINBUTTON:
1663
1664 if ( m_nClassId == FormComponentType::SCROLLBAR )
1666
1668 break;
1669
1670 default:
1671 OSL_FAIL("OControlExport::examineControl: unknown control type (class id)!");
1672 [[fallthrough]];
1673
1674 case FormComponentType::NAVIGATIONBAR:
1675 // TODO: should we have an own file format for this?
1676 // NO break
1677
1678 case FormComponentType::CONTROL:
1680 // unknown control type
1682 // at least a name should be there, 'cause without a name the control could never have been
1683 // inserted into its parent container
1684 // In addition, the service name is absolutely necessary to create the control upon reading.
1686 // we always should be able to export events - this is not control type dependent
1687 break;
1688 }
1689
1690 // in general, all control types need to export the control id
1692
1693 // is it a control bound to a calc cell?
1695 {
1697 {
1698 if ( FormCellBindingHelper::isCellBinding( aHelper.getCurrentBinding( ) ) )
1699 {
1701 if ( m_nClassId == FormComponentType::LISTBOX )
1703 }
1704 }
1705
1706 // is it a list-like control which uses a calc cell range as list source?
1707 {
1708 if ( FormCellBindingHelper::isCellRangeListSource( aHelper.getCurrentListSource( ) ) )
1710 }
1711 }
1712
1713 // is control bound to XForms?
1714 if( !getXFormsBindName( m_xProps ).isEmpty() )
1715 {
1717 }
1718
1719 // is (list-)control bound to XForms list?
1720 if( !getXFormsListBindName( m_xProps ).isEmpty() )
1721 {
1723 }
1724
1725 // does the control have an XForms submission?
1726 if( !getXFormsSubmissionName( m_xProps ).isEmpty() )
1727 {
1729 }
1730 }
1731
1732 void OControlExport::exportCellBindingAttributes( bool _bIncludeListLinkageType )
1733 {
1734 try
1735 {
1737 Reference< XValueBinding > xBinding( aHelper.getCurrentBinding() );
1738 OSL_ENSURE( xBinding.is(), "OControlExport::exportCellBindingAttributes: invalid bindable or invalid binding!" );
1739 if ( xBinding.is() )
1740 {
1744 aHelper.getStringAddressFromCellBinding( xBinding )
1745 );
1746
1747 if ( _bIncludeListLinkageType )
1748 {
1749 sal_Int16 nLinkageType = FormCellBindingHelper::isCellIntegerBinding( xBinding ) ? 1 : 0;
1750
1751 OUStringBuffer sBuffer;
1753 sBuffer,
1754 nLinkageType,
1756 );
1757
1761 sBuffer.makeStringAndClear()
1762 );
1763 }
1764
1765 }
1766 }
1767 catch( const Exception& )
1768 {
1769 TOOLS_WARN_EXCEPTION( "xmloff.forms", "OControlExport::exportCellBindingAttributes" );
1770 }
1771 }
1772
1774 {
1775 OUString sBindName = getXFormsBindName( m_xProps );
1777 }
1779 {
1780 OUString sBindName = getXFormsListBindName( m_xProps );
1782 }
1784 {
1785 OUString sSubmission = getXFormsSubmissionName( m_xProps );
1787 }
1789 {
1790 try
1791 {
1792 Reference< XListEntrySink > xSink( m_xProps, UNO_QUERY );
1793 Reference< XListEntrySource > xSource;
1794 if ( xSink.is() )
1795 xSource = xSink->getListEntrySource();
1796 OSL_ENSURE( xSource.is(), "OControlExport::exportCellListSourceRange: list source or sink!" );
1797 if ( xSource.is() )
1798 {
1800
1804 aHelper.getStringAddressFromCellListSource( xSource )
1805 );
1806 }
1807 }
1808 catch( const Exception& )
1809 {
1810 TOOLS_WARN_EXCEPTION( "xmloff.forms", "OControlExport::exportCellListSourceRange" );
1811 }
1812 }
1813
1815 {
1816 try
1817 {
1818 sal_Int16 nImagePosition = ImagePosition::Centered;
1819 OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_IMAGE_POSITION ) >>= nImagePosition );
1820 OSL_ENSURE( ( nImagePosition >= ImagePosition::LeftTop ) && ( nImagePosition <= ImagePosition::Centered ),
1821 "OControlExport::exportImagePositionAttributes: don't know this image position!" );
1822
1823 if ( ( nImagePosition < ImagePosition::LeftTop ) || ( nImagePosition > ImagePosition::Centered ) )
1824 // this is important to prevent potential buffer overflows below, so don't optimize
1825 nImagePosition = ImagePosition::Centered;
1826
1827 if ( nImagePosition == ImagePosition::Centered )
1828 {
1830 }
1831 else
1832 {
1833 const XMLTokenEnum eXmlImagePositions[] =
1834 {
1836 };
1837 const XMLTokenEnum eXmlImageAligns[] =
1838 {
1840 };
1841
1842 XMLTokenEnum eXmlImagePosition = eXmlImagePositions[ nImagePosition / 3 ];
1843 XMLTokenEnum eXmlImageAlign = eXmlImageAligns [ nImagePosition % 3 ];
1844
1847 }
1848
1850 // some of the controls which have an ImagePosition also have an ImageAlign for compatibility
1851 // reasons. Since the ImageAlign values simply represent a sub set of the ImagePosition values,
1852 // we don't need to export ImageAlign anymore
1854 }
1855 catch( const Exception& )
1856 {
1857 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
1858 }
1859 }
1860
1862 {
1863 try
1864 {
1865 // currently exchanging the data with a database column?
1866 OUString sBoundFieldPropertyName( "BoundField" );
1867 if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( sBoundFieldPropertyName ) )
1868 {
1869 Reference< XPropertySet > xBoundField;
1870 m_xProps->getPropertyValue( sBoundFieldPropertyName ) >>= xBoundField;
1871 if ( xBoundField.is() )
1872 return true;
1873 }
1874
1875 // currently exchanging data with an external binding?
1876 Reference< XBindableValue > xBindable( m_xProps, UNO_QUERY );
1877 if ( xBindable.is() && xBindable->getValueBinding().is() )
1878 return true;
1879 }
1880 catch( const Exception& )
1881 {
1882 TOOLS_WARN_EXCEPTION( "xmloff.forms", "OColumnExport::controlHasActiveDataBinding" );
1883 }
1884
1885 return false;
1886 }
1887
1889 {
1890 try
1891 {
1892 // an external list source?
1893 Reference< XListEntrySink > xEntrySink( m_xProps, UNO_QUERY );
1894 if ( xEntrySink.is() && xEntrySink->getListEntrySource().is() )
1895 return false;
1896
1897 if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( PROPERTY_LISTSOURCETYPE ) )
1898 {
1899 ListSourceType eListSourceType = ListSourceType_VALUELIST;
1900 OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eListSourceType );
1901 if ( eListSourceType == ListSourceType_VALUELIST )
1902 // for value lists, the list entries as entered by the user are used
1903 return true;
1904
1905 // for every other type, the list entries are filled with some data obtained
1906 // from a database - if and only if the ListSource property is not empty
1907 return getScalarListSourceValue().isEmpty();
1908 }
1909 }
1910 catch( const Exception& )
1911 {
1912 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
1913 }
1914
1915 OSL_FAIL( "OControlExport::controlHasUserSuppliedListEntries: unreachable code!" );
1916 // this method should be called for list and combo boxes only
1917 return true;
1918 }
1919
1920 //= OColumnExport
1921 OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl, const OUString& _rControlId,
1922 const Sequence< ScriptEventDescriptor >& _rEvents)
1923 :OControlExport(_rContext, _rxControl, _rControlId, OUString(), _rEvents)
1924 {
1925 }
1926
1928 {
1929 }
1930
1932 {
1933 // the attribute "service name" (which has a slightly different meaning for columns
1935 OUString sColumnServiceName;
1936 m_xProps->getPropertyValue(PROPERTY_COLUMNSERVICENAME) >>= sColumnServiceName;
1937 // the service name is a full qualified one (i.e. com.sun.star.form.TextField), but the
1938 // real service name for the column (for use with the XGridColumnFactory) is only the last
1939 // token of this complete name.
1940 sal_Int32 nLastSep = sColumnServiceName.lastIndexOf('.');
1941 OSL_ENSURE(-1 != nLastSep, "OColumnExport::startExportElement: invalid service name!");
1942 sColumnServiceName = sColumnServiceName.copy(nLastSep + 1);
1943 sColumnServiceName =
1945 XML_NAMESPACE_OOO, sColumnServiceName );
1946 // add the attribute
1949 , sColumnServiceName);
1950 // flag the property as "handled"
1952
1953 }
1954
1956 {
1957 return "column";
1958 }
1959
1961 {
1963
1964 // the attribute "label"
1969
1970 // the style attribute
1971 OUString sStyleName = m_rContext.getObjectStyleName( m_xProps );
1972 if ( !sStyleName.isEmpty() )
1973 {
1977 sStyleName
1978 );
1979 }
1980 }
1981
1983 {
1985
1986 // grid columns miss some properties of the controls they're representing
1989
1990 if (FormComponentType::DATEFIELD != m_nClassId)
1991 // except date fields, no column has the DropDown property
1992 m_nIncludeCommon &= ~CCAFlags::Dropdown;
1993 }
1994
1995 //= OFormExport
1996 OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm,
1997 const Sequence< ScriptEventDescriptor >& _rEvents)
1998 :OElementExport(_rContext, _rxForm, _rEvents)
1999 ,m_bCreateConnectionResourceElement(false)
2000 {
2001 OSL_ENSURE(m_xProps.is(), "OFormExport::OFormExport: invalid arguments!");
2002 }
2003
2005 {
2006 return "form";
2007 }
2008
2010 {
2012 {
2014 OUString sPropValue;
2015 m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue; // if set it is a file url
2016 if ( sPropValue.isEmpty() )
2017 m_xProps->getPropertyValue( PROPERTY_URL ) >>= sPropValue;
2018 if ( !sPropValue.isEmpty() )
2024 {
2026 }
2027 }
2028
2029 // let the base class export the remaining properties and the events
2031 // loop through all children
2032 Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY);
2033 OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspicious!");
2034
2035 if (xCollection.is())
2037 }
2038
2040 {
2041 sal_Int32 i=0;
2042
2043 // the string properties
2044 {
2045 static const FormAttributes eStringPropertyIds[] =
2046 {
2047 faName, /*faAction,*/ faCommand, faFilter, faOrder
2048 };
2049 static const rtl::OUStringConstExpr aStringPropertyNames[] =
2050 {
2052 };
2053 static const sal_Int32 nIdCount = std::size(eStringPropertyIds);
2054 #if OSL_DEBUG_LEVEL > 0
2055 static const sal_Int32 nNameCount = std::size(aStringPropertyNames);
2056 OSL_ENSURE((nIdCount == nNameCount),
2057 "OFormExport::exportAttributes: somebody tampered with the maps (1)!");
2058 #endif
2059 for (i=0; i<nIdCount; ++i)
2062 OAttributeMetaData::getFormAttributeName(eStringPropertyIds[i]),
2063 aStringPropertyNames[i]);
2064
2065 // #i112082# xlink:type is added as part of exportTargetLocationAttribute
2066
2067 // now export the data source name or databaselocation or connection resource
2068 OUString sPropValue;
2069 m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue;
2070 m_bCreateConnectionResourceElement = sPropValue.isEmpty();
2072 {
2073 INetURLObject aURL(sPropValue);
2074 m_bCreateConnectionResourceElement = ( aURL.GetProtocol() == INetProtocol::File );
2080 }
2081 else
2085 }
2086
2087 // the boolean properties
2088 {
2089 static const FormAttributes eBooleanPropertyIds[] =
2090 {
2092 };
2093 static const rtl::OUStringConstExpr pBooleanPropertyNames[] =
2094 {
2101 };
2102 static const BoolAttrFlags nBooleanPropertyAttrFlags[] =
2103 {
2105 };
2106 static const sal_Int32 nIdCount = std::size(eBooleanPropertyIds);
2107 #if OSL_DEBUG_LEVEL > 0
2108 static const sal_Int32 nNameCount = std::size(pBooleanPropertyNames);
2109 static const sal_Int32 nFlagsCount = std::size(nBooleanPropertyAttrFlags);
2110 OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
2111 "OFormExport::exportAttributes: somebody tampered with the maps (2)!");
2112 #endif
2113 for (i=0; i<nIdCount; ++i)
2116 OAttributeMetaData::getFormAttributeName(eBooleanPropertyIds[i]),
2117 pBooleanPropertyNames[i],
2118 nBooleanPropertyAttrFlags[i]
2119 );
2120 }
2121
2122 // the enum properties
2123 {
2129 FormSubmitEncoding_URL,
2130 false
2131 );
2137 FormSubmitMethod_GET,
2138 false
2139 );
2145 CommandType::COMMAND,
2146 false
2147 );
2153 NavigationBarMode_CURRENT,
2154 false
2155 );
2161 TabulatorCycle_RECORDS,
2162 true
2163 );
2164 }
2165
2166 // the service name
2168 // the target frame
2170 // the target URL
2171 exportTargetLocationAttribute(true); // #i110911# add type attribute (for form, but not for control)
2172
2173 // master fields
2178 // detail fields
2183 }
2184} // namespace xmloff
2185
2186/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
PropertiesInfo aProperties
constexpr OUStringLiteral sServiceName
virtual sal_Int16 SAL_CALL getLength() override
Definition: attrlist.cxx:34
const SvXMLNamespaceMap & GetNamespaceMap() const
Definition: xmlexp.hxx:390
OUString GetRelativeReference(const OUString &rValue)
Definition: xmlexp.cxx:2064
XMLEventExport & GetEventExport()
get Event export, with handlers for script types "None" and "StarBasic" already registered; other han...
Definition: xmlexp.cxx:1993
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
Definition: xmlexp.hxx:562
void ClearAttrList()
Definition: xmlexp.cxx:1010
void SAL_DLLPRIVATE AddAttributeIdLegacy(sal_uInt16 const nLegacyPrefix, OUString const &rValue)
add xml:id and legacy namespace id
Definition: xmlexp.cxx:2281
SvXMLAttributeList & GetAttrList()
Definition: xmlexp.hxx:379
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:145
void Export(css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
export the events (calls EventExport::Export(Reference<XNameAccess>) )
static const XMLPropertyMapEntry * getPropertyMapForType(TextPropMap _nType)
Definition: txtprmap.cxx:1140
std::vector< Value >::const_iterator const_iterator
const_iterator find(const Value &x) const
size_type erase(const Value &x)
bool empty() const
const_iterator end() const
std::pair< const_iterator, bool > insert(Value &&x)
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
static bool convertBool(bool &rBool, std::u16string_view rString)
sal_uInt16 GetSec() const
sal_uInt16 GetMin() const
sal_uInt16 GetHour() const
void MakeTimeFromMS(sal_Int32 nMS)
encapsulates functionality related to binding a form control to a spreadsheet cell
static bool isCellRangeListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource)
checks whether a given list source is a spreadsheet cell list source
static bool livesInSpreadsheetDocument(const css::uno::Reference< css::beans::XPropertySet > &_rxControlModel)
determines whether the given control model lives in a spreadsheet document
static bool isCellBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
checks whether a given binding is a spreadsheet cell binding
static bool isCellIntegerBinding(const css::uno::Reference< css::form::binding::XValueBinding > &_rxBinding)
checks whether a given binding is a spreadsheet cell binding, exchanging integer values
virtual SvXMLExport & getGlobalContext()=0
virtual OUString getObjectStyleName(const css::uno::Reference< css::beans::XPropertySet > &_rxObject)=0
virtual void exportCollectionElements(const css::uno::Reference< css::container::XIndexAccess > &_rxCollection)=0
steps through a collection and exports all children of this collection
static OUString getBindingAttributeName(BAFlags _nId)
calculates the xml attribute representation of a binding attribute.
static OUString getFormAttributeName(FormAttributes _eAttrib)
retrieves the name of an attribute of a form xml representation
static sal_uInt16 getSpecialAttributeNamespace(SCAFlags _nId)
calculates the xml namespace key to use for a special attribute.
static OUString getSpecialAttributeName(SCAFlags _nId)
calculates the xml attribute representation of a special attribute.
static sal_uInt16 getFormAttributeNamespace(FormAttributes _eAttrib)
calculates the xml namespace key to use for an attribute of a form xml representation
static sal_uInt16 getDatabaseAttributeNamespace()
calculates the xml namespace key to use for a database attribute.
static OUString getCommonControlAttributeName(CCAFlags _nId)
calculates the xml attribute representation of a common control attribute.
static OUString getDatabaseAttributeName(DAFlags _nId)
calculates the xml attribute representation of a database attribute.
static sal_uInt16 getBindingAttributeNamespace()
calculates the xml namespace key to use for a binding attribute.
static sal_uInt16 getCommonControlAttributeNamespace(CCAFlags _nId)
calculates the xml namespace key to use for a common control attribute
virtual void examine() override
examine the control.
OColumnExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxControl, const OUString &_rControlId, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
ctor
virtual void exportServiceNameAttribute() override
add the service-name attribute to the export context
virtual ~OColumnExport() override
virtual const char * getOuterXMLElementName() const override
get the name of the outer XML element
virtual void exportAttributes() override
export the attributes
static const char * getElementName(ElementType _eType)
retrieves the tag name to be used to describe a control of the given type
Helper class for handling xml elements representing a form control.
void exportCellBindingAttributes(bool _bIncludeListLinkageType)
exports the attribute which descrives a cell value binding of a control in a spreadsheet document
bool controlHasActiveDataBinding() const
determines whether the control we're exporting has an active data binding.
virtual void implEndElement() override
ends the XML element
void exportOuterAttributes()
exports the attributes for the outer element
std::unique_ptr< SvXMLElementExport > m_pOuterElement
void exportXFormsBindAttributes()
exports the attribute(s) which bind this control to XForms
virtual void implStartElement(const char *_pName) override
start the XML element
void exportXFormsListAttributes()
exports the attribute(s) which bind the list of a list control to XForms
void exportXFormsSubmissionAttributes()
exports the attribute(s) for an XForms submission
void getSequenceInt16PropertyAsSet(const OUString &_rPropertyName, Int16Set &_rOut)
gets a Sequence< sal_Int16 > property value as set of sal_Int16's
virtual void exportAttributes() override
export the attributes
void exportListSourceAsAttribute()
exports the ListSource property of a control as attribute
virtual const char * getXMLElementName() const override
get the name of the XML element
void exportSubTags() override
writes everything which needs to be represented as sub tag
void exportDatabaseAttributes()
adds database attributes to the XMLExport context given
void exportCommonControlAttributes()
adds common control attributes to the XMLExport context given
OControlExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxControl, OUString _sControlId, OUString _sReferringControls, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
constructs an object capable of exporting controls
bool controlHasUserSuppliedListEntries() const
determines whether the list entries (of a combo or list box) are supplied by the user
void exportBindingAttributes()
adds the XML attributes which are related to binding controls to external values and/or list sources
void exportListSourceAsElements()
exports the ListSource property of a control as XML elements
virtual void examine() override
examine the control.
void exportCellListSourceRange()
exports the attribute which descrives a cell range which acts as list source for a list-like control
void exportInnerAttributes()
exports the attributes for the inner element
virtual const char * getOuterXMLElementName() const
get the name of the outer XML element
void exportImagePositionAttributes()
exports the attribute(s) for the ImagePosition property
void exportGenericHandlerAttributes()
adds the attributes which are handled via generic IPropertyHandlers
void exportSpecialAttributes()
adds attributes which are special to a control type to the export context's attribute list
OUString getScalarListSourceValue() const
retrieves the string specifying the ListSource of a list or combo box
virtual void implEndElement()
ends the XML element
virtual void exportSubTags()
export any sub tags
void exportEvents()
exports the events (as script:events tag)
OElementExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxProps, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rEvents)
virtual void implStartElement(const char *_pName)
start the XML element
virtual void exportAttributes()
export the attributes
virtual const char * getXMLElementName() const =0
get the name of the XML element
std::unique_ptr< SvXMLElementExport > m_pXMLElement
virtual void examine()
examine the element we're exporting
css::uno::Sequence< css::script::ScriptEventDescriptor > m_aEvents
virtual void exportServiceNameAttribute()
add the service-name attribute to the export context
helper class wrapping different script event representations
Definition: eventexport.hxx:48
virtual const char * getXMLElementName() const override
get the name of the XML element
virtual void exportSubTags() override
export any sub tags
OFormExport(IFormsExportContext &_rContext, const css::uno::Reference< css::beans::XPropertySet > &_rxForm, const css::uno::Sequence< css::script::ScriptEventDescriptor > &_rxEvents)
constructs an object capable of exporting controls
virtual void exportAttributes() override
export the attributes
bool m_bCreateConnectionResourceElement
provides export related tools for attribute handling
void exportStringSequenceAttribute(const sal_uInt16 _nAttributeNamespaceKey, const OUString &_pAttributeName, const OUString &_rPropertyName)
exports a property value, which is a string sequence, as attribute
void exportEnumPropertyAttribute(const sal_uInt16 _nNamespaceKey, const OUString &_pAttributeName, const OUString &_rPropertyName, const SvXMLEnumMapEntry< EnumT > *_pValueMap, const EnumT _nDefault, const bool _bVoidDefault=false)
add an attribute which is represented by an enum property to the export context
IFormsExportContext & m_rContext
void exportInt32PropertyAttribute(const sal_uInt16 _nNamespaceKey, const OUString &_pAttributeName, const OUString &_rPropertyName, const sal_Int32 _nDefault)
add an attribute which is represented by a sal_Int32 property to the export context
void exportedProperty(const OUString &_rPropertyName)
indicates that a property has been handled by a derived class, without using the helper methods of th...
bool shouldExportProperty(const OUString &i_propertyName) const
determines whether the given property is to be exported
void flagStyleProperties()
flag the style properties as 'already exported'
void exportInt16PropertyAttribute(const sal_uInt16 _nNamespaceKey, const OUString &_pAttributeName, const OUString &_rPropertyName, const sal_Int16 _nDefault, const bool force=false)
add an attribute which is represented by a sal_Int16 property to the export context
void exportImageDataAttribute()
add the form:image attribute to the export context.
const css::uno::Reference< css::beans::XPropertySet > m_xProps
void exportBooleanPropertyAttribute(const sal_uInt16 _nNamespaceKey, const OUString &_pAttributeName, const OUString &_rPropertyName, const BoolAttrFlags _nBooleanAttributeFlags)
add an attribute which is represented by a boolean property to the export context
void exportGenericPropertyAttribute(const sal_uInt16 _nAttributeNamespaceKey, const OUString &_pAttributeName, const OUString &_pPropertyName)
add an arbitrary attribute extracted from an arbitrary property to the export context
void exportStringPropertyAttribute(const sal_uInt16 _nNamespaceKey, const OUString &_pAttributeName, const OUString &_rPropertyName)
add an attribute which is represented by a string property to the export context
const css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertyInfo
void AddAttribute(sal_uInt16 _nPrefix, const OUString &_rName, const OUString &_rValue)
void exportTargetLocationAttribute(bool _bAddType)
add the form:href attribute to the export context.
void exportTargetFrameAttribute()
add the hlink:target-frame attribute to the export context.
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.
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
URL aURL
#define CHECK_N_TRANSLATE(name)
#define RESET_BIT(bitfield, bit)
const EnumerationType m_eType
Any aHelper
UNKNOWN
sal_Int16 nValue
SCAFlags
@ ColumnStyleName
@ AutoCompletion
DAFlags
@ ListSource_TYPE
@ ConvertEmpty
@ InputRequired
BAFlags
@ ListLinkingType
@ ListCellRange
@ XFormsSubmission
@ XFormsListBind
EAFlags
@ ControlEvents
@ OnDoubleClick
CCAFlags
@ TargetLocation
@ CurrentSelected
TRISTATE_FALSE
tools::SvRef< SvBaseLink > xSink
#define SAL_WARN(area, stream)
NONE
@ Exception
FORM
int i
const sal_Int16 FORMATTEDFIELD
State
const PropertyDescription * getPropertyDescription(const OUString &i_propertyName)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
@ XML_CONNECTION_RESOURCE
Definition: xmltoken.hxx:2374
@ XML_XFORMS_LIST_SOURCE
Definition: xmltoken.hxx:3123
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3527
constexpr OUStringLiteral PROPERTY_SPIN_INCREMENT
Definition: strings.hxx:129
constexpr OUStringLiteral PROPERTY_INPUT_REQUIRED
Definition: strings.hxx:67
constexpr OUStringLiteral PROPERTY_COLUMNSERVICENAME
Definition: strings.hxx:106
constexpr OUStringLiteral PROPERTY_CYCLE
Definition: strings.hxx:62
constexpr OUStringLiteral PROPERTY_BUTTONTYPE
Definition: strings.hxx:63
constexpr OUStringLiteral PROPERTY_BLOCK_INCREMENT
Definition: strings.hxx:123
const SvXMLEnumMapEntry< TriState > aCheckStateMap[]
Definition: formenums.cxx:99
constexpr OUStringLiteral PROPERTY_DEFAULT_STATE
Definition: strings.hxx:40
constexpr OUStringLiteral PROPERTY_ALLOWUPDATES
Definition: strings.hxx:54
constexpr OUStringLiteral SERVICE_EDIT
Definition: strings.hxx:177
constexpr OUStringLiteral PROPERTY_ECHOCHAR
Definition: strings.hxx:29
constexpr OUStringLiteral PROPERTY_ECHO_CHAR
Definition: strings.hxx:70
const SvXMLEnumMapEntry< NavigationBarMode > aNavigationTypeMap[]
Definition: formenums.cxx:66
constexpr OUStringLiteral PROPERTY_SELECT_SEQ
Definition: strings.hxx:80
constexpr OUStringLiteral PROPERTY_LINECOUNT
Definition: strings.hxx:46
constexpr OUStringLiteral PROPERTY_STRICTFORMAT
Definition: strings.hxx:71
constexpr OUStringLiteral PROPERTY_ALLOWDELETES
Definition: strings.hxx:52
constexpr OUStringLiteral PROPERTY_DETAILFIELDS
Definition: strings.hxx:105
constexpr OUStringLiteral PROPERTY_ENABLED
Definition: strings.hxx:43
const SvXMLEnumMapEntry< sal_Int16 > aVisualEffectMap[]
Definition: formenums.cxx:157
constexpr OUStringLiteral PROPERTY_ENABLEVISIBLE
Definition: strings.hxx:44
const SvXMLEnumMapEntry< sal_Int32 > aOrientationMap[]
Definition: formenums.cxx:151
constexpr OUStringLiteral PROPERTY_ESCAPEPROCESSING
Definition: strings.hxx:56
constexpr OUStringLiteral PROPERTY_CLASSID
Definition: strings.hxx:28
const SvXMLEnumMapEntry< FormSubmitMethod > aSubmitMethodMap[]
Definition: formenums.cxx:53
constexpr OUStringLiteral PROPERTY_COMMAND_TYPE
Definition: strings.hxx:60
FormAttributes
attributes in the xml tag representing a form
@ faEscapeProcessing
constexpr OUStringLiteral PROPERTY_VALUE_SEQ
Definition: strings.hxx:78
constexpr OUStringLiteral PROPERTY_TRISTATE
Definition: strings.hxx:75
constexpr OUStringLiteral PROPERTY_TITLE
Definition: strings.hxx:36
constexpr OUStringLiteral PROPERTY_DEFAULTBUTTON
Definition: strings.hxx:74
constexpr OUStringLiteral PROPERTY_ALLOWINSERTS
Definition: strings.hxx:53
constexpr OUStringLiteral PROPERTY_LINE_INCREMENT
Definition: strings.hxx:122
constexpr OUStringLiteral PROPERTY_COMMAND
Definition: strings.hxx:48
constexpr OUStringLiteral PROPERTY_URL
Definition: strings.hxx:101
constexpr OUStringLiteral PROPERTY_DATAFIELD
Definition: strings.hxx:64
constexpr OUStringLiteral PROPERTY_STATE
Definition: strings.hxx:42
const SvXMLEnumMapEntry< ListSourceType > aListSourceTypeMap[]
Definition: formenums.cxx:88
constexpr OUStringLiteral PROPERTY_MULTISELECTION
Definition: strings.hxx:73
const SvXMLEnumMapEntry< FormButtonType > aFormButtonTypeMap[]
Definition: formenums.cxx:80
constexpr OUStringLiteral PROPERTY_DEFAULT_SELECT_SEQ
Definition: strings.hxx:79
constexpr OUStringLiteral PROPERTY_NAME
Definition: strings.hxx:31
constexpr OUStringLiteral PROPERTY_LABEL
Definition: strings.hxx:33
constexpr OUStringLiteral PROPERTY_PRINTABLE
Definition: strings.hxx:38
constexpr OUStringLiteral PROPERTY_REPEAT_DELAY
Definition: strings.hxx:124
constexpr OUStringLiteral PROPERTY_IGNORERESULT
Definition: strings.hxx:57
constexpr OUStringLiteral PROPERTY_CONTROLLABEL
Definition: strings.hxx:76
constexpr OUStringLiteral PROPERTY_READONLY
Definition: strings.hxx:39
const SvXMLEnumMapEntry< FormSubmitEncoding > aSubmitEncodingMap[]
Definition: formenums.cxx:46
constexpr OUStringLiteral PROPERTY_ORIENTATION
Definition: strings.hxx:130
constexpr OUStringLiteral PROPERTY_MAXTEXTLENGTH
Definition: strings.hxx:45
constexpr OUStringLiteral PROPERTY_RICH_TEXT
Definition: strings.hxx:143
constexpr OUStringLiteral SERVICE_FORMATTEDFIELD
Definition: strings.hxx:195
const SvXMLEnumMapEntry< sal_Int32 > aCommandTypeMap[]
Definition: formenums.cxx:59
constexpr OUStringLiteral PROPERTY_LISTSOURCE
Definition: strings.hxx:68
constexpr OUStringLiteral PROPERTY_TABSTOP
Definition: strings.hxx:41
constexpr OUStringLiteral PROPERTY_SUBMIT_ENCODING
Definition: strings.hxx:58
constexpr OUStringLiteral PROPERTY_VISUAL_EFFECT
Definition: strings.hxx:133
constexpr OUStringLiteral PROPERTY_IMAGE_ALIGN
Definition: strings.hxx:135
constexpr OUStringLiteral PROPERTY_DROPDOWN
Definition: strings.hxx:37
const SvXMLEnumMapEntry< sal_Int16 > aListLinkageMap[]
Definition: formenums.cxx:145
constexpr OUStringLiteral PROPERTY_ORDER
Definition: strings.hxx:51
constexpr OUStringLiteral PROPERTY_SUBMIT_METHOD
Definition: strings.hxx:59
constexpr OUStringLiteral PROPERTY_EMPTY_IS_NULL
Definition: strings.hxx:66
constexpr OUStringLiteral PROPERTY_FOCUS_ON_CLICK
Definition: strings.hxx:132
constexpr OUStringLiteral PROPERTY_STRING_ITEM_LIST
Definition: strings.hxx:77
constexpr OUStringLiteral PROPERTY_APPLYFILTER
Definition: strings.hxx:55
constexpr OUStringLiteral PROPERTY_MASTERFIELDS
Definition: strings.hxx:104
constexpr OUStringLiteral PROPERTY_TOGGLE
Definition: strings.hxx:131
const SvXMLEnumMapEntry< TabulatorCycle > aTabulatorCycleMap[]
Definition: formenums.cxx:73
constexpr OUStringLiteral PROPERTY_MULTILINE
Definition: strings.hxx:30
constexpr OUStringLiteral PROPERTY_TABINDEX
Definition: strings.hxx:47
constexpr OUStringLiteral PROPERTY_NAVIGATION
Definition: strings.hxx:61
constexpr OUStringLiteral PROPERTY_FILTER
Definition: strings.hxx:50
constexpr OUStringLiteral PROPERTY_BOUNDCOLUMN
Definition: strings.hxx:65
constexpr OUStringLiteral PROPERTY_DATASOURCENAME
Definition: strings.hxx:49
constexpr OUStringLiteral PROPERTY_PERSISTENCE_MAXTEXTLENGTH
Definition: strings.hxx:117
constexpr OUStringLiteral PROPERTY_AUTOCOMPLETE
Definition: strings.hxx:72
constexpr OUStringLiteral PROPERTY_LISTSOURCETYPE
Definition: strings.hxx:69
constexpr OUStringLiteral PROPERTY_IMAGE_POSITION
Definition: strings.hxx:134
constexpr OUStringLiteral PROPERTY_FORMATKEY
Definition: strings.hxx:107
constexpr OUStringLiteral PROPERTY_GROUP_NAME
Definition: strings.hxx:137
Orientation
#define DBG_CHECK_PROPERTY_NO_TYPE(name)
BoolAttrFlags
#define DBG_CHECK_PROPERTY(name, type)
#define SERVICE_PERSISTENT_COMPONENT_EDIT
Definition: strings.hxx:155
Represents a property with its API-name, its XML-name and the type of its value.
Definition: maptype.hxx:33
bool IsEnd() const
Definition: maptype.hxx:132
const OUString & getApiName() const
Definition: maptype.hxx:129
::xmloff::token::XMLTokenEnum attributeToken
const PropertyId propertyId
the unique ID of the property. The property meta data table must not contain two entries with the sam...
const AttributeDescription attribute
const PropertyHandlerFactory factory
denotes the attribute which represents the property.
sal_uInt16 sal_Unicode
ButtonType
OUString getXFormsSubmissionName(const Reference< XPropertySet > &xBinding)
OUString getXFormsBindName(const Reference< XPropertySet > &xControl)
OUString getXFormsListBindName(const Reference< XPropertySet > &xControl)
constexpr sal_uInt16 XML_NAMESPACE_FORM
constexpr sal_uInt16 XML_NAMESPACE_XFORMS
constexpr sal_uInt16 XML_NAMESPACE_OOO